]> granicus.if.org Git - clang/commitdiff
GCC compatibility: Ignore -fexec-charset=UTF-8 argument. It is the default in Clang...
authorSylvestre Ledru <sylvestre@debian.org>
Mon, 11 Aug 2014 18:09:03 +0000 (18:09 +0000)
committerSylvestre Ledru <sylvestre@debian.org>
Mon, 11 Aug 2014 18:09:03 +0000 (18:09 +0000)
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

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

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

index 82e6fafa23a236cfd6cbb767ea4f926d4e8847de..2e400e56b578b3bb824097943ff1e1abee858d5e 100644 (file)
@@ -481,7 +481,6 @@ def femit_all_decls : Flag<["-"], "femit-all-decls">, Group<f_Group>, Flags<[CC1
   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-calls">, Alias<fapple_kext>;
 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">;
index b6274a8fc785dbee40c0235e32c76ddb97131f6a..2a817f78638fdcd18ba4ae16c2e08060cc649e1c 100644 (file)
@@ -4177,6 +4177,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
           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))
index 1a616a8651f607b332bc346e8401a7203067aff3..30075ba975fc878df9c3bfd535eb3ad6f7bad331 100644 (file)
 // 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        \
 // 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                                      \
 // 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                                                 \