<body class="article">\r
<div id="header">\r
<h1>ccache copyright and license</h1>\r
-<span id="revnumber">version 3.7.1</span>\r
+<span id="revnumber">version 3.7.2</span>\r
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Version 3.7.1<br />\r
+Version 3.7.2<br />\r
Last updated\r
- 2019-05-01 16:28:03 CEST\r
+ 2019-07-19 09:58:41 CEST\r
</div>\r
</div>\r
</body>\r
set -e
-rm -f dev_mode_disabled
+if [ -f dev_mode_disabled ]; then
+ cat <<EOF >&2
+Error: It looks like you are building ccache from a release archive. If so,
+there is no need to run autoconf.sh. See INSTALL.md for further instructions.
+
+If you do want to the enable the development mode, delete the file
+dev_mode_disabled first, but it's probably a better idea to work with the
+proper ccache Git repository directly as described on
+<https://ccache.dev/repo.html>.
+EOF
+ exit 1
+fi
+
autoheader
autoconf
echo "Now run ./configure and make"
mkdir -p .deps src unittest
-if test ! -f $srcdir/dev_mode_disabled && test "$RUN_FROM_BUILD_FARM" != yes; then
+if test ! -f $srcdir/dev_mode_disabled; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: developer mode enabled" >&5
$as_echo "$as_me: developer mode enabled" >&6;}
ac_config_files="$ac_config_files dev.mk"
mkdir -p .deps src unittest
dnl Enable developer mode if dev.mk.in exists.
-if test ! -f $srcdir/dev_mode_disabled && test "$RUN_FROM_BUILD_FARM" != yes; then
+if test ! -f $srcdir/dev_mode_disabled; then
AC_MSG_NOTICE(developer mode enabled)
AC_CONFIG_FILES([dev.mk])
include_dev_mk='include dev.mk'
dist_dir = ccache-$(version)
dist_archives = \
- ccache-$(version).tar.bz2 \
- ccache-$(version).tar.gz
-ifneq ($(shell uname), Darwin)
- dist_archives += ccache-$(version).tar.xz
-endif
+ ccache-$(version).tar.gz \
+ ccache-$(version).tar.xz
generated_docs = \
LICENSE.html \
generated_headers = \
unittest/suites.h
-files_to_clean += *.tar.bz2 *.tar.gz *.tar.xz *.xml .deps/* perfdir.*
+files_to_clean += *.tar.gz *.tar.xz *.xml doc/*.xml .deps/* perfdir.*
files_to_clean += compile_commands.json
files_to_clean += src/confitems_lookup.c
files_to_clean += src/envtoconfitems_lookup.c
(cd $$tmpdir && \
tarcompression= && \
case $@ in \
- *.bz2) tarcompression=-j ;; \
*.gz) tarcompression=-z ;; \
*.xz) tarcompression=-J ;; \
esac && \
* Leanid Chaika
* Loïc Yhuel
* Luboš Luňák
+* luzpaz
* Maarten Maathuis
* Mark Starovoytov
* Martin Ettl
<body class="article">\r
<div id="header">\r
<h1>ccache authors</h1>\r
-<span id="revnumber">version 3.7.1</span>\r
+<span id="revnumber">version 3.7.2</span>\r
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</li>\r
<li>\r
<p>\r
+luzpaz\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
Maarten Maathuis\r
</p>\r
</li>\r
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Version 3.7.1<br />\r
+Version 3.7.2<br />\r
Last updated\r
- 2019-05-01 16:28:03 CEST\r
+ 2019-07-19 09:58:41 CEST\r
</div>\r
</div>\r
</body>\r
or source code will make the hash different. Compare this with the default
setup where ccache will fall back to the preprocessor mode, which is tolerant
to some types of changes of compiler options and source code changes.
-* The manifest entries will include system header files as well, thus slowing
- down cache hits slightly.
+* If -MD is used, the manifest entries will include system header files as
+ well, thus slowing down cache hits slightly, just as using -MD slows down
+ make.
+* If -MMD is used, the manifest entries will not include system header files,
+ which means ccache will ignore changes in them.
The depend mode will be disabled if any of the following holds:
* You must either:
+
--
-** use the *-include* compiler option to include the precompiled header
- (i.e., don't use *#include* in the source code to include the header); or
+** use the *-include* compiler option to include the precompiled header (i.e.,
+ don't use *#include* in the source code to include the header; the filename
+ itself must be sufficient to find the header, i.e. *-I* paths are not
+ searched); or
** (for the Clang compiler) use the *-include-pch* compiler option to include
the PCH file generated from the precompiled header; or
-** add the *-fpch-preprocess* compiler option when compiling.
+** (for the GCC compiler) add the *-fpch-preprocess* compiler option when
+ compiling.
If you don't do this, either the non-precompiled version of the header file
will be used (if available) or ccache will fall back to running the real
<body class="article">\r
<div id="header">\r
<h1>CCACHE(1)</h1>\r
-<span id="revnumber">version 3.7.1</span>\r
+<span id="revnumber">version 3.7.2</span>\r
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</li>\r
<li>\r
<p>\r
-The manifest entries will include system header files as well, thus slowing\r
- down cache hits slightly.\r
+If -MD is used, the manifest entries will include system header files as\r
+ well, thus slowing down cache hits slightly, just as using -MD slows down\r
+ make.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+If -MMD is used, the manifest entries will not include system header files,\r
+ which means ccache will ignore changes in them.\r
</p>\r
</li>\r
</ul></div>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
-use the <strong>-include</strong> compiler option to include the precompiled header\r
- (i.e., don’t use <strong>#include</strong> in the source code to include the header); or\r
+use the <strong>-include</strong> compiler option to include the precompiled header (i.e.,\r
+ don’t use <strong>#include</strong> in the source code to include the header; the filename\r
+ itself must be sufficient to find the header, i.e. <strong>-I</strong> paths are not\r
+ searched); or\r
</p>\r
</li>\r
<li>\r
</li>\r
<li>\r
<p>\r
-add the <strong>-fpch-preprocess</strong> compiler option when compiling.\r
+(for the GCC compiler) add the <strong>-fpch-preprocess</strong> compiler option when\r
+ compiling.\r
</p>\r
</li>\r
</ul></div>\r
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Version 3.7.1<br />\r
+Version 3.7.2<br />\r
Last updated\r
- 2019-05-01 16:28:03 CEST\r
+ 2019-07-19 09:58:41 CEST\r
</div>\r
</div>\r
</body>\r
ccache news
===========
+ccache 3.7.2
+------------
+Release date: 2019-07-19
+
+Bug fixes
+~~~~~~~~~
+
+- The compiler option `-gdwarf*` no longer forces “run_second_cpp = true”.
+
+- Added verification that the value passed to the `-o/--set-config` option is
+ valid.
+
+- Fixed detection of precompiled headers in the depend mode.
+
+- Bail out on too hard Clang option `-ftime-trace`.
+
+- ccache now updates the correct stats file when adding/updating manifest
+ files. This bug previously made the file and size statistics counters
+ incorrect over time.
+
+- Fixed warnings from Clang about unused arguments during preprocessing.
+
+- Unknown manifest versions are now handled gracefully in `--dump-manifest`.
+
+- Fixed `make check` with “funny” locales.
+
+
+Documentation
+~~~~~~~~~~~~~
+
+- Added a hint about not running `autogen.sh` when building from a release
+ archive.
+
+- Mention that `xsltproc` is needed when building from the source repository.
+
+
ccache 3.7.1
------------
Release date: 2019-05-01
- Compilations with /dev/null as the input file are now cached.
-- ccache has learned how to contruct the object filename if no `-o` option is
+- ccache has learned how to construct the object filename if no `-o` option is
given and the source filename does not include a `.` or ends with a `.`.
- Fixed a temporary file leak when the depend mode is enabled and the compiler
<body class="article">\r
<div id="header">\r
<h1>ccache news</h1>\r
-<span id="revnumber">version 3.7.1</span>\r
+<span id="revnumber">version 3.7.2</span>\r
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</div>\r
<div id="content">\r
<div class="sect1">\r
+<h2 id="_ccache_3_7_2">ccache 3.7.2</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2019-07-19</p></div>\r
+<div class="sect2">\r
+<h3 id="_bug_fixes">Bug fixes</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+The compiler option <code>-gdwarf*</code> no longer forces “run_second_cpp = true”.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Added verification that the value passed to the <code>-o/--set-config</code> option is\r
+ valid.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Fixed detection of precompiled headers in the depend mode.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Bail out on too hard Clang option <code>-ftime-trace</code>.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+ccache now updates the correct stats file when adding/updating manifest\r
+ files. This bug previously made the file and size statistics counters\r
+ incorrect over time.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Fixed warnings from Clang about unused arguments during preprocessing.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Unknown manifest versions are now handled gracefully in <code>--dump-manifest</code>.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Fixed <code>make check</code> with “funny” locales.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_documentation">Documentation</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+Added a hint about not running <code>autogen.sh</code> when building from a release\r
+ archive.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Mention that <code>xsltproc</code> is needed when building from the source repository.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
<h2 id="_ccache_3_7_1">ccache 3.7.1</h2>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2019-05-01</p></div>\r
</li>\r
<li>\r
<p>\r
-ccache has learned how to contruct the object filename if no <code>-o</code> option is\r
+ccache has learned how to construct the object filename if no <code>-o</code> option is\r
given and the source filename does not include a <code>.</code> or ends with a <code>.</code>.\r
</p>\r
</li>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2018-09-02</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes">Bug fixes</h3>\r
+<h3 id="_bug_fixes_2">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2018-03-25</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_2">Bug fixes</h3>\r
+<h3 id="_bug_fixes_3">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2018-02-11</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_3">Bug fixes</h3>\r
+<h3 id="_bug_fixes_4">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_4">Bug fixes</h3>\r
+<h3 id="_bug_fixes_5">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_5">Bug fixes</h3>\r
+<h3 id="_bug_fixes_6">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_6">Bug fixes</h3>\r
+<h3 id="_bug_fixes_7">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_7">Bug fixes</h3>\r
+<h3 id="_bug_fixes_8">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-10-26</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_8">Bug fixes</h3>\r
+<h3 id="_bug_fixes_9">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-09-28</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_9">Bug fixes</h3>\r
+<h3 id="_bug_fixes_10">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-09-07</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_10">Bug fixes</h3>\r
+<h3 id="_bug_fixes_11">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_11">Bug fixes</h3>\r
+<h3 id="_bug_fixes_12">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-09-28</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_12">Bug fixes</h3>\r
+<h3 id="_bug_fixes_13">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-09-07</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_13">Bug fixes</h3>\r
+<h3 id="_bug_fixes_14">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-07-20</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_14">Bug fixes</h3>\r
+<h3 id="_bug_fixes_15">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-07-12</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_15">Bug fixes</h3>\r
+<h3 id="_bug_fixes_16">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_16">Bug fixes</h3>\r
+<h3 id="_bug_fixes_17">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2015-10-08</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_17">Bug fixes</h3>\r
+<h3 id="_bug_fixes_18">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_18">Bug fixes</h3>\r
+<h3 id="_bug_fixes_19">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_19">Bug fixes</h3>\r
+<h3 id="_bug_fixes_20">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2014-12-10</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_20">Bug fixes</h3>\r
+<h3 id="_bug_fixes_21">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_21">Bug fixes</h3>\r
+<h3 id="_bug_fixes_22">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2016-07-12</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_22">Bug fixes</h3>\r
+<h3 id="_bug_fixes_23">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2015-03-07</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_23">Bug fixes</h3>\r
+<h3 id="_bug_fixes_24">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_24">Bug fixes</h3>\r
+<h3 id="_bug_fixes_25">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2013-01-06</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_25">Bug fixes</h3>\r
+<h3 id="_bug_fixes_26">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_26">Bug fixes</h3>\r
+<h3 id="_bug_fixes_27">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2012-01-08</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_27">Bug fixes</h3>\r
+<h3 id="_bug_fixes_28">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_28">Bug fixes</h3>\r
+<h3 id="_bug_fixes_29">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_29">Bug fixes</h3>\r
+<h3 id="_bug_fixes_30">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2011-01-09</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_30">Bug fixes</h3>\r
+<h3 id="_bug_fixes_31">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2010-11-28</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_31">Bug fixes</h3>\r
+<h3 id="_bug_fixes_32">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2010-11-21</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_32">Bug fixes</h3>\r
+<h3 id="_bug_fixes_33">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2010-11-07</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_33">Bug fixes</h3>\r
+<h3 id="_bug_fixes_34">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_34">Bug fixes</h3>\r
+<h3 id="_bug_fixes_35">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div class="sectionbody">\r
<div class="paragraph"><p>Release date: 2010-07-15</p></div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_35">Bug fixes</h3>\r
+<h3 id="_bug_fixes_36">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
</ul></div>\r
</div>\r
<div class="sect2">\r
-<h3 id="_bug_fixes_36">Bug fixes</h3>\r
+<h3 id="_bug_fixes_37">Bug fixes</h3>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Version 3.7.1<br />\r
+Version 3.7.2<br />\r
Last updated\r
- 2019-05-01 16:28:03 CEST\r
+ 2019-07-19 09:58:41 CEST\r
</div>\r
</div>\r
</body>\r
.\" Title: ccache
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\" Date: 05/01/2019
+.\" Date: 07/19/2019
.\" Manual: ccache Manual
-.\" Source: ccache 3.7.1
+.\" Source: ccache 3.7.2
.\" Language: English
.\"
-.TH "CCACHE" "1" "05/01/2019" "ccache 3\&.7\&.1" "ccache Manual"
+.TH "CCACHE" "1" "07/19/2019" "ccache 3\&.7\&.2" "ccache Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.sp -1
.IP \(bu 2.3
.\}
-The manifest entries will include system header files as well, thus slowing down cache hits slightly\&.
+If \-MD is used, the manifest entries will include system header files as well, thus slowing down cache hits slightly, just as using \-MD slows down make\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If \-MMD is used, the manifest entries will not include system header files, which means ccache will ignore changes in them\&.
.RE
.sp
The depend mode will be disabled if any of the following holds:
\fB\-include\fR
compiler option to include the precompiled header (i\&.e\&., don\(cqt use
\fB#include\fR
-in the source code to include the header); or
+in the source code to include the header; the filename itself must be sufficient to find the header, i\&.e\&.
+\fB\-I\fR
+paths are not searched); or
.RE
.sp
.RS 4
.sp -1
.IP \(bu 2.3
.\}
-add the
+(for the GCC compiler) add the
\fB\-fpch\-preprocess\fR
compiler option when compiling\&.
.RE
// belongs (<cache_dir>/<x>/stats).
char *stats_file = NULL;
+// The stats file to use for the manifest.
+static char *manifest_stats_file;
+
// Whether the output is a precompiled header.
bool output_is_precompiled_header = false;
bool is_pch = is_precompiled_header(path);
if (is_pch) {
+ if (!included_pch_file) {
+ cc_log("Detected use of precompiled header: %s", path);
+ }
bool using_pch_sum = false;
if (conf->pch_external_checksum) {
// hash pch.sum instead of pch when it exists
free(data);
free(cwd);
- // Explicitly check the .gch/.pch/.pth file, Clang does not include any
+ // Explicitly check the .gch/.pch/.pth file as Clang does not include any
// mention of it in the preprocessed output.
if (included_pch_file) {
char *pch_path = x_strdup(included_pch_file);
fclose(f);
+ // Explicitly check the .gch/.pch/.pth file as it may not be mentioned in the
+ // dependencies output.
+ if (included_pch_file) {
+ char *pch_path = x_strdup(included_pch_file);
+ pch_path = make_relative_path(pch_path);
+ hash_string(hash, pch_path);
+ remember_include_file(pch_path, hash, false, NULL);
+ }
+
bool debug_included = getenv("CCACHE_DEBUG_INCLUDED");
if (debug_included) {
print_included_files(stdout);
failed();
}
stats_update_size(
+ stats_file,
file_size(&st) - (orig_dest_existed ? file_size(&orig_dest_st) : 0),
orig_dest_existed ? 0 : 1);
}
if (stat(manifest_path, &st) == 0) {
old_size = file_size(&st);
}
+
MTR_BEGIN("manifest", "manifest_put");
if (manifest_put(manifest_path, cached_obj_hash, included_files)) {
cc_log("Added object file hash to %s", manifest_path);
if (x_stat(manifest_path, &st) == 0) {
- stats_update_size(file_size(&st) - old_size, old_size == 0 ? 1 : 0);
+ stats_update_size(
+ manifest_stats_file,
+ file_size(&st) - old_size,
+ old_size == 0 ? 1 : 0);
}
} else {
cc_log("Failed to add object file hash to %s", manifest_path);
char *manifest_name = hash_result(hash);
manifest_path = get_path_in_cache(manifest_name, ".manifest");
+ manifest_stats_file =
+ format("%s/%c/stats", conf->cache_dir, manifest_name[0]);
free(manifest_name);
cc_log("Looking for object file hash in %s", manifest_path);
const char *explicit_language = NULL; // As specified with -x.
const char *file_language; // As deduced from file extension.
const char *input_charset = NULL;
+
// Is the dependency makefile name overridden with -MF?
bool dependency_filename_specified = false;
+
// Is the dependency makefile target name specified with -MT or -MQ?
bool dependency_target_specified = false;
+
// Is the dependency target name implicitly specified using
// DEPENDENCIES_OUTPUT or SUNPRO_DEPENDENCIES?
bool dependency_implicit_target_specified = false;
+
// expanded_args is a copy of the original arguments given to the compiler
// but with arguments from @file and similar constructs expanded. It's only
// used as a temporary data structure to loop over.
struct args *expanded_args = args_copy(args);
- // stripped_args essentially contains all original arguments except those
- // that only should be passed to the preprocessor (if run_second_cpp is
- // false) and except dependency options (like -MD and friends).
- struct args *stripped_args = args_init(0, NULL);
- // cpp_args contains arguments that were not added to stripped_args, i.e.
- // those that should only be passed to the preprocessor if run_second_cpp is
- // false. If run_second_cpp is true, they will be passed to the compiler as
- // well.
+
+ // common_args contains all original arguments except:
+ // * those that never should be passed to the preprocessor,
+ // * those that only should be passed to the preprocessor (if run_second_cpp
+ // is false), and
+ // * dependency options (like -MD and friends).
+ struct args *common_args = args_init(0, NULL);
+
+ // cpp_args contains arguments that were not added to common_args, i.e. those
+ // that should only be passed to the preprocessor if run_second_cpp is false.
+ // If run_second_cpp is true, they will be passed to the compiler as well.
struct args *cpp_args = args_init(0, NULL);
- // dep_args contains dependency options like -MD. They only passed to the
+
+ // dep_args contains dependency options like -MD. They are only passed to the
// preprocessor, never to the compiler.
struct args *dep_args = args_init(0, NULL);
- bool found_color_diagnostics = false;
+ // compiler_only_args contains arguments that should only be passed to the
+ // compiler, not the preprocessor.
+ struct args *compiler_only_args = args_init(0, NULL);
+ bool found_color_diagnostics = false;
bool found_directives_only = false;
bool found_rewrite_includes = false;
int argc = expanded_args->argc;
char **argv = expanded_args->argv;
- args_add(stripped_args, argv[0]);
+ args_add(common_args, argv[0]);
bool result = true;
for (int i = 1; i < argc; i++) {
result = false;
goto out;
}
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
continue;
}
+ // Handle options that should not be passed to the preprocessor.
+ if (compopt_affects_comp(argv[i])) {
+ args_add(compiler_only_args, argv[i]);
+ if (compopt_takes_arg(argv[i])) {
+ if (i == argc - 1) {
+ cc_log("Missing argument to %s", argv[i]);
+ stats_update(STATS_ARGS);
+ result = false;
+ goto out;
+ }
+ args_add(compiler_only_args, argv[i + 1]);
+ ++i;
+ }
+ continue;
+ }
+ if (compopt_prefix_affects_comp(argv[i])) {
+ args_add(compiler_only_args, argv[i]);
+ continue;
+ }
+
if (str_eq(argv[i], "-fpch-preprocess")
|| str_eq(argv[i], "-emit-pch")
|| str_eq(argv[i], "-emit-pth")) {
// -S changes the default extension.
if (str_eq(argv[i], "-S")) {
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
found_S_opt = true;
continue;
}
(debug_prefix_maps_len + 1) * sizeof(char *));
debug_prefix_maps[debug_prefix_maps_len++] =
x_strdup(&argv[i][argv[i][2] == 'f' ? 18 : 19]);
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
// Debugging is handled specially, so that we know if we can strip line
// number info.
if (str_startswith(argv[i], "-g")) {
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
+
+ if (str_startswith(argv[i], "-gdwarf")) {
+ // Selection of DWARF format (-gdwarf or -gdwarf-<version>) enables
+ // debug info on level 2.
+ generating_debuginfo = true;
+ continue;
+ }
char last_char = argv[i][strlen(argv[i]) - 1];
if (last_char == '0') {
}
if (str_eq(argv[i], "-fprofile-arcs")) {
profile_arcs = true;
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_eq(argv[i], "-ftest-coverage")) {
generating_coverage = true;
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_eq(argv[i], "-fstack-usage")) {
generating_stackusage = true;
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_eq(argv[i], "--coverage") // = -fprofile-arcs -ftest-coverage
|| str_eq(argv[i], "-coverage")) { // Undocumented but still works.
profile_arcs = true;
generating_coverage = true;
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_startswith(argv[i], "-fprofile-dir=")) {
profile_dir = x_strdup(argv[i] + 14);
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_startswith(argv[i], "-fsanitize-blacklist=")) {
sanitize_blacklists,
(sanitize_blacklists_len + 1) * sizeof(char *));
sanitize_blacklists[sanitize_blacklists_len++] = x_strdup(argv[i] + 21);
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (str_startswith(argv[i], "--sysroot=")) {
char *relpath = make_relative_path(x_strdup(argv[i] + 10));
char *option = format("--sysroot=%s", relpath);
- args_add(stripped_args, option);
+ args_add(common_args, option);
free(relpath);
free(option);
continue;
result = false;
goto out;
}
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
char *relpath = make_relative_path(x_strdup(argv[i+1]));
- args_add(stripped_args, relpath);
+ args_add(common_args, relpath);
i++;
free(relpath);
continue;
result = false;
goto out;
}
- args_add(stripped_args, argv[i]);
- args_add(stripped_args, argv[i+1]);
+ args_add(common_args, argv[i]);
+ args_add(common_args, argv[i+1]);
i++;
continue;
}
}
if (supported_profile_option) {
- args_add(stripped_args, arg);
+ args_add(common_args, arg);
free(arg);
// If the profile directory has already been set, give up... Hard to
|| str_eq(argv[i], "-fdiagnostics-color=always")
|| str_eq(argv[i], "-fno-diagnostics-color")
|| str_eq(argv[i], "-fdiagnostics-color=never")) {
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
found_color_diagnostics = true;
continue;
}
if (str_eq(argv[i], "-fdiagnostics-color=auto")) {
if (color_output_possible()) {
// Output is redirected, so color output must be forced.
- args_add(stripped_args, "-fdiagnostics-color=always");
+ args_add(common_args, "-fdiagnostics-color=always");
cc_log("Automatically forcing colors");
} else {
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
}
found_color_diagnostics = true;
continue;
args_add(cpp_args, argv[i]);
args_add(cpp_args, relpath);
} else {
- args_add(stripped_args, argv[i]);
- args_add(stripped_args, relpath);
+ args_add(common_args, argv[i]);
+ args_add(common_args, relpath);
}
free(relpath);
if (compopt_affects_cpp(option)) {
args_add(cpp_args, new_option);
} else {
- args_add(stripped_args, new_option);
+ args_add(common_args, new_option);
}
free(new_option);
free(relpath);
args_add(cpp_args, argv[i]);
args_add(cpp_args, argv[i+1]);
} else {
- args_add(stripped_args, argv[i]);
- args_add(stripped_args, argv[i+1]);
+ args_add(common_args, argv[i]);
+ args_add(common_args, argv[i+1]);
}
i++;
|| compopt_prefix_affects_cpp(argv[i])) {
args_add(cpp_args, argv[i]);
} else {
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
}
continue;
}
&& (stat(argv[i], &st) != 0 || !S_ISREG(st.st_mode))) {
cc_log("%s is not a regular file, not considering as input file",
argv[i]);
- args_add(stripped_args, argv[i]);
+ args_add(common_args, argv[i]);
continue;
}
if (!found_c_opt && !found_S_opt) {
if (output_is_precompiled_header) {
- args_add(stripped_args, "-c");
+ args_add(common_args, "-c");
} else {
cc_log("No -c option found");
// I find that having a separate statistic for autoconf tests is useful,
if (!found_color_diagnostics && color_output_possible()) {
if (guessed_compiler == GUESSED_CLANG) {
if (!str_eq(actual_language, "assembler")) {
- args_add(stripped_args, "-fcolor-diagnostics");
+ args_add(common_args, "-fcolor-diagnostics");
cc_log("Automatically enabling colors");
}
} else if (guessed_compiler == GUESSED_GCC) {
// set (and not empty), so use that for detecting if GCC would use
// colors.
if (getenv("GCC_COLORS") && getenv("GCC_COLORS")[0] != '\0') {
- args_add(stripped_args, "-fdiagnostics-color");
+ args_add(common_args, "-fdiagnostics-color");
cc_log("Automatically enabling colors");
}
}
output_su = make_relative_path(default_sufile_name);
}
- *compiler_args = args_copy(stripped_args);
+ *compiler_args = args_copy(common_args);
+ args_extend(*compiler_args, compiler_only_args);
+
if (conf->run_second_cpp) {
args_extend(*compiler_args, cpp_args);
} else if (found_directives_only || found_rewrite_includes) {
// source.
args_extend(cpp_args, dep_args);
- *preprocessor_args = args_copy(stripped_args);
+ *preprocessor_args = args_copy(common_args);
args_extend(*preprocessor_args, cpp_args);
out:
args_free(expanded_args);
- args_free(stripped_args);
+ args_free(common_args);
args_free(dep_args);
args_free(cpp_args);
return result;
from_cache(FROMCACHE_DIRECT_MODE, 0);
// Wasn't able to return from cache at this point. However, the object
- // was already found in manifest, so don't readd it later.
+ // was already found in manifest, so don't re-add it later.
put_object_in_manifest = false;
object_hash_from_manifest = object_hash;
!= -1) {
switch (c) {
case DUMP_MANIFEST:
+ initialize();
manifest_dump(optarg, stdout);
break;
void stats_zero(void);
void stats_summary(void);
void stats_print(void);
-void stats_update_size(int64_t size, int files);
+void stats_update_size(const char *sfile, int64_t size, int files);
void stats_get_obsolete_limits(const char *dir, unsigned *maxfiles,
uint64_t *maxsize);
void stats_set_sizes(const char *dir, unsigned num_files, uint64_t total_size);
#include "ccache.h"
#include "compopt.h"
+// The option it too hard to handle at all.
#define TOO_HARD (1 << 0)
+
+// The option it too hard for the direct mode.
#define TOO_HARD_DIRECT (1 << 1)
+
+// The option takes a separate argument, e.g. "-D FOO=1".
#define TAKES_ARG (1 << 2)
+
+// The option takes a concatenated argument, e.g. "-DFOO=1".
#define TAKES_CONCAT_ARG (1 << 3)
+
+// The argument to the option is a path that may be rewritten if base_dir is
+// used.
#define TAKES_PATH (1 << 4)
+
+// The option only affects preprocessing; not passed to the compiler if
+// run_second_cpp is false.
#define AFFECTS_CPP (1 << 5)
+// The option only affects compilation; not passed to the preprocesor.
+#define AFFECTS_COMP (1 << 6)
+
struct compopt {
const char *name;
int type;
{"-P", TOO_HARD},
{"-U", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG},
{"-V", TAKES_ARG},
- {"-Xassembler", TAKES_ARG},
+ {"-Wa,", TAKES_CONCAT_ARG | AFFECTS_COMP},
+ {"-Werror", AFFECTS_COMP}, // don't exit with error when preprocessing
+ {"-Wl,", TAKES_CONCAT_ARG | AFFECTS_COMP},
+ {"-Xassembler", TAKES_ARG | TAKES_CONCAT_ARG | AFFECTS_COMP},
{"-Xclang", TAKES_ARG},
- {"-Xlinker", TAKES_ARG},
+ {"-Xlinker", TAKES_ARG | TAKES_CONCAT_ARG | AFFECTS_COMP},
{"-Xpreprocessor", AFFECTS_CPP | TOO_HARD_DIRECT | TAKES_ARG},
+ {"-all_load", AFFECTS_COMP},
{"-analyze", TOO_HARD}, // clang
{"-arch", TAKES_ARG},
{"-aux-info", TAKES_ARG},
{"-b", TAKES_ARG},
+ {"-bind_at_load", AFFECTS_COMP},
+ {"-bundle", AFFECTS_COMP},
{"-ccbin", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"-fmodules", TOO_HARD},
{"-fno-working-directory", AFFECTS_CPP},
{"-fplugin=libcc1plugin", TOO_HARD}, // interaction with GDB
{"-frepo", TOO_HARD},
+ {"-ftime-trace", TOO_HARD}, // clang
{"-fworking-directory", AFFECTS_CPP},
{"-gtoggle", TOO_HARD},
{"-idirafter", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
{"-iwithprefixbefore",
AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
{"-ldir", AFFECTS_CPP | TAKES_ARG}, // nvcc
+ {"-nolibc", AFFECTS_COMP},
{"-nostdinc", AFFECTS_CPP},
{"-nostdinc++", AFFECTS_CPP},
{"-odir", AFFECTS_CPP | TAKES_ARG}, // nvcc
+ {"-pie", AFFECTS_COMP},
+ {"-prebind", AFFECTS_COMP},
+ {"-preload", AFFECTS_COMP},
+ {"-rdynamic", AFFECTS_COMP},
{"-remap", AFFECTS_CPP},
{"-save-temps", TOO_HARD},
{"-save-temps=cwd", TOO_HARD},
return co && (co->type & AFFECTS_CPP);
}
+bool
+compopt_affects_comp(const char *option)
+{
+ const struct compopt *co = find(option);
+ return co && (co->type & AFFECTS_COMP);
+}
+
bool
compopt_too_hard(const char *option)
{
const struct compopt *co = find_prefix(option);
return co && (co->type & TAKES_CONCAT_ARG) && (co->type & AFFECTS_CPP);
}
+
+// Determines if the prefix of the option matches any option and affects the
+// preprocessor.
+bool
+compopt_prefix_affects_comp(const char *option)
+{
+ // Prefix options have to take concatenated args.
+ const struct compopt *co = find_prefix(option);
+ return co && (co->type & TAKES_CONCAT_ARG) && (co->type & AFFECTS_COMP);
+}
bool compopt_short(bool (*fn)(const char *option), const char *option);
bool compopt_affects_cpp(const char *option);
+bool compopt_affects_comp(const char *option);
bool compopt_too_hard(const char *option);
bool compopt_too_hard_for_direct_mode(const char *option);
bool compopt_takes_path(const char *option);
bool compopt_takes_arg(const char *option);
bool compopt_takes_concat_arg(const char *option);
bool compopt_prefix_affects_cpp(const char *option);
+bool compopt_prefix_affects_comp(const char *option);
#endif // CCACHE_COMPOPT_H
// Note: The path pointer is stored in conf, so path must outlive conf.
//
-// On failure, if an I/O error occured errno is set appropriately, otherwise
+// On failure, if an I/O error occurred errno is set appropriately, otherwise
// errno is set to zero indicating that config itself was invalid.
bool
conf_read(struct conf *conf, const char *path, char **errmsg)
return false;
}
+ char dummy[8] = {0}; // The maximum entry size in struct conf.
+ if (!item->parser(value, (void *)dummy, errmsg)
+ || (item->verifier && !item->verifier(value, errmsg))) {
+ return false;
+ }
+
FILE *infile = fopen(path, "r");
if (!infile) {
*errmsg = format("%s: %s", path, strerror(errno));
#include "ccache.h"
static char *
-format_string(void *value)
+format_string(const void *value)
{
- char **str = (char **)value;
+ const char * const *str = (const char * const*)value;
return x_strdup(*str);
}
}
char *
-confitem_format_bool(void *value)
+confitem_format_bool(const void *value)
{
- bool *b = (bool *)value;
+ const bool *b = (const bool *)value;
return x_strdup(*b ? "true" : "false");
}
}
char *
-confitem_format_env_string(void *value)
+confitem_format_env_string(const void *value)
{
return format_string(value);
}
}
char *
-confitem_format_double(void *value)
+confitem_format_double(const void *value)
{
- double *x = (double *)value;
+ const double *x = (const double *)value;
return format("%.1f", *x);
}
}
char *
-confitem_format_size(void *value)
+confitem_format_size(const void *value)
{
- uint64_t *size = (uint64_t *)value;
+ const uint64_t *size = (const uint64_t *)value;
return format_parsable_size_with_suffix(*size);
}
}
char *
-confitem_format_sloppiness(void *value)
+confitem_format_sloppiness(const void *value)
{
- unsigned *sloppiness = (unsigned *)value;
+ const unsigned *sloppiness = (const unsigned *)value;
char *s = x_strdup("");
if (*sloppiness & SLOPPY_FILE_MACRO) {
reformat(&s, "%sfile_macro, ", s);
}
char *
-confitem_format_string(void *value)
+confitem_format_string(const void *value)
{
return format_string(value);
}
}
char *
-confitem_format_umask(void *value)
+confitem_format_umask(const void *value)
{
- unsigned *umask = (unsigned *)value;
+ const unsigned *umask = (const unsigned *)value;
if (*umask == UINT_MAX) {
return x_strdup("");
} else {
}
char *
-confitem_format_unsigned(void *value)
+confitem_format_unsigned(const void *value)
{
- unsigned *i = (unsigned *)value;
+ const unsigned *i = (const unsigned *)value;
return format("%u", *i);
}
bool
-confitem_verify_absolute_path(void *value, char **errmsg)
+confitem_verify_absolute_path(const void *value, char **errmsg)
{
- char **path = (char **)value;
+ const char * const *path = (const char * const *)value;
assert(*path);
if (str_eq(*path, "")) {
// The empty string means "disable" in this case.
}
bool
-confitem_verify_dir_levels(void *value, char **errmsg)
+confitem_verify_dir_levels(const void *value, char **errmsg)
{
- unsigned *levels = (unsigned *)value;
+ const unsigned *levels = (const unsigned *)value;
assert(levels);
if (*levels >= 1 && *levels <= 8) {
return true;
#include "system.h"
typedef bool (*conf_item_parser)(const char *str, void *result, char **errmsg);
-typedef bool (*conf_item_verifier)(void *value, char **errmsg);
-typedef char *(*conf_item_formatter)(void *value);
+typedef bool (*conf_item_verifier)(const void *value, char **errmsg);
+typedef char *(*conf_item_formatter)(const void *value);
struct conf_item {
const char *name;
};
bool confitem_parse_bool(const char *str, void *result, char **errmsg);
-char *confitem_format_bool(void *value);
+char *confitem_format_bool(const void *value);
bool confitem_parse_env_string(const char *str, void *result, char **errmsg);
-char *confitem_format_env_string(void *value);
+char *confitem_format_env_string(const void *value);
bool confitem_parse_double(const char *str, void *result, char **errmsg);
-char *confitem_format_double(void *value);
+char *confitem_format_double(const void *value);
bool confitem_parse_size(const char *str, void *result, char **errmsg);
-char *confitem_format_size(void *value);
+char *confitem_format_size(const void *value);
bool confitem_parse_sloppiness(const char *str, void *result, char **errmsg);
-char *confitem_format_sloppiness(void *value);
+char *confitem_format_sloppiness(const void *value);
bool confitem_parse_string(const char *str, void *result, char **errmsg);
-char *confitem_format_string(void *value);
+char *confitem_format_string(const void *value);
bool confitem_parse_umask(const char *str, void *result, char **errmsg);
-char *confitem_format_umask(void *value);
+char *confitem_format_umask(const void *value);
bool confitem_parse_unsigned(const char *str, void *result, char **errmsg);
-char *confitem_format_unsigned(void *value);
+char *confitem_format_unsigned(const void *value);
-bool confitem_verify_absolute_path(void *value, char **errmsg);
-bool confitem_verify_dir_levels(void *value, char **errmsg);
+bool confitem_verify_absolute_path(const void *value, char **errmsg);
+bool confitem_verify_dir_levels(const void *value, char **errmsg);
const struct conf_item *confitems_get(const char *str, size_t len);
size_t confitems_count(void);
-// Copyright (C) 2010-2016 Joel Rosdahl
+// Copyright (C) 2010-2019 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
void
counters_free(struct counters *c)
{
- free(c->data);
- free(c);
+ if (c) {
+ free(c->data);
+ free(c);
+ }
}
// Set a new size. New data entries are set to 0.
}
static struct manifest *
-read_manifest(gzFile f)
+read_manifest(gzFile f, char **errmsg)
{
+ *errmsg = NULL;
struct manifest *mf = create_empty_manifest();
uint32_t magic;
READ_INT(4, magic);
if (magic != MAGIC) {
- cc_log("Manifest file has bad magic number %u", magic);
+ *errmsg = format("Manifest file has bad magic number %u", magic);
goto error;
}
READ_BYTE(mf->version);
if (mf->version != MANIFEST_VERSION) {
- cc_log("Manifest file has unknown version %u", mf->version);
+ *errmsg = format(
+ "Unknown manifest version (actual %u, expected %u)",
+ mf->version,
+ MANIFEST_VERSION);
goto error;
}
READ_BYTE(mf->hash_size);
if (mf->hash_size != 16) {
// Temporary measure until we support different hash algorithms.
- cc_log("Manifest file has unsupported hash size %u", mf->hash_size);
+ *errmsg =
+ format("Manifest file has unsupported hash size %u", mf->hash_size);
goto error;
}
return mf;
error:
- cc_log("Corrupt manifest file");
+ if (!errmsg) {
+ *errmsg = x_strdup("Corrupt manifest file");
+ }
free_manifest(mf);
return NULL;
}
cc_log("Failed to gzdopen manifest file");
goto out;
}
- mf = read_manifest(f);
+
+ char *errmsg;
+ mf = read_manifest(f, &errmsg);
if (!mf) {
- cc_log("Error reading manifest file");
+ cc_log("%s", errmsg);
goto out;
}
close(fd1);
goto out;
}
- mf = read_manifest(f1);
+ char *errmsg;
+ mf = read_manifest(f1, &errmsg);
gzclose(f1);
if (!mf) {
+ cc_log("%s", errmsg);
+ free(errmsg);
cc_log("Failed to read manifest file; deleting it");
x_unlink(manifest_path);
mf = create_empty_manifest();
close(fd);
goto out;
}
- mf = read_manifest(f);
+ char *errmsg;
+ mf = read_manifest(f, &errmsg);
if (!mf) {
- fprintf(stderr, "Error reading manifest file\n");
+ fprintf(stderr, "%s\n", errmsg);
+ free(errmsg);
goto out;
}
static char *format_size_times_1024(uint64_t size);
static char *format_timestamp(uint64_t timestamp);
+static void stats_flush_to_file(const char *sfile, struct counters *updates);
// Statistics fields in display order.
static struct {
// Record that a number of bytes and files have been added to the cache. Size
// is in bytes.
void
-stats_update_size(int64_t size, int files)
+stats_update_size(const char *sfile, int64_t size, int files)
{
- init_counter_updates();
- counter_updates->data[STATS_NUMFILES] += files;
- counter_updates->data[STATS_TOTALSIZE] += size / 1024;
+ struct counters *updates;
+ if (sfile == stats_file) {
+ init_counter_updates();
+ updates = counter_updates;
+ } else {
+ updates = counters_init(STATS_END);
+ }
+ updates->data[STATS_NUMFILES] += files;
+ updates->data[STATS_TOTALSIZE] += size / 1024;
+ if (sfile != stats_file) {
+ stats_flush_to_file(sfile, updates);
+ counters_free(updates);
+ }
}
// Read in the stats from one directory and add to the counters.
free(data);
}
-// Write counter updates in counter_updates to disk.
-void
-stats_flush(void)
+// Write counter updates in updates to sfile.
+static void
+stats_flush_to_file(const char *sfile, struct counters *updates)
{
assert(conf);
return;
}
- if (!counter_updates) {
+ if (!updates) {
return;
}
bool should_flush = false;
for (int i = 0; i < STATS_END; ++i) {
- if (counter_updates->data[i] > 0) {
+ if (updates->data[i] > 0) {
should_flush = true;
break;
}
return;
}
- if (!stats_file) {
+ if (!sfile) {
char *stats_dir;
- // A NULL stats_file means that we didn't get past calculate_object_hash(),
- // so we just choose one of stats files in the 16 subdirectories.
+ // A NULL sfile means that we didn't get past calculate_object_hash(), so
+ // we just choose one of stats files in the 16 subdirectories.
stats_dir = format("%s/%x", conf->cache_dir, hash_from_int(getpid()) % 16);
- stats_file = format("%s/stats", stats_dir);
+ sfile = format("%s/stats", stats_dir);
free(stats_dir);
}
- if (!lockfile_acquire(stats_file, lock_staleness_limit)) {
+ if (!lockfile_acquire(sfile, lock_staleness_limit)) {
return;
}
struct counters *counters = counters_init(STATS_END);
- stats_read(stats_file, counters);
+ stats_read(sfile, counters);
for (int i = 0; i < STATS_END; ++i) {
- counters->data[i] += counter_updates->data[i];
+ counters->data[i] += updates->data[i];
}
- stats_write(stats_file, counters);
- lockfile_release(stats_file);
+ stats_write(sfile, counters);
+ lockfile_release(sfile);
if (!str_eq(conf->log_file, "") || conf->debug) {
for (int i = 0; i < STATS_END; ++i) {
- if (counter_updates->data[stats_info[i].stat] != 0
+ if (updates->data[stats_info[i].stat] != 0
&& !(stats_info[i].flags & FLAG_NOZERO)) {
cc_log("Result: %s", stats_info[i].message);
}
}
}
- char *subdir = dirname(stats_file);
+ char *subdir = dirname(sfile);
bool need_cleanup = false;
if (conf->max_files != 0
counters_free(counters);
}
+// Write counter updates in counter_updates to disk.
+void
+stats_flush(void)
+{
+ stats_flush_to_file(stats_file, counter_updates);
+ counters_free(counter_updates);
+ counter_updates = NULL;
+}
+
// Update a normal stat.
void
stats_update(enum stats stat)
-extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.1";
+extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.2";
# =============================================================================
# main program
+export LC_ALL=C
+
if pwd | grep '[^A-Za-z0-9/.,=_%+-]' >/dev/null 2>&1; then
cat <<EOF
Error: The test suite doesn't work in directories with whitespace or other
}
SUITE_pch() {
- # Clang and GCC handle precompiled headers similarly, but GCC is much more
- # forgiving with precompiled headers. Both GCC and Clang keep an absolute
- # path reference to the original file except that Clang uses that reference
- # to validate the pch and GCC ignores the reference. Also, Clang has an
- # additional feature: pre-tokenized headers. For these reasons, Clang
- # should be tested differently from GCC. Clang can only use pch or pth
- # headers on the command line and not as an #include statement inside a
- # source file.
-
+ # Clang should generally be compatible with GCC and so most of the tests
+ # can be shared. There are some differences though:
+ #
+ # - Both GCC and Clang keep an absolute path reference to the original file
+ # except that Clang uses that reference to validate the pch and GCC
+ # ignores the reference (i.e. the original file can be removed).
+ # - Clang can only use pch headers on the command line and not as an
+ # #include statement inside a source file, because it silently ignores
+ # -fpch-preprocess and does not output pragma GCC pch_preprocess.
+ # - Clang has -include-pch to directly include a PCH file without any magic
+ # of searching for a .gch file.
+ #
+ # Put tests that work with both compilers in pch_suite_common and put
+ # compiler-specific tests in pch_suite_clang/pch_suite_gcc.
+
+ pch_suite_common
if $COMPILER_TYPE_CLANG; then
pch_suite_clang
else
fi
}
-pch_suite_gcc() {
+pch_suite_common() {
# -------------------------------------------------------------------------
TEST "Create .gch, -c, no -o, without opt-in"
expect_stat 'cache miss' 1
expect_file_exists pch.h.gch
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ rm pch.h.gch
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+ expect_file_exists pch.h.gch
+
# -------------------------------------------------------------------------
TEST "Create .gch, no -c, -o, with opt-in"
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
expect_file_exists pch.gch
# -------------------------------------------------------------------------
- TEST "Use .gch, no -fpch-preprocess, #include"
+ TEST "Use .gch, #include, remove pch.h"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
rm pch.h
- $CCACHE_COMPILE $SYSROOT -c pch.c
+ $CCACHE_COMPILE $SYSROOT -c pch.c 2>/dev/null
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 0
# Preprocessor error because GCC can't find the real include file when
- # trying to preprocess:
+ # trying to preprocess (gcc -E will be called by ccache):
expect_stat 'preprocessor error' 1
# -------------------------------------------------------------------------
- TEST "Use .gch, no -fpch-preprocess, -include, no sloppiness"
+ TEST "Use .gch, -include, no sloppiness"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- rm pch.h
$CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat "can't use precompiled header" 1
# -------------------------------------------------------------------------
- TEST "Use .gch, no -fpch-preprocess, -include, sloppiness"
+ TEST "Use .gch, -include"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- rm pch.h
CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 2
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
# -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, #include, no sloppiness"
+ TEST "Use .gch, preprocessor mode, -include"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- rm pch.h
- $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
- # Must enable sloppy time macros:
- expect_stat "can't use precompiled header" 1
+ expect_stat 'cache miss' 1
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 1
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 2
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 2
+ expect_stat 'cache miss' 2
+
+ # -------------------------------------------------------------------------
+ TEST "Create .gch, -c, -o"
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ rm -f pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ expect_file_exists pch.h.gch
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ rm pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+ expect_file_exists pch.h.gch
# -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, #include, sloppiness"
+ TEST "Use .gch, -include, PCH_EXTSUM=1"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- rm pch.h
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ echo "original checksum" > pch.h.gch.sum
+
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
+ echo "other checksum" > pch.h.gch.sum
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
+ echo "original checksum" > pch.h.gch.sum
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 2
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
+ # With GCC, a newly generated PCH is always different, even if the contents
+ # should be exactly the same. And Clang stores file timestamps, so in this
+ # case the PCH is different too. So without .sum a "changed" PCH would mean
+ # a miss, but if the .sum doesn't change, it should be a hit.
+
+ sleep 1
+ touch pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 3
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
# -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, #include, file changed"
+ TEST "Use .gch, -include, no PCH_EXTSUM"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- rm pch.h
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ echo "original checksum" > pch.h.gch.sum
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ # external checksum not used, so no cache miss when changed
+ echo "other checksum" > pch.h.gch.sum
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
+ expect_stat 'cache hit (direct)' 2
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ # -------------------------------------------------------------------------
+ TEST "Use .gch, -include, other dir for .gch"
+
+ mkdir -p dir
+ $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch
+ backdate dir/pch.h.gch
+ rm -f pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch
+ backdate dir/pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c
+ expect_stat 'cache hit (direct)' 2
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+ rm -rf dir
+
+ # -------------------------------------------------------------------------
+ TEST "Use .gch, preprocessor mode, -include, other dir for .gch"
+
+ mkdir -p dir
+ $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch
+ backdate dir/pch.h.gch
+ rm -f pch.h.gch
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 1
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch
+ backdate dir/pch.h.gch
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 2
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 2
+ expect_stat 'cache miss' 2
+ rm -rf dir
+
+ # -------------------------------------------------------------------------
+ TEST "Use .gch, depend mode, -include"
+
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- echo "updated" >>pch.h.gch # GCC seems to cope with this...
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
+}
+pch_suite_gcc() {
# -------------------------------------------------------------------------
- TEST "Use .gch, preprocessor mode"
+ TEST "Use .gch, -include, remove pch.h"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
rm pch.h
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 1
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
# -------------------------------------------------------------------------
- TEST "Use .gch, preprocessor mode, file changed"
+ TEST "Use .gch, #include, no sloppiness"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
rm pch.h
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
+ # Must enable sloppy time macros:
+ expect_stat "can't use precompiled header" 1
- echo "updated" >>pch.h.gch # GCC seems to cope with this...
+ # -------------------------------------------------------------------------
+ TEST "Use .gch, #include"
+
+ $REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
+ rm pch.h
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 2
+ expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ # -------------------------------------------------------------------------
+ TEST "Use .gch, preprocessor mode, #include"
+
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+ rm pch.h
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 1
+
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache miss' 2
+
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 2
expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
mkdir pch.h.gch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
rm pch.h.gch/foo
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
backdate pch.h.gch/foo
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
echo "updated" >>pch.h.gch/foo # GCC seems to cope with this...
backdate pch.h.gch/foo
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 3
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 3
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 3
# -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, PCH_EXTSUM=1"
+ TEST "Use .gch, #include, PCH_EXTSUM=1"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
echo "original checksum" > pch.h.gch.sum
- CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
echo "other checksum" > pch.h.gch.sum
- CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
echo "original checksum" > pch.h.gch.sum
- CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
+ # With GCC, a newly generated PCH is always different, even if the contents
+ # should be exactly the same. And Clang stores file timestamps, so in this
+ # case the PCH is different too. So without .sum a "changed" PCH would mean
+ # a miss, but if the .sum doesn't change, it should be a hit.
+
+ sleep 1
+ touch pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ expect_stat 'cache hit (direct)' 3
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 2
+
# -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, no PCH_EXTSUM"
+ TEST "Use .gch, #include, no PCH_EXTSUM"
$REAL_COMPILER $SYSROOT -c pch.h
backdate pch.h.gch
echo "original checksum" > pch.h.gch.sum
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
# external checksum not used, so no cache miss when changed
echo "other checksum" > pch.h.gch.sum
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
}
pch_suite_clang() {
- # -------------------------------------------------------------------------
- TEST "Create .gch, -c, no -o, without opt-in"
-
- $CCACHE_COMPILE $SYSROOT -c pch.h
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 0
- expect_stat "can't use precompiled header" 1
-
- # -------------------------------------------------------------------------
- TEST "Create .gch, no -c, -o, without opt-in"
-
- $CCACHE_COMPILE pch.h -o pch.gch
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 0
- expect_stat "can't use precompiled header" 1
-
- # -------------------------------------------------------------------------
- TEST "Create .gch, -c, no -o, with opt-in"
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch.h
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- rm pch.h.gch
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch.h
- expect_stat 'cache hit (direct)' 1
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_file_exists pch.h.gch
-
- # -------------------------------------------------------------------------
- TEST "Create .gch, no -c, -o, with opt-in"
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch
- expect_stat 'cache hit (direct)' 1
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_file_exists pch.gch
-
# -------------------------------------------------------------------------
TEST "Create .gch, include file mtime changed"
# of the test.h include, otherwise we might not cache its ctime/mtime.
sleep 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch2.h
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
touch test.h
sleep 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch2.h
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
$REAL_COMPILER $SYSROOT -c -include pch2.h pch2.c
expect_file_exists pch2.o
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch2.h
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
- TEST "Use .gch, no -fpch-preprocess, -include, no sloppiness"
+ TEST "Use .pch, -include, no sloppiness"
- $REAL_COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c 2>/dev/null
+ $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 0
expect_stat "can't use precompiled header" 1
# -------------------------------------------------------------------------
- TEST "Use .gch, no -fpch-preprocess, -include, sloppiness"
+ TEST "Use .pch, -include"
- $REAL_COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- # -------------------------------------------------------------------------
- TEST "Use .gch, -fpch-preprocess, -include, file changed"
-
- $REAL_COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- echo "updated" >>pch.h.gch # clang seems to cope with this...
- backdate pch.h.gch
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 2
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
- TEST "Use .gch, preprocessor mode"
+ TEST "Use .pch, preprocessor mode, -include"
- $REAL_COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 1
expect_stat 'cache miss' 1
- # -------------------------------------------------------------------------
- TEST "Use .gch, preprocessor mode, file changed"
-
- $REAL_COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
-
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- echo "updated" >>pch.h.gch # clang seems to cope with this...
- backdate pch.h.gch
-
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 2
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 1
expect_stat 'cache miss' 2
- # -------------------------------------------------------------------------
- TEST "Create .pth, -c, -o"
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.pth
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- rm -f pch.h.pth
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.pth
- expect_stat 'cache hit (direct)' 1
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_file_exists pch.h.pth
-
- # -------------------------------------------------------------------------
- TEST "Use .pth, no -fpch-preprocess, -include, no sloppiness"
-
- $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pth
- backdate pch.h.pth
-
- $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c
expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 0
- # Must enable sloppy time macros:
- expect_stat "can't use precompiled header" 1
+ expect_stat 'cache hit (preprocessed)' 2
+ expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
- TEST "Use .pth, no -fpch-preprocess, -include, sloppiness"
+ TEST "Use .pch, -include-pch"
- $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pth
- backdate pch.h.pth
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- # -------------------------------------------------------------------------
- TEST "Use .pth, -fpch-preprocess, -include, file changed"
-
- $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pth
- backdate pch.h.pth
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- echo "updated" >>pch.h.pth # clang seems to cope with this...
- backdate pch.h.pth
-
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 2
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
- TEST "Use .pth, preprocessor mode"
+ TEST "Use .pch, preprocessor mode, -include-pch"
- $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pth
- backdate pch.h.pth
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 1
expect_stat 'cache miss' 1
- # -------------------------------------------------------------------------
- TEST "Use .pth, preprocessor mode, file changed"
-
- $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pth
- backdate pch.h.pth
-
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- echo "updated" >>pch.h.pth # clang seems to cope with this...
- backdate pch.h.pth
+ echo '#include <string.h> /*change pch*/' >>pch.h
+ backdate pch.h
+ $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch
+ backdate pch.h.pch
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c
expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache hit (preprocessed)' 1
expect_stat 'cache miss' 2
- CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h -fpch-preprocess pch.c
+ CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c
expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 1
+ expect_stat 'cache hit (preprocessed)' 2
expect_stat 'cache miss' 2
}
-// Copyright (C) 2010-2018 Joel Rosdahl
+// Copyright (C) 2010-2019 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
}
}
- if (getenv("RUN_FROM_BUILD_FARM")) {
- verbose = 1;
- }
-
testdir = format("testdir.%d", (int)getpid());
cct_create_fresh_dir(testdir);
dir_before = gnu_getcwd();
-// Copyright (C) 2010-2018 Joel Rosdahl
+// Copyright (C) 2010-2019 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
args_free(orig);
}
+TEST(options_not_to_be_passed_to_the_preprocesor)
+{
+ struct args *orig = args_init_from_string(
+ "cc -Wa,foo foo.c -g -Xlinker fie -Xlinker,fum -c -Werror");
+ struct args *exp_cpp = args_init_from_string("cc -g");
+ struct args *exp_cc = args_init_from_string(
+ "cc -g -Wa,foo -Xlinker fie -Xlinker,fum -Werror -c");
+ struct args *act_cpp = NULL;
+ struct args *act_cc = NULL;
+
+ create_file("foo.c", "");
+ CHECK(cc_process_args(orig, &act_cpp, &act_cc));
+ CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
+ CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
+
+ args_free(orig);
+}
+
TEST_SUITE_END
char *data;
create_file("ccache.conf", "path = vanilla\n");
- CHECKM(conf_set_value_in_file("ccache.conf", "stats", "chocolate", &errmsg),
+ CHECKM(conf_set_value_in_file("ccache.conf", "compiler", "chocolate", &errmsg),
errmsg);
data = read_text_file("ccache.conf", 0);
CHECK(data);
- CHECK_STR_EQ_FREE2("path = vanilla\nstats = chocolate\n", data);
+ CHECK_STR_EQ_FREE2("path = vanilla\ncompiler = chocolate\n", data);
}
TEST(conf_set_existing_value)