aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index f5dacfa6cf..2e74e272cb 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1363,14 +1363,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
// GCC provides a macro definition '__DEPRECATED' when -Wdeprecated is active
- // during C++ compilation. CC1 uses '-fdeprecated-macro' to control this.
- // Both '-Wdeprecated' and '-fdeprecated-macro' default to on, so the flag
- // logic here is inverted.
- if (Args.hasFlag(options::OPT_Wno_deprecated, options::OPT_Wdeprecated,
- false)) {
- // GCC keeps this define even in the presence of '-w', match this behavior
- // bug-for-bug.
- CmdArgs.push_back("-fno-deprecated-macro");
+ // during C++ compilation, which it is by default. GCC keeps this define even
+ // in the presence of '-w', match this behavior bug-for-bug.
+ if (types::isCXX(InputType) &&
+ Args.hasFlag(options::OPT_Wdeprecated, options::OPT_Wno_deprecated,
+ true)) {
+ CmdArgs.push_back("-fdeprecated-macro");
}
// Translate GCC's misnamer '-fasm' arguments to '-fgnu-keywords'.