Landing: 7df5ed25b25d

Project / Subsystem

gcc / c++

Date

2026-04-17

Author

Jakub Jelinek

Commit

7df5ed25b25df456a237615aa9915abc08a33719

Source

github

Impact

4/10

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
7df5ed25b25df456a237615aa9915abc08a33719
source_type
github
headline
C++: Correct -Wkeyword-macro warnings for contracts-related keywords.
tldr
Adjusts -Wkeyword-macro warnings to correctly handle contract-related keywords like `pre` and `post`.
why_it_matters
Ensures that the compiler emits accurate warnings when macros are defined with the same names as C++ keywords, particularly those related to contracts.
author
Jakub Jelinek
impact_score
4
impact_rationale
Fixes a compiler warning, which improves code quality and helps developers avoid potential naming conflicts.
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • C++
  • warnings
  • macros
  • contracts
discussion_id_link
bugzilla_pr
date
2026-04-17T00:00:00.000Z

The -Wkeyword-macro warning was incorrectly triggered for contract_assert, which is already handled as a keyword. This commit corrects the warning logic to instead focus on pre and post, which are identifiers with special meaning in the context of contracts. The associated tests are updated to reflect these changes.