Skip to content

warnings under Xcode 6.1.1 (probably with -Weverything) #96

Closed

Description

@dixlorenz

commit ba17cca, 2/6/2015:

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.

Activity

  1. dixlorenz commented on Feb 6, 2015

    @dixlorenz
    ContributorAuthor

    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.

  2. added 2 commits that reference this issue on Feb 7, 2015
  3. vitaut commented on Feb 8, 2015

    @vitaut
    Contributor

    Reopening until the fallthrough warning is resolved.

  4. reopened this on Feb 8, 2015
  5. vitaut commented on Feb 8, 2015

    @vitaut
    Contributor

    @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 change 600 to your version in https://github.com/cppformat/cppformat/blob/fallthrough/format.h#L124 if it is lower).

  6. dixlorenz commented on Feb 8, 2015

    @dixlorenz
    ContributorAuthor

    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.

  7. vitaut commented on Feb 9, 2015

    @vitaut
    Contributor

    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!

  8. dixlorenz commented on Feb 9, 2015

    @dixlorenz
    ContributorAuthor

    That works perfectly, no warning, neither in debug or in release.

  9. vitaut commented on Feb 9, 2015

    @vitaut
    Contributor

    Closing the issue via 04a21bb then. Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions