tbaeder updated this revision to Diff 316115. tbaeder added a comment. Okay, I've added a test and made sure it fails before and succeeds after this patch.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93375/new/ https://reviews.llvm.org/D93375 Files: clang/include/clang/Driver/Options.td clang/test/Driver/ansi.c Index: clang/test/Driver/ansi.c =================================================================== --- /dev/null +++ clang/test/Driver/ansi.c @@ -0,0 +1,19 @@ +// Check that -std=c89 and -ansi are both not forwarded to the linker +// RUN: %clang -std=c89 %s -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK %s +// CHECK: -std=c89 +// CHECK-NOT: -std=c89 + +// Same check with -ansi (which is an alias for -std=c89) +// RUN: %clang -ansi %s -### -o %t.o 2>&1 | FileCheck --check-prefix=ANSI %s +// ANSI: -std=c89 +// ANSI-NOT: -ansi + +// Passing -std to linking and compiling is both valid +// RUN: %clang -std=c89 %s -c -o %t1.o && %clang %t1.o -Werror -std=c89 -o %t1 + +// Same for -ansi +// RUN: %clang -ansi %s -c -o %t2.o && %clang %t2.o -Werror -ansi -o %t1 + +int main(int argc, char **argv) +{ +} Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -800,7 +800,7 @@ def Z_Joined : Joined<["-"], "Z">; def all__load : Flag<["-"], "all_load">; def allowable__client : Separate<["-"], "allowable_client">; -def ansi : Flag<["-", "--"], "ansi">; +def ansi : Flag<["-", "--"], "ansi">, Group<CompileOnly_Group>; def arch__errors__fatal : Flag<["-"], "arch_errors_fatal">; def arch : Separate<["-"], "arch">, Flags<[NoXarchOption]>; def arch__only : Separate<["-"], "arch_only">;
Index: clang/test/Driver/ansi.c =================================================================== --- /dev/null +++ clang/test/Driver/ansi.c @@ -0,0 +1,19 @@ +// Check that -std=c89 and -ansi are both not forwarded to the linker +// RUN: %clang -std=c89 %s -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK %s +// CHECK: -std=c89 +// CHECK-NOT: -std=c89 + +// Same check with -ansi (which is an alias for -std=c89) +// RUN: %clang -ansi %s -### -o %t.o 2>&1 | FileCheck --check-prefix=ANSI %s +// ANSI: -std=c89 +// ANSI-NOT: -ansi + +// Passing -std to linking and compiling is both valid +// RUN: %clang -std=c89 %s -c -o %t1.o && %clang %t1.o -Werror -std=c89 -o %t1 + +// Same for -ansi +// RUN: %clang -ansi %s -c -o %t2.o && %clang %t2.o -Werror -ansi -o %t1 + +int main(int argc, char **argv) +{ +} Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -800,7 +800,7 @@ def Z_Joined : Joined<["-"], "Z">; def all__load : Flag<["-"], "all_load">; def allowable__client : Separate<["-"], "allowable_client">; -def ansi : Flag<["-", "--"], "ansi">; +def ansi : Flag<["-", "--"], "ansi">, Group<CompileOnly_Group>; def arch__errors__fatal : Flag<["-"], "arch_errors_fatal">; def arch : Separate<["-"], "arch">, Flags<[NoXarchOption]>; def arch__only : Separate<["-"], "arch_only">;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits