Good Evening to you all,
I tried to compile libc++abi with -Weverything enabled and got a whole
bunch of warnings.
I changed some #if X's to #if defined(X)'s to silence all of the -Wundef
warnings.
None of the functionality has changed, so it should be safe to apply the
the attached patch without breaking anything. *fingers crossed*
Also, there are some unused (member-)functions in cxa_demangle.cpp,
cxa_guard.cpp, and stdexcept.cpp. Are those intentionally kept, or are
they "leftovers" and could be removed?
I hope this is useful to someone. I will keep working on some of the
other warnings (a whole bunch of them are caused by casting pointers
with different alignment-requirements) and refactoring the code a bit.
Unless someone wants me to "keep my filthy hands off" their code, that
is. 
Best regards, Flo.
fix-Wundef.patch (4.74 KB)
-#if __arm__
+#if defined(__arm__)
The above is a semantic change. If someone set -D__arm__=0, the changed code does something different.
IANALL, but -Wundef triggering on these built-in preprocessor symbols seems wrong.
-Nick
Nick Kledzik wrote:
-#if __arm__
+#if defined(__arm__)
The above is a semantic change. If someone set -D__arm__=0, the
changed code does something different.
Thank you for catching that! I didn't even dare to think that someone
might intentionally set a symbol that is meant to be built-in.
BTW: do you know of a way to ask clang to issue a warning if somebody
would do such a horrible thing?
IANALL, but -Wundef triggering on these built-in preprocessor symbols
seems wrong.
I think this behavior is perfectly reasonable. After all, these are
"just" preprocessor symbols like all others, so the user should check
them in the same way.
What I would really like, though, would be for clang to check if someone
were to mess with symbols that are meant to be built-in (e.g. by re- or
undefining them). That could really mess things up!
Florian Kutscherauer wrote:
[...] None of the functionality has changed[...].
*fingers crossed*
Apparently that didn't do the trick...
[...] I will keep working [... u]nless someone wants me to "keep
my filthy hands off" their code, that is. 
Best regards, Flo.