llvm / llvm/llvm-project

pragma deprecated is not always wrappeable inside another macro

Open
#202,391 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Hello,

We've tried leveraging `#pragma clang deprecated`, but faced an issue where due to its design (i.e. taking the macro name directly, and not as a stringified form), it is impossible to wrap in a `DEPRECATED_MACRO` proxy (that would for example also support MSVC). While it works well with the example given in the clang documentation (i.e. `MIN(a,b)`), it doesn't work with macros that are parameterless, as they will get expanded before being stringified for the `_Pragma` directive. I've tried many tricks to prevent the expansion, without success. I think the only way to truely prevent expansion would be to stringy the macro name, but that would require support form `#pragma clang deprecated`.

Here is some code sample:
https://godbolt.org/z/s69T7sPGY

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.