Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
f9fc8fd0
Commit
f9fc8fd0
authored
Dec 09, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix -Wshadow warnings
parent
b49a1b4a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
CMakeLists.txt
CMakeLists.txt
+1
-1
format.cc
format.cc
+15
-15
format.h
format.h
+8
-5
No files found.
CMakeLists.txt
View file @
f9fc8fd0
...
@@ -69,7 +69,7 @@ endif ()
...
@@ -69,7 +69,7 @@ endif ()
add_library
(
format
${
shared
}
${
FMT_SOURCES
}
)
add_library
(
format
${
shared
}
${
FMT_SOURCES
}
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
set_target_properties
(
format PROPERTIES COMPILE_FLAGS
set_target_properties
(
format PROPERTIES COMPILE_FLAGS
"-Wall -Wextra -pedantic"
)
"-Wall -Wextra -
Wshadow -
pedantic"
)
endif
()
endif
()
if
(
CPP11_FLAG AND FMT_EXTRA_TESTS
)
if
(
CPP11_FLAG AND FMT_EXTRA_TESTS
)
set_target_properties
(
format PROPERTIES COMPILE_FLAGS
${
CPP11_FLAG
}
)
set_target_properties
(
format PROPERTIES COMPILE_FLAGS
${
CPP11_FLAG
}
)
...
...
format.cc
View file @
f9fc8fd0
...
@@ -362,10 +362,10 @@ inline Arg::StringValue<wchar_t> ignore_incompatible_str(
...
@@ -362,10 +362,10 @@ inline Arg::StringValue<wchar_t> ignore_incompatible_str(
}
// namespace
}
// namespace
FMT_FUNC
void
fmt
::
SystemError
::
init
(
FMT_FUNC
void
fmt
::
SystemError
::
init
(
int
err
or
_code
,
StringRef
format_str
,
ArgList
args
)
{
int
err_code
,
StringRef
format_str
,
ArgList
args
)
{
error_code_
=
err
or
_code
;
error_code_
=
err_code
;
MemoryWriter
w
;
MemoryWriter
w
;
internal
::
format_system_error
(
w
,
err
or
_code
,
format
(
format_str
,
args
));
internal
::
format_system_error
(
w
,
err_code
,
format
(
format_str
,
args
));
std
::
runtime_error
&
base
=
*
this
;
std
::
runtime_error
&
base
=
*
this
;
base
=
std
::
runtime_error
(
w
.
str
());
base
=
std
::
runtime_error
(
w
.
str
());
}
}
...
@@ -612,20 +612,20 @@ class fmt::internal::ArgFormatter :
...
@@ -612,20 +612,20 @@ class fmt::internal::ArgFormatter :
template
<
typename
Char
>
template
<
typename
Char
>
template
<
typename
StrChar
>
template
<
typename
StrChar
>
void
fmt
::
BasicWriter
<
Char
>::
write_str
(
void
fmt
::
BasicWriter
<
Char
>::
write_str
(
const
Arg
::
StringValue
<
StrChar
>
&
s
tr
,
const
FormatSpec
&
spec
)
{
const
Arg
::
StringValue
<
StrChar
>
&
s
,
const
FormatSpec
&
spec
)
{
// Check if StrChar is convertible to Char.
// Check if StrChar is convertible to Char.
internal
::
CharTraits
<
Char
>::
convert
(
StrChar
());
internal
::
CharTraits
<
Char
>::
convert
(
StrChar
());
if
(
spec
.
type_
&&
spec
.
type_
!=
's'
)
if
(
spec
.
type_
&&
spec
.
type_
!=
's'
)
internal
::
report_unknown_type
(
spec
.
type_
,
"string"
);
internal
::
report_unknown_type
(
spec
.
type_
,
"string"
);
const
StrChar
*
s
=
str
.
value
;
const
StrChar
*
s
tr_value
=
s
.
value
;
std
::
size_t
s
ize
=
str
.
size
;
std
::
size_t
s
tr_size
=
s
.
size
;
if
(
size
==
0
)
{
if
(
s
tr_s
ize
==
0
)
{
if
(
!
s
)
if
(
!
s
tr_value
)
FMT_THROW
(
FormatError
(
"string pointer is null"
));
FMT_THROW
(
FormatError
(
"string pointer is null"
));
if
(
*
s
)
if
(
*
s
tr_value
)
s
ize
=
std
::
char_traits
<
StrChar
>::
length
(
s
);
s
tr_size
=
std
::
char_traits
<
StrChar
>::
length
(
str_value
);
}
}
write_str
(
s
,
size
,
spec
);
write_str
(
s
tr_value
,
str_
size
,
spec
);
}
}
template
<
typename
Char
>
template
<
typename
Char
>
...
@@ -739,9 +739,9 @@ unsigned fmt::internal::PrintfFormatter<Char>::parse_header(
...
@@ -739,9 +739,9 @@ unsigned fmt::internal::PrintfFormatter<Char>::parse_header(
template
<
typename
Char
>
template
<
typename
Char
>
void
fmt
::
internal
::
PrintfFormatter
<
Char
>::
format
(
void
fmt
::
internal
::
PrintfFormatter
<
Char
>::
format
(
BasicWriter
<
Char
>
&
writer
,
BasicStringRef
<
Char
>
format
,
BasicWriter
<
Char
>
&
writer
,
BasicStringRef
<
Char
>
format
_str
,
const
ArgList
&
args
)
{
const
ArgList
&
args
)
{
const
Char
*
start
=
format
.
c_str
();
const
Char
*
start
=
format
_str
.
c_str
();
set_args
(
args
);
set_args
(
args
);
const
Char
*
s
=
start
;
const
Char
*
s
=
start
;
while
(
*
s
)
{
while
(
*
s
)
{
...
@@ -892,8 +892,8 @@ void fmt::internal::PrintfFormatter<Char>::format(
...
@@ -892,8 +892,8 @@ void fmt::internal::PrintfFormatter<Char>::format(
case
Arg
:
:
CUSTOM
:
{
case
Arg
:
:
CUSTOM
:
{
if
(
spec
.
type_
)
if
(
spec
.
type_
)
internal
::
report_unknown_type
(
spec
.
type_
,
"object"
);
internal
::
report_unknown_type
(
spec
.
type_
,
"object"
);
const
void
*
s
=
"s"
;
const
void
*
s
tr_format
=
"s"
;
arg
.
custom
.
format
(
&
writer
,
arg
.
custom
.
value
,
&
s
);
arg
.
custom
.
format
(
&
writer
,
arg
.
custom
.
value
,
&
s
tr_format
);
break
;
break
;
}
}
default:
default:
...
...
format.h
View file @
f9fc8fd0
...
@@ -47,11 +47,14 @@
...
@@ -47,11 +47,14 @@
#ifdef __GNUC__
#ifdef __GNUC__
# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# define FMT_GCC_EXTENSION __extension__
# define FMT_GCC_EXTENSION __extension__
// Disable warning about "long long" which is sometimes reported even
// when using __extension__.
# if FMT_GCC_VERSION >= 406
# if FMT_GCC_VERSION >= 406
# pragma GCC diagnostic push
# pragma GCC diagnostic push
// Disable the warning about "long long" which is sometimes reported even
// when using __extension__.
# pragma GCC diagnostic ignored "-Wlong-long"
# pragma GCC diagnostic ignored "-Wlong-long"
// Disable the warning about declaration shadowing because it affects too
// many valid cases.
# pragma GCC diagnostic ignored "-Wshadow"
# endif
# endif
#else
#else
# define FMT_GCC_EXTENSION
# define FMT_GCC_EXTENSION
...
@@ -154,7 +157,7 @@ void format(BasicFormatter<Char> &f, const Char *&format_str, const T &value);
...
@@ -154,7 +157,7 @@ void format(BasicFormatter<Char> &f, const Char *&format_str, const T &value);
different types of strings to a function, for example::
different types of strings to a function, for example::
template <typename... Args>
template <typename... Args>
std::string format(StringRef format, const Args & ... args);
std::string format(StringRef format
_str
, const Args & ... args);
format("{}", 42);
format("{}", 42);
format(std::string("{}"), 42);
format(std::string("{}"), 42);
...
@@ -989,7 +992,7 @@ class PrintfFormatter : private FormatterBase {
...
@@ -989,7 +992,7 @@ class PrintfFormatter : private FormatterBase {
public:
public:
void
format
(
BasicWriter
<
Char
>
&
writer
,
void
format
(
BasicWriter
<
Char
>
&
writer
,
BasicStringRef
<
Char
>
format
,
const
ArgList
&
args
);
BasicStringRef
<
Char
>
format
_str
,
const
ArgList
&
args
);
};
};
}
// namespace internal
}
// namespace internal
...
@@ -1388,7 +1391,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
...
@@ -1388,7 +1391,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
*/
*/
class
SystemError
:
public
internal
::
RuntimeError
{
class
SystemError
:
public
internal
::
RuntimeError
{
private:
private:
void
init
(
int
err
or
_code
,
StringRef
format_str
,
ArgList
args
);
void
init
(
int
err_code
,
StringRef
format_str
,
ArgList
args
);
protected:
protected:
int
error_code_
;
int
error_code_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment