Lubos Lunak wrote:
On Wednesday 11 of J>>> but I think the bug originally described in<
https://bugzilla.samba.org/show_bug.cgi?id=8460>  could possibly be valid.
If you are compiling from a .i or .ii file, the -D and -I options can't
have any effect.  It's reasonable for clang to emit a warning about it,
and it would be reasonable for ccache to strip those options when
compiling a preprocessed file.

Aye, if that would be acceptable for the ccache authors, that would be the
best solution I think.

  The best option is to use CCACHE_CPP2 with Clang. Giving Clang preprocessed
source causes a number of small problems, such as some warnings not being
suppressed or error/warning messages quoting modified source code. As a
side-effect, this problem with preprocessor options will not exist with
CCACHE_CPP2 either. It is a question how much not using CCACHE_CPP2 with
Clang would improve performance anyway.

This is a good point. Showing errors coming from monolithic preprocessed file and not from actual location is a bad thing to do. Yet there are cases where CCACHE_CPP2 will cause havoc. I found at least one of them when building virtualbox 4.1.18 with gcc 4.2:

cc1plus: error: to generate dependencies you must specify either -M or -MM
kmk: *** [/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/out/freebsd.amd64/release/obj/RuntimeBldProg/common/checksum/RTSha1Digest.o] Error 1
The failing command:
@c++ -c -O2 -g -pipe -pedantic -Wshadow -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-trigraphs -fdiagnostics-show-option -Wno-long-long -Wno-variadic-macros -O2 -fno-omit-frame-pointer -fno-strict-aliasing -m64 -I/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/src/VBox/Runtime/include -I/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/src/libs/liblzf-3.4 -I/usr/include -I/usr/X11R6/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -I/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/src/libs/boost-1.37.0 -I/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/include -I/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/out/freebsd.amd64/release -DVBOX -DVBOX_WITH_DEBUGGER -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_HARDENING -DRTPATH_APP_PRIVATE=\"/usr/local/share/virtualbox-ose\" -DRTPATH_APP_PRIVATE_ARCH=\"/usr/local/lib/virtualbox\" -DRTPATH_SHARED_LIBS=\"/usr/local/lib/virtualbox\" -DRTPATH_APP_DOCS=\"/usr/local/share/doc/virtualbox-ose\" -DRT_OS_FREEBSD -D__FREEBSD__ -DRT_ARCH_AMD64 -D__AMD64__ -D_REENTRANT -DBOOST_DISABLE_ASSERTS -DIN_RING3 -DLOG_DISABLED -DIN_RT_R3 -DIN_SUP_R3 -DLDR_WITH_NATIVE -DLDR_WITH_ELF32 -DLDR_WITH_PE -DRT_WITH_VBOX -DRT_NO_GIP -DRT_WITH_ICONV_CACHE -Wp,-MD,/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/out/freebsd.amd64/release/obj/RuntimeBldProg/common/checksum/RTSha1Digest.o.dep -Wp,-MT,/tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/out/freebsd.amd64/release/obj/RuntimeBldProg/common/checksum/RTSha1Digest.o -Wp,-MP -o /tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/out/freebsd.amd64/release/obj/RuntimeBldProg/common/checksum/RTSha1Digest.o /tmp/ports/.amd_mnt/faz/host/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.1.18/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp

On the other hand preprocessing can be simplified with clang by adding -frewrite-includes flag starting with clang 3.2. This will make clang only rewrite includes and do nothing more than that. (http://llvm.org/bugs/show_bug.cgi?id=13282#c3)

--
Sphinx of black quartz judge my vow.
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to