llvm / llvm/llvm-project

[clang][enhancement] namespace control for -Werror=deprecated-declarations

Open
#165,230 1 comment 0 reactions 0 assignees View on GitHub
clang:diagnostics enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The [[deprecated("reason")]] allows a library author to deprecate names it exports.

-Wdeprecated-declarations allows a library author to tolerate deprecated declarations it imports.

-Werror=deprecated-declarations allows a library author to assert that the library does not use its own deprecated names, except that it conflicts with =Wdeprecated-declarations for imported names.

A library author would like fine-grained control over which namespaces cause a warning, and which cause an error. This would allow the compiler that the library does not use its own deprecated symbols, but still tolerates deprecated symbols from the environment, over which it has no control. Where the library uses its own symbols intentionally (for example, in tests), the author would sprinkle pragmas to suppress these errors.

Possible syntax: -Werror=deprecated-declarations-namespace-n1-n2 to error for deprecated symbols from namespace n1::n2.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Clang's existing handling of -Wdeprecated-declarations and -Werror=deprecated-declarations, including warning-option parsing and namespace information. Define how namespace-specific warnings and errors should interact with imported and intentionally used deprecated symbols, including pragma suppression. Done means the proposed namespace control works without changing unrelated deprecation diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.