Imported Upstream version 3.2.6 upstream/3.2.6
authorJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:17:18 +0000 (16:17 +0900)
committerJinWang An <jinwang.an@samsung.com>
Tue, 3 Aug 2021 07:17:18 +0000 (16:17 +0900)
16 files changed:
AUTHORS.html
HACKING.txt
INSTALL.html
LICENSE.html
MANUAL.html
MANUAL.txt
NEWS.html
NEWS.txt
README.html
README.txt
ccache.1
ccache.c
compopt.c
hashtable.c
test.sh
version.c

index 8a2d4e6..5a87c37 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache authors</h1>\r
-<span id="revnumber">version 3.2.5</span>\r
+<span id="revnumber">version 3.2.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>
@@ -1020,9 +1020,9 @@ Yiding Jia &lt;<a href="mailto:yiding@fb.com">yiding@fb.com</a>&gt;
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.5<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-04-17 16:40:11 CEST\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index 01cdd47..e025c11 100644 (file)
@@ -10,6 +10,8 @@ Code formatting
   at the end of the same line.
 * Put no space between function name and the following parenthesis.
 * Put one space between if/switch/for/while/do and opening curly brace.
+* Always use curly braces around if/for/while/do bodies, even if they only
+  contain one statement.
 * If possible, keep lines at most 80 character wide for a 2 character tab
   width.
 * Use only lowercase names for functions and variables.
index a8e690c..e6c0459 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache installation</h1>\r
-<span id="revnumber">version 3.2.4+101_g4218b81</span>\r
+<span id="revnumber">version 3.2.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>
@@ -848,9 +848,9 @@ above.</p></div>
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.4+101_g4218b81<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-02-06 17:21:49 CET\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index 1ff2d6f..19b4375 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache copyright and license</h1>\r
-<span id="revnumber">version 3.2.5</span>\r
+<span id="revnumber">version 3.2.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>
@@ -1205,9 +1205,9 @@ following license:</p></div>
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.5<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-04-17 16:43:39 CEST\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index f393eff..725e73b 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>CCACHE(1)</h1>\r
-<span id="revnumber">version 3.2.5</span>\r
+<span id="revnumber">version 3.2.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>
@@ -1292,7 +1292,7 @@ the <strong>prefix_command</strong> setting if possible. See
 <p>\r
     If true, ccache will include the current working directory in the hash that\r
     is used to distinguish two compilations. This prevents a problem with the\r
-    storage of the current working directory in the debug info of a object\r
+    storage of the current working directory in the debug info of an object\r
     file, which can lead ccache to give a cached object file that has the\r
     working directory in the debug info set incorrectly. This option is off by\r
     default as the incorrect setting of this debug info rarely causes problems.\r
@@ -2167,9 +2167,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.2.5<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-04-17 16:43:39 CEST\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index 9993019..5a5edd4 100644 (file)
@@ -367,7 +367,7 @@ WRAPPERS>>.
 
     If true, ccache will include the current working directory in the hash that
     is used to distinguish two compilations. This prevents a problem with the
-    storage of the current working directory in the debug info of a object
+    storage of the current working directory in the debug info of an object
     file, which can lead ccache to give a cached object file that has the
     working directory in the debug info set incorrectly. This option is off by
     default as the incorrect setting of this debug info rarely causes problems.
index 9f16a1c..42f28a0 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache news</h1>\r
-<span id="revnumber">version 3.2.5</span>\r
+<span id="revnumber">version 3.2.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>
@@ -742,6 +742,41 @@ asciidoc.install(2);
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_ccache_3_2_6">ccache 3.2.6</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2016-07-12</p></div>\r
+<div class="sect2">\r
+<h3 id="_bug_fixes">Bug fixes</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+Fixed build problem on QNX, which lacks &#8220;SA_RESTART&#8221;.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Bail out on compiler option <code>-fstack-usage</code> since it creates a <code>.su</code> file\r
+  which ccache currently doesn&#8217;t handle.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+ccache now knows how to work around a glitch in the output of GCC 6&#8217;s\r
+  preprocessor.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Fixed a bug where (due to ccache rewriting paths) the compiler could choose\r
+  incorrect include files if <code>CCACHE_BASEDIR</code> is used and the source file path\r
+  is absolute and is a symlink.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_ccache_3_2_5">ccache 3.2.5</h2>\r
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2016-04-17</p></div>\r
@@ -767,7 +802,7 @@ Made it harder to misinterpret documentation of boolean environment settings'
 </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
