Skip to content

cmake: fix a redundant flag causing the build to fail with newer GCC versions#10940

Open
SquareRobin wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
SquareRobin:build-fixes
Open

cmake: fix a redundant flag causing the build to fail with newer GCC versions#10940
SquareRobin wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
SquareRobin:build-fixes

Conversation

@SquareRobin

Copy link
Copy Markdown

Summary

Passing -D_GLIBCXX_ASSERTIONS directly to the preprocessor results in an error compiling with GCC 14 or 15 (14.3.1 and 15.3.0) , simply removing -Wp fixes this and causes no compile time errors/warnings. Tests also pass with the flag changed.

Type of Change

  • Bug fix

Impact

Adds support for GCC 14 and 15 (probably other versions, too) while causing no observable functionality changes.

Verification

  • I have verified that the local build succeeds (ran cmake manually).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Signed-off-by: Igor Sokolov <disk.destroyer@yahoo.com>
@SquareRobin
SquareRobin requested a review from a team as a code owner July 17, 2026 12:39

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the compiler options in src/CMakeLists.txt by changing -Wp,-D_GLIBCXX_ASSERTIONS to -D_GLIBCXX_ASSERTIONS. The reviewer recommended wrapping this macro in a C++ generator expression to ensure it is only applied to C++ source files and not C or assembly files.

Comment thread src/CMakeLists.txt
-Wformat-security
-Wno-sign-compare
-Wp,-D_GLIBCXX_ASSERTIONS
-D_GLIBCXX_ASSERTIONS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since _GLIBCXX_ASSERTIONS is a C++ standard library (libstdc++) specific macro, it is best practice to restrict it to C++ compilation using a generator expression. This prevents the flag from being passed to C or assembly source files in the project (such as those in subdirectories like ABC or linenoise).

  $<$<COMPILE_LANGUAGE:CXX>:-D_GLIBCXX_ASSERTIONS>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to OpenROAD! Thanks for opening your first PR.
Before we review:

Please ensure:

  • CI passes
  • Code is properly formatted
  • Tests are included where applicable
    A maintainer will review shortly!

@SquareRobin
SquareRobin requested review from a team as code owners July 17, 2026 15:07
@SquareRobin
SquareRobin requested review from gudeh and maliberty July 17, 2026 15:07
@github-actions github-actions Bot added size/S and removed size/XS labels Jul 17, 2026
@github-actions github-actions Bot added size/XS and removed size/S labels Jul 17, 2026
@gudeh
gudeh removed their request for review July 17, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant