From 61fbf6283816f4d9b8539cdc17bc147ed596281e Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 23 Apr 2011 09:27:53 +0000 Subject: Fix Clang's __DEPRECATED define to be controled by -Wdeprecated. This matches GCC behavior which libstdc++ uses to limit #warning-based messages about deprecation. The machinery involves threading this through a new '-fdeprecated-macro' flag for CC1. The flag defaults to "on", similarly to -Wdeprecated. We turn the flag off in the driver when the warning is turned off (modulo matching some GCC bugs). We record this as a language option, and key the preprocessor on the option when introducing the define. A separate flag rather than a '-D' flag allows us to properly represent the difference between C and C++ builds (only C++ receives the define), and it allows the specific behavior of following -Wdeprecated without potentially impacting the set of user-provided macro flags. llvm-svn: 130055 --- clang/lib/Frontend/InitPreprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index ff3cf4b..802d66f 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -319,7 +319,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__USING_SJLJ_EXCEPTIONS__"); if (LangOpts.CPlusPlus) { - Builder.defineMacro("__DEPRECATED"); + if (LangOpts.Deprecated) + Builder.defineMacro("__DEPRECATED"); Builder.defineMacro("__GNUG__", "4"); Builder.defineMacro("__GXX_WEAK__"); if (LangOpts.GNUMode) -- cgit v1.1