diff options
author | Edward Z. Yang <ezyang@fb.com> | 2017-06-30 07:35:29 -0700 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2018-01-11 21:02:33 +0100 |
commit | da4fa01e97938fd969fbe0cf616fdaeccd87d6f3 (patch) | |
tree | 72cc829b644bf223e0108c924da6a38bb7736355 | |
parent | 3f96ae31e61e2cee64fba2bf58a424f4a51abafe (diff) | |
download | ccache-da4fa01e97938fd969fbe0cf616fdaeccd87d6f3.tar.gz |
Clang emits warnings for unused linker arguments, respect that!
If ccache concludes the invocation with/without linker arguments
is the same as before, then it may show/fail to show a warning
when it should. I know we're not supposed to rely on the
is clang check, but this solves it in normal cases.
Fixes #189.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
-rw-r--r-- | ccache.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1639,19 +1639,24 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) hash_int(hash, MANIFEST_VERSION); } + // clang will emit warnings for unused linker flags, so we shouldn't + // skip those arguments + int is_clang = compiler_is_clang(args); + // First the arguments. for (int i = 1; i < args->argc; i++) { // -L doesn't affect compilation. - if (i < args->argc-1 && str_eq(args->argv[i], "-L")) { + if (i < args->argc-1 && str_eq(args->argv[i], "-L") && !is_clang) { i++; continue; } - if (str_startswith(args->argv[i], "-L")) { + if (str_startswith(args->argv[i], "-L") && !is_clang) { continue; } // -Wl,... doesn't affect compilation. - if (str_startswith(args->argv[i], "-Wl,")) { + if (str_startswith(args->argv[i], "-Wl,") && !is_clang) { + // ...but it affects warnings with clang continue; } |