[PATCH] D132568: [clang][Sema] check default argument promotions for printf
YingChi Long via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 24 18:18:31 PDT 2022
inclyc added a comment.
> Do we want to encode that in `test_promotion` in `clang/test/Sema/format-strings.c`? Seems like tests on shorts are missing.
Tests for short and char "incompatibility" could be found elsewhere in this file.
format-strings.c
void should_understand_small_integers(void) {
printf("%hhu", (short) 10); // expected-warning{{format specifies type 'unsigned char' but the argument has type 'short'}}
printf("%hu\n", (unsigned char)1); // warning with -Wformat-pedantic only
printf("%hu\n", (uint8_t)1); // warning with -Wformat-pedantic only
}
/* ... */
void test13(short x) {
char bel = 007;
printf("bel: '0%hhd'\n", bel); // no-warning
printf("x: '0%hhd'\n", x); // expected-warning {{format specifies type 'char' but the argument has type 'short'}}
}
Do I need to explicitly test again in the `test_promotion`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132568/new/
https://reviews.llvm.org/D132568
More information about the cfe-commits
mailing list