From e8fa06e07363b6d5e6c371bbd454d51bab78d01d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 12 May 2009 18:21:11 +0000 Subject: [PATCH] accept "#pragma clang foo" where we accept "#pragma GCC foo". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71572 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Pragma.cpp | 13 ++++++++++++- test/Lexer/constants.c | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index bde3fbc0e8..ce5934134f 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -666,6 +666,8 @@ struct PragmaSTDC_UnknownHandler : public PragmaHandler { void Preprocessor::RegisterBuiltinPragmas() { AddPragmaHandler(0, new PragmaOnceHandler(getIdentifierInfo("once"))); AddPragmaHandler(0, new PragmaMarkHandler(getIdentifierInfo("mark"))); + + // #pragma GCC ... AddPragmaHandler("GCC", new PragmaPoisonHandler(getIdentifierInfo("poison"))); AddPragmaHandler("GCC", new PragmaSystemHeaderHandler( getIdentifierInfo("system_header"))); @@ -673,7 +675,16 @@ void Preprocessor::RegisterBuiltinPragmas() { getIdentifierInfo("dependency"))); AddPragmaHandler("GCC", new PragmaDiagnosticHandler( getIdentifierInfo("diagnostic"))); - + // #pragma clang ... + AddPragmaHandler("clang", new PragmaPoisonHandler( + getIdentifierInfo("poison"))); + AddPragmaHandler("clang", new PragmaSystemHeaderHandler( + getIdentifierInfo("system_header"))); + AddPragmaHandler("clang", new PragmaDependencyHandler( + getIdentifierInfo("dependency"))); + AddPragmaHandler("clang", new PragmaDiagnosticHandler( + getIdentifierInfo("diagnostic"))); + AddPragmaHandler("STDC", new PragmaSTDC_FP_CONTRACTHandler( getIdentifierInfo("FP_CONTRACT"))); AddPragmaHandler("STDC", new PragmaSTDC_FENV_ACCESSHandler( diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c index c0355314b2..fcb6de9545 100644 --- a/test/Lexer/constants.c +++ b/test/Lexer/constants.c @@ -25,11 +25,11 @@ t', }; -#pragma GCC diagnostic ignored "-Wmultichar" +#pragma clang diagnostic ignored "-Wmultichar" char d = 'df'; // no warning. char e = 'abcd'; // still warn: expected-warning {{multi-character character constant}} -#pragma GCC diagnostic ignored "-Wfour-char-constants" +#pragma clang diagnostic ignored "-Wfour-char-constants" char f = 'abcd'; // ignored. -- 2.40.0