From: Chad Rosier Date: Fri, 26 Aug 2011 18:30:43 +0000 (+0000) Subject: [driver] Remove a few more options when clang invokes cc1plus for i386 kexts. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=807179763b87a24de26b3c89e7ae9e898bab420c;p=clang [driver] Remove a few more options when clang invokes cc1plus for i386 kexts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138637 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9e06f20561..d91285b0a8 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2460,103 +2460,121 @@ void darwin::CC1::RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const { it != ie;) { StringRef Option = *it; + bool RemoveOption = false; - // We only remove warning options. - if (!Option.startswith("-W")) { - ++it; + // Remove -faltivec + if (Option.equals("-faltivec")) { + it = CmdArgs.erase(it); + ie = CmdArgs.end(); continue; } - if (Option.startswith("-Wno-")) - Option = Option.substr(5); - else - Option = Option.substr(2); - - bool RemoveOption = llvm::StringSwitch(Option) - .Case("address-of-temporary", true) - .Case("ambiguous-member-template", true) - .Case("analyzer-incompatible-plugin", true) - .Case("array-bounds", true) - .Case("array-bounds-pointer-arithmetic", true) - .Case("bind-to-temporary-copy", true) - .Case("bitwise-op-parentheses", true) - .Case("bool-conversions", true) - .Case("builtin-macro-redefined", true) - .Case("c++-hex-floats", true) - .Case("c++0x-compat", true) - .Case("c++0x-extensions", true) - .Case("c++0x-narrowing", true) - .Case("c++0x-static-nonintegral-init", true) - .Case("conditional-uninitialized", true) - .Case("constant-conversion", true) - .Case("CFString-literal", true) - .Case("constant-logical-operand", true) - .Case("custom-atomic-properties", true) - .Case("default-arg-special-member", true) - .Case("delegating-ctor-cycles", true) - .Case("delete-non-virtual-dtor", true) - .Case("deprecated-implementations", true) - .Case("deprecated-writable-strings", true) - .Case("distributed-object-modifiers", true) - .Case("duplicate-method-arg", true) - .Case("dynamic-class-memaccess", true) - .Case("enum-compare", true) - .Case("exit-time-destructors", true) - .Case("gnu", true) - .Case("gnu-designator", true) - .Case("header-hygiene", true) - .Case("idiomatic-parentheses", true) - .Case("ignored-qualifiers", true) - .Case("implicit-atomic-properties", true) - .Case("incompatible-pointer-types", true) - .Case("incomplete-implementation", true) - .Case("initializer-overrides", true) - .Case("invalid-noreturn", true) - .Case("invalid-token-paste", true) - .Case("literal-conversion", true) - .Case("literal-range", true) - .Case("local-type-template-args", true) - .Case("logical-op-parentheses", true) - .Case("method-signatures", true) - .Case("microsoft", true) - .Case("mismatched-tags", true) - .Case("missing-method-return-type", true) - .Case("non-pod-varargs", true) - .Case("nonfragile-abi2", true) - .Case("null-arithmetic", true) - .Case("null-dereference", true) - .Case("out-of-line-declaration", true) - .Case("overriding-method-mismatch", true) - .Case("readonly-setter-attrs", true) - .Case("return-stack-address", true) - .Case("self-assign", true) - .Case("semicolon-before-method-body", true) - .Case("sentinel", true) - .Case("shift-overflow", true) - .Case("shift-sign-overflow", true) - .Case("sign-conversion", true) - .Case("sizeof-array-argument", true) - .Case("sizeof-pointer-memaccess", true) - .Case("string-compare", true) - .Case("super-class-method-mismatch", true) - .Case("tautological-compare", true) - .Case("typedef-redefinition", true) - .Case("typename-missing", true) - .Case("undefined-reinterpret-cast", true) - .Case("unknown-warning-option", true) - .Case("unnamed-type-template-args", true) - .Case("unneeded-internal-declaration", true) - .Case("unneeded-member-function", true) - .Case("unused-comparison", true) - .Case("unused-exception-parameter", true) - .Case("unused-member-function", true) - .Case("unused-result", true) - .Case("vector-conversions", true) - .Case("vla", true) - .Case("used-but-marked-unused", true) - .Case("weak-vtables", true) - .Default(false); - + // Handle machine specific options. + if (Option.startswith("-m")) { + RemoveOption = llvm::StringSwitch(Option) + .Case("-mthumb", true) + .Case("-mno-thumb", true) + .Case("-mno-fused-madd", true) + .Case("-mlong-branch", true) + .Case("-mlongcall", true) + .Case("-mcpu=G4", true) + .Case("-mcpu=G5", true) + .Default(false); + } + + // Handle warning options. + if (Option.startswith("-W")) { + // Remove -W/-Wno- to reduce the number of cases. + if (Option.startswith("-Wno-")) + Option = Option.substr(5); + else + Option = Option.substr(2); + + RemoveOption = llvm::StringSwitch(Option) + .Case("address-of-temporary", true) + .Case("ambiguous-member-template", true) + .Case("analyzer-incompatible-plugin", true) + .Case("array-bounds", true) + .Case("array-bounds-pointer-arithmetic", true) + .Case("bind-to-temporary-copy", true) + .Case("bitwise-op-parentheses", true) + .Case("bool-conversions", true) + .Case("builtin-macro-redefined", true) + .Case("c++-hex-floats", true) + .Case("c++0x-compat", true) + .Case("c++0x-extensions", true) + .Case("c++0x-narrowing", true) + .Case("c++0x-static-nonintegral-init", true) + .Case("conditional-uninitialized", true) + .Case("constant-conversion", true) + .Case("CFString-literal", true) + .Case("constant-logical-operand", true) + .Case("custom-atomic-properties", true) + .Case("default-arg-special-member", true) + .Case("delegating-ctor-cycles", true) + .Case("delete-non-virtual-dtor", true) + .Case("deprecated-implementations", true) + .Case("deprecated-writable-strings", true) + .Case("distributed-object-modifiers", true) + .Case("duplicate-method-arg", true) + .Case("dynamic-class-memaccess", true) + .Case("enum-compare", true) + .Case("exit-time-destructors", true) + .Case("gnu", true) + .Case("gnu-designator", true) + .Case("header-hygiene", true) + .Case("idiomatic-parentheses", true) + .Case("ignored-qualifiers", true) + .Case("implicit-atomic-properties", true) + .Case("incompatible-pointer-types", true) + .Case("incomplete-implementation", true) + .Case("initializer-overrides", true) + .Case("invalid-noreturn", true) + .Case("invalid-token-paste", true) + .Case("literal-conversion", true) + .Case("literal-range", true) + .Case("local-type-template-args", true) + .Case("logical-op-parentheses", true) + .Case("method-signatures", true) + .Case("microsoft", true) + .Case("mismatched-tags", true) + .Case("missing-method-return-type", true) + .Case("non-pod-varargs", true) + .Case("nonfragile-abi2", true) + .Case("null-arithmetic", true) + .Case("null-dereference", true) + .Case("out-of-line-declaration", true) + .Case("overriding-method-mismatch", true) + .Case("readonly-setter-attrs", true) + .Case("return-stack-address", true) + .Case("self-assign", true) + .Case("semicolon-before-method-body", true) + .Case("sentinel", true) + .Case("shift-overflow", true) + .Case("shift-sign-overflow", true) + .Case("sign-conversion", true) + .Case("sizeof-array-argument", true) + .Case("sizeof-pointer-memaccess", true) + .Case("string-compare", true) + .Case("super-class-method-mismatch", true) + .Case("tautological-compare", true) + .Case("typedef-redefinition", true) + .Case("typename-missing", true) + .Case("undefined-reinterpret-cast", true) + .Case("unknown-warning-option", true) + .Case("unnamed-type-template-args", true) + .Case("unneeded-internal-declaration", true) + .Case("unneeded-member-function", true) + .Case("unused-comparison", true) + .Case("unused-exception-parameter", true) + .Case("unused-member-function", true) + .Case("unused-result", true) + .Case("vector-conversions", true) + .Case("vla", true) + .Case("used-but-marked-unused", true) + .Case("weak-vtables", true) + .Default(false); + } // if (Option.startswith("-W")) if (RemoveOption) { it = CmdArgs.erase(it); ie = CmdArgs.end(); diff --git a/test/Driver/apple-kext-i386.cpp b/test/Driver/apple-kext-i386.cpp index 80c8bfca44..aebe33f9d0 100644 --- a/test/Driver/apple-kext-i386.cpp +++ b/test/Driver/apple-kext-i386.cpp @@ -16,8 +16,8 @@ // CHECK-MKERNEL: "-mkernel" // RUN: %clang -ccc-host-triple i386-apple-darwin10 \ -// RUN: -Wno-self-assign -Wc++0x-extensions \ -// RUN: -Wno-microsoft -Wmicrosoft \ +// RUN: -Wno-self-assign -Wc++0x-extensions -Wno-microsoft -Wmicrosoft -Wvla \ +// RUN: -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \ // RUN: -fapple-kext -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s @@ -26,3 +26,10 @@ // CHECK-UNSUPPORTED-NOT: "-Wc++0x-extensions" // CHECK-UNSUPPORTED-NOT: "-Wno-microsoft" // CHECK-UNSUPPORTED-NOT: "-Wmicrosoft" +// CHECK-UNSUPPORTED-NOT: "-Wvla" +// CHECK-UNSUPPORTED-NOT: "-faltivec" +// CHECK-UNSUPPORTED-NOT: "-mthumb" +// CHECK-UNSUPPORTED-NOT: "-mlongcall" +// CHECK-UNSUPPORTED: "-mno-longcall" +// CHECK-UNSUPPORTED: "-msoft-float" +