@@ -827,7 +862,7 @@ The man page is now built when running &#8220;make install&#8221; from Git repos
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-10-08</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
@@ -882,7 +917,7 @@ Added support for compiler option <code>-gsplit-dwarf</code>.
 </ul></div>\r
 </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
@@ -936,7 +971,7 @@ Add support for caching code coverage results (compiling for gcov).
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_4">Bug fixes</h3>\r
+<h3 id="_bug_fixes_5">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1007,7 +1042,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_5">Bug fixes</h3>\r
+<h3 id="_bug_fixes_6">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1239,7 +1274,7 @@ Various other improvements of the test suite.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_6">Bug fixes</h3>\r
+<h3 id="_bug_fixes_7">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1266,11 +1301,29 @@ Fixed test suite failures when <code>CC</code> is a ccache-wrapped compiler.
 </div>\r
 </div>\r
 <div class="sect1">\r
+<h2 id="_ccache_3_1_12">ccache 3.1.12</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Release date: 2016-07-12</p></div>\r
+<div class="sect2">\r
+<h3 id="_bug_fixes_8">Bug fixes</h3>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+Fixed a bug where (due to ccache rewriting paths) the compiler could choose\r
+  incorrect include files if <code>CCACHE_BASEDIR</code> is used and the source file path\r
+  is absolute and is a symlink.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_ccache_3_1_11">ccache 3.1.11</h2>\r
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2015-03-07</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_7">Bug fixes</h3>\r
+<h3 id="_bug_fixes_9">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1353,7 +1406,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_8">Bug fixes</h3>\r
+<h3 id="_bug_fixes_10">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1393,7 +1446,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_9">Bug fixes</h3>\r
+<h3 id="_bug_fixes_11">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1464,7 +1517,7 @@ Clang plugins are now hashed to catch plugin upgrades.
 </ul></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_10">Bug fixes</h3>\r
