summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2018-08-21 22:22:38 +0200
committerJoel Rosdahl <joel@rosdahl.net>2018-08-23 22:19:06 +0200
commitec228389e6e0efeefafcd04edbad14cee2eb61c1 (patch)
treec537a9438ac7333cbb4d9da29ccc092a2a909593
parent14fcb7a13db88b14d237473e6b9cd6ca7a59f2c1 (diff)
downloadccache-ec228389e6e0efeefafcd04edbad14cee2eb61c1.tar.gz
Bail out on compiler option -save-temps=obj
Also add a test, and handle default (=cwd) Closes #299
-rw-r--r--src/compopt.c4
-rw-r--r--unittest/test_compopt.c15
2 files changed, 19 insertions, 0 deletions
diff --git a/src/compopt.c b/src/compopt.c
index 0df2bd0a..63351acb 100644
--- a/src/compopt.c
+++ b/src/compopt.c
@@ -35,6 +35,8 @@ static const struct compopt compopts[] = {
{"--output-directory", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"--param", TAKES_ARG},
{"--save-temps", TOO_HARD},
+ {"--save-temps=cwd",TOO_HARD},
+ {"--save-temps=obj",TOO_HARD},
{"--serialize-diagnostics", TAKES_ARG | TAKES_PATH},
{"-A", TAKES_ARG},
{"-B", TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
@@ -86,6 +88,8 @@ static const struct compopt compopts[] = {
{"-odir", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"-remap", AFFECTS_CPP},
{"-save-temps", TOO_HARD},
+ {"-save-temps=cwd", TOO_HARD},
+ {"-save-temps=obj", TOO_HARD},
{"-stdlib=", AFFECTS_CPP | TAKES_CONCAT_ARG},
{"-trigraphs", AFFECTS_CPP},
{"-u", TAKES_ARG | TAKES_CONCAT_ARG},
diff --git a/unittest/test_compopt.c b/unittest/test_compopt.c
index 2efda502..fb50f357 100644
--- a/unittest/test_compopt.c
+++ b/unittest/test_compopt.c
@@ -55,6 +55,21 @@ TEST(dash_MM_too_hard)
CHECK(compopt_too_hard("-MM"));
}
+TEST(dash_save_temps_too_hard)
+{
+ CHECK(compopt_too_hard("-save-temps"));
+}
+
+TEST(dash_save_temps_cwd_too_hard)
+{
+ CHECK(compopt_too_hard("-save-temps=cwd"));
+}
+
+TEST(dash_save_temps_obj_too_hard)
+{
+ CHECK(compopt_too_hard("-save-temps=obj"));
+}
+
TEST(dash_MD_not_too_hard)
{
CHECK(!compopt_too_hard("-MD"));