]> granicus.if.org Git - clang/commitdiff
GCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default in Clang.
authorSylvestre Ledru <sylvestre@debian.org>
Tue, 1 Jul 2014 17:24:27 +0000 (17:24 +0000)
committerSylvestre Ledru <sylvestre@debian.org>
Tue, 1 Jul 2014 17:24:27 +0000 (17:24 +0000)
Currently, we fail with an error.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rnk, cfe-commits

Differential Revision: http://reviews.llvm.org/D4347

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212110 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Driver/Tools.cpp
test/Driver/clang_f_opts.c

index 95f13cc384532c0bece9123396c4fc76b392c7aa..396b02fc67f3dc71e9e7ba4e15a1f5fbee2a1d3c 100644 (file)
@@ -559,6 +559,7 @@ def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>;
 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>;
index c7211686e942787345f3e6c81042e547e1adee74..823816791821ad325410d8856f0481ebb7c9a0de 100644 (file)
@@ -3911,6 +3911,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     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))
index c88ced05ac35f5ca7be6221a016a5159b2f82a41..664ee8a3a4f1a5965aef37af24604f007b7ca1f0 100644 (file)
 // 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        \
 // 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                                      \