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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to