Compilation errors

While doing a make on the recently checkout version:

I got the following errors:

[ 68%] Built target dd
[ 68%] Built target compiler-rt-headers
[ 68%] Building C object
projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/x86_64/floatdidf.c.o
In file included from
/home/tthtlc/llvm/llvm/projects/compiler-rt/lib/builtins/x86_64/floatdidf.c:9:0:
/home/tthtlc/llvm/llvm/projects/compiler-rt/lib/builtins/x86_64/../int_lib.h:131:8:
error: C++ style comments are not allowed in ISO C90 [-Werror]
#endif // defined(_MSC_VER) && !defined(__clang__)
        ^
/home/tthtlc/llvm/llvm/projects/compiler-rt/lib/builtins/x86_64/../int_lib.h:131:8:
error: (this will be reported only once per input file) [-Werror]
cc1: all warnings being treated as errors
make[2]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/x86_64/floatdidf.c.o]
Error 1
make[1]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/all]
Error 2
make: *** [all] Error 2

Can anyone comment on the error?

Disclaimer: coming from a Java background where tools like Ant, Maven
and Gradle reign supreme, I'm rather new to make and CMake myself (not
to mention C and C++, which I've only started learning recently). So
take my words with a grain of salt. Nonetheless, you'll find my take
below:

The relevant lines, I would suppose, are

error: C++ style comments are not allowed in ISO C90 [-Werror]
#endif // defined(_MSC_VER) && !defined(__clang__)

and

error: (this will be reported only once per input file) [-Werror]
cc1: all warnings being treated as errors

So, did you happen to have generated your make files using CMake
passing -DLLVM_ENABLE_WERROR=ON ?

My reasoning is as follows (but please do correct me if I'm wrong
somewhere): When generating your make file using cmake, since by
default LLVM_ENABLE_PEDANTIC is set to ON, the above warning gets
triggered (cf. the description of "pedantic" at
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html, assuming that
either you're building with gcc, or that Clang has the same
interpretation of "pedantic"). Again, by default, LLVM_ENABLE_WERROR
is set to OFF, so it should normally remain a warning.

As an aside, is there any reason for why C++-style comments were used
in C files at all, or should they simply be replaced with the usual /*
... */ in accordance with pre-C99 standards? In the latter case, would
there be any objection to it if I were to make a patch for this? While
the change itself would be trivial, I don't yet have any experience
with making patches, and so for that purpose it would be a useful
exercise.

Note that in my previous reply I assumed the use of CMake. I did see
there's already a couple of Makefiles in the source tree as well, but
I remember having read somewhere these haven't been touched in a long
time and the use of CMake was the preferred method for generating
Makefiles now. (But again, correct me if I'm wrong.)

They are valid C99 and quite a bit of the compiler-rt source is C99,
too. Personally, I don't see any reason why this has to support direct
build with Visual Studio or other compilers that haven't caught up with
a 16 year old standard.

Joerg

Ah, thanks for the explanation. While I’m not yet familiar with the code base, I should have been able to tell myself by doing a quick search for other C99 features, which indeed appear frequently. My bad. Thanks!

Arno