Diagnostic -Wcast-qual is not enabled by default in gcc/clang, It was enabled explicitly some time ago.
Later, clang has learned to do -Wcast-qual, like gcc does.
While that clang diagnostic is compatible with gcc's, it additionally catches one more case, see D34153.
And last but not least, clang's diagnostic -Wcast-qual only works for C code (sic!)
In D33102, i have extended it to work for C++ code too.
Once that landed, -Werror buildbots broke. That is when i was made aware that this diagnostic is enabled in llvm builds.
I have fixed that particular buildbot-discovered failure in D34153.
However, when i tried building clang stage2 with self-built clang stage1 (with D33102), i have quickly discovered that some sub-projects also exhibit this warning.
Specifically, openmp and libcxx subprojects produce 401 -Wcast-qual warnings, and i believe not all of these warnings are clang-specific.
(i don't think i have all subprojects checked-out, so there may be even more)
This tells two things:
- these subprojects are not being built by -Werror buildbots. (at least as part of LLVM, not standalone)
- no one builds LLVM by GCC with these subprojects with -Werror enabled.
So, if D33102 is to land, this may not break -Werror buildbots. This is bad and good.
But. If someone wants to build LLVM with these subprojects and with -Werror, he/she/it will face a lot of fatal warnings.
It is unfeasible for me to fix all these warnings before re-landing D33102, thus i propose this diff.
After D33102 has landed, the buildbots should probably be adjusted to catch these cases, and i will see if i can help fix these issues and revert this patch.
Thoughts?