Imported Upstream version 3.7.6 upstream/3.7.6
authorJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:28:49 +0000 (16:28 +0900)
committerJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:28:49 +0000 (16:28 +0900)
19 files changed:
LICENSE.html
dev.mk.in
doc/AUTHORS.adoc
doc/AUTHORS.html
doc/MANUAL.adoc
doc/MANUAL.html
doc/NEWS.adoc
doc/NEWS.html
doc/ccache.1
src/ccache.c
src/ccache.h
src/compopt.c
src/confitems.c
src/stats.c
src/util.c
src/version.c
test/suites/direct.bash
unittest/test_compopt.c
unittest/test_conf.c

index 9b5aed9..0825ae2 100644 (file)
@@ -735,7 +735,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache copyright and license</h1>\r
-<span id="revnumber">version 3.7.5</span>\r
+<span id="revnumber">version 3.7.6</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>
@@ -1235,9 +1235,9 @@ following license:</p></div>
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.7.5<br />\r
+Version 3.7.6<br />\r
 Last updated\r
- 2019-10-22 20:50:43 CEST\r
+ 2019-11-17 20:10:03 CET\r
 </div>\r
 </div>\r
 </body>\r
index dbe2a22..7b0839f 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -191,7 +191,9 @@ doc/ccache.1: doc/MANUAL.xml
 
 .PHONY: update-authors
 update-authors:
-       git log --pretty=format:"* %aN" \
+       git log --pretty=format:"%H %aN" \
+         | grep -Ev 'd7c5056beda5483fcd5c098165fffd9be86fe98d' \
+         | sed -r 's/[^ ]+/*/' \
          | sort -u \
          | perl -00 -p -i -e 's/^\*.*/<STDIN> . "\n"/es' doc/AUTHORS.adoc
 
index f8bc0e6..d1ea696 100644 (file)
@@ -88,6 +88,7 @@ ccache is a collective work with contributions from many people, including:
 * Robert Yang
 * Robin H. Johnson
 * Rolf Bjarne Kvinge
+* Russell King
 * RW
 * Ryan Brown
 * Sam Gross
index 06a8dd3..85575ad 100644 (file)
@@ -735,7 +735,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache authors</h1>\r
-<span id="revnumber">version 3.7.5</span>\r
+<span id="revnumber">version 3.7.6</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>
@@ -1160,6 +1160,11 @@ Rolf Bjarne Kvinge
 </li>\r
 <li>\r
 <p>\r
+Russell King\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
 RW\r
 </p>\r
 </li>\r
@@ -1251,9 +1256,9 @@ Yvan Janssens
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.7.5<br />\r
+Version 3.7.6<br />\r
 Last updated\r
- 2019-10-22 20:50:43 CEST\r
+ 2019-11-17 20:10:03 CET\r
 </div>\r
 </div>\r
 </body>\r
index 2ca82c0..0964152 100644 (file)
@@ -558,13 +558,6 @@ still has to do _some_ preprocessing (like macros).
     computing the manifest hash. This is useful if you use Xcode, which uses an
     index store path derived from the local project path. Note that the index
     store won't be updated correctly on cache hits if you enable this option.
-*file_macro*::
-    ccache normally includes the input file path in the hash in order to be
-    able to produce the correct object file if the source code includes a
-    `__FILE__` macro. If you know that `__FILE__` isn't used in practise, or
-    don't care if ccache produces objects where `__FILE__` is expanded to the
-    wrong path, you can set *sloppiness* to *file_macro*. ccache will then
-    exclude the input file path from the hash.
 *file_stat_matches*::
     ccache normally examines a file's contents to determine whether it matches
     the cached version. With this option set, ccache will consider a file as
@@ -1227,12 +1220,10 @@ problems and what may be done to increase the hit rate:
    output. If you know that `__DATE__` isn't used in practise, or don't care if
    ccache produces objects where `__DATE__` is expanded to something in the
    past, you can set *sloppiness* to *time_macros*.
-** The input file path has changed. ccache normally includes the input file
-   path in the hash in order to be able to produce the correct object file if
-   the source code includes a `__FILE__` macro. If you know that `__FILE__`
-   isn't used in practise, or don't care if ccache produces objects where
-   `__FILE__` is expanded to the wrong path, you can set *sloppiness* to
-   *file_macro*. ccache will then exclude the input file path from the hash.
+** The input file path has changed. ccache includes the input file path in the
+   direct mode hash to be able to take relative include files into account and
+   to produce a correct object file if the source code includes a `__FILE__`
+   macro.
 * If ``cache miss'' has been incremented even though the same code has been
   compiled and cached before, ccache has either detected that something has
   changed anyway or a cleanup has been performed (either explicitly or
index 9dd91c3..d8da17d 100644 (file)
@@ -735,7 +735,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>CCACHE(1)</h1>\r
-<span id="revnumber">version 3.7.5</span>\r
+<span id="revnumber">version 3.7.6</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>
@@ -1577,19 +1577,6 @@ still has to do <em>some</em> preprocessing (like macros).</p></div>
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
-<strong>file_macro</strong>\r
-</dt>\r
-<dd>\r
-<p>\r
-    ccache normally includes the input file path in the hash in order to be\r
-    able to produce the correct object file if the source code includes a\r
-    <code>__FILE__</code> macro. If you know that <code>__FILE__</code> isn&#8217;t used in practise, or\r
-    don&#8217;t care if ccache produces objects where <code>__FILE__</code> is expanded to the\r
-    wrong path, you can set <strong>sloppiness</strong> to <strong>file_macro</strong>. ccache will then\r
-    exclude the input file path from the hash.\r
-</p>\r
-</dd>\r
-<dt class="hdlist1">\r
 <strong>file_stat_matches</strong>\r
 </dt>\r
 <dd>\r
@@ -2646,12 +2633,10 @@ The <code>__DATE__</code> preprocessor macro is (potentially) being used and the
 </li>\r
 <li>\r
 <p>\r
-The input file path has changed. ccache normally includes the input file\r
-   path in the hash in order to be able to produce the correct object file if\r
-   the source code includes a <code>__FILE__</code> macro. If you know that <code>__FILE__</code>\r
-   isn&#8217;t used in practise, or don&#8217;t care if ccache produces objects where\r
-   <code>__FILE__</code> is expanded to the wrong path, you can set <strong>sloppiness</strong> to\r
-   <strong>file_macro</strong>. ccache will then exclude the input file path from the hash.\r
+The input file path has changed. ccache includes the input file path in the\r
+   direct mode hash to be able to take relative include files into account and\r
+   to produce a correct object file if the source code includes a <code>__FILE__</code>\r
+   macro.\r
 </p>\r
 </li>\r
 </ul></div>\r
@@ -2746,9 +2731,9 @@ maintained by Joel Rosdahl. See AUTHORS.txt or AUTHORS.html and
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.7.5<br />\r
+Version 3.7.6<br />\r
 Last updated\r
- 2019-10-22 20:50:43 CEST\r
+ 2019-11-17 20:10:03 CET\r
 </div>\r
 </div>\r
 </body>\r
index 224ca79..7d8c7be 100644 (file)
@@ -1,6 +1,27 @@
 ccache news
 ===========
 
+ccache 3.7.6
+------------
+Release date: 2019-11-17
+
+Bug fixes
+~~~~~~~~~
+
+- The opt-in “file_macro sloppiness” mode has been removed so that the input
+  file path now is always included in the direct mode hash. This fixes a bug
+  that could result in false cache hits in an edge case when “file_macro
+  sloppiness” is enabled and several identical source files include a relative
+  header file with the same name but in different directories.
+
+- Statistics files are no longer lost when the filesystem of the cache is full.
+
+- Bail out on too hard Clang option `-MJarg` (in addition to the previous
+  bailout of `-MJ arg`).
+
+- Properly handle color diagnostics in the depend mode as well.
+
+
 ccache 3.7.5
 ------------
 Release date: 2019-10-22
index 9a96ed3..db4f0a0 100644 (file)
@@ -735,7 +735,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache news</h1>\r
-<span id="revnumber">version 3.7.5</span>\r
+<span id="revnumber">version 3.7.6</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>
@@ -743,6 +743,42 @@ asciidoc.install(2);
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_ccache_3_7_6">ccache 3.7.6</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2019-11-17</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 opt-in “file_macro sloppiness” mode has been removed so that the input\r
+  file path now is always included in the direct mode hash. This fixes a bug\r
+  that could result in false cache hits in an edge case when “file_macro\r
+  sloppiness” is enabled and several identical source files include a relative\r
+  header file with the same name but in different directories.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Statistics files are no longer lost when the filesystem of the cache is full.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Bail out on too hard Clang option <code>-MJarg</code> (in addition to the previous\r
+  bailout of <code>-MJ arg</code>).\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Properly handle color diagnostics in the depend mode as well.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_ccache_3_7_5">ccache 3.7.5</h2>\r
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2019-10-22</p></div>\r
@@ -758,7 +794,7 @@ Added support for <code>-MF=arg</code> (with an extra equal sign) as understood
 </ul></div>\r
 </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
@@ -828,7 +864,7 @@ Added support for converting paths like “/c/users” into relative paths on
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2019-08-17</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
@@ -853,7 +889,7 @@ Fixed a regression in 3.7.2 when using the compiler option “-Werror” and the
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2019-07-19</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
@@ -1310,7 +1346,7 @@ Made “./configure --without-bundled-zlib” do what’s intended.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2018-09-02</p></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
@@ -1347,7 +1383,7 @@ Upgraded bundled zlib to version 1.2.11.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2018-03-25</p></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
@@ -1391,7 +1427,7 @@ Made it possible to perform out-of-source builds in dev mode again.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2018-02-11</p></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
@@ -1477,7 +1513,7 @@ Documented caveats related to colored warnings from compilers.
 </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
@@ -1515,7 +1551,7 @@ Improved instructions on how to get cache hits between different working
 </ul></div>\r
 </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
@@ -1541,7 +1577,7 @@ Documented how automatic cache cleanup works.
 </ul></div>\r
 </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
@@ -1624,7 +1660,7 @@ Documented the different cache statistics counters.
 </ul></div>\r
 </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
@@ -1654,7 +1690,7 @@ Fixed undefined behavior warnings in ccache found by <code>-fsanitize=undefined<
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-10-26</p></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
@@ -1671,7 +1707,7 @@ ccache now detects usage of <code>.incbin</code> assembler directives in the sou
 <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
@@ -1696,7 +1732,7 @@ Fixed a regression in ccache 3.3.1: ccache could get confused when using the
 <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
@@ -1878,7 +1914,7 @@ Increased buffer size used when reading file data. This improves performance
 </ul></div>\r
 </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
@@ -1904,7 +1940,7 @@ Fixed build and test for MinGW32 and Windows.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-09-28</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
@@ -1922,7 +1958,7 @@ Fixed a regression in ccache 3.2.8: ccache could get confused when using the
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-09-07</p></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
@@ -1946,7 +1982,7 @@ ccache now understands the undocumented <code>-coverage</code> (only one dash) G
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-07-20</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
@@ -1969,7 +2005,7 @@ ccache now knows how to work around a glitch in the output of GCC 6’s
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-07-12</p></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
@@ -2019,7 +2055,7 @@ Made it harder to misinterpret documentation of boolean environment settings’
 </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
@@ -2079,7 +2115,7 @@ The man page is now built when running “make install” from Git repository
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-10-08</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
@@ -2134,7 +2170,7 @@ Added support for compiler option <code>-gsplit-dwarf</code>.
 </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
@@ -2188,7 +2224,7 @@ Add support for caching code coverage results (compiling for gcov).
 </ul></div>\r
 </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
@@ -2258,7 +2294,7 @@ Fixed build error when compiling ccache with recent Clang versions.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2014-12-10</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
@@ -2490,7 +2526,7 @@ Various other improvements of the test suite.
 </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
@@ -2521,7 +2557,7 @@ Fixed test suite failures when <code>CC</code> is a ccache-wrapped compiler.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-07-12</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
@@ -2539,7 +2575,7 @@ Fixed a bug where (due to ccache rewriting paths) the compiler could choose
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-03-07</p></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
@@ -2621,7 +2657,7 @@ Stale files in the internal temporary directory (<code>&lt;ccache_dir&gt;/tmp</c
 </ul></div>\r
 </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
@@ -2661,7 +2697,7 @@ Fixed problem with logging of current working directory.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2013-01-06</p></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
@@ -2732,7 +2768,7 @@ Clang plugins are now hashed to catch plugin upgrades.
 </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
@@ -2780,7 +2816,7 @@ Fixed <code>static_assert</code> macro definition clash with GCC 4.7.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2012-01-08</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
@@ -2863,7 +2899,7 @@ Rewrite argument to <code>--sysroot</code> if <code>CCACHE_BASEDIR</code> is use
 </ul></div>\r
 </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
@@ -2916,7 +2952,7 @@ Improved order of statistics counters in <code>ccache -s</code> output.
 </ul></div>\r
 </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
@@ -2949,7 +2985,7 @@ Systems that lack (and don’t need to be linked with) libm are now supported.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2011-01-09</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
@@ -2982,7 +3018,7 @@ The file handle in now correctly closed on write error when trying to create
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-28</p></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
@@ -3009,7 +3045,7 @@ Portability fixes for HP-UX 11.00 and other esoteric systems.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-21</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
@@ -3057,7 +3093,7 @@ The test suite now also works on systems that lack a /dev/zero.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-11-07</p></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
@@ -3179,7 +3215,7 @@ Added <code>-install_name</code> as an option known to take an argument. (This i
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_37">Bug fixes</h3>\r
+<h3 id="_bug_fixes_38">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3265,7 +3301,7 @@ New <code>HACKING.txt</code> file with some notes about ccache code conventions.
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2010-07-15</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_38">Bug fixes</h3>\r
+<h3 id="_bug_fixes_39">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3454,7 +3490,7 @@ The following options are no longer hashed in the preprocessor mode:
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_39">Bug fixes</h3>\r
+<h3 id="_bug_fixes_40">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3599,9 +3635,9 @@ Statistics counters are now correctly updated for -E option failures and
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.7.5<br />\r
+Version 3.7.6<br />\r
 Last updated\r
- 2019-10-22 20:50:43 CEST\r
+ 2019-11-17 20:10:03 CET\r
 </div>\r
 </div>\r
 </body>\r
index 9a5ce36..1745ce3 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: ccache
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 10/22/2019
+.\"      Date: 11/17/2019
 .\"    Manual: ccache Manual
-.\"    Source: ccache 3.7.5
+.\"    Source: ccache 3.7.6
 .\"  Language: English
 .\"
-.TH "CCACHE" "1" "10/22/2019" "ccache 3\&.7\&.5" "ccache Manual"
+.TH "CCACHE" "1" "11/17/2019" "ccache 3\&.7\&.6" "ccache Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -701,20 +701,6 @@ Ignore the Clang compiler option
 and its argument when computing the manifest hash\&. This is useful if you use Xcode, which uses an index store path derived from the local project path\&. Note that the index store won\(cqt be updated correctly on cache hits if you enable this option\&.
 .RE
 .PP
-\fBfile_macro\fR
-.RS 4
-ccache normally includes the input file path in the hash in order to be able to produce the correct object file if the source code includes a
-\fB__FILE__\fR
-macro\&. If you know that
-\fB__FILE__\fR
-isn\(cqt used in practise, or don\(cqt care if ccache produces objects where
-\fB__FILE__\fR
-is expanded to the wrong path, you can set
-\fBsloppiness\fR
-to
-\fBfile_macro\fR\&. ccache will then exclude the input file path from the hash\&.
-.RE
-.PP
 \fBfile_stat_matches\fR
 .RS 4
 ccache normally examines a file\(cqs contents to determine whether it matches the cached version\&. With this option set, ccache will consider a file as matching its cached version if the mtimes and ctimes match\&.
@@ -2168,16 +2154,9 @@ to
 .sp -1
 .IP \(bu 2.3
 .\}
-The input file path has changed\&. ccache normally includes the input file path in the hash in order to be able to produce the correct object file if the source code includes a
-\fB__FILE__\fR
-macro\&. If you know that
-\fB__FILE__\fR
-isn\(cqt used in practise, or don\(cqt care if ccache produces objects where
+The input file path has changed\&. ccache includes the input file path in the direct mode hash to be able to take relative include files into account and to produce a correct object file if the source code includes a
 \fB__FILE__\fR
-is expanded to the wrong path, you can set
-\fBsloppiness\fR
-to
-\fBfile_macro\fR\&. ccache will then exclude the input file path from the hash\&.
+macro\&.
 .RE
 .RE
 .sp
index 2ad1ed5..dbfd821 100644 (file)
@@ -104,6 +104,9 @@ char *current_working_dir = NULL;
 // The original argument list.
 static struct args *orig_args;
 
+// Argument list to add to compiler invocation in depend mode.
+static struct args *depend_extra_args;
+
 // The source file.
 static char *input_file;
 
@@ -331,6 +334,18 @@ add_prefix(struct args *args, char *prefix_command)
        args_free(prefix);
 }
 
+// Compiler in depend mode is invoked with the original arguments.
+// Collect extra arguments that should be added.
+static void
+add_extra_arg(const char *arg)
+{
+       if (conf->depend_mode) {
+               if (depend_extra_args == NULL) {
+                       depend_extra_args = args_init(0, NULL);
+               }
+               args_add(depend_extra_args, arg);
+       }
+}
 
 static void failed(void) ATTR_NORETURN;
 
@@ -485,7 +500,7 @@ clean_up_internal_tempdir(void)
        time_t now = time(NULL);
        struct stat st;
        if (x_stat(conf->cache_dir, &st) != 0
-                       || st.st_mtime + k_tempdir_cleanup_interval >= now) {
+           || st.st_mtime + k_tempdir_cleanup_interval >= now) {
                // No cleanup needed.
                return;
        }
@@ -505,7 +520,7 @@ clean_up_internal_tempdir(void)
 
                char *path = format("%s/%s", temp_dir(), entry->d_name);
                if (x_lstat(path, &st) == 0
-                               && st.st_mtime + k_tempdir_cleanup_interval < now) {
+                   && st.st_mtime + k_tempdir_cleanup_interval < now) {
                        tmp_unlink(path);
                }
                free(path);
@@ -1459,6 +1474,9 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
                assert(orig_args);
                struct args *depend_mode_args = args_copy(orig_args);
                args_strip(depend_mode_args, "--ccache-");
+               if (depend_extra_args) {
+                       args_extend(depend_mode_args, depend_extra_args);
+               }
                add_prefix(depend_mode_args, conf->prefix_command);
 
                time_of_compilation = time(NULL);
@@ -2216,12 +2234,19 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode)
                        }
                }
 
-               if (!(conf->sloppiness & SLOPPY_FILE_MACRO)) {
-                       // The source code file or an include file may contain __FILE__, so make
-                       // sure that the hash is unique for the file name.
-                       hash_delimiter(hash, "inputfile");
-                       hash_string(hash, input_file);
-               }
+               // Make sure that the direct mode hash is unique for the input file path.
+               // If this would not be the case:
+               //
+               // * An false cache hit may be produced. Scenario:
+               //   - a/r.h exists.
+               //   - a/x.c has #include "r.h".
+               //   - b/x.c is identical to a/x.c.
+               //   - Compiling a/x.c records a/r.h in the manifest.
+               //   - Compiling b/x.c results in a false cache hit since a/x.c and b/x.c
+               //     share manifests and a/r.h exists.
+               // * The expansion of __FILE__ may be incorrect.
+               hash_delimiter(hash, "inputfile");
+               hash_string(hash, input_file);
 
                hash_delimiter(hash, "sourcecode");
                int result = hash_source_code_file(conf, hash, input_file);
@@ -2649,7 +2674,9 @@ cc_process_args(struct args *args,
                }
 
                // These are always too hard.
-               if (compopt_too_hard(argv[i]) || str_startswith(argv[i], "-fdump-")) {
+               if (compopt_too_hard(argv[i])
+                   || str_startswith(argv[i], "-fdump-")
+                   || str_startswith(argv[i], "-MJ")) {
                        cc_log("Compiler option %s is unsupported", argv[i]);
                        stats_update(STATS_UNSUPPORTED_OPTION);
                        result = false;
@@ -3100,6 +3127,7 @@ cc_process_args(struct args *args,
                        if (color_output_possible()) {
                                // Output is redirected, so color output must be forced.
                                args_add(common_args, "-fdiagnostics-color=always");
+                               add_extra_arg("-fdiagnostics-color=always");
                                cc_log("Automatically forcing colors");
                        } else {
                                args_add(common_args, argv[i]);
@@ -3507,6 +3535,7 @@ cc_process_args(struct args *args,
                if (guessed_compiler == GUESSED_CLANG) {
                        if (!str_eq(actual_language, "assembler")) {
                                args_add(common_args, "-fcolor-diagnostics");
+                               add_extra_arg("-fcolor-diagnostics");
                                cc_log("Automatically enabling colors");
                        }
                } else if (guessed_compiler == GUESSED_GCC) {
@@ -3516,6 +3545,7 @@ cc_process_args(struct args *args,
                        // colors.
                        if (getenv("GCC_COLORS") && getenv("GCC_COLORS")[0] != '\0') {
                                args_add(common_args, "-fdiagnostics-color");
+                               add_extra_arg("-fdiagnostics-color");
                                cc_log("Automatically enabling colors");
                        }
                }
@@ -3818,6 +3848,7 @@ cc_reset(void)
        sanitize_blacklists_len = 0;
        free(included_pch_file); included_pch_file = NULL;
        args_free(orig_args); orig_args = NULL;
+       args_free(depend_extra_args); depend_extra_args = NULL;
        free(input_file); input_file = NULL;
        free(output_obj); output_obj = NULL;
        free(output_dep); output_dep = NULL;
index ac12a14..cabc980 100644 (file)
@@ -87,22 +87,21 @@ extern enum guessed_compiler guessed_compiler;
 
 #define SLOPPY_INCLUDE_FILE_MTIME (1U << 0)
 #define SLOPPY_INCLUDE_FILE_CTIME (1U << 1)
-#define SLOPPY_FILE_MACRO (1U << 2)
-#define SLOPPY_TIME_MACROS (1U << 3)
-#define SLOPPY_PCH_DEFINES (1U << 4)
+#define SLOPPY_TIME_MACROS (1U << 2)
+#define SLOPPY_PCH_DEFINES (1U << 3)
 // Allow us to match files based on their stats (size, mtime, ctime), without
 // looking at their contents.
-#define SLOPPY_FILE_STAT_MATCHES (1U << 5)
+#define SLOPPY_FILE_STAT_MATCHES (1U << 4)
 // Allow us to not include any system headers in the manifest include files,
 // similar to -MM versus -M for dependencies.
-#define SLOPPY_SYSTEM_HEADERS (1U << 6)
+#define SLOPPY_SYSTEM_HEADERS (1U << 5)
 // Allow us to ignore ctimes when comparing file stats, so we can fake mtimes
 // if we want to (it is much harder to fake ctimes, requires changing clock)
-#define SLOPPY_FILE_STAT_MATCHES_CTIME (1U << 7)
+#define SLOPPY_FILE_STAT_MATCHES_CTIME (1U << 6)
 // Allow us to not include the -index-store-path option in the manifest hash.
-#define SLOPPY_CLANG_INDEX_STORE (1U << 8)
+#define SLOPPY_CLANG_INDEX_STORE (1U << 7)
 // Ignore locale settings.
-#define SLOPPY_LOCALE (1U << 9)
+#define SLOPPY_LOCALE (1U << 8)
 
 #define str_eq(s1, s2) (strcmp((s1), (s2)) == 0)
 #define str_startswith(s, prefix) \
index 6b46cbe..9b42fd1 100644 (file)
@@ -65,7 +65,6 @@ static const struct compopt compopts[] = {
        {"-L",              TAKES_ARG},
        {"-M",              TOO_HARD},
        {"-MF",             TAKES_ARG},
-       {"-MJ",             TAKES_ARG | TOO_HARD},
        {"-MM",             TOO_HARD},
        {"-MQ",             TAKES_ARG},
        {"-MT",             TAKES_ARG},
@@ -175,16 +174,27 @@ compopt_short(bool (*fn)(const char *), const char *option)
 }
 
 // Used by unittest/test_compopt.c.
-bool compopt_verify_sortedness(void);
+bool compopt_verify_sortedness_and_flags(void);
 
 // For test purposes.
 bool
-compopt_verify_sortedness(void)
+compopt_verify_sortedness_and_flags(void)
 {
-       for (size_t i = 1; i < ARRAY_SIZE(compopts); i++) {
+       for (size_t i = 0; i < ARRAY_SIZE(compopts); i++) {
+               if (compopts[i].type & TOO_HARD && compopts[i].type & TAKES_CONCAT_ARG) {
+                       fprintf(stderr,
+                               "type (TOO_HARD | TAKES_CONCAT_ARG) not allowed, used by %s\n",
+                               compopts[i].name);
+                       return false;
+               }
+
+               if (i == 0) {
+                       continue;
+               }
+
                if (strcmp(compopts[i-1].name, compopts[i].name) >= 0) {
                        fprintf(stderr,
-                               "compopt_verify_sortedness: %s >= %s\n",
+                               "compopt_verify_sortedness_and_flags: %s >= %s\n",
                                compopts[i-1].name,
                                compopts[i].name);
                        return false;
index 1c24464..15064e7 100644 (file)
@@ -20,7 +20,7 @@
 static char *
 format_string(const void *value)
 {
-       const char * const *str = (const char * const*)value;
+       const char *const *str = (const char *const *)value;
        return x_strdup(*str);
 }
 
@@ -110,6 +110,8 @@ confitem_format_size(const void *value)
 bool
 confitem_parse_sloppiness(const char *str, void *result, char **errmsg)
 {
+       (void)errmsg;
+
        unsigned *value = (unsigned *)result;
        if (!str) {
                return *value;
@@ -120,9 +122,7 @@ confitem_parse_sloppiness(const char *str, void *result, char **errmsg)
        char *word;
        char *saveptr = NULL;
        while ((word = strtok_r(q, ", ", &saveptr))) {
-               if (str_eq(word, "file_macro")) {
-                       *value |= SLOPPY_FILE_MACRO;
-               } else if (str_eq(word, "file_stat_matches")) {
+               if (str_eq(word, "file_stat_matches")) {
                        *value |= SLOPPY_FILE_STAT_MATCHES;
                } else if (str_eq(word, "file_stat_matches_ctime")) {
                        *value |= SLOPPY_FILE_STAT_MATCHES_CTIME;
@@ -141,11 +141,8 @@ confitem_parse_sloppiness(const char *str, void *result, char **errmsg)
                        *value |= SLOPPY_CLANG_INDEX_STORE;
                } else if (str_eq(word, "locale")) {
                        *value |= SLOPPY_LOCALE;
-               } else {
-                       *errmsg = format("unknown sloppiness: \"%s\"", word);
-                       free(p);
-                       return false;
                }
+               // else: ignore unknown value for forward compatibility
                q = NULL;
        }
        free(p);
@@ -157,9 +154,6 @@ confitem_format_sloppiness(const void *value)
 {
        const unsigned *sloppiness = (const unsigned *)value;
        char *s = x_strdup("");
-       if (*sloppiness & SLOPPY_FILE_MACRO) {
-               reformat(&s, "%sfile_macro, ", s);
-       }
        if (*sloppiness & SLOPPY_INCLUDE_FILE_MTIME) {
                reformat(&s, "%sinclude_file_mtime, ", s);
        }
@@ -268,7 +262,7 @@ confitem_format_unsigned(const void *value)
 bool
 confitem_verify_absolute_path(const void *value, char **errmsg)
 {
-       const char * const *path = (const char * const *)value;
+       const char *const *path = (const char *const *)value;
        assert(*path);
        if (str_eq(*path, "")) {
                // The empty string means "disable" in this case.
index ff3123a..214f3be 100644 (file)
@@ -340,12 +340,20 @@ stats_write(const char *path, struct counters *counters)
        FILE *f = create_tmp_file(&tmp_file, "wb");
        for (size_t i = 0; i < counters->size; i++) {
                if (fprintf(f, "%u\n", counters->data[i]) < 0) {
-                       fatal("Failed to write to %s", tmp_file);
+                       fclose(f);
+                       goto error;
                }
        }
-       fclose(f);
+       if (fclose(f) == EOF) {
+               goto error;
+       }
        x_rename(tmp_file, path);
        free(tmp_file);
+       return;
+
+error:
+       tmp_unlink(tmp_file);
+       fatal("Failed to write to %s", tmp_file);
 }
 
 static void
index 2dbe665..262aa6a 100644 (file)
@@ -1227,8 +1227,7 @@ localtime_r(const time_t *timep, struct tm *result)
        if (tm) {
                *result = *tm;
                return result;
-       }
-       else {
+       } else {
                memset(result, 0, sizeof(*result));
                return NULL;
        }
index 0537aa7..877563a 100644 (file)
@@ -1 +1 @@
-extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.5";
+extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.6";
index 1373044..fca072f 100644 (file)
@@ -554,12 +554,13 @@ EOF
     expect_stat 'cache miss' 1
 
     # -------------------------------------------------------------------------
-    TEST "__FILE__ in source file disables direct mode"
+    TEST "The source file path is included in the hash"
 
     cat <<EOF >file.c
 #define file __FILE__
 int test;
 EOF
+    cp file.c file2.c
 
     $CCACHE_COMPILE -c file.c
     expect_stat 'cache hit (direct)' 0
@@ -571,47 +572,34 @@ EOF
     expect_stat 'cache hit (preprocessed)' 0
     expect_stat 'cache miss' 1
 
-    $CCACHE_COMPILE -c `pwd`/file.c
+    $CCACHE_COMPILE -c file2.c
     expect_stat 'cache hit (direct)' 1
     expect_stat 'cache hit (preprocessed)' 0
     expect_stat 'cache miss' 2
 
-    # -------------------------------------------------------------------------
-    TEST "__FILE__ in include file disables direct mode"
-
-    cat <<EOF >file.h
-#define file __FILE__
-int test;
-EOF
-    backdate file.h
-    cat <<EOF >file_h.c
-#include "file.h"
-EOF
-
-    $CCACHE_COMPILE -c file_h.c
-    expect_stat 'cache hit (direct)' 0
+    $CCACHE_COMPILE -c file2.c
+    expect_stat 'cache hit (direct)' 2
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
+    expect_stat 'cache miss' 2
 
-    $CCACHE_COMPILE -c file_h.c
-    expect_stat 'cache hit (direct)' 1
+    $CCACHE_COMPILE -c $(pwd)/file.c
+    expect_stat 'cache hit (direct)' 2
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
-
-    mv file_h.c file2_h.c
+    expect_stat 'cache miss' 3
 
-    $CCACHE_COMPILE -c `pwd`/file2_h.c
-    expect_stat 'cache hit (direct)' 1
+    $CCACHE_COMPILE -c $(pwd)/file.c
+    expect_stat 'cache hit (direct)' 3
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 2
+    expect_stat 'cache miss' 3
 
     # -------------------------------------------------------------------------
-    TEST "__FILE__ in source file ignored if sloppy"
+    TEST "The source file path is included even if sloppiness = file_macro"
 
     cat <<EOF >file.c
 #define file __FILE__
 int test;
 EOF
+    cp file.c file2.c
 
     CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file.c
     expect_stat 'cache hit (direct)' 0
@@ -623,39 +611,66 @@ EOF
     expect_stat 'cache hit (preprocessed)' 0
     expect_stat 'cache miss' 1
 
-    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c `pwd`/file.c
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file2.c
+    expect_stat 'cache hit (direct)' 1
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 2
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file2.c
     expect_stat 'cache hit (direct)' 2
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
+    expect_stat 'cache miss' 2
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c $(pwd)/file.c
+    expect_stat 'cache hit (direct)' 2
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 3
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c $(pwd)/file.c
+    expect_stat 'cache hit (direct)' 3
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 3
 
     # -------------------------------------------------------------------------
-    TEST "__FILE__ in include file ignored if sloppy"
+    TEST "Relative includes for identical source code in different directories"
 
-    cat <<EOF >file.h
-#define file __FILE__
-int test;
+    mkdir a
+    cat <<EOF >a/file.c
+#include "file.h"
+EOF
+    cat <<EOF >a/file.h
+int x = 1;
 EOF
-    backdate file.h
-    cat <<EOF >file_h.c
+    backdate a/file.h
+
+    mkdir b
+    cat <<EOF >b/file.c
 #include "file.h"
 EOF
+    cat <<EOF >b/file.h
+int x = 2;
+EOF
+    backdate b/file.h
 
-    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file_h.c
+    $CCACHE_COMPILE -c a/file.c
     expect_stat 'cache hit (direct)' 0
     expect_stat 'cache hit (preprocessed)' 0
     expect_stat 'cache miss' 1
 
-    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file_h.c
+    $CCACHE_COMPILE -c a/file.c
     expect_stat 'cache hit (direct)' 1
     expect_stat 'cache hit (preprocessed)' 0
     expect_stat 'cache miss' 1
 
-    mv file_h.c file2_h.c
+    $CCACHE_COMPILE -c b/file.c
+    expect_stat 'cache hit (direct)' 1
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 2
 
-    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c `pwd`/file2_h.c
+    $CCACHE_COMPILE -c b/file.c
     expect_stat 'cache hit (direct)' 2
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
+    expect_stat 'cache miss' 2
 
     # -------------------------------------------------------------------------
     TEST "__TIME__ in source file disables direct mode"
index c9ae789..eed3562 100644 (file)
@@ -24,8 +24,8 @@ TEST_SUITE(compopt)
 
 TEST(option_table_should_be_sorted)
 {
-       bool compopt_verify_sortedness(void);
-       CHECK(compopt_verify_sortedness());
+       bool compopt_verify_sortedness_and_flags(void);
+       CHECK(compopt_verify_sortedness_and_flags());
 }
 
 TEST(dash_I_affects_cpp)
index 886bd28..bc458fc 100644 (file)
@@ -132,7 +132,7 @@ TEST(conf_read_valid_config)
                "read_only_direct = true\n"
                "recache = true\n"
                "run_second_cpp = false\n"
-               "sloppiness =     file_macro   ,time_macros,  include_file_mtime,include_file_ctime,file_stat_matches,file_stat_matches_ctime,pch_defines ,  no_system_headers,system_headers,clang_index_store\n"
+               "sloppiness =     time_macros   ,include_file_mtime  include_file_ctime,file_stat_matches,file_stat_matches_ctime,pch_defines ,  no_system_headers,system_headers,clang_index_store\n"
                "stats = false\n"
                "temporary_dir = ${USER}_foo\n"
                "umask = 777\n"
@@ -175,7 +175,6 @@ TEST(conf_read_valid_config)
        CHECK_INT_EQ(
                SLOPPY_INCLUDE_FILE_MTIME
                |SLOPPY_INCLUDE_FILE_CTIME
-               |SLOPPY_FILE_MACRO
                |SLOPPY_TIME_MACROS
                |SLOPPY_FILE_STAT_MATCHES
                |SLOPPY_FILE_STAT_MATCHES_CTIME
@@ -267,15 +266,13 @@ TEST(conf_read_invalid_size)
        conf_free(conf);
 }
 
-TEST(conf_read_invalid_sloppiness)
+TEST(conf_read_unknown_sloppiness)
 {
        struct conf *conf = conf_create();
        char *errmsg;
-       create_file("ccache.conf", "sloppiness = file_macro, foo");
-       CHECK(!conf_read(conf, "ccache.conf", &errmsg));
-       CHECK_INT_EQ(errno, 0);
-       CHECK_STR_EQ_FREE2("ccache.conf:1: unknown sloppiness: \"foo\"",
-                          errmsg);
+       create_file("ccache.conf", "sloppiness = time_macros, foo");
+       CHECK(conf_read(conf, "ccache.conf", &errmsg));
+       CHECK_INT_EQ(conf->sloppiness, SLOPPY_TIME_MACROS);
        conf_free(conf);
 }
 
@@ -369,7 +366,8 @@ TEST(conf_set_new_value)
        char *data;
 
        create_file("ccache.conf", "path = vanilla\n");
-       CHECKM(conf_set_value_in_file("ccache.conf", "compiler", "chocolate", &errmsg),
+       CHECKM(conf_set_value_in_file("ccache.conf", "compiler", "chocolate",
+                                     &errmsg),
               errmsg);
        data = read_text_file("ccache.conf", 0);
        CHECK(data);
@@ -404,6 +402,19 @@ TEST(conf_set_unknown_option)
        CHECK_STR_EQ_FREE2("path = chocolate\nstats = chocolate\n", data);
 }
 
+TEST(conf_set_unknown_sloppiness)
+{
+       char *errmsg;
+       char *data;
+
+       create_file("ccache.conf", "path = vanilla\n");
+       CHECK(conf_set_value_in_file("ccache.conf", "sloppiness", "foo", &errmsg));
+
+       data = read_text_file("ccache.conf", 0);
+       CHECK(data);
+       CHECK_STR_EQ_FREE2("path = vanilla\nsloppiness = foo\n", data);
+}
+
 TEST(conf_print_existing_value)
 {
        struct conf *conf = conf_create();
@@ -481,7 +492,7 @@ TEST(conf_print_items)
                true,
                true,
                .run_second_cpp = false,
-               SLOPPY_FILE_MACRO|SLOPPY_INCLUDE_FILE_MTIME|
+               SLOPPY_INCLUDE_FILE_MTIME|
                SLOPPY_INCLUDE_FILE_CTIME|SLOPPY_TIME_MACROS|
                SLOPPY_FILE_STAT_MATCHES|SLOPPY_FILE_STAT_MATCHES_CTIME|
                SLOPPY_PCH_DEFINES|SLOPPY_SYSTEM_HEADERS|SLOPPY_CLANG_INDEX_STORE,
@@ -534,7 +545,7 @@ TEST(conf_print_items)
        CHECK_STR_EQ("read_only_direct = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("recache = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("run_second_cpp = false", received_conf_items[n++].descr);
-       CHECK_STR_EQ("sloppiness = file_macro, include_file_mtime,"
+       CHECK_STR_EQ("sloppiness = include_file_mtime,"
                     " include_file_ctime, time_macros, pch_defines,"
                     " file_stat_matches, file_stat_matches_ctime, system_headers,"
                     " clang_index_store",