+<h3 id="_bug_fixes_12">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1512,7 +1565,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_11">Bug fixes</h3>\r
+<h3 id="_bug_fixes_13">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1595,7 +1648,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_12">Bug fixes</h3>\r
+<h3 id="_bug_fixes_14">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1648,7 +1701,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_13">Bug fixes</h3>\r
+<h3 id="_bug_fixes_15">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1681,7 +1734,7 @@ Systems that lack (and don&#8217;t need to be linked with) libm are now supporte
 <div class="sectionbody">\r
 <div class="paragraph"><p>Release date: 2011-01-09</p></div>\r
 <div class="sect2">\r
-<h3 id="_bug_fixes_14">Bug fixes</h3>\r
+<h3 id="_bug_fixes_16">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1714,7 +1767,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_15">Bug fixes</h3>\r
+<h3 id="_bug_fixes_17">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1741,7 +1794,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_16">Bug fixes</h3>\r
+<h3 id="_bug_fixes_18">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1789,7 +1842,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_17">Bug fixes</h3>\r
+<h3 id="_bug_fixes_19">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1911,7 +1964,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_18">Bug fixes</h3>\r
+<h3 id="_bug_fixes_20">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -1997,7 +2050,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_19">Bug fixes</h3>\r
+<h3 id="_bug_fixes_21">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2186,7 +2239,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_20">Bug fixes</h3>\r
+<h3 id="_bug_fixes_22">Bug fixes</h3>\r
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
@@ -2331,9 +2384,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.2.5<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-04-17 16:43:59 CEST\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index a0fee0e..4b2d144 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -2,6 +2,26 @@ ccache news
 ===========
 
 
+ccache 3.2.6
+------------
+Release date: 2016-07-12
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed build problem on QNX, which lacks ``SA_RESTART''.
+
+- Bail out on compiler option `-fstack-usage` since it creates a `.su` file
+  which ccache currently doesn't handle.
+
+- ccache now knows how to work around a glitch in the output of GCC 6's
+  preprocessor.
+
+- Fixed a bug where (due to ccache rewriting paths) the compiler could choose
+  incorrect include files if `CCACHE_BASEDIR` is used and the source file path
+  is absolute and is a symlink.
+
+
 ccache 3.2.5
 ------------
 Release date: 2016-04-17
@@ -275,6 +295,19 @@ Bug fixes
 - Fixed test suite failures when `CC` is a ccache-wrapped compiler.
 
 
+ccache 3.1.12
+-------------
+Release date: 2016-07-12
+
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed a bug where (due to ccache rewriting paths) the compiler could choose
+  incorrect include files if `CCACHE_BASEDIR` is used and the source file path
+  is absolute and is a symlink.
+
+
 ccache 3.1.11
 -------------
 Release date: 2015-03-07
index 6872e84..de56289 100644 (file)
@@ -734,7 +734,7 @@ asciidoc.install(2);
 <body class="article">\r
 <div id="header">\r
 <h1>ccache README</h1>\r
-<span id="revnumber">version 3.2.5</span>\r
+<span id="revnumber">version 3.2.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>
@@ -802,12 +802,12 @@ page:</p></div>
 repository, use git:</p></div>\r
 <div class="literalblock">\r
 <div class="content">\r
-<pre><code>git clone git://git.samba.org/ccache.git</code></pre>\r
+<pre><code>git clone https://github.com/ccache/ccache.git</code></pre>\r
 </div></div>\r
 <div class="paragraph"><p>You can also browse the repository:</p></div>\r
 <div class="literalblock">\r
 <div class="content">\r
-<pre><code>http://gitweb.samba.org/?p=ccache.git</code></pre>\r
+<pre><code>https://github.com/ccache/ccache</code></pre>\r
 </div></div>\r
 </div>\r
 </div>\r
@@ -830,9 +830,9 @@ Thiele&#8217;s &#8220;compilercache&#8221; (see <a href="http://www.erikyyy.de/c
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Version 3.2.5<br />\r
+Version 3.2.6<br />\r
 Last updated\r
- 2016-04-17 16:43:39 CEST\r
+ 2016-07-12 21:36:01 CEST\r
 </div>\r
 </div>\r
 </body>\r
index e7bcc25..bf808d4 100644 (file)
@@ -58,11 +58,11 @@ Source code repository
 To get the very latest version of ccache directly from the source code
 repository, use git:
 
-    git clone git://git.samba.org/ccache.git
+    git clone https://github.com/ccache/ccache.git
 
 You can also browse the repository:
 
-    http://gitweb.samba.org/?p=ccache.git
+    https://github.com/ccache/ccache
 
 
 History
index b42a95f..ea5cb34 100644 (file)
--- a/ccache.1
+++ b/ccache.1
@@ -2,12 +2,12 @@
 .\"     Title: ccache
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 04/17/2016
+.\"      Date: 07/12/2016
 .\"    Manual: ccache Manual
-.\"    Source: ccache 3.2.5
+.\"    Source: ccache 3.2.6
 .\"  Language: English
 .\"
-.TH "CCACHE" "1" "04/17/2016" "ccache 3\&.2\&.5" "ccache Manual"
+.TH "CCACHE" "1" "07/12/2016" "ccache 3\&.2\&.6" "ccache Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -489,7 +489,7 @@ If true, ccache will attempt to use hard links from the cache directory when cre
 .PP
 \fBhash_dir\fR (\fBCCACHE_HASHDIR\fR or \fBCCACHE_NOHASHDIR\fR, see Boolean values above)
 .RS 4
-If true, ccache will include the current working directory in the hash that is used to distinguish two compilations\&. This prevents a problem with the storage of the current working directory in the debug info of a object file, which can lead ccache to give a cached object file that has the working directory in the debug info set incorrectly\&. This option is off by default as the incorrect setting of this debug info rarely causes problems\&. If you strike problems with GDB not using the correct directory then enable this option\&.
+If true, ccache will include the current working directory in the hash that is used to distinguish two compilations\&. This prevents a problem with the storage of the current working directory in the debug info of an object file, which can lead ccache to give a cached object file that has the working directory in the debug info set incorrectly\&. This option is off by default as the incorrect setting of this debug info rarely causes problems\&. If you strike problems with GDB not using the correct directory then enable this option\&.
 .RE
 .PP
 \fBlog_file\fR (\fBCCACHE_LOGFILE\fR)
index 544c397..014c5a0 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -402,7 +402,9 @@ register_signal_handler(int signum)
        memset(&act, 0, sizeof(act));
        act.sa_handler = signal_handler;
        act.sa_mask = fatal_signal_set;
+#ifdef SA_RESTART
        act.sa_flags = SA_RESTART;
+#endif
        sigaction(signum, &act, NULL);
 }
 
