From 30fdd670b20cd57a96c8140a29752d022e51e1c6 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 20 May 2019 21:25:27 +0200 Subject: Tweak formatting of manual text and code comments --- doc/MANUAL.adoc | 18 ++++++++++-------- src/ccache.c | 6 +++--- test/suites/pch.bash | 32 ++++++++++++++++++-------------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/doc/MANUAL.adoc b/doc/MANUAL.adoc index a62d6870..20f048b1 100644 --- a/doc/MANUAL.adoc +++ b/doc/MANUAL.adoc @@ -943,9 +943,10 @@ Disadvantages: or source code will make the hash different. Compare this with the default setup where ccache will fall back to the preprocessor mode, which is tolerant to some types of changes of compiler options and source code changes. -* (If -MD is used) The manifest entries will include system header files as well, - thus slowing down cache hits slightly, just as using -MD slows down make. -* (If -MMD is used) The manifest entries will not include system header files, +* If -MD is used, the manifest entries will include system header files as + well, thus slowing down cache hits slightly, just as using -MD slows down + make. +* If -MMD is used, the manifest entries will not include system header files, which means ccache will ignore changes in them. The depend mode will be disabled if any of the following holds: @@ -1059,13 +1060,14 @@ things to make it work properly: * You must either: + -- -** use the *-include* compiler option to include the precompiled header - (i.e., don't use *#include* in the source code to include the header), - the filename itself must be sufficient to find the header (i.e. -I paths - are not searched); or +** use the *-include* compiler option to include the precompiled header (i.e., + don't use *#include* in the source code to include the header; the filename + itself must be sufficient to find the header, i.e. *-I* paths are not + searched); or ** (for the Clang compiler) use the *-include-pch* compiler option to include the PCH file generated from the precompiled header; or -** (for the GCC compiler) add the *-fpch-preprocess* compiler option when compiling. +** (for the GCC compiler) add the *-fpch-preprocess* compiler option when + compiling. If you don't do this, either the non-precompiled version of the header file will be used (if available) or ccache will fall back to running the real diff --git a/src/ccache.c b/src/ccache.c index 7c3b8364..67e5f182 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -1035,7 +1035,7 @@ process_preprocessed_file(struct hash *hash, const char *path, bool pump) free(data); free(cwd); - // Explicitly check the .gch/.pch/.pth file, Clang does not include any + // Explicitly check the .gch/.pch/.pth file as Clang does not include any // mention of it in the preprocessed output. if (included_pch_file) { char *pch_path = x_strdup(included_pch_file); @@ -1165,8 +1165,8 @@ object_hash_from_depfile(const char *depfile, struct hash *hash) fclose(f); - // Explicitly check the .gch/.pch/.pth file, it may not be mentioned - // in the dependencies output. + // Explicitly check the .gch/.pch/.pth file as it may not be mentioned in the + // dependencies output. if (included_pch_file) { char *pch_path = x_strdup(included_pch_file); pch_path = make_relative_path(pch_path); diff --git a/test/suites/pch.bash b/test/suites/pch.bash index 0f365623..caf82c45 100644 --- a/test/suites/pch.bash +++ b/test/suites/pch.bash @@ -33,16 +33,18 @@ EOF SUITE_pch() { # Clang should generally be compatible with GCC and so most of the tests # can be shared. There are some differences though: - # - Both GCC and Clang keep an absolute path reference to the original - # file except that Clang uses that reference to validate the pch and GCC - # ignores the reference (i.e. the original file can be removed). - # - Clang can only use pch headers on the command line and not as an #include - # statement inside a source file, because it silently ignores -fpch-preprocess - # and does not output pragma GCC pch_preprocess. + # + # - Both GCC and Clang keep an absolute path reference to the original file + # except that Clang uses that reference to validate the pch and GCC + # ignores the reference (i.e. the original file can be removed). + # - Clang can only use pch headers on the command line and not as an + # #include statement inside a source file, because it silently ignores + # -fpch-preprocess and does not output pragma GCC pch_preprocess. # - Clang has -include-pch to directly include a PCH file without any magic - # of searching for a .gch file. + # of searching for a .gch file. # - # Therefore have common tests and do dedicated tests only for differences. + # Put tests that work with both compilers in pch_suite_common and put + # compiler-specific tests in pch_suite_clang/pch_suite_gcc. pch_suite_common if $COMPILER_TYPE_CLANG; then @@ -254,9 +256,10 @@ pch_suite_common() { expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 2 - # With GCC, a newly generated PCH is always different, even if the contents should be exactly the same. - # And Clang stores file timestamps, so in this case the PCH is different too. - # So without .sum a "changed" PCH would mean a miss, but if the .sum doesn't change, it should be a hit. + # With GCC, a newly generated PCH is always different, even if the contents + # should be exactly the same. And Clang stores file timestamps, so in this + # case the PCH is different too. So without .sum a "changed" PCH would mean + # a miss, but if the .sum doesn't change, it should be a hit. sleep 1 touch pch.h @@ -560,9 +563,10 @@ pch_suite_gcc() { expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 2 - # With GCC, a newly generated PCH is always different, even if the contents should be exactly the same. - # And Clang stores file timestamps, so in this case the PCH is different too. - # So without .sum a "changed" PCH would mean a miss, but if the .sum doesn't change, it should be a hit. + # With GCC, a newly generated PCH is always different, even if the contents + # should be exactly the same. And Clang stores file timestamps, so in this + # case the PCH is different too. So without .sum a "changed" PCH would mean + # a miss, but if the .sum doesn't change, it should be a hit. sleep 1 touch pch.h -- cgit v1.2.1