r212110 - GCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default in Clang.
Sylvestre Ledru
sylvestre at debian.org
Tue Jul 1 10:24:27 PDT 2014
Author: sylvestre
Date: Tue Jul 1 12:24:27 2014
New Revision: 212110
URL: http://llvm.org/viewvc/llvm-project?rev=212110&view=rev
Log:
GCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default in Clang.
Currently, we fail with an error.
Reviewers: rafael
Reviewed By: rafael
Subscribers: rnk, cfe-commits
Differential Revision: http://reviews.llvm.org/D4347
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=212110&r1=212109&r2=212110&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jul 1 12:24:27 2014
@@ -559,6 +559,7 @@ def filelist : Separate<["-"], "filelist
def : Flag<["-"], "findirect-virtual-calls">, Alias<fapple_kext>;
def finline_functions : Flag<["-"], "finline-functions">, Group<clang_ignored_f_Group>;
def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
+def finput_charset_EQ : Joined<["-"], "finput-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 : Flag<["-"], "fkeep-inline-functions">, Group<clang_ignored_f_Group>;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=212110&r1=212109&r2=212110&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 1 12:24:27 2014
@@ -3911,6 +3911,14 @@ void Clang::ConstructJob(Compilation &C,
D.Diag(diag::err_drv_clang_unsupported)
<< Args.getLastArg(options::OPT_fno_for_scope)->getAsString(Args);
+ // -finput_charset=UTF-8 is default. Reject others
+ if (Arg *inputCharset = Args.getLastArg(
+ options::OPT_finput_charset_EQ)) {
+ StringRef value = inputCharset->getValue();
+ if (value != "UTF-8")
+ D.Diag(diag::err_drv_invalid_value) << inputCharset->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=212110&r1=212109&r2=212110&view=diff
==============================================================================
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Tue Jul 1 12:24:27 2014
@@ -129,6 +129,9 @@
// RUN: %clang -S -O20 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s
// CHECK-INVALID-O: warning: optimization level '-O20' is unsupported; using '-O3' instead
+// 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'
+
// Test that we don't error on these.
// RUN: %clang -### -S -Werror \
// RUN: -falign-functions -falign-functions=2 -fno-align-functions \
@@ -140,6 +143,7 @@
// RUN: -fgcse -fno-gcse \
// RUN: -fident -fno-ident \
// RUN: -fimplicit-templates -fno-implicit-templates \
+// RUN: -finput-charset=UTF-8 \
// RUN: -fivopts -fno-ivopts \
// RUN: -fnon-call-exceptions -fno-non-call-exceptions \
// RUN: -fpermissive -fno-permissive \
More information about the cfe-commits
mailing list