]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Merge branch 'maint'
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Aug 2014 12:31:51 +0000 (14:31 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Aug 2014 12:31:51 +0000 (14:31 +0200)
* maint:
  Require CCACHE_SLOPPINESS=pch_defines when creating precompiled header

Conflicts:
ccache.c
test.sh

1  2 
ccache.c
test.sh

diff --cc ccache.c
index 2bd7f55cb02cc1e6a2760d8449a4f99227228d70,f0dca22c7fc76b76ba716c3268241b328c6de5ef..e23af937ab24f87520b183a55d3d61f2cc06bf88
+++ b/ccache.c
@@@ -2169,10 -1758,9 +2169,9 @@@ cc_process_args(struct args *args, stru
  
        if (found_pch || found_fpch_preprocess) {
                using_precompiled_header = true;
-               if (!(conf->sloppiness & SLOPPY_PCH_DEFINES)
-                   || !(conf->sloppiness & SLOPPY_TIME_MACROS)) {
 -              if (!(sloppiness & SLOPPY_TIME_MACROS)) {
 -                      cc_log("You have to specify \"pch_defines,time_macros\" sloppiness when"
 -                             " using precompiled headers to get direct hits");
++              if (!(conf->sloppiness & SLOPPY_TIME_MACROS)) {
 +                      cc_log("You have to specify \"time_macros\" sloppiness when using"
 +                             " precompiled headers to get direct hits");
                        cc_log("Disabling direct mode");
                        stats_update(STATS_CANTUSEPCH);
                        result = false;
        }
  
        output_is_precompiled_header =
 -              actual_language && strstr(actual_language, "-header") != NULL;
 +              actual_language && strstr(actual_language, "-header");
  
 -      if (output_is_precompiled_header && !(sloppiness & SLOPPY_PCH_DEFINES)) {
++      if (output_is_precompiled_header && !(conf->sloppiness & SLOPPY_PCH_DEFINES)) {
+               cc_log("You have to specify \"pch_defines,time_macros\" sloppiness when"
+                      " creating precompiled headers");
+               stats_update(STATS_CANTUSEPCH);
+               result = false;
+               goto out;
+       }
        if (!found_c_opt) {
                if (output_is_precompiled_header) {
                        args_add(stripped_args, "-c");
diff --cc test.sh
index 51b9c882288932ef324f85cef867cfeaf29c9761,4cad450d2c2727add3c68c4fd61e77cf01fe751e..da0b2f108891ac34f5ac3f69148b48c8dc782921
+++ b/test.sh
          return
      fi
  
 +    # clang and gcc handle precompiled headers similarly, but gcc is much more
 +    # forgiving with precompiled headers. Both gcc and clang keep an absolute
 +    # path reference to the original file except that clang uses that reference
 +    # to validate the pch and gcc ignores the reference. Also, clang has an
 +    # additional feature: pre-tokenized headers. For these reasons clang should
 +    # be tested separately than gcc. clang can only use pch or pth headers on
 +    # the command line and not as an #include statement inside a source file.
 +
 +    if [ $COMPILER_TYPE_CLANG -eq 1 ]; then
 +        clang_pch_suite
 +    else
 +        gcc_pch_suite
 +    fi
 +}
 +
 +gcc_pch_suite() {
      ##################################################################
-     # Tests for creating a .gch.
+     # Tests for creating a .gch without opt-in.
  
      backdate pch.h
  
-     testname="create .gch, -c, no -o"
+     testname="create .gch, -c, no -o, without opt-in"
      $CCACHE -zC >/dev/null
 -    $CCACHE $COMPILER -c pch.h
 +    $CCACHE $COMPILER $SYSROOT -c pch.h
      checkstat 'cache hit (direct)' 0
      checkstat 'cache hit (preprocessed)' 0
 -    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c pch.h
+     checkstat 'cache miss' 0
+     checkstat "can't use precompiled header" 1
+     testname="create .gch, no -c, -o, without opt-in"
+     $CCACHE -Cz >/dev/null
+     $CCACHE $COMPILER pch.h -o pch.gch
+     checkstat 'cache hit (direct)' 0
+     checkstat 'cache hit (preprocessed)' 0
+     checkstat 'cache miss' 0
+     checkstat "can't use precompiled header" 1
+     ##################################################################
+     # Tests for creating a .gch with opt-in.
+     backdate pch.h
+     testname="create .gch, -c, no -o, with opt-in"
+     $CCACHE -zC >/dev/null
++    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT -c pch.h
+     checkstat 'cache hit (direct)' 0
+     checkstat 'cache hit (preprocessed)' 0
      checkstat 'cache miss' 1
      rm -f pch.h.gch
-     $CCACHE $COMPILER $SYSROOT -c pch.h
 -    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c pch.h
++    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT -c pch.h
      checkstat 'cache hit (direct)' 1
      checkstat 'cache hit (preprocessed)' 0
      checkstat 'cache miss' 1
          test_failed "pch.h.gch missing"
      fi
  
-     testname="create .gch, no -c, -o"
+     testname="create .gch, no -c, -o, with opt-in"
      $CCACHE -Cz >/dev/null
-     $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
 -    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER pch.h -o pch.gch
++    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
      checkstat 'cache hit (direct)' 0
      checkstat 'cache hit (preprocessed)' 0
      checkstat 'cache miss' 1
-     $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
 -    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER pch.h -o pch.gch
++    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
      checkstat 'cache hit (direct)' 1
      checkstat 'cache hit (preprocessed)' 0
      checkstat 'cache miss' 1