[PATCH] D106732: Support macro deprecation #pragma clang deprecated

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 23 18:03:41 PDT 2021


beanz created this revision.
beanz added reviewers: aaron.ballman, rsmith, erik.pilkington, lgerbarg, pete.
Herald added a subscriber: dexonsmith.
beanz requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: clang.

This patch adds `#pragma clang deprecated` to enable deprecation of
preprocessor macros.

The macro must be defined before `#pragma clang deprecated`. When
deprecating a macro a custom message may be optionally provided.

Warnings are emitted at the use site of a deprecated macro, and can be
controlled via the `-Wdeprecated` warning group.

This patch takes some rough inspiration and a few lines of code from
https://reviews.llvm.org/D67935.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106732

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/IdentifierTable.h
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/test/Lexer/deprecate-macro.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106732.361396.patch
Type: text/x-patch
Size: 10097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210724/cdc4946f/attachment.bin>


More information about the cfe-commits mailing list