I am exprimenting with a diagnostic flag -Wpadded. I've found that on my Windows Clang for some reason I don't see warnings for obvious violations.
Experimented with this source:
#include <stdio.h>
struct s {
char c;
int i;
};
int main() {
s s1 = {};
printf("%zu\n", sizeof(s1));
return 0;
}
On Windows:
$ third_party/llvm-build/Release+Asserts/bin/clang-cl.exe test.cpp -Wpadded
$ ./test
8
Clearly there was some padding going on. On Linux:
$ third_party/llvm-build/Release+Asserts/bin/clang test.cpp -Wpadded
/usr/local/google/home/jmadill/temp/test.cpp:6:6: warning: padding struct 's' with 3 bytes to align 'i' [-Wpadded]
int i;
^
1 warning generated.
Anyone know how/if I can get this error to show up with the Windows Clang in Chrome? Was trying to add this to ANGLE.
Thanks,
Jamie