-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
$ cat test.c
int printf(const char *, ...) __attribute__((__format__(__printf__, 1, 2)));
struct S {
unsigned int bf : 16;
unsigned char c;
};
struct S s;
void foo(void) {
printf("%x\n", s.bf);
printf("%x\n", s.c);
}
$ clang test.c -c -o -Wformat -Wformat-signedness
test.c:11:18: warning: format specifies type 'unsigned int' but the argument has type 'int', which differs in signedness [-Wformat-signedness]
11 | printf("%x\n", s.bf);
| ~~ ^~~~
| %x
1 warning generated.
Both s.bf
and s.c
are promoted to int
as a result of default argument promotion. clang silences the warning only when the latter is passed.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"