]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Merge branch 'maint'
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 8 Aug 2013 20:47:43 +0000 (22:47 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 8 Aug 2013 20:47:43 +0000 (22:47 +0200)
* maint:
  Bail out on option -gsplit-dwarf which produces multiple output files
  Treat zero length object files as invalid
  Fix path canonicalization in make_relative_path when path doesn't exist
  Handle some dirname() special cases as expected
  Correct make_relative_path comment

Conflicts:
ccache.c
compopt.c
test/test_argument_processing.c
test/test_util.c

1  2 
ccache.c
compopt.c
test/test_argument_processing.c
test/test_util.c
util.c

diff --cc ccache.c
index 377bfa1d73ce6364155678dbc0ef532f653c51aa,b20c087bcdd19d07eb586bdcc910fdb73af36add..77590359c5af366ccb5b9930635843159fc11547
+++ b/ccache.c
@@@ -441,9 -387,10 +441,10 @@@ ignore
  static char *
  make_relative_path(char *path)
  {
-       char *relpath, *canon_path;
+       char *relpath, *canon_path, *path_suffix = NULL;
+       struct stat st;
  
 -      if (!base_dir || !str_startswith(path, base_dir)) {
 +      if (str_eq(conf->base_dir, "") || !str_startswith(path, conf->base_dir)) {
                return path;
        }
  
@@@ -1289,12 -1105,16 +1317,22 @@@ from_cache(enum fromcache_call_mode mod
                return;
        }
  
 +      /* Check if the diagnostic file is there. */
 +      if (output_dia && stat(cached_dia, &st) != 0) {
 +              cc_log("Diagnostic file %s not in cache", cached_dia);
 +              return;
 +      }
 +
+       /*
+        * Occasionally, e.g. on hard reset, our cache ends up as just filesystem
+        * meta-data with no content catch an easy case of this.
+        */
+       if (st.st_size == 0) {
+               cc_log("Invalid (empty) object file %s in cache", cached_obj);
+               x_unlink(cached_obj);
+               return;
+       }
        /*
         * (If mode != FROMCACHE_DIRECT_MODE, the dependency file is created by
         * gcc.)
diff --cc compopt.c
index ebe07576089c3b735595ce04c7b08b8d949e577b,2417726b79afdcf379f443e449a7c82283719e63..1996fdfc36d25c912b6e62723bd014f6d6b784a8
+++ b/compopt.c
@@@ -1,5 -1,5 +1,5 @@@
  /*
-  * Copyright (C) 2010, 2012 Joel Rosdahl
 - * Copyright (C) 2010, 2013 Joel Rosdahl
++ * Copyright (C) 2010, 2012-2013 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
@@@ -52,14 -51,16 +52,15 @@@ static const struct compopt compopts[] 
        {"-Xassembler",     TAKES_ARG},
        {"-Xclang",         TAKES_ARG},
        {"-Xlinker",        TAKES_ARG},
 -      {"-Xpreprocessor",  TOO_HARD_DIRECT | TAKES_ARG},
 +      {"-Xpreprocessor",  AFFECTS_CPP | TOO_HARD_DIRECT | TAKES_ARG},
 +      {"-arch",           TAKES_ARG},
        {"-aux-info",       TAKES_ARG},
        {"-b",              TAKES_ARG},
 -      {"-fbranch-probabilities", TOO_HARD},
 -      {"-fprofile-arcs",  TOO_HARD},
 -      {"-fprofile-generate", TOO_HARD},
 -      {"-fprofile-use",   TOO_HARD},
 +      {"-fno-working-directory", AFFECTS_CPP},
        {"-frepo",          TOO_HARD},
 -      {"-ftest-coverage", TOO_HARD},
 -      {"-gsplit-dwarf",   TOO_HARD},
 +      {"-ftest-coverage", TOO_HARD}, /* generates a .gcno file at the same time */
 +      {"-fworking-directory", AFFECTS_CPP},
++      {"-gsplit-dwarf",   TOO_HARD}, /* generates a .dwo file at the same time */
        {"-idirafter",      AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
        {"-iframework",     AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
        {"-imacros",        AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
index 8ae128f36a1c2da50f8f349f1453fd87cb725d14,6ed0daa8ea01f3792e9ce477916159419c7ea9ea..e0a44794908022a7afee89d1c116fb074e031aa4
@@@ -114,26 -88,25 +114,24 @@@ TEST(dependency_flags_that_take_an_argu
  
  TEST(sysroot_should_be_rewritten_if_basedir_is_used)
  {
 -      extern char *base_dir;
        extern char *current_working_dir;
-       struct args *orig =
-               args_init_from_string("cc --sysroot=/some/directory -c foo.c");
+       char *arg_string;
+       struct args *orig;
        struct args *act_cpp = NULL, *act_cc = NULL;
-       create_file("foo.c", "");
-       CHECK(cc_process_args(orig, &act_cpp, &act_cc));
-       CHECK_STR_EQ("--sysroot=/some/directory", act_cpp->argv[1]);
-       args_free(act_cpp);
-       args_free(act_cc);
-       cc_reset();
  
-       conf->base_dir = x_strdup("/some");
+       create_file("foo.c", "");
 +      free(conf->base_dir);
++      conf->base_dir = x_strdup("/");
        current_working_dir = get_cwd();
 -      base_dir = "/";
 -
+       arg_string = format("cc --sysroot=%s/foo -c foo.c", current_working_dir);
+       orig = args_init_from_string(arg_string);
        CHECK(cc_process_args(orig, &act_cpp, &act_cc));
-       CHECK(str_startswith(act_cpp->argv[1], "--sysroot=../"));
+       CHECK(str_startswith(act_cpp->argv[1], "--sysroot=./foo"));
        args_free(orig);
 -      base_dir = NULL;
 -      current_working_dir = NULL;
 +      args_free(act_cpp);
 +      args_free(act_cc);
  }
  
  TEST(MF_flag_with_immediate_argument_should_work_as_last_argument)
index 0ad51d2e496c452c3b1bef8052685ff9405b4cff,afa457ae6e46c865fb790b215e7fb1040a38175a..a0df1eaa4a688c078472cfbdb307bf52aea8a561
@@@ -1,5 -1,5 +1,5 @@@
  /*
-  * Copyright (C) 2010-2012 Joel Rosdahl
 - * Copyright (C) 2010, 2012-2013 Joel Rosdahl
++ * Copyright (C) 2010-2013 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
diff --cc util.c
Simple merge