[LLVMbugs] [Bug 16384] New: -Wformat highlights incorrect range when using cinttypes macros

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 19 22:51:53 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16384

            Bug ID: 16384
           Summary: -Wformat highlights incorrect range when using
                    cinttypes macros
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: seth.cantrell at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Example:

⑆ cat main.cpp 
#include <cstdio>
#include <cstdint>
#include <cinttypes>

int main() {
  std::printf("%" PRIu32 "\n", std::uint64_t{100});
}

⑆ clang++ -std=c++11 -stdlib=libc++ -Wall main.cpp
main.cpp:6:32: warning: format specifies type 'unsigned int' but the argument
has type 'std::uint64_t' (aka 'unsigned long long') [-Wformat]
  std::printf("%" PRIu32 "\n", std::uint64_t{100});
               ~~~             ^
1 warning generated.

Expected results:

  std::printf("%" PRIu32 "\n", std::uint64_t{100});
               ~~~~~~~~~       ^

The highlighting for the argument might also be improved:

  std::printf("%" PRIu32 "\n", std::uint64_t{100});
               ~~~~~~~~~       ^~~~~~~~~~~~~~~~~~

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130620/07b40b34/attachment.html>


More information about the llvm-bugs mailing list