Clang ignoring some (or all?) warning flags on my Windows machine

47 views
Skip to first unread message

Jamie Madill

unread,
Oct 24, 2018, 2:57:50 PM10/24/18
to chromi...@chromium.org, syou...@chromium.org
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

Reid Kleckner

unread,
Oct 24, 2018, 3:03:58 PM10/24/18
to jma...@google.com, chromi...@chromium.org, syou...@chromium.org
The issue is that the warning is not implemented in the MS C++ ABI specific record layout codepath. I filed a bug for it here: https://bugs.llvm.org/show_bug.cgi?id=39423

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CACOTusTEjY2xcTMN4ENmJ-LWw0RXQGetn8Yef_-pmLEfGirCnA%40mail.gmail.com.

Nico Weber

unread,
Oct 24, 2018, 3:04:42 PM10/24/18
to Jamie Madill, chromi...@chromium.org, syou...@chromium.org
I think this warning isn't implemented in clang's microsoft codegen -- all references to warn_padded_struct_ in http://llvm-cs.pcc.me.uk/tools/clang/lib/AST/RecordLayoutBuilder.cpp#1922 are in ItaniumRecordLayoutBuilder ("itanium" meaning basically "not windows"). If you want this, can you file a bug please?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

Jamie Madill

unread,
Oct 24, 2018, 3:29:15 PM10/24/18
to Nico Weber, chromi...@chromium.org, syou...@chromium.org
Cool, thanks the responses & Reid for filing the issue!
Reply all
Reply to author
Forward
0 new messages