]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Handle all Intel “-xCODE” compiler options correctly
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 20 May 2020 19:26:35 +0000 (21:26 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 21 Jul 2020 13:10:33 +0000 (15:10 +0200)
“CODE” in the Intel compiler’s “-xCODE” option for specifying processor
features seems to always start with an uppercase letter, and since GCC’s
language specifications always are lowercase we can just treat uppercase
codes as an ordinary compiler argument.

(cherry picked from commit a1964c685ba111ed79f6ae10e85e1e5355068ec5)

src/ccache.c

index c23d2f31a1a67fe6882dd471cd030bd64be00e3e..73509847e91df094dbadd00bc3bb50a0edc19030 100644 (file)
@@ -2892,9 +2892,13 @@ cc_process_args(struct args *args,
                        continue;
                }
 
-               if (str_eq(argv[i], "-xHost")) {
-                       // -xHost is an ordinary Intel compiler option, not a language
-                       // specification.
+               if (strlen(argv[i]) >= 3
+                   && str_startswith(argv[i], "-x")
+                   && !islower(argv[i][2])) {
+                       // -xCODE (where CODE can be e.g. Host or CORE-AVX2, always starting with
+                       // an uppercase letter) is an ordinary Intel compiler option, not a
+                       // language specification. (GCC's "-x" language argument is always
+                       // lowercase.)
                        args_add(common_args, argv[i]);
                        continue;
                }