[LLVMbugs] [Bug 12761] New: -Wformat warns about printf("%hhu", 'a'); with -funsigned-char
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 8 00:52:07 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12761
Bug #: 12761
Summary: -Wformat warns about printf("%hhu", 'a'); with
-funsigned-char
Product: clang
Version: trunk
Platform: All
OS/Version: All
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
#include <stdio.h>
void f(char c) {
printf("%hhu", 'a');
}
$ clang -fsyntax-only -Wformat -funsigned-char a.cc
a.cc:4:14: warning: format specifies type 'unsigned char' but the argument has
type 'char' [-Wformat]
printf("%hhu", 'a');
~~~^ ~~~
%hhu
So, even though 'a' in this case is an unsigned char, it warns, and it provides
a fixit that doesn't help.
For "%hhx" it doesn't preserve the "x" in the fixit, but suggests "%hhu".
--
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