@@ -748,6 +750,28 @@ process_preprocessed_file(struct mdfour *hash, const char *path)
                    && (q == data || q[-1] == '\n')) {
                        char *path;
 
+                       /* Workarounds for preprocessor linemarker bugs in GCC version 6 */
+                       if (q[2] == '3') {
+                               if (str_startswith(q, "# 31 \"<command-line>\"\n")) {
+                                       /* Bogus extra line with #31, after the regular #1:
+                                          Ignore the whole line, and continue parsing */
+                                       while (q < end && *q != '\n') {
+                                               q++;
+                                       }
+                                       p = q;
+                                       continue;
+                               } else if (str_startswith(q, "# 32 \"<command-line>\" 2\n")) {
+                                       /* Bogus wrong line with #32, instead of regular #1:
+                                          Replace the line number with the usual one */
+                                       hash_buffer(hash, p, q - p);
+                                       q += 1;
+                                       q[0] = '#';
+                                       q[1] = ' ';
+                                       q[2] = '1';
+                                       p = q;
+                               }
+                       }
+
                        while (q < end && *q != '"' && *q != '\n') {
                                q++;
                        }
@@ -1098,7 +1122,7 @@ to_cache(struct args *args)
                cc_log("Stored in cache: %s", cached_stderr);
                if (!conf->compression
                    /* If the file was compressed, obtain the size again: */
-                   || (conf->compression && x_stat(cached_stderr, &st) == 0)) {
+                   || x_stat(cached_stderr, &st) == 0) {
                        stats_update_size(file_size(&st), 1);
                }
        } else {
@@ -1841,7 +1865,7 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
        x_exit(0);
 }
 
-/* find the real compiler. We just search the PATH to find a executable of the
+/* find the real compiler. We just search the PATH to find an executable of the
  * same name that isn't a link to ourselves */
 static void
 find_compiler(char **argv)
@@ -2490,8 +2514,17 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
                        continue;
                }
 
