[cfe-dev] interesting ccc issue

Brooks Davis brooks at freebsd.org
Tue Feb 5 16:16:32 PST 2008


I've run into an interesting problem with messing with ccc.  I was trying to
compile libarchive as integrated into the FreeBSD build system.  It has some
interesting hacks where it avoids the use of the autoconf bits entirely since
we keep those out of the tree as a rule.  One of them does:

#if defined(PLATFORM_CONFIG_H)
/* Use hand-built config.h in environments that need it. */
#include PLATFORM_CONFIG_H
#elif defined(HAVE_CONFIG_H)
/* Most POSIX platforms use the 'configure' script to build config.h */
#include "../config.h"
#else
/* Warn if the library hasn't been (automatically or manually) configured. */
#error Oops: No config.h and no pre-built configuration in archive_platform.h.
#endif

This is integrated into the build system by having CFLAGS include

-DPLATFORM_CONFIG_H=\"config_freebsd.h\"

The \" bits are key because when substituted the #include works.  With
ccc the \'s get removed and thus the "s don't make it all the way to clang's
preprocessor resulting in this error:

ccc -O2 -fno-strict-aliasing -pipe  -DPACKAGE_VERSION=\"2.2.5\" -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -I/usr/src/usr.bin/tar -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wno-pointer-sign -c bsdtar.c
bsdtar.c
clang -emit-llvm-bc -x c -o bsdtar.o bsdtar.c -DPACKAGE_VERSION="2.2.5" -DPLATFORM_CONFIG_H="config_freebsd.h" -I/usr/src/usr.bin/tar
In file included from bsdtar.c:26:
/usr/src/usr.bin/tar/bsdtar_platform.h:39:10: error: expected "FILENAME" or <FILENAME>
#include PLATFORM_CONFIG_H
         ^

I'm not sure what all issues involved in re-escaping the '"' characters
would be would be, but hopefully someone with stronger python-foo that
mine will have some ideas.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080205/86cd5731/attachment.sig>


More information about the cfe-dev mailing list