diff --git a/dmd2/mars.h b/dmd2/mars.h index 09d3bf47..62b2f52e 100644 --- a/dmd2/mars.h +++ b/dmd2/mars.h @@ -518,6 +518,7 @@ void fatal(); void err_nomem(); #if IN_LLVM void error(const char *format, ...) IS_PRINTF(1); +void warning(const char *format, ...) IS_PRINTF(1); #else int runLINK(); void deleteExeFile(); diff --git a/dmd2/statement.c b/dmd2/statement.c index 2365210d..15da3909 100644 --- a/dmd2/statement.c +++ b/dmd2/statement.c @@ -31,6 +31,8 @@ #include "import.h" #if IN_LLVM +// From pragma.cpp +bool matchPragma(Identifier* needle, Identifier* ident, Identifier* oldIdent); #if defined(_MSC_VER) #include #else @@ -3169,13 +3171,8 @@ Statement *PragmaStatement::semantic(Scope *sc) } #if IN_LLVM // FIXME Move to pragma.cpp - else if (ident == Id::LDC_allow_inline || ident == Id::allow_inline) + else if (matchPragma(ident, Id::LDC_allow_inline, Id::allow_inline)) { -#if DMDV2 - if (ident == Id::allow_inline && !global.params.useDeprecated) - error("non-vendor-prefixed pragma '%s' is deprecated; use '%s' instead", - Id::allow_inline->toChars(), Id::LDC_allow_inline->toChars()); -#endif sc->func->allowInlining = true; } #endif diff --git a/gen/pragma.cpp b/gen/pragma.cpp index 8d554ceb..be2d62b6 100644 --- a/gen/pragma.cpp +++ b/gen/pragma.cpp @@ -46,15 +46,23 @@ static bool parseIntExp(Expression* e, dinteger_t& res) static void pragmaDeprecated(Identifier* oldIdent, Identifier* newIdent) { -#ifndef DMDV1 +#if !DMDV1 // Do not print a deprecation warning for D1 – we do not want to // introduce needless breakage at this stage. - if (!global.params.useDeprecated) - error("non-vendor-prefixed pragma '%s' is deprecated; use '%s' instead"); + if (global.params.useDeprecated == 0) + { + error("non-vendor-prefixed pragma '%s' is deprecated; use '%s' instead", + oldIdent->toChars(), newIdent->toChars()); + } + else if (global.params.useDeprecated == 2) + { + warning("non-vendor-prefixed pragma '%s' is deprecated; use '%s' instead", + oldIdent->toChars(), newIdent->toChars()); + } #endif } -static bool matchPragma(Identifier* needle, Identifier* ident, Identifier* oldIdent) +bool matchPragma(Identifier* needle, Identifier* ident, Identifier* oldIdent) { if (needle == ident) return true; if (needle == oldIdent)