-               /* Rewrite to relative to increase hit rate. */
-               input_file = make_relative_path(x_strdup(argv[i]));
+               lstat(argv[i], &st);
+               if (S_ISLNK(st.st_mode)) {
+                       /* Don't rewrite source file path if it's a symlink since
+                          make_relative_path resolves symlinks using realpath(3) and this leads
+                          to potentially choosing incorrect relative header files. See the
+                          "symlink to source file" test. */
+                       input_file = x_strdup(argv[i]);
+               } else {
+                       /* Rewrite to relative to increase hit rate. */
+                       input_file = make_relative_path(x_strdup(argv[i]));
+               }
        } /* for */
 
        if (found_S_opt) {
index 87166df..1b8dc70 100644 (file)
--- a/compopt.c
+++ b/compopt.c
@@ -60,6 +60,7 @@ static const struct compopt compopts[] = {
        {"-fno-working-directory", AFFECTS_CPP},
        {"-fplugin=libcc1plugin", TOO_HARD}, /* interaction with GDB */
        {"-frepo",          TOO_HARD},
+       {"-fstack-usage",   TOO_HARD},
        {"-fworking-directory", AFFECTS_CPP},
        {"-idirafter",      AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
        {"-iframework",     AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
index 5340383..02ab454 100644 (file)
@@ -102,7 +102,6 @@ hashtable_expand(struct hashtable *h)
     /* Double the size of the table to accommodate more entries */
     struct entry **newtable;
     struct entry *e;
-    struct entry **pE;
     unsigned int newsize, i, index;
     /* Check we're not hitting max capacity */
     if (h->primeindex == (prime_table_length - 1)) return 0;
@@ -128,6 +127,7 @@ hashtable_expand(struct hashtable *h)
     /* Plan B: realloc instead */
     else 
     {
+        struct entry **pE;
         newtable = (struct entry **)
                    realloc(h->table, newsize * sizeof(struct entry *));
         if (NULL == newtable) { (h->primeindex)--; return 0; }
diff --git a/test.sh b/test.sh
index 1090649..27895a9 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -3,7 +3,7 @@
 # A simple test suite for ccache.
 #
 # Copyright (C) 2002-2007 Andrew Tridgell
-# Copyright (C) 2009-2015 Joel Rosdahl
+# Copyright (C) 2009-2016 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
@@ -2411,6 +2411,59 @@ b"
 b"
 }
 
+symlinks_suite() {
+    ##################################################################
+    testname="symlink to source directory"
+
+    mkdir dir
+    cd dir
+    mkdir -p d1/d2
+    echo '#define A "OK"' >d1/h.h
+    cat <<EOF >d1/d2/c.c
+#include <stdio.h>
+#include "../h.h"
+int main() { printf("%s\n", A); }
+EOF
+    echo '#define A "BUG"' >h.h
+    ln -s d1/d2 d3
+
+    CCACHE_BASEDIR=/ $CCACHE $COMPILER -c $PWD/d3/c.c
+    $COMPILER -c $PWD/d3/c.c
+    $COMPILER c.o -o c
+    result=$(./c)
+    if [ "$result" != OK ]; then
+        test_failed "Incorrect header file used"
+    fi
+
+    cd ..
+    rm -rf dir
+
+    ##################################################################
+    testname="symlink to source file"
+
+    mkdir dir
+    cd dir
+    mkdir d
+    echo '#define A "BUG"' >d/h.h
+    cat <<EOF >d/c.c
+#include <stdio.h>
+#include "h.h"
+int main() { printf("%s\n", A); }
+EOF
+    echo '#define A "OK"' >h.h
+    ln -s d/c.c c.c
+
+    CCACHE_BASEDIR=/ $CCACHE $COMPILER -c $PWD/c.c
+    $COMPILER c.o -o c
+    result=$(./c)
+    if [ "$result" != OK ]; then
+        test_failed "Incorrect header file used"
+    fi
+
+    cd ..
+    rm -rf dir
+}
+
 ######################################################################
 # main program
 
@@ -2521,6 +2574,7 @@ readonly_direct
 extrafiles
 cleanup
 pch
+symlinks
 upgrade
 prefix
 "
index 0ccc6e5..71912ab 100644 (file)
--- a/version.c
+++ b/version.c
@@ -1 +1 @@
-const char CCACHE_VERSION[] = "3.2.5";
+const char CCACHE_VERSION[] = "3.2.6";