<predefines> in clang -E output


I tried to compile perl with clang and I found this problem.
Perl uses it's own "makedepend" script that determines dependencies,
the clang relevant part is this:

  $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c >.cout 2>.cerr

$cppstdin is "clang-driver -E"

the output file is then fed to sed that filters out "stuff":

       $sed \
            -e '1d' \
            -e '/^#.*<stdin>/d' \
            -e '/^#.*<builtin>/d' \
            -e '/^#.*<built-in>/d' \
            -e '/^#.*<command line>/d' \
            -e '/^#.*<command-line>/d' \
            -e '/^#.*"-"/d' \
            -e '/^#.*"\/.*\/"/d' \
            -e '/: file path prefix .* never used$/d' \
            -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
            -e 's/^[ ]*#[ ]*line/#/' \
            -e '/^# *[0-9][0-9]* *[".\/]/!d' \
            -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
            -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
            -e 's|: \./|: |' \
           -e 's|\.c\.c|.c|' $uwinfix .cout .cerr

the problem is that clang -E puts in the output <predefines>, which this does
not filter out and things break.

witten /tmp# clang-driver -E void.c
# 1 "void.c"
# 1 "void.c" 1
# 1 "<predefines>" 1
# 1 "void.c" 2

what is this <predefines> thing? is it mandatory? is perl's makedepend broken?

please shed some light on this :slight_smile:

thnx, roman

It is the same as <builtin> I guess. Please file a bugzilla, I will change this. BTW, this is insanely gross. <sarcastic> Is there any obscure implementation detail of GCC that is not depended on by some program?


cc1 -v prints the compiler checksum. I’m sure someone somewhere greps this. :slight_smile:

  • Daniel

Distributed builds use it to validate the remote compiler is the same as the local compiler, maybe. :slight_smile: