Author: sylvestre Date: Mon Aug 11 13:09:03 2014 New Revision: 215368 URL: http://llvm.org/viewvc/llvm-project?rev=215368&view=rev Log: GCC compatibility: Ignore -fexec-charset=UTF-8 argument. It is the default in Clang. Reject other values.
Summary: Just like with -finput-charset=UTF-8 in review http://reviews.llvm.org/D4347, I think we should just ignore it when UTF-8 is provided. Reviewers: rnk, rafael Reviewed By: rafael Subscribers: rafael, cfe-commits Differential Revision: http://reviews.llvm.org/D4841 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/clang_f_opts.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=215368&r1=215367&r2=215368&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 11 13:09:03 2014 @@ -481,7 +481,6 @@ def femit_all_decls : Flag<["-"], "femit HelpText<"Emit all declarations, even if unused">; def fencoding_EQ : Joined<["-"], "fencoding=">, Group<f_Group>; def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group<f_Group>, Flags<[CoreOption]>; -def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<clang_ignored_f_Group>; def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Enable support for exception handling">; def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, @@ -584,6 +583,7 @@ def : Flag<["-"], "findirect-virtual-cal def finline_functions : Flag<["-"], "finline-functions">, Group<clang_ignored_gcc_optimization_f_Group>; def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>; def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>; +def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>; def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Generate calls to instrument function entry and exit">; def flat__namespace : Flag<["-"], "flat_namespace">; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=215368&r1=215367&r2=215368&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Mon Aug 11 13:09:03 2014 @@ -4177,6 +4177,14 @@ void Clang::ConstructJob(Compilation &C, D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args) << value; } + // -fexec_charset=UTF-8 is default. Reject others + if (Arg *execCharset = Args.getLastArg( + options::OPT_fexec_charset_EQ)) { + StringRef value = execCharset->getValue(); + if (value != "UTF-8") + D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args) << value; + } + // -fcaret-diagnostics is default. if (!Args.hasFlag(options::OPT_fcaret_diagnostics, options::OPT_fno_caret_diagnostics, true)) Modified: cfe/trunk/test/Driver/clang_f_opts.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=215368&r1=215367&r2=215368&view=diff ============================================================================== --- cfe/trunk/test/Driver/clang_f_opts.c (original) +++ cfe/trunk/test/Driver/clang_f_opts.c Mon Aug 11 13:09:03 2014 @@ -139,6 +139,9 @@ // RUN: %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s // CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1' +// RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s +// CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1' + // Test that we don't error on these. // RUN: %clang -### -S -Werror \ // RUN: -falign-functions -falign-functions=2 -fno-align-functions \ @@ -151,6 +154,7 @@ // RUN: -fident -fno-ident \ // RUN: -fimplicit-templates -fno-implicit-templates \ // RUN: -finput-charset=UTF-8 \ +// RUN: -fexec-charset=UTF-8 \ // RUN: -fivopts -fno-ivopts \ // RUN: -fnon-call-exceptions -fno-non-call-exceptions \ // RUN: -fpermissive -fno-permissive \ @@ -219,7 +223,6 @@ // RUN: -ffriend-injection \ // RUN: -fno-implement-inlines -fimplement-inlines \ // RUN: -fstack-check \ -// RUN: -fexec-charset=UTF-8 \ // RUN: -fforce-addr \ // RUN: -malign-functions=100 \ // RUN: -malign-loops=100 \ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
