[cfe-dev] <predefines> in clang -E output

Roman Divacky rdivacky at freebsd.org
Thu Mar 19 12:03:30 PDT 2009


hi

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
main()
{
}

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

please shed some light on this :)

thnx, roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090319/fd6c08c4/attachment.sig>


More information about the cfe-dev mailing list