You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
warnings under Xcode 6.1.1 (probably with -Weverything) #96
format.h:
Unknown Command Tag Name:
line #142: /rst
line #164: \endrst
line #1567: out.write("Current point:\n");
the last one ist about "\n"; this might well be an Xcode bug
format.cpp:
Semantic issue, 'return' will never be executed
line #254, line #276
these returns are after an unconditional FMT_THROW
warning: comparison of integers of different signs: 'const int' and 'std::size_t' (aka 'unsigned long')
line #628: if (spec.precision_ >= 0 && spec.precision_ < str_size)
spec.precision_ and str_size are the problem.
one more: in Result visit(const Arg &arg) clang complains about the fallthrough in release mode and suggests inserting [[clang::fallthrough]]. This gives a warning in debug mode though, because after the assert(false) it is unreachable code.
Almost perfect. It resolves the fallthrough warning, but in debug build I now get
warning: fallthrough annotation in unreachable code
because of the assert(false)... Somewhat interestingly (to me): this code
default:
assert(false);
return FMT_DISPATCH(visit_int(arg.int_value));
case Arg::INT:
return FMT_DISPATCH(visit_int(arg.int_value));
does not give a warning about unreachable code (or any other).
That might be the easiest/cleanest solution. It does have the same semantics as the fallthrough and doesn't need macros, #ifdefs or rely on the compiler or its version at all.
So does this commit fixes the warnings? (I used your suggestion but simplified it a bit since there is no need to dispatch there.) If it works I'll merge it into master and remove the fallthrough attribute detection.
Thanks!
Activity
dixlorenz commentedon Feb 6, 2015
one more: in Result visit(const Arg &arg) clang complains about the fallthrough in release mode and suggests inserting [[clang::fallthrough]]. This gives a warning in debug mode though, because after the assert(false) it is unreachable code.
Fix by @dixlorenz for clang warnings "'return' will never be executed" (
Try detecting clang::fallthrough using __has_cpp_attribute
vitaut commentedon Feb 8, 2015
Reopening until the fallthrough warning is resolved.
vitaut commentedon Feb 8, 2015
@dixlorenz Could you please check if the fix in branch fallthrough resolves the fallthrough warning? I tried detecting the availability of
[[clang::fallthrough]]based on clang version there (you might need to change600to your version in https://github.com/cppformat/cppformat/blob/fallthrough/format.h#L124 if it is lower).dixlorenz commentedon Feb 8, 2015
Almost perfect. It resolves the fallthrough warning, but in debug build I now get
warning: fallthrough annotation in unreachable code
because of the assert(false)... Somewhat interestingly (to me): this code
does not give a warning about unreachable code (or any other).
That might be the easiest/cleanest solution. It does have the same semantics as the fallthrough and doesn't need macros, #ifdefs or rely on the compiler or its version at all.
vitaut commentedon Feb 9, 2015
So does this commit fixes the warnings? (I used your suggestion but simplified it a bit since there is no need to dispatch there.) If it works I'll merge it into master and remove the fallthrough attribute detection.
Thanks!
dixlorenz commentedon Feb 9, 2015
That works perfectly, no warning, neither in debug or in release.
vitaut commentedon Feb 9, 2015
Closing the issue via 04a21bb then. Thanks again for your help.