Discussion:
New clang-cl warnings
Gisle Vanem
2017-05-12 09:43:41 UTC
Permalink
I'm not sure exactly when or how these new warnings from
clang-cl happened (a lot of them):

f:/ProgramFiler-x86/WindowsKits/Include/10.0.15063.0/ucrt/stdlib.h(78,5):
warning: macro expansion producing 'defined' has undefined behavior
[-Wexpansion-to-defined]
#if _CRT_INTERNAL_NONSTDC_NAMES
^
f:\ProgramFiler-x86\WindowsKits\Include\10.0.15063.0\ucrt\corecrt.h(288,11): note: expanded from macro
'_CRT_INTERNAL_NONSTDC_NAMES'
( defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || \
^

Really, why? This happens in any program using Gnulib. The above is from Wget.

I guess it has something to do with (the lack of?) one of the '_CRT_x'
defines MS uses. I compile with '-Wno-expansion-to-defined' to ignore this
warning. Any idea?
--
--gv
Bruno Haible
2017-05-12 13:23:56 UTC
Permalink
Post by Gisle Vanem
I'm not sure exactly when or how these new warnings from
warning: macro expansion producing 'defined' has undefined behavior
[-Wexpansion-to-defined]
#if _CRT_INTERNAL_NONSTDC_NAMES
^
f:\ProgramFiler-x86\WindowsKits\Include\10.0.15063.0\ucrt\corecrt.h(288,11): note: expanded from macro
'_CRT_INTERNAL_NONSTDC_NAMES'
( defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || \
^
Really, why?
Well, the compiler's "note" tells you: The system include files (corecrt.h in
your case) define _CRT_INTERNAL_NONSTDC_NAMES to some expression that includes
the 'defined' keyword.

You seem to be doing a native Windows compilation with the MSVC include files
and a non-Microsoft compiler [1]. This is not the among usual tested combinations;
good luck with this adventure :)

I just fixed a wrong #if in this area two days ago [2]; you can expect to find
more mistakes of this sort in gnulib and other GNU packages.

Bruno

[1] https://clang.llvm.org/docs/MSVCCompatibility.html
[2] https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=1888a27a1e48e4f8b9006c164ba1d1218a143c28
Gisle Vanem
2017-05-12 22:22:46 UTC
Permalink
Post by Bruno Haible
You seem to be doing a native Windows compilation with the MSVC include files
and a non-Microsoft compiler [1]. This is not the among usual tested combinations;
good luck with this adventure :)
clang-cl is just gcc 4.x in disguise AFAICS. I love clang-cl;
it's what gcc/cl should have been years ago. With it speed and
colourized diagnostics. It has worked fine for me the last 2 years.
In program like Wget2, I have to use clang-cl or MinGW-w64. It's
only these annoying warnings that's crept up recently. Not sure it
related the newest WindowsKit v10.0.15063.0.
Post by Bruno Haible
I just fixed a wrong #if in this area two days ago [2]; you can expect to find
more mistakes of this sort in gnulib and other GNU packages.
That didn't help.
--
--gv
Loading...