From: Joel Rosdahl Date: Thu, 8 Aug 2013 20:47:43 +0000 (+0200) Subject: Merge branch 'maint' X-Git-Tag: v3.2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e623ec9d902f0b55f9d0d575751099415026833;p=thirdparty%2Fccache.git Merge branch 'maint' * 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 --- 6e623ec9d902f0b55f9d0d575751099415026833 diff --cc ccache.c index 377bfa1d7,b20c087bc..77590359c --- a/ccache.c +++ 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 ebe075760,2417726b7..1996fdfc3 --- a/compopt.c +++ 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}, diff --cc test/test_argument_processing.c index 8ae128f36,6ed0daa8e..e0a447949 --- a/test/test_argument_processing.c +++ b/test/test_argument_processing.c @@@ -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(); + create_file("foo.c", ""); + free(conf->base_dir); - conf->base_dir = x_strdup("/some"); ++ conf->base_dir = x_strdup("/"); current_working_dir = get_cwd(); + arg_string = format("cc --sysroot=%s/foo -c foo.c", current_working_dir); + orig = args_init_from_string(arg_string); + - base_dir = "/"; - 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) diff --cc test/test_util.c index 0ad51d2e4,afa457ae6..a0df1eaa4 --- a/test/test_util.c +++ b/test/test_util.c @@@ -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