Fznamznon wrote:
> If you have an embed file with a single byte in it whose value is 0xFF, you
> could use a test like:
struct S {
signed char ch;
};
constexpr struct S s = {
#embed "foo"
};
which should give the same behavior as: https://godbolt.org/z/Tno5YPexM
Thanks! That worked.
I didn't add these though
```
static_assert(_Generic(
#embed __FILE__ limit(1)
, int : 1, default : 0));
static_assert(alignof(typeof(
#embed __FILE__ limit(1)
)) == alignof(int));
printf("%hhu", // Do we get a -Wformat diagnostic about the specifier mismatch?
#embed __FILE__ limit(1)
);
```
for several reasons:
- They don't test this patch as it affects only what happens in an initializer
list
- The one with alignof/typeof asserts for C++ (not for C) and I like to make a
fix and add this test in a separate PR
- we don't emit warnings even for `printf("%hhu", 300);`
https://github.com/llvm/llvm-project/pull/99050
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits