Imported Upstream version 3.7.7 upstream/3.7.7
authorJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:28:53 +0000 (16:28 +0900)
committerJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:28:53 +0000 (16:28 +0900)
31 files changed:
LICENSE.adoc
LICENSE.html
Makefile.in
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/conf.c
src/conf.h
src/confitems.gperf
src/confitems_lookup.c
src/envtoconfitems.gperf
src/envtoconfitems_lookup.c
src/manifest.c
src/manifest.h
src/stats.c
src/unify.c [deleted file]
src/unify.h [deleted file]
src/version.c
test/suites/base.bash
test/suites/direct.bash
test/suites/readonly.bash
test/suites/readonly_direct.bash
unittest/test_argument_processing.c
unittest/test_conf.c

index e10ae208fefaf39b4d2eb6f7d87beac96ef30ba5..2cc656e0c68a466dc2585da5ea3d996cfc8a5858 100644 (file)
@@ -38,7 +38,7 @@ The copyright for ccache as a whole is as follows:
 
 -------------------------------------------------------------------------------
   Copyright (C) 2002-2007 Andrew Tridgell
-  Copyright (C) 2009-2019 Joel Rosdahl
+  Copyright (C) 2009-2020 Joel Rosdahl
 -------------------------------------------------------------------------------
 
 
index 0825ae2ffc66bdcd8eb170643dd03fc242fdf5a6..66556c42fe41b1468a7d26f872fc49720ad835cc 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.6</span>\r
+<span id="revnumber">version 3.7.7</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>
@@ -777,7 +777,7 @@ their portions of the work.</p></div>
 <div class="listingblock">\r
 <div class="content">\r
 <pre><code>  Copyright (C) 2002-2007 Andrew Tridgell\r
-  Copyright (C) 2009-2019 Joel Rosdahl</code></pre>\r
+  Copyright (C) 2009-2020 Joel Rosdahl</code></pre>\r
 </div></div>\r
 </div>\r
 </div>\r
@@ -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.6<br />\r
+Version 3.7.7<br />\r
 Last updated\r
- 2019-11-17 20:10:03 CET\r
+ 2020-01-05 21:09:39 CET\r
 </div>\r
 </div>\r
 </body>\r
index b5a3ea5dd60dc4e2dd12dc0407c4d146a218cfec..d10f9459b37271f79626907e8a119dc92ff42df2 100644 (file)
@@ -46,7 +46,6 @@ non_3pp_sources = \
     src/manifest.c \
     src/mdfour.c \
     src/stats.c \
-    src/unify.c \
     src/util.c
 generated_sources = \
     src/confitems_lookup.c \
index 7b0839fc2581b153de0e6b31a1e3dbdbb1961ee3..8890b33346c7e1eb7cea51ffc56f5b80fad554d8 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -53,7 +53,6 @@ headers = \
     src/minitrace.h \
     src/murmurhashneutral2.h \
     src/system.h \
-    src/unify.h \
     unittest/framework.h \
     unittest/util.h
 generated_headers = \
index d1ea696623223cbd9b185cd4a3f9fbc0841c1bd4..20c9bb427a883a166e1e2aa17540d32486d6a667 100644 (file)
@@ -68,6 +68,7 @@ ccache is a collective work with contributions from many people, including:
 * Mike Frysinger
 * Mike Gulick
 * Mikhail Kolomeytsev
+* Mizuha Himuraki
 * Mostyn Bramley-Moore
 * Neil Mushell
 * Nick Schultz
index 85575ad1ab431e08981d907d93ea4ac900c7833b..512639351f4ebdd542dd649eca02fd228f119617 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.6</span>\r
+<span id="revnumber">version 3.7.7</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>
@@ -1060,6 +1060,11 @@ Mikhail Kolomeytsev
 </li>\r
 <li>\r
 <p>\r
+Mizuha Himuraki\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
 Mostyn Bramley-Moore\r
 </p>\r
 </li>\r
@@ -1256,9 +1261,9 @@ Yvan Janssens
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.7.6<br />\r
+Version 3.7.7<br />\r
 Last updated\r
- 2019-11-17 20:10:03 CET\r
+ 2020-01-05 21:09:39 CET\r
 </div>\r
 </div>\r
 </body>\r
index 0964152c2cc3622ecd1e2e6b87ab927dd834448e..409d56084b2dba655940e41b19b62bfdce5697d0 100644 (file)
@@ -508,9 +508,13 @@ might be incorrect.
 *read_only* (*CCACHE_READONLY* or *CCACHE_NOREADONLY*, see <<_boolean_values,Boolean values>> above)::
 
     If true, ccache will attempt to use existing cached object files, but it
-    will not to try to add anything new to the cache. If you are using this
-    because your ccache directory is read-only, then you need to set
-    *temporary_dir* as otherwise ccache will fail to create temporary files.
+    will not add new results to the cache. Statistics counters will still be
+    updated, though, unless the *stats* option is set to *false*.
++
+If you are using this because your ccache directory is read-only, you need to
+set *temporary_dir* since ccache will fail to create temporary files otherwise.
+You may also want to set *stats = false* to make ccache not even try to update
+stats files.
 
 *read_only_direct* (*CCACHE_READONLY_DIRECT* or *CCACHE_NOREADONLY_DIRECT*, see <<_boolean_values,Boolean values>> above)::
 
@@ -610,18 +614,6 @@ NOTE: In previous versions of ccache, *CCACHE_TEMPDIR* had to be on the same
     with other users. Note that this also affects the file permissions set on
     the object files created from your compilations.
 
-*unify* (*CCACHE_UNIFY* or *CCACHE_NOUNIFY*, see <<_boolean_values,Boolean values>> above)::
-
-    If true, ccache will use a C/C++ unifier when hashing the preprocessor
-    output if the *-g* option is not used. The unifier is slower than a normal
-    hash, so setting this environment variable loses a little bit of speed, but
-    it means that ccache can take advantage of not recompiling when the changes
-    to the source code consist of reformatting only. Note that enabling the
-    unifier changes the hash, so cached compilations produced when the unifier
-    is enabled cannot be reused when the unifier is disabled, and vice versa.
-    Enabling the unifier may result in incorrect line number information in
-    compiler warning messages and expansions of the `__LINE__` macro.
-
 
 Cache size management
 ---------------------
@@ -935,7 +927,6 @@ The depend mode will be disabled if any of the following holds:
 
 * the configuration setting *depend_mode* is false
 * the configuration setting *run_second_cpp* is false
-* the configuration setting *unify* is true
 * the compiler is not generating dependencies using *-MD* or *-MMD*
 
 
index d8da17de96b180c2589925ec5ea8e60615bd5974..805860e1c3a01cb050f0a620fb0b8b8895ad8807 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.6</span>\r
+<span id="revnumber">version 3.7.7</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>
@@ -1504,10 +1504,13 @@ might be incorrect.</p></div>
 <dd>\r
 <p>\r
     If true, ccache will attempt to use existing cached object files, but it\r
-    will not to try to add anything new to the cache. If you are using this\r
-    because your ccache directory is read-only, then you need to set\r
-    <strong>temporary_dir</strong> as otherwise ccache will fail to create temporary files.\r
+    will not add new results to the cache. Statistics counters will still be\r
+    updated, though, unless the <strong>stats</strong> option is set to <strong>false</strong>.\r
 </p>\r
+<div class="paragraph"><p>If you are using this because your ccache directory is read-only, you need to\r
+set <strong>temporary_dir</strong> since ccache will fail to create temporary files otherwise.\r
+You may also want to set <strong>stats = false</strong> to make ccache not even try to update\r
+stats files.</p></div>\r
 </dd>\r
 <dt class="hdlist1">\r
 <strong>read_only_direct</strong> (<strong>CCACHE_READONLY_DIRECT</strong> or <strong>CCACHE_NOREADONLY_DIRECT</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
@@ -1694,22 +1697,6 @@ information.</p></div>
     the object files created from your compilations.\r
 </p>\r
 </dd>\r
-<dt class="hdlist1">\r
-<strong>unify</strong> (<strong>CCACHE_UNIFY</strong> or <strong>CCACHE_NOUNIFY</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
-</dt>\r
-<dd>\r
-<p>\r
-    If true, ccache will use a C/C++ unifier when hashing the preprocessor\r
-    output if the <strong>-g</strong> option is not used. The unifier is slower than a normal\r
-    hash, so setting this environment variable loses a little bit of speed, but\r
-    it means that ccache can take advantage of not recompiling when the changes\r
-    to the source code consist of reformatting only. Note that enabling the\r
-    unifier changes the hash, so cached compilations produced when the unifier\r
-    is enabled cannot be reused when the unifier is disabled, and vice versa.\r
-    Enabling the unifier may result in incorrect line number information in\r
-    compiler warning messages and expansions of the <code>__LINE__</code> macro.\r
-</p>\r
-</dd>\r
 </dl></div>\r
 </div>\r
 </div>\r
@@ -2176,11 +2163,6 @@ the configuration setting <strong>run_second_cpp</strong> is false
 </li>\r
 <li>\r
 <p>\r
-the configuration setting <strong>unify</strong> is true\r
-</p>\r
-</li>\r
-<li>\r
-<p>\r
 the compiler is not generating dependencies using <strong>-MD</strong> or <strong>-MMD</strong>\r
 </p>\r
 </li>\r
@@ -2731,9 +2713,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.6<br />\r
+Version 3.7.7<br />\r
 Last updated\r
- 2019-11-17 20:10:03 CET\r
+ 2020-01-05 21:09:39 CET\r
 </div>\r
 </div>\r
 </body>\r
index 7d8c7be732c3e8e261cb4fd09db15dff48fd387c..5b8f9f1c0361fb87c0ff9be18f4b61787b13cf5a 100644 (file)
@@ -1,6 +1,36 @@
 ccache news
 ===========
 
+ccache 3.7.7
+------------
+Release date: 2020-01-05
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed a bug related to object file location in the dependency file (if using
+  `-MD` or `-MMD` but not `-MF` and the build directory is not the same as the
+  source directory then the object file location in the `.d` file would become
+  incorrect). This fixes regression in ccache 3.7.5 introduced by the bug fix
+  related to EDG-based compilers. Note that this removes support for EDG-based
+  compilers again. (A better fix for this is planned for ccache 4.0.)
+
+- Removed the unify mode since it has bugs and shortcomings that are non-trivial
+  or impossible to fix: it doesn’t work with the direct mode, it doesn’t handle
+  C++ raw strings correctly, it can give false cache hits for `.incbin`
+  directives, it’s turned off when using `-g` and it can make line numbers in
+  warning messages and `__LINE__` macros incorrect.
+
+- mtime and ctime values are now stored in the manifest files only when
+  sloppy_file_stat is set. This avoids adding superfluous manifest file entries
+  on direct mode cache misses.
+
+- A “Result:” line is now always printed to the log.
+
+- The “cache miss” statistics counter will now be updated for read-only cache
+  misses, making it consistent with the cache hit case.
+
+
 ccache 3.7.6
 ------------
 Release date: 2019-11-17
index db4f0a0088c8e2bc309c1d3d741e7e35af3f4e63..e41e51fa625353ac6c39cec0755bd592ccddb89a 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.6</span>\r
+<span id="revnumber">version 3.7.7</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,11 +743,59 @@ asciidoc.install(2);
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_ccache_3_7_7">ccache 3.7.7</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2020-01-05</p></div>\r
+<div class="sect2">\r
+<h3 id="_bug_fixes">Bug fixes</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+Fixed a bug related to object file location in the dependency file (if using\r
+  <code>-MD</code> or <code>-MMD</code> but not <code>-MF</code> and the build directory is not the same as the\r
+  source directory then the object file location in the <code>.d</code> file would become\r
+  incorrect). This fixes regression in ccache 3.7.5 introduced by the bug fix\r
+  related to EDG-based compilers. Note that this removes support for EDG-based\r
+  compilers again. (A better fix for this is planned for ccache 4.0.)\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Removed the unify mode since it has bugs and shortcomings that are non-trivial\r
+  or impossible to fix: it doesn’t work with the direct mode, it doesn’t handle\r
+  C++ raw strings correctly, it can give false cache hits for <code>.incbin</code>\r
+  directives, it’s turned off when using <code>-g</code> and it can make line numbers in\r
+  warning messages and <code>__LINE__</code> macros incorrect.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+mtime and ctime values are now stored in the manifest files only when\r
+  sloppy_file_stat is set. This avoids adding superfluous manifest file entries\r
+  on direct mode cache misses.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+A “Result:” line is now always printed to the log.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+The “cache miss” statistics counter will now be updated for read-only cache\r
+  misses, making it consistent with the cache hit case.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\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
+<h3 id="_bug_fixes_2">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -794,7 +842,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_2">Bug fixes</h3>\r
+<h3 id="_bug_fixes_3">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -864,7 +912,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_3">Bug fixes</h3>\r
+<h3 id="_bug_fixes_4">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -889,7 +937,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_4">Bug fixes</h3>\r
+<h3 id="_bug_fixes_5">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1346,7 +1394,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_5">Bug fixes</h3>\r
+<h3 id="_bug_fixes_6">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1383,7 +1431,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_6">Bug fixes</h3>\r
+<h3 id="_bug_fixes_7">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1427,7 +1475,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_7">Bug fixes</h3>\r
+<h3 id="_bug_fixes_8">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1513,7 +1561,7 @@ Documented caveats related to colored warnings from compilers.
 </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
@@ -1551,7 +1599,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_9">Bug fixes</h3>\r
+<h3 id="_bug_fixes_10">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1577,7 +1625,7 @@ Documented how automatic cache cleanup works.
 </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
@@ -1660,7 +1708,7 @@ Documented the different cache statistics counters.
 </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
@@ -1690,7 +1738,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_12">Bug fixes</h3>\r
+<h3 id="_bug_fixes_13">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1707,7 +1755,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_13">Bug fixes</h3>\r
+<h3 id="_bug_fixes_14">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1732,7 +1780,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_14">Bug fixes</h3>\r
+<h3 id="_bug_fixes_15">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1914,7 +1962,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_15">Bug fixes</h3>\r
+<h3 id="_bug_fixes_16">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1940,7 +1988,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_16">Bug fixes</h3>\r
+<h3 id="_bug_fixes_17">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1958,7 +2006,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_17">Bug fixes</h3>\r
+<h3 id="_bug_fixes_18">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1982,7 +2030,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_18">Bug fixes</h3>\r
+<h3 id="_bug_fixes_19">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2005,7 +2053,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_19">Bug fixes</h3>\r
+<h3 id="_bug_fixes_20">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2055,7 +2103,7 @@ Made it harder to misinterpret documentation of boolean environment settings’
 </ul></div>\r
 </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
@@ -2115,7 +2163,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_21">Bug fixes</h3>\r
+<h3 id="_bug_fixes_22">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2170,7 +2218,7 @@ Added support for compiler option <code>-gsplit-dwarf</code>.
 </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
@@ -2224,7 +2272,7 @@ Add support for caching code coverage results (compiling for gcov).
 </ul></div>\r
 </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
@@ -2294,7 +2342,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_24">Bug fixes</h3>\r
+<h3 id="_bug_fixes_25">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2526,7 +2574,7 @@ Various other improvements of the test suite.
 </ul></div>\r
 </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
@@ -2557,7 +2605,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_26">Bug fixes</h3>\r
+<h3 id="_bug_fixes_27">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2575,7 +2623,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_27">Bug fixes</h3>\r
+<h3 id="_bug_fixes_28">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2657,7 +2705,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_28">Bug fixes</h3>\r
+<h3 id="_bug_fixes_29">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2697,7 +2745,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_29">Bug fixes</h3>\r
+<h3 id="_bug_fixes_30">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2768,7 +2816,7 @@ Clang plugins are now hashed to catch plugin upgrades.
 </ul></div>\r
 </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
@@ -2816,7 +2864,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_31">Bug fixes</h3>\r
+<h3 id="_bug_fixes_32">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2899,7 +2947,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_32">Bug fixes</h3>\r
+<h3 id="_bug_fixes_33">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2952,7 +3000,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_33">Bug fixes</h3>\r
+<h3 id="_bug_fixes_34">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2985,7 +3033,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_34">Bug fixes</h3>\r
+<h3 id="_bug_fixes_35">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3018,7 +3066,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_35">Bug fixes</h3>\r
+<h3 id="_bug_fixes_36">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3045,7 +3093,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_36">Bug fixes</h3>\r
+<h3 id="_bug_fixes_37">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3093,7 +3141,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_37">Bug fixes</h3>\r
+<h3 id="_bug_fixes_38">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3215,7 +3263,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_38">Bug fixes</h3>\r
+<h3 id="_bug_fixes_39">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3301,7 +3349,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_39">Bug fixes</h3>\r
+<h3 id="_bug_fixes_40">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3490,7 +3538,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_40">Bug fixes</h3>\r
+<h3 id="_bug_fixes_41">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -3635,9 +3683,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.6<br />\r
+Version 3.7.7<br />\r
 Last updated\r
- 2019-11-17 20:10:03 CET\r
+ 2020-01-05 21:09:39 CET\r
 </div>\r
 </div>\r
 </body>\r
index 1745ce3ce14cb37724d94895eda1422c60294e3a..be80e0d6c5e517165b39f72e502a7b33b759f6ff 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: 11/17/2019
+.\"      Date: 01/05/2020
 .\"    Manual: ccache Manual
-.\"    Source: ccache 3.7.6
+.\"    Source: ccache 3.7.7
 .\"  Language: English
 .\"
-.TH "CCACHE" "1" "11/17/2019" "ccache 3\&.7\&.6" "ccache Manual"
+.TH "CCACHE" "1" "01/05/2020" "ccache 3\&.7\&.7" "ccache Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -649,9 +649,16 @@ This option adds a list of prefixes (separated by space) to the command line tha
 .PP
 \fBread_only\fR (\fBCCACHE_READONLY\fR or \fBCCACHE_NOREADONLY\fR, see Boolean values above)
 .RS 4
-If true, ccache will attempt to use existing cached object files, but it will not to try to add anything new to the cache\&. If you are using this because your ccache directory is read\-only, then you need to set
+If true, ccache will attempt to use existing cached object files, but it will not add new results to the cache\&. Statistics counters will still be updated, though, unless the
+\fBstats\fR
+option is set to
+\fBfalse\fR\&.
+.sp
+If you are using this because your ccache directory is read\-only, you need to set
 \fBtemporary_dir\fR
-as otherwise ccache will fail to create temporary files\&.
+since ccache will fail to create temporary files otherwise\&. You may also want to set
+\fBstats = false\fR
+to make ccache not even try to update stats files\&.
 .RE
 .PP
 \fBread_only_direct\fR (\fBCCACHE_READONLY_DIRECT\fR or \fBCCACHE_NOREADONLY_DIRECT\fR, see Boolean values above)
@@ -795,15 +802,6 @@ path, but this requirement has been relaxed\&.)
 .RS 4
 This setting specifies the umask for ccache and all child processes (such as the compiler)\&. This is mostly useful when you wish to share your cache with other users\&. Note that this also affects the file permissions set on the object files created from your compilations\&.
 .RE
-.PP
-\fBunify\fR (\fBCCACHE_UNIFY\fR or \fBCCACHE_NOUNIFY\fR, see Boolean values above)
-.RS 4
-If true, ccache will use a C/C++ unifier when hashing the preprocessor output if the
-\fB\-g\fR
-option is not used\&. The unifier is slower than a normal hash, so setting this environment variable loses a little bit of speed, but it means that ccache can take advantage of not recompiling when the changes to the source code consist of reformatting only\&. Note that enabling the unifier changes the hash, so cached compilations produced when the unifier is enabled cannot be reused when the unifier is disabled, and vice versa\&. Enabling the unifier may result in incorrect line number information in compiler warning messages and expansions of the
-\fB__LINE__\fR
-macro\&.
-.RE
 .SH "CACHE SIZE MANAGEMENT"
 .sp
 By default, ccache has a 5 GB limit on the total size of files in the cache and no limit on the number of files\&. You can set different limits using the \fB\-M\fR/\fB\-\-max\-size\fR and \fB\-F\fR/\fB\-\-max\-files\fR options\&. Use \fBccache \-s/\-\-show\-stats\fR to see the cache size and the currently configured limits (in addition to other various statistics)\&.
@@ -1502,19 +1500,6 @@ is false
 .sp -1
 .IP \(bu 2.3
 .\}
-the configuration setting
-\fBunify\fR
-is true
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
 the compiler is not generating dependencies using
 \fB\-MD\fR
 or
index dbfd82134454b88a7e64e83e18d0c0f89975e681..36b41bb232bd97857ee115fd8040a5a83a78f864 100644 (file)
@@ -1,7 +1,7 @@
 // ccache -- a fast C/C++ compiler cache
 //
 // Copyright (C) 2002-2007 Andrew Tridgell
-// Copyright (C) 2009-2019 Joel Rosdahl
+// Copyright (C) 2009-2020 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
@@ -30,7 +30,6 @@
 #include "hashutil.h"
 #include "language.h"
 #include "manifest.h"
-#include "unify.h"
 
 #define STRINGIFY(x) #x
 #define TO_STRING(x) STRINGIFY(x)
@@ -47,7 +46,7 @@ static const char VERSION_TEXT[] =
        MYNAME " version %s\n"
        "\n"
        "Copyright (C) 2002-2007 Andrew Tridgell\n"
-       "Copyright (C) 2009-2019 Joel Rosdahl\n"
+       "Copyright (C) 2009-2020 Joel Rosdahl\n"
        "\n"
        "This program is free software; you can redistribute it and/or modify it under\n"
        "the terms of the GNU General Public License as published by the Free Software\n"
@@ -596,6 +595,7 @@ get_current_working_dir(void)
                if (!current_working_dir) {
                        cc_log("Unable to determine current working directory: %s",
                               strerror(errno));
+                       stats_update(STATS_ERROR);
                        failed();
                }
        }
@@ -1386,8 +1386,15 @@ update_manifest_file(void)
                old_size = file_size(&st);
        }
 
+       // See comment in get_file_hash_index for why saving of timestamps is forced
+       // for precompiled headers.
+       bool save_timestamp =
+               (conf->sloppiness & SLOPPY_FILE_STAT_MATCHES)
+               || output_is_precompiled_header;
+
        MTR_BEGIN("manifest", "manifest_put");
-       if (manifest_put(manifest_path, cached_obj_hash, included_files)) {
+       if (manifest_put(manifest_path, cached_obj_hash, included_files,
+                        save_timestamp)) {
                cc_log("Added object file hash to %s", manifest_path);
                if (x_stat(manifest_path, &st) == 0) {
                        stats_update_size(
@@ -1513,18 +1520,21 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
                if (x_rename(tmp_stderr, tmp_stderr2)) {
                        cc_log("Failed to rename %s to %s: %s", tmp_stderr, tmp_stderr2,
                               strerror(errno));
+                       stats_update(STATS_ERROR);
                        failed();
                }
 
                int fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY);
                if (fd_cpp_stderr == -1) {
                        cc_log("Failed opening %s: %s", cpp_stderr, strerror(errno));
+                       stats_update(STATS_ERROR);
                        failed();
                }
 
                int fd_real_stderr = open(tmp_stderr2, O_RDONLY | O_BINARY);
                if (fd_real_stderr == -1) {
                        cc_log("Failed opening %s: %s", tmp_stderr2, strerror(errno));
+                       stats_update(STATS_ERROR);
                        failed();
                }
 
@@ -1532,6 +1542,7 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
                        open(tmp_stderr, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
                if (fd_result == -1) {
                        cc_log("Failed opening %s: %s", tmp_stderr, strerror(errno));
+                       stats_update(STATS_ERROR);
                        failed();
                }
 
@@ -1566,6 +1577,7 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
                struct file_hash *object_hash =
                        object_hash_from_depfile(output_dep, depend_mode_hash);
                if (!object_hash) {
+                       stats_update(STATS_ERROR);
                        failed();
                }
                update_cached_result_globals(object_hash);
@@ -1628,7 +1640,7 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
 
        MTR_END("file", "file_put");
 
-       stats_update(STATS_TOCACHE);
+       stats_update(STATS_CACHEMISS);
 
        // Make sure we have a CACHEDIR.TAG in the cache part of cache_dir. This can
        // be done almost anywhere, but we might as well do it near the end as we
@@ -1719,27 +1731,11 @@ get_object_name_from_cpp(struct args *args, struct hash *hash)
                failed();
        }
 
-       if (conf->unify) {
-               // When we are doing the unifying tricks we need to include the input file
-               // name in the hash to get the warnings right.
-               hash_delimiter(hash, "unifyfilename");
-               hash_string(hash, input_file);
-
-               hash_delimiter(hash, "unifycpp");
-
-               bool debug_unify = getenv("CCACHE_DEBUG_UNIFY");
-               if (unify_hash(hash, path_stdout, debug_unify) != 0) {
-                       stats_update(STATS_ERROR);
-                       cc_log("Failed to unify %s", path_stdout);
-                       failed();
-               }
-       } else {
-               hash_delimiter(hash, "cpp");
-               if (!process_preprocessed_file(hash, path_stdout,
-                                              guessed_compiler == GUESSED_PUMP)) {
-                       stats_update(STATS_ERROR);
-                       failed();
-               }
+       hash_delimiter(hash, "cpp");
+       if (!process_preprocessed_file(hash, path_stdout,
+                                      guessed_compiler == GUESSED_PUMP)) {
+               stats_update(STATS_ERROR);
+               failed();
        }
 
        hash_delimiter(hash, "cppstderr");
@@ -2251,6 +2247,7 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode)
                hash_delimiter(hash, "sourcecode");
                int result = hash_source_code_file(conf, hash, input_file);
                if (result & HASH_SOURCE_CODE_ERROR) {
+                       stats_update(STATS_ERROR);
                        failed();
                }
                if (result & HASH_SOURCE_CODE_FOUND_TIME) {
@@ -2595,6 +2592,7 @@ cc_process_args(struct args *args,
                        i++;
                        if (i == argc) {
                                cc_log("--ccache-skip lacks an argument");
+                               stats_update(STATS_ARGS);
                                result = false;
                                goto out;
                        }
@@ -3101,6 +3099,7 @@ cc_process_args(struct args *args,
                                // know what the user means, and what the compiler will do.
                                if (arg_profile_dir && profile_dir) {
                                        cc_log("Profile directory already set; giving up");
+                                       stats_update(STATS_UNSUPPORTED_OPTION);
                                        result = false;
                                        goto out;
                                } else if (arg_profile_dir) {
@@ -3296,11 +3295,6 @@ cc_process_args(struct args *args,
                }
        } // for
 
-       if (generating_debuginfo && conf->unify) {
-               cc_log("Generating debug info; disabling unify mode");
-               conf->unify = false;
-       }
-
        if (generating_debuginfo_level_3 && !conf->run_second_cpp) {
                cc_log("Generating debug info level 3; not compiling preprocessed code");
                conf->run_second_cpp = true;
@@ -3563,8 +3557,7 @@ cc_process_args(struct args *args,
                }
 
                if (!dependency_target_specified
-                   && !dependency_implicit_target_specified
-                   && !str_eq(get_extension(output_obj), ".o")) {
+                   && !dependency_implicit_target_specified) {
                        args_add(dep_args, "-MQ");
                        args_add(dep_args, output_obj);
                }
@@ -3901,6 +3894,7 @@ set_up_uncached_err(void)
        int uncached_fd = dup(2); // The file descriptor is intentionally leaked.
        if (uncached_fd == -1) {
                cc_log("dup(2) failed: %s", strerror(errno));
+               stats_update(STATS_ERROR);
                failed();
        }
 
@@ -3908,6 +3902,7 @@ set_up_uncached_err(void)
        char *buf = format("UNCACHED_ERR_FD=%d", uncached_fd);
        if (putenv(buf) == -1) {
                cc_log("putenv failed: %s", strerror(errno));
+               stats_update(STATS_ERROR);
                failed();
        }
 }
@@ -3951,6 +3946,7 @@ ccache(int argc, char *argv[])
 
        if (conf->disable) {
                cc_log("ccache is disabled");
+               stats_update(STATS_CACHEMISS); // Dummy to trigger stats_flush.
                failed();
        }
 
@@ -3978,13 +3974,13 @@ ccache(int argc, char *argv[])
        MTR_BEGIN("main", "process_args");
        if (!cc_process_args(
              orig_args, &preprocessor_args, &extra_args_to_hash, &compiler_args)) {
-               failed();
+               failed(); // stats_update is called in cc_process_args.
        }
        MTR_END("main", "process_args");
 
        if (conf->depend_mode
            && (!generating_dependencies || str_eq(output_dep, "/dev/null")
-               || !conf->run_second_cpp || conf->unify)) {
+               || !conf->run_second_cpp)) {
                cc_log("Disabling depend mode");
                conf->depend_mode = false;
        }
@@ -4066,6 +4062,7 @@ ccache(int argc, char *argv[])
 
        if (conf->read_only_direct) {
                cc_log("Read-only direct mode; running real compiler");
+               stats_update(STATS_CACHEMISS);
                failed();
        }
 
@@ -4112,6 +4109,7 @@ ccache(int argc, char *argv[])
 
        if (conf->read_only) {
                cc_log("Read-only mode; running real compiler");
+               stats_update(STATS_CACHEMISS);
                failed();
        }
 
index cabc980d653f392d27fff3277962fd59c23d69df..0d6be609a01c4e111aea6b34fad7b268a19e2993 100644 (file)
@@ -1,5 +1,5 @@
 // Copyright (C) 2002-2007 Andrew Tridgell
-// Copyright (C) 2009-2019 Joel Rosdahl
+// Copyright (C) 2009-2020 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
@@ -43,7 +43,7 @@ enum stats {
        STATS_STDOUT = 1,
        STATS_STATUS = 2,
        STATS_ERROR = 3,
-       STATS_TOCACHE = 4,
+       STATS_CACHEMISS = 4,
        STATS_PREPROCESSOR = 5,
        STATS_COMPILER = 6,
        STATS_MISSING = 7,
index 9ddd14c027a925d85a84db9e565a47cc3cd4ccd8..92fe34bd630e3e035292308afe209d7aec1bfb1d 100644 (file)
@@ -160,7 +160,6 @@ conf_create(void)
        conf->stats = true;
        conf->temporary_dir = x_strdup("");
        conf->umask = UINT_MAX; // Default: don't set umask.
-       conf->unify = false;
        conf->item_origins = x_malloc(confitems_count() * sizeof(char *));
        for (size_t i = 0; i < confitems_count(); ++i) {
                conf->item_origins[i] = "default";
@@ -429,6 +428,5 @@ conf_print_items(struct conf *conf,
        ok &= print_item(conf, "stats", printer, context);
        ok &= print_item(conf, "temporary_dir", printer, context);
        ok &= print_item(conf, "umask", printer, context);
-       ok &= print_item(conf, "unify", printer, context);
        return ok;
 }
index 52a48c8e796ae046ed2af3071dc0752f10315724..6fb0844d2a90d483e7c25f493fda0ad30ff47122 100644 (file)
@@ -37,7 +37,6 @@ struct conf {
        bool stats;
        char *temporary_dir;
        unsigned umask;
-       bool unify;
 
        const char **item_origins;
 };
index 828e62eb3f4a566e6ff8a756735137060aeba8c4..60e48ca8f0ff35aa20c983e5b223fdb17720fed0 100644 (file)
@@ -53,4 +53,3 @@ sloppiness,                 ITEM(sloppiness, sloppiness)
 stats,                      ITEM(stats, bool)
 temporary_dir,              ITEM(temporary_dir, env_string)
 umask,                      ITEM(umask, umask)
-unify,                      ITEM(unify, bool)
index 8cd130a064b823e1af69b74ef8029ede8e1af924..1bb30a24906a571460073689fcf48f2e130c57df 100644 (file)
@@ -66,7 +66,7 @@ confitems_hash (register const char *str, register size_t len)
       50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
       50, 50, 50, 50, 50, 50, 50,  0, 35,  0,
        5, 10, 50,  0, 30, 20, 50,  0, 10, 20,
-      15,  0,  0, 50,  5, 10, 10, 15, 50, 50,
+      50,  0,  0, 50,  5, 10, 10, 15, 50, 50,
       20, 50, 50, 50, 50, 50, 50, 50, 50, 50,
       50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
       50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
@@ -90,7 +90,7 @@ confitems_get (register const char *str, register size_t len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 34,
+      TOTAL_KEYWORDS = 33,
       MIN_WORD_LENGTH = 4,
       MAX_WORD_LENGTH = 26,
       MIN_HASH_VALUE = 4,
@@ -131,7 +131,7 @@ confitems_get (register const char *str, register size_t len)
       {"disable",                    11, ITEM(disable, bool)},
       {"temporary_dir",              31, ITEM(temporary_dir, env_string)},
       {"run_second_cpp",             28, ITEM(run_second_cpp, bool)},
-      {"unify",                      33, ITEM(unify, bool)},
+      {"",0,0,NULL,NULL,NULL},
       {"direct_mode",                10, ITEM(direct_mode, bool)},
       {"",0,0,NULL,NULL,NULL},
       {"hash_dir",                   14, ITEM(hash_dir, bool)},
@@ -160,4 +160,4 @@ confitems_get (register const char *str, register size_t len)
     }
   return 0;
 }
-size_t confitems_count(void) { return 34; }
+size_t confitems_count(void) { return 33; }
index 374d19c5d3f16653b9bdbb799d594dda6a19f959..ae5f37f29a5bd875739dfb06c1d6eb798e663c7a 100644 (file)
@@ -45,4 +45,3 @@ SLOPPINESS, "sloppiness"
 STATS, "stats"
 TEMPDIR, "temporary_dir"
 UMASK, "umask"
-UNIFY, "unify"
index 08117ef4d15165059a5a46606e061be8e98f3908..b49f2b3b9b66727b1dc956676cdc12cfcdf97680 100644 (file)
@@ -1,6 +1,6 @@
 /* ANSI-C code produced by gperf version 3.1 */
 /* Command-line: gperf  */
-/* Computed positions: -k'4-5' */
+/* Computed positions: -k'1,5' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -31,7 +31,7 @@
 
 #include "envtoconfitems.h"
 struct env_to_conf_item;
-/* maximum key range = 52, duplicates = 0 */
+/* maximum key range = 49, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
@@ -45,45 +45,45 @@ envtoconfitems_hash (register const char *str, register size_t len)
 {
   static const unsigned char asso_values[] =
     {
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-       0, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 25, 10,  0,  0,  5,
-      10,  0, 15,  0, 54, 10, 35, 25, 10, 25,
-       0, 54, 15, 20,  0,  0, 25, 54, 54, 15,
-      54, 54, 54, 54, 54,  0, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 54
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 30,  0,  0,  0,
+      35, 51, 25,  5,  0, 51, 10, 15,  0, 10,
+       5,  5,  5, 20, 20,  5, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51
     };
   register unsigned int hval = len;
 
   switch (hval)
     {
       default:
-        hval += asso_values[(unsigned char)str[4]];
+        hval += asso_values[(unsigned char)str[4]+1];
       /*FALLTHROUGH*/
       case 4:
-        hval += asso_values[(unsigned char)str[3]];
-      /*FALLTHROUGH*/
       case 3:
       case 2:
+      case 1:
+        hval += asso_values[(unsigned char)str[0]];
         break;
     }
   return hval;
@@ -94,11 +94,11 @@ envtoconfitems_get (register const char *str, register size_t len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 35,
+      TOTAL_KEYWORDS = 34,
       MIN_WORD_LENGTH = 2,
       MAX_WORD_LENGTH = 15,
       MIN_HASH_VALUE = 2,
-      MAX_HASH_VALUE = 53
+      MAX_HASH_VALUE = 50
     };
 
   static const struct env_to_conf_item wordlist[] =
@@ -107,49 +107,51 @@ envtoconfitems_get (register const char *str, register size_t len)
       {"CC", "compiler"},
       {"DIR", "cache_dir"},
       {"CPP2", "run_second_cpp"},
-      {"DEBUG", "debug"},
       {"",""},
-      {"TEMPDIR", "temporary_dir"},
+      {"DIRECT", "direct_mode"},
+      {"DISABLE", "disable"},
       {"COMPILER", "compiler"},
+      {"PATH", "path"},
       {"",""},
-      {"SLOPPINESS", "sloppiness"},
-      {"DIRECT", "direct_mode"},
-      {"BASEDIR", "base_dir"},
-      {"COMPILERCHECK", "compiler_check"},
-      {"LIMIT_MULTIPLE", "limit_multiple"},
-      {"PCH_EXTSUM", "pch_external_checksum"},
       {"PREFIX", "prefix_command"},
-      {"LOGFILE", "log_file"},
-      {"MAXFILES", "max_files"},
-      {"PATH", "path"},
+      {"RECACHE", "recache"},
+      {"COMPILERCHECK", "compiler_check"},
+      {"",""},
       {"PREFIX_CPP", "prefix_command_cpp"},
       {"DEPEND", "depend_mode"},
-      {"HASHDIR", "hash_dir"},
-      {"COMPRESS", "compression"},
+      {"LOGFILE", "log_file"},
+      {"READONLY", "read_only"},
       {"EXTENSION", "cpp_extension"},
-      {"STATS", "stats"},
+      {"UMASK", "umask"},
       {"",""},
       {"MAXSIZE", "max_size"},
+      {"MAXFILES", "max_files"},
+      {"",""},
+      {"READONLY_DIRECT", "read_only_direct"},
+      {"",""},
+      {"TEMPDIR", "temporary_dir"},
+      {"COMPRESS", "compression"},
+      {"LIMIT_MULTIPLE", "limit_multiple"},
+      {"DEBUG", "debug"},
+      {"",""},
+      {"HASHDIR", "hash_dir"},
       {"COMPRESSLEVEL", "compression_level"},
       {"",""},
-      {"UNIFY", "unify"},
+      {"SLOPPINESS", "sloppiness"},
       {"",""},
-      {"RECACHE", "recache"},
-      {"READONLY", "read_only"},
+      {"BASEDIR", "base_dir"},
+      {"IGNOREHEADERS", "ignore_headers_in_manifest"},
       {"",""},
-      {"UMASK", "umask"},
+      {"EXTRAFILES", "extra_files_to_hash"},
       {"",""},
       {"NLEVELS", "cache_dir_levels"},
       {"COMMENTS", "keep_comments_cpp"},
       {"",""},
-      {"READONLY_DIRECT", "read_only_direct"},
-      {"",""},
-      {"DISABLE", "disable"},
-      {"HARDLINK", "hard_link"},
-      {"",""}, {"",""}, {"",""}, {"",""}, {"",""}, {"",""},
-      {"EXTRAFILES", "extra_files_to_hash"},
+      {"STATS", "stats"},
       {"",""}, {"",""},
-      {"IGNOREHEADERS", "ignore_headers_in_manifest"}
+      {"HARDLINK", "hard_link"},
+      {"",""},
+      {"PCH_EXTSUM", "pch_external_checksum"}
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -166,4 +168,4 @@ envtoconfitems_get (register const char *str, register size_t len)
     }
   return 0;
 }
-size_t envtoconfitems_count(void) { return 35; }
+size_t envtoconfitems_count(void) { return 34; }
index 603d85bbd1864679b3d90387d1ccbf0a6e55f9e1..fcc528776722c4133ed1e4c778706f841bea9b04 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2018 Joel Rosdahl
+// Copyright (C) 2009-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
@@ -493,7 +493,8 @@ get_file_hash_index(struct manifest *mf,
                     char *path,
                     struct file_hash *file_hash,
                     struct hashtable *mf_files,
-                    struct hashtable *mf_file_infos)
+                    struct hashtable *mf_file_infos,
+                    bool save_timestamp)
 {
        struct file_info fi;
        fi.index = get_include_file_index(mf, path, mf_files);
@@ -506,9 +507,13 @@ get_file_hash_index(struct manifest *mf,
        //
        // st->ctime may be 0, so we have to check time_of_compilation against
        // MAX(mtime, ctime).
+       //
+       // ccache only reads mtime/ctime if file_stat_match sloppiness is enabled, so
+       // mtimes/ctimes are stored as a dummy value (-1) if not enabled. This reduces
+       // the number of file_info entries for the common case.
 
        struct stat file_stat;
-       if (stat(path, &file_stat) != -1
+       if (save_timestamp && stat(path, &file_stat) != -1
            && time_of_compilation > MAX(file_stat.st_mtime, file_stat.st_ctime)) {
                fi.mtime = file_stat.st_mtime;
                fi.ctime = file_stat.st_ctime;
@@ -531,7 +536,8 @@ get_file_hash_index(struct manifest *mf,
 
 static void
 add_file_info_indexes(uint32_t *indexes, uint32_t size,
-                      struct manifest *mf, struct hashtable *included_files)
+                      struct manifest *mf, struct hashtable *included_files,
+                      bool save_timestamp)
 {
        if (size == 0) {
                return;
@@ -549,7 +555,7 @@ add_file_info_indexes(uint32_t *indexes, uint32_t size,
                char *path = hashtable_iterator_key(iter);
                struct file_hash *file_hash = hashtable_iterator_value(iter);
                indexes[i] = get_file_hash_index(mf, path, file_hash, mf_files,
-                                                mf_file_infos);
+                                                mf_file_infos, save_timestamp);
                i++;
        } while (hashtable_iterator_advance(iter));
        assert(i == size);
@@ -561,7 +567,8 @@ add_file_info_indexes(uint32_t *indexes, uint32_t size,
 static void
 add_object_entry(struct manifest *mf,
                  struct file_hash *object_hash,
-                 struct hashtable *included_files)
+                 struct hashtable *included_files,
+                 bool save_timestamp)
 {
        uint32_t n_objs = mf->n_objects;
        mf->objects = x_realloc(mf->objects, (n_objs + 1) * sizeof(*mf->objects));
@@ -571,7 +578,8 @@ add_object_entry(struct manifest *mf,
        uint32_t n_fii = hashtable_count(included_files);
        obj->n_file_info_indexes = n_fii;
        obj->file_info_indexes = x_malloc(n_fii * sizeof(*obj->file_info_indexes));
-       add_file_info_indexes(obj->file_info_indexes, n_fii, mf, included_files);
+       add_file_info_indexes(obj->file_info_indexes, n_fii, mf, included_files,
+                             save_timestamp);
        memcpy(obj->hash.hash, object_hash->hash, mf->hash_size);
        obj->hash.size = object_hash->size;
 }
@@ -640,7 +648,7 @@ out:
 // Returns true on success, otherwise false.
 bool
 manifest_put(const char *manifest_path, struct file_hash *object_hash,
-             struct hashtable *included_files)
+             struct hashtable *included_files, bool save_timestamp)
 {
        int ret = 0;
        gzFile f2 = NULL;
@@ -707,7 +715,7 @@ manifest_put(const char *manifest_path, struct file_hash *object_hash,
                goto out;
        }
 
-       add_object_entry(mf, object_hash, included_files);
+       add_object_entry(mf, object_hash, included_files, save_timestamp);
        if (write_manifest(f2, mf)) {
                gzclose(f2);
                f2 = NULL;
index e116c3491014b2ca73edc6079e3081248ed6428a..8878384efd9b4d496f57e75672dd1c3913661484 100644 (file)
@@ -9,7 +9,7 @@
 
 struct file_hash *manifest_get(struct conf *conf, const char *manifest_path);
 bool manifest_put(const char *manifest_path, struct file_hash *object_hash,
-                  struct hashtable *included_files);
+                  struct hashtable *included_files, bool save_timestamp);
 bool manifest_dump(const char *manifest_path, FILE *stream);
 
 #endif
index 214f3be500a72474f955dcb19a40f5c0b5f8d5f5..c06c44b4b940f205619aa03fa1636570e2f43c09 100644 (file)
@@ -1,5 +1,5 @@
 // Copyright (C) 2002-2004 Andrew Tridgell
-// Copyright (C) 2009-2019 Joel Rosdahl
+// Copyright (C) 2009-2020 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
@@ -79,7 +79,7 @@ static struct {
                FLAG_ALWAYS
        },
        {
-               STATS_TOCACHE,
+               STATS_CACHEMISS,
                "cache_miss",
                "cache miss",
                NULL,
@@ -370,7 +370,7 @@ stats_hit_rate(struct counters *counters)
        unsigned direct = counters->data[STATS_CACHEHIT_DIR];
        unsigned preprocessed = counters->data[STATS_CACHEHIT_CPP];
        unsigned hit = direct + preprocessed;
-       unsigned miss = counters->data[STATS_TOCACHE];
+       unsigned miss = counters->data[STATS_CACHEMISS];
        unsigned total = hit + miss;
        return total > 0 ? (100.0 * hit) / total : 0.0;
 }
@@ -442,11 +442,26 @@ stats_flush_to_file(const char *sfile, struct counters *updates)
 {
        assert(conf);
 
-       if (!conf->stats) {
+       if (!updates) {
                return;
        }
 
-       if (!updates) {
+       if (conf->disable) {
+               // Just log result, don't update statistics.
+               cc_log("Result: disabled");
+               return;
+       }
+
+       if (!str_eq(conf->log_file, "") || conf->debug) {
+               for (int i = 0; i < STATS_END; ++i) {
+                       if (updates->data[stats_info[i].stat] != 0
+                           && !(stats_info[i].flags & FLAG_NOZERO)) {
+                               cc_log("Result: %s", stats_info[i].message);
+                       }
+               }
+       }
+
+       if (!conf->stats) {
                return;
        }
 
@@ -483,15 +498,6 @@ stats_flush_to_file(const char *sfile, struct counters *updates)
        stats_write(sfile, counters);
        lockfile_release(sfile);
 
-       if (!str_eq(conf->log_file, "") || conf->debug) {
-               for (int i = 0; i < STATS_END; ++i) {
-                       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(sfile);
        bool need_cleanup = false;
 
@@ -591,7 +597,7 @@ stats_summary(void)
                        free(value);
                }
 
-               if (stat == STATS_TOCACHE) {
+               if (stat == STATS_CACHEMISS) {
                        double percent = stats_hit_rate(counters);
                        printf("cache hit rate                    %6.2f %%\n", percent);
                }
diff --git a/src/unify.c b/src/unify.c
deleted file mode 100644 (file)
index 4b72784..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright (C) 2002 Andrew Tridgell
-// Copyright (C) 2009-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
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along with
-// this program; if not, write to the Free Software Foundation, Inc., 51
-// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-// C/C++ unifier
-//
-// The idea is that changes that don't affect the resulting C code should not
-// change the hash. This is achieved by folding white-space and other
-// non-semantic fluff in the input into a single unified format.
-//
-// This unifier was design to match the output of the unifier in compilercache,
-// which is flex based. The major difference is that this unifier is much
-// faster (about 2x) and more forgiving of syntactic errors. Continuing on
-// syntactic errors is important to cope with C/C++ extensions in the local
-// compiler (for example, inline assembly systems).
-
-#include "ccache.h"
-#include "hash.h"
-#include "unify.h"
-
-static bool print_unified = true;
-
-static const char *const s_tokens[] = {
-       "...", ">>=", "<<=", "+=", "-=", "*=", "/=", "%=", "&=", "^=",
-       "|=",  ">>",  "<<",  "++", "--", "->", "&&", "||", "<=", ">=",
-       "==",  "!=",  ";",   "{",  "<%", "}",  "%>", ",",  ":",  "=",
-       "(",   ")",   "[",   "<:", "]",  ":>", ".",  "&",  "!",  "~",
-       "-",   "+",   "*",   "/",  "%",  "<",  ">",  "^",  "|",  "?",
-       0
-};
-
-#define C_ALPHA 1
-#define C_SPACE 2
-#define C_TOKEN 4
-#define C_QUOTE 8
-#define C_DIGIT 16
-#define C_HEX   32
-#define C_FLOAT 64
-#define C_SIGN  128
-
-static struct {
-       unsigned char type;
-       unsigned char num_toks;
-       const char *toks[7];
-} tokens[256];
-
-// Build up the table used by the unifier.
-static void
-build_table(void)
-{
-       static bool done;
-       if (done) {
-               return;
-       }
-       done = true;
-
-       memset(tokens, 0, sizeof(tokens));
-       for (unsigned char c = 0; c < 128; c++) {
-               if (isalpha(c) || c == '_') {
-                       tokens[c].type |= C_ALPHA;
-               }
-               if (isdigit(c)) {
-                       tokens[c].type |= C_DIGIT;
-               }
-               if (isspace(c)) {
-                       tokens[c].type |= C_SPACE;
-               }
-               if (isxdigit(c)) {
-                       tokens[c].type |= C_HEX;
-               }
-       }
-       tokens['\''].type |= C_QUOTE;
-       tokens['"'].type |= C_QUOTE;
-       tokens['l'].type |= C_FLOAT;
-       tokens['L'].type |= C_FLOAT;
-       tokens['f'].type |= C_FLOAT;
-       tokens['F'].type |= C_FLOAT;
-       tokens['U'].type |= C_FLOAT;
-       tokens['u'].type |= C_FLOAT;
-
-       tokens['-'].type |= C_SIGN;
-       tokens['+'].type |= C_SIGN;
-
-       for (int i = 0; s_tokens[i]; i++) {
-               unsigned char c = s_tokens[i][0];
-               tokens[c].type |= C_TOKEN;
-               tokens[c].toks[tokens[c].num_toks] = s_tokens[i];
-               tokens[c].num_toks++;
-       }
-}
-
-// Buffer up characters before hashing them.
-static void
-pushchar(struct hash *hash, unsigned char c)
-{
-       static unsigned char buf[64];
-       static size_t len;
-
-       if (c == 0) {
-               if (len > 0) {
-                       hash_buffer(hash, (char *)buf, len);
-                       if (print_unified) {
-                               printf("%.*s", (int) len, buf);
-                       }
-                       len = 0;
-               }
-               return;
-       }
-
-       buf[len++] = c;
-       if (len == 64) {
-               hash_buffer(hash, (char *)buf, len);
-               if (print_unified) {
-                       printf("%.*s", (int) len, buf);
-               }
-               len = 0;
-       }
-}
-
-// Hash some C/C++ code after unifying.
-static void
-unify(struct hash *hash, unsigned char *p, size_t size)
-{
-       build_table();
-
-       for (size_t ofs = 0; ofs < size;) {
-               if (p[ofs] == '#') {
-                       if ((size-ofs) > 2 && p[ofs+1] == ' ' && isdigit(p[ofs+2])) {
-                               do {
-                                       ofs++;
-                               } while (ofs < size && p[ofs] != '\n');
-                               ofs++;
-                       } else {
-                               do {
-                                       pushchar(hash, p[ofs]);
-                                       ofs++;
-                               } while (ofs < size && p[ofs] != '\n');
-                               pushchar(hash, '\n');
-                               ofs++;
-                       }
-                       continue;
-               }
-
-               if (tokens[p[ofs]].type & C_ALPHA) {
-                       do {
-                               pushchar(hash, p[ofs]);
-                               ofs++;
-                       } while (ofs < size && (tokens[p[ofs]].type & (C_ALPHA|C_DIGIT)));
-                       pushchar(hash, '\n');
-                       continue;
-               }
-
-               if (tokens[p[ofs]].type & C_DIGIT) {
-                       do {
-                               pushchar(hash, p[ofs]);
-                               ofs++;
-                       } while (ofs < size &&
-                                ((tokens[p[ofs]].type & C_DIGIT) || p[ofs] == '.'));
-                       if (ofs < size && (p[ofs] == 'x' || p[ofs] == 'X')) {
-                               do {
-                                       pushchar(hash, p[ofs]);
-                                       ofs++;
-                               } while (ofs < size && (tokens[p[ofs]].type & C_HEX));
-                       }
-                       if (ofs < size && (p[ofs] == 'E' || p[ofs] == 'e')) {
-                               pushchar(hash, p[ofs]);
-                               ofs++;
-                               while (ofs < size && (tokens[p[ofs]].type & (C_DIGIT|C_SIGN))) {
-                                       pushchar(hash, p[ofs]);
-                                       ofs++;
-                               }
-                       }
-                       while (ofs < size && (tokens[p[ofs]].type & C_FLOAT)) {
-                               pushchar(hash, p[ofs]);
-                               ofs++;
-                       }
-                       pushchar(hash, '\n');
-                       continue;
-               }
-
-               if (tokens[p[ofs]].type & C_SPACE) {
-                       do {
-                               ofs++;
-                       } while (ofs < size && (tokens[p[ofs]].type & C_SPACE));
-                       continue;
-               }
-
-               if (tokens[p[ofs]].type & C_QUOTE) {
-                       unsigned char q = p[ofs];
-                       pushchar(hash, p[ofs]);
-                       do {
-                               ofs++;
-                               while (ofs < size-1 && p[ofs] == '\\') {
-                                       pushchar(hash, p[ofs]);
-                                       pushchar(hash, p[ofs+1]);
-                                       ofs += 2;
-                               }
-                               pushchar(hash, p[ofs]);
-                       } while (ofs < size && p[ofs] != q);
-                       pushchar(hash, '\n');
-                       ofs++;
-                       continue;
-               }
-
-               if (tokens[p[ofs]].type & C_TOKEN) {
-                       unsigned char q = p[ofs];
-                       int i;
-                       for (i = 0; i < tokens[q].num_toks; i++) {
-                               const unsigned char *s = (const unsigned char *)tokens[q].toks[i];
-                               int len = strlen((const char *)s);
-                               if (size >= ofs+len && memcmp(&p[ofs], s, len) == 0) {
-                                       int j;
-                                       for (j = 0; s[j]; j++) {
-                                               pushchar(hash, s[j]);
-                                               ofs++;
-                                       }
-                                       pushchar(hash, '\n');
-                                       break;
-                               }
-                       }
-                       if (i < tokens[q].num_toks) {
-                               continue;
-                       }
-               }
-
-               pushchar(hash, p[ofs]);
-               pushchar(hash, '\n');
-               ofs++;
-       }
-       pushchar(hash, 0);
-}
-
-
-// Hash a file that consists of preprocessor output, but remove any line number
-// information from the hash.
-int
-unify_hash(struct hash *hash, const char *fname, bool debug)
-{
-       char *data;
-       size_t size;
-       if (!read_file(fname, 0, &data, &size)) {
-               stats_update(STATS_PREPROCESSOR);
-               return -1;
-       }
-       print_unified = debug;
-       unify(hash, (unsigned char *)data, size);
-       free(data);
-       return 0;
-}
diff --git a/src/unify.h b/src/unify.h
deleted file mode 100644 (file)
index eac167d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2018 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
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along with
-// this program; if not, write to the Free Software Foundation, Inc., 51
-// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-#ifndef UNIFY_H
-#define UNIFY_H
-
-#include "hash.h"
-
-int unify_hash(struct hash *hash, const char *fname, bool print);
-
-#endif
index 877563a9a5f71a12860157adaab855f8c841af84..fb1c3084049d984a4f6c0c0194b180115f7cb549 100644 (file)
@@ -1 +1 @@
-extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.6";
+extern const char CCACHE_VERSION[]; const char CCACHE_VERSION[] = "3.7.7";
index fac44ea670e83b8eacf715821ce03daf0a739add..00664a9c6401a454b902429ac3207c72ebc0bc4a 100644 (file)
@@ -434,22 +434,6 @@ base_tests() {
     expect_stat 'cache hit (preprocessed)' 2
     expect_stat 'cache miss' 1
 
-    # -------------------------------------------------------------------------
-    TEST "CCACHE_UNIFY"
-
-    echo '// a silly comment' >>test1.c
-    CCACHE_UNIFY=1 $CCACHE_COMPILE -c test1.c
-    expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
-
-    echo '// another silly comment' >>test1.c
-    CCACHE_UNIFY=1 $CCACHE_COMPILE -c test1.c
-    expect_stat 'cache hit (preprocessed)' 1
-    expect_stat 'cache miss' 1
-
-    $REAL_COMPILER -c -o reference_test1.o test1.c
-    expect_equal_object_files reference_test1.o test1.o
-
     # -------------------------------------------------------------------------
     TEST "CCACHE_NLEVELS"
 
@@ -1000,6 +984,20 @@ EOF
     expect_stat 'cache miss' 2
     expect_stat 'files in cache' 2
 
+    # -------------------------------------------------------------------------
+    TEST "Dependency file content"
+
+    mkdir build
+    cp test1.c build
+
+    for src in test1.c build/test1.c; do
+        for obj in test1.o build/test1.o; do
+            $CCACHE_COMPILE -c -MMD $src -o $obj
+            dep=$(echo $obj | sed 's/\.o$/.d/')
+            expect_file_content $dep "$obj: $src"
+        done
+    done
+
     # -------------------------------------------------------------------------
     TEST "Buggy GCC 6 cpp"
 
@@ -1076,10 +1074,11 @@ EOF
     fi
 
     # -------------------------------------------------------------------------
+if ! $HOST_OS_WINDOWS; then
     TEST ".incbin"
 
     cat <<EOF >incbin.c
-char x[] = ".incbin";
+__asm__(".incbin \"/dev/null\"");
 EOF
 
     $CCACHE_COMPILE -c incbin.c
@@ -1087,6 +1086,16 @@ EOF
     expect_stat 'cache miss' 0
     expect_stat 'unsupported code directive' 1
 
+    cat <<EOF >incbin.s
+.incbin "/dev/null";
+EOF
+
+    $CCACHE_COMPILE -c incbin.s
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 0
+    expect_stat 'unsupported code directive' 2
+fi
+
     # -------------------------------------------------------------------------
     TEST "UNCACHED_ERR_FD"
 
index fca072f7574f69c6b4d85ab2ed80e5c13bbdd401..e766af5a83415e15799e0b78e439e8959177e83b 100644 (file)
@@ -159,14 +159,29 @@ EOF
     mkdir a b
     touch a/source.c b/source.c
     backdate a/source.h b/source.h
-    $CCACHE_COMPILE -MMD -c a/source.c
-    expect_file_content source.d "source.o: a/source.c"
+    $CCACHE_COMPILE -MMD -c a/source.c -o a/source.o
+    expect_file_content a/source.d "a/source.o: a/source.c"
 
-    $CCACHE_COMPILE -MMD -c b/source.c
-    expect_file_content source.d "source.o: b/source.c"
+    $CCACHE_COMPILE -MMD -c b/source.c -o b/source.o
+    expect_file_content b/source.d "b/source.o: b/source.c"
 
-    $CCACHE_COMPILE -MMD -c a/source.c
-    expect_file_content source.d "source.o: a/source.c"
+    $CCACHE_COMPILE -MMD -c a/source.c -o a/source.o
+    expect_file_content a/source.d "a/source.o: a/source.c"
+
+    # -------------------------------------------------------------------------
+    TEST "Dependency file content"
+
+    mkdir build
+    touch test1.c
+    cp test1.c build
+
+    for src in test1.c build/test1.c; do
+        for obj in test1.o build/test1.o; do
+            $CCACHE_COMPILE -c -MMD $src -o $obj
+            dep=$(echo $obj | sed 's/\.o$/.d/')
+            expect_file_content $dep "$obj: $src"
+        done
+    done
 
     # -------------------------------------------------------------------------
     TEST "-MMD for different include file paths"
index be98696687450db59eb0e870078c3d0c6434824d..5cdbc251d356df057053ffd5336b600e3e397601 100644 (file)
@@ -44,9 +44,9 @@ SUITE_readonly() {
     if [ $? -ne 0 ]; then
         test_failed "Failure when compiling test2.c read-only"
     fi
-    if [ -d $CCACHE_DIR ]; then
-        test_failed "ccache dir was created"
-    fi
+    expect_stat 'cache hit (preprocessed)' 0
+    expect_stat 'cache miss' 1
+    expect_stat 'files in cache' 0
 
     # -------------------------------------------------------------------------
     # Check that read-only mode and direct mode work together.
index b1ea4c6e8d78d6da835a8682d8a119a5043ff3d0..9a7636f41fcae686920f4ae6735f5e61b3398f64 100644 (file)
@@ -29,5 +29,5 @@ SUITE_readonly_direct() {
     CCACHE_READONLY_DIRECT=1 $CCACHE_COMPILE -DFOO -c test.c -o test.o
     expect_stat 'cache hit (direct)' 0
     expect_stat 'cache hit (preprocessed)' 0
-    expect_stat 'cache miss' 1
+    expect_stat 'cache miss' 2
 }
index 3a2d0ed37adbca5ae66cbe8984b9bb90689e5acf..c0504bee1d8949c8b1f246570af00bc62d040aec 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2019 Joel Rosdahl
+// Copyright (C) 2010-2020 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
@@ -173,36 +173,6 @@ TEST(dependency_flags_that_take_an_argument_should_not_require_space_delimiter)
        args_free(orig);
 }
 
-TEST(MQ_flag_should_not_be_added_for_standard_obj_extension)
-{
-       struct args *orig = args_init_from_string("cc -c -MD foo.c -o foo.o");
-       struct args *exp_cpp = args_init_from_string("cc -MD -MF foo.d");
-       struct args *exp_cc = args_init_from_string("cc -c");
-       struct args *act_cpp = NULL, *act_cc = NULL;
-       create_file("foo.c", "");
-
-       CHECK(cc_process_args(orig, &act_cpp, NULL, &act_cc));
-       CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
-       CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
-
-       args_free(orig);
-}
-
-TEST(MQ_flag_should_be_added_for_non_standard_obj_extension)
-{
-       struct args *orig = args_init_from_string("cc -c -MD foo.c -o foo.obj");
-       struct args *exp_cpp = args_init_from_string("cc -MD -MF foo.d -MQ foo.obj");
-       struct args *exp_cc = args_init_from_string("cc -c");
-       struct args *act_cpp = NULL, *act_cc = NULL;
-       create_file("foo.c", "");
-
-       CHECK(cc_process_args(orig, &act_cpp, NULL, &act_cc));
-       CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
-       CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
-
-       args_free(orig);
-}
-
 TEST(equal_sign_after_MF_should_be_removed)
 {
        struct args *orig = args_init_from_string("cc -c -MF=path foo.c -o foo.o");
index bc458fce247e1d717678e0292f97a45888f882a8..a203ec8752ce13f7912fc03e17e8bda4dc67aa4e 100644 (file)
@@ -18,7 +18,7 @@
 #include "framework.h"
 #include "util.h"
 
-#define N_CONFIG_ITEMS 34
+#define N_CONFIG_ITEMS 33
 static struct {
        char *descr;
        char *origin;
@@ -83,7 +83,6 @@ TEST(conf_create)
        CHECK(conf->stats);
        CHECK_STR_EQ("", conf->temporary_dir);
        CHECK_INT_EQ(UINT_MAX, conf->umask);
-       CHECK(!conf->unify);
        conf_free(conf);
 }
 
@@ -135,8 +134,7 @@ TEST(conf_read_valid_config)
                "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"
-               "unify = true"); // Note: no newline.
+               "umask = 777"); // Note: no newline.
        CHECK(conf_read(conf, "ccache.conf", &errmsg));
        CHECK(!errmsg);
 
@@ -185,7 +183,6 @@ TEST(conf_read_valid_config)
        CHECK(!conf->stats);
        CHECK_STR_EQ_FREE1(format("%s_foo", user), conf->temporary_dir);
        CHECK_INT_EQ(0777, conf->umask);
-       CHECK(conf->unify);
 
        conf_free(conf);
 }
@@ -499,7 +496,6 @@ TEST(conf_print_items)
                false,
                "td",
                022,
-               true,
                NULL
        };
        size_t n = 0;
@@ -553,7 +549,6 @@ TEST(conf_print_items)
        CHECK_STR_EQ("stats = false", received_conf_items[n++].descr);
        CHECK_STR_EQ("temporary_dir = td", received_conf_items[n++].descr);
        CHECK_STR_EQ("umask = 022", received_conf_items[n++].descr);
-       CHECK_STR_EQ("unify = true", received_conf_items[n++].descr);
 
        for (i = 0; i < N_CONFIG_ITEMS; ++i) {
 #ifndef __MINGW32__