Skip to content

Commit b8198f0

Browse files
committedAug 11, 2014
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 llvm-svn: 215368
1 parent f610289 commit b8198f0

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed
 

‎clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ def femit_all_decls : Flag<["-"], "femit-all-decls">, Group<f_Group>, Flags<[CC1
481481
HelpText<"Emit all declarations, even if unused">;
482482
def fencoding_EQ : Joined<["-"], "fencoding=">, Group<f_Group>;
483483
def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group<f_Group>, Flags<[CoreOption]>;
484-
def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<clang_ignored_f_Group>;
485484
def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option]>,
486485
HelpText<"Enable support for exception handling">;
487486
def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
@@ -584,6 +583,7 @@ def : Flag<["-"], "findirect-virtual-calls">, Alias<fapple_kext>;
584583
def finline_functions : Flag<["-"], "finline-functions">, Group<clang_ignored_gcc_optimization_f_Group>;
585584
def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
586585
def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>;
586+
def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>;
587587
def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>,
588588
HelpText<"Generate calls to instrument function entry and exit">;
589589
def flat__namespace : Flag<["-"], "flat_namespace">;

‎clang/lib/Driver/Tools.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4177,6 +4177,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41774177
D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args) << value;
41784178
}
41794179

4180+
// -fexec_charset=UTF-8 is default. Reject others
4181+
if (Arg *execCharset = Args.getLastArg(
4182+
options::OPT_fexec_charset_EQ)) {
4183+
StringRef value = execCharset->getValue();
4184+
if (value != "UTF-8")
4185+
D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args) << value;
4186+
}
4187+
41804188
// -fcaret-diagnostics is default.
41814189
if (!Args.hasFlag(options::OPT_fcaret_diagnostics,
41824190
options::OPT_fno_caret_diagnostics, true))

‎clang/test/Driver/clang_f_opts.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@
139139
// RUN: %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s
140140
// CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1'
141141

142+
// RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
143+
// CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1'
144+
142145
// Test that we don't error on these.
143146
// RUN: %clang -### -S -Werror \
144147
// RUN: -falign-functions -falign-functions=2 -fno-align-functions \
@@ -151,6 +154,7 @@
151154
// RUN: -fident -fno-ident \
152155
// RUN: -fimplicit-templates -fno-implicit-templates \
153156
// RUN: -finput-charset=UTF-8 \
157+
// RUN: -fexec-charset=UTF-8 \
154158
// RUN: -fivopts -fno-ivopts \
155159
// RUN: -fnon-call-exceptions -fno-non-call-exceptions \
156160
// RUN: -fpermissive -fno-permissive \
@@ -219,7 +223,6 @@
219223
// RUN: -ffriend-injection \
220224
// RUN: -fno-implement-inlines -fimplement-inlines \
221225
// RUN: -fstack-check \
222-
// RUN: -fexec-charset=UTF-8 \
223226
// RUN: -fforce-addr \
224227
// RUN: -malign-functions=100 \
225228
// RUN: -malign-loops=100 \

0 commit comments

Comments
 (0)