forked from OSchip/llvm-project
Move all of the logic for __DEPRECATED to the driver based on comments
from dgregor. llvm-svn: 130066
This commit is contained in:
parent
dbbdd2fe50
commit
30483fb188
|
@ -215,7 +215,7 @@ public:
|
|||
GNUInline = 0;
|
||||
NoInline = 0;
|
||||
|
||||
Deprecated = 1; // -Wdeprecated defaults to "on".
|
||||
Deprecated = 0;
|
||||
|
||||
CharIsSigned = 1;
|
||||
ShortWChar = 0;
|
||||
|
|
|
@ -540,9 +540,9 @@ def fdelayed_template_parsing : Flag<"-fdelayed-template-parsing">,
|
|||
def funknown_anytype : Flag<"-funknown-anytype">,
|
||||
HelpText<"Enable parser support for the __unknown_anytype type; for testing purposes only">;
|
||||
def fdeprecated_macro : Flag<"-fdeprecated-macro">,
|
||||
HelpText<"Defines the __DEPRECATED macro in C++ compilations">;
|
||||
HelpText<"Defines the __DEPRECATED macro">;
|
||||
def fno_deprecated_macro : Flag<"-fno-deprecated-macro">,
|
||||
HelpText<"Undefines the __DEPRECATED macro in C++ compilations">;
|
||||
HelpText<"Undefines the __DEPRECATED macro">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Header Search Options
|
||||
|
|
|
@ -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'.
|
||||
|
|
|
@ -694,8 +694,8 @@ static void LangOptsToArgs(const LangOptions &Opts,
|
|||
Res.push_back("-funknown-anytype");
|
||||
if (Opts.DelayedTemplateParsing)
|
||||
Res.push_back("-fdelayed-template-parsing");
|
||||
if (!Opts.Deprecated)
|
||||
Res.push_back("-fno-deprecated-macro");
|
||||
if (Opts.Deprecated)
|
||||
Res.push_back("-fdeprecated-macro");
|
||||
}
|
||||
|
||||
static void PreprocessorOptsToArgs(const PreprocessorOptions &Opts,
|
||||
|
|
|
@ -318,9 +318,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
if (LangOpts.SjLjExceptions)
|
||||
Builder.defineMacro("__USING_SJLJ_EXCEPTIONS__");
|
||||
|
||||
if (LangOpts.Deprecated)
|
||||
Builder.defineMacro("__DEPRECATED");
|
||||
|
||||
if (LangOpts.CPlusPlus) {
|
||||
if (LangOpts.Deprecated)
|
||||
Builder.defineMacro("__DEPRECATED");
|
||||
Builder.defineMacro("__GNUG__", "4");
|
||||
Builder.defineMacro("__GXX_WEAK__");
|
||||
if (LangOpts.GNUMode)
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
// RUN: %clang -### -S -Wwrite-strings -w %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS3 %s
|
||||
// WRITE-STRINGS3: -fconst-strings
|
||||
|
||||
// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
|
||||
// RUN: %clang -### -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// DEPRECATED-OFF-CHECK: -fno-deprecated-macro
|
||||
// DEPRECATED-ON-CHECK-NOT: -fno-deprecated-macro
|
||||
// RUN: %clang -### -x c++ -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -x c++ -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -x c++ -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
|
||||
// RUN: %clang -### -x c++ -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -x c++ -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
|
||||
// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
|
||||
// RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
|
||||
// DEPRECATED-ON-CHECK: -fdeprecated-macro
|
||||
// DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
//
|
||||
// RUN: %clang_cc1 -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s
|
||||
//
|
||||
// CXX0X:#define __DEPRECATED 1
|
||||
// CXX0X:#define __GNUG__
|
||||
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
|
||||
// CXX0X:#define __GXX_RTTI 1
|
||||
|
@ -22,7 +21,6 @@
|
|||
//
|
||||
// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
|
||||
//
|
||||
// CXX98:#define __DEPRECATED 1
|
||||
// CXX98:#define __GNUG__
|
||||
// CXX98:#define __GXX_RTTI 1
|
||||
// CXX98:#define __GXX_WEAK__ 1
|
||||
|
@ -30,6 +28,11 @@
|
|||
// CXX98:#define __private_extern__ extern
|
||||
//
|
||||
//
|
||||
// RUN: %clang_cc1 -fdeprecated-macro -E -dM < /dev/null | FileCheck -check-prefix DEPRECATED %s
|
||||
//
|
||||
// DEPRECATED:#define __DEPRECATED 1
|
||||
//
|
||||
//
|
||||
// RUN: %clang_cc1 -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s
|
||||
//
|
||||
// C99:#define __STDC_VERSION__ 199901L
|
||||
|
@ -62,7 +65,6 @@
|
|||
//
|
||||
// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
|
||||
//
|
||||
// GXX98:#define __DEPRECATED 1
|
||||
// GXX98:#define __GNUG__
|
||||
// GXX98:#define __GXX_WEAK__ 1
|
||||
// GXX98:#define __cplusplus 1
|
||||
|
|
Loading…
Reference in New Issue