[LLVMbugs] [Bug 12017] New: -Wformat should warn about non-standard format strings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 16 09:44:46 PST 2012


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

             Bug #: 12017
           Summary: -Wformat should warn about non-standard format strings
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


There should be a warning for non-standard features (extensions) in format
strings:

  - the 'q', 'm' and 'a' length modifiers
  - the 'C' and 'S' conversion specifiers (except in Objective-C, I suppose)
  - the 'm' (errno) conversion specifier (can we even parse that right now?)
  - positional arguments ('n$')
  - the 'L' length modifier together with an integer conversion specifier ('i',
'o', 'u', 'x', 'X').

Please add to the list if I'm forgetting some :)


I'm happy to take a stab at this, but would like some input on how to organize
the warnings.

My first idea would be to add a -Wformat-non-standard flag and stick that under
-pedantic.

But maybe we want it on by default?

And maybe we don't want to warn about GNU extensions for -std=gnu99, but still
warn about the others.

(At a later point we should also warn about using C99 things like the 'a'
conversion specifier in C90 mode, but that's a different bug.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list