Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-118124: fix assert related C++ checks on Solaris/Illumos #121974

Merged
merged 2 commits into from
Jul 21, 2024

Conversation

kulikjak
Copy link
Contributor

@kulikjak kulikjak commented Jul 18, 2024

__STDC_VERSION__ can be defined for C++ builds on some platforms (in my case, Solaris/Illumos).

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57025

#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \
&& defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__cplusplus) && __STDC_VERSION__ >= 201112L \
Copy link

Choose a reason for hiding this comment

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

I'd keep defined(__STDC_VERSION__) and add && !defined(__cplusplus) to the end. I believe it was there for some reason, e.g. GCC and Clang may warn undefined identifiers(-Wundef).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, better be safe here. I kept the defined(__STDC_VERSION__) in the check.

@picnixz
Copy link
Member

picnixz commented Jul 21, 2024

cc @vstinner as the author of the original fix

@vstinner vstinner merged commit e88bd96 into python:main Jul 21, 2024
35 checks passed
@vstinner vstinner added the needs backport to 3.13 bugs and security fixes label Jul 21, 2024
@miss-islington-app
Copy link

Thanks @kulikjak for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @kulikjak and @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e88bd96d0d6cf8218c4fca37e1d20399ae676a04 3.13

@vstinner
Copy link
Member

Do 3.12 and 3.13 branches need backport? I cannot check right now.

@kulikjak
Copy link
Contributor Author

So, the second #ifdef (the Py_BUILD_ASSERT_EXPR related one you added a few months ago) is in 3.13 as well, but doesn't backport cleanly because there was an unrelated push into main since.

The first #ifdef is all the way in 3.11, though I don't think that branch accepts bug fixes anymore (3.12 does).

I can prepare backport PRs.

@vstinner
Copy link
Member

If 3.12 and 3.13, backports would be welcomed, sure.

kulikjak added a commit to kulikjak/cpython that referenced this pull request Jul 22, 2024
…mos (pythonGH-121974)

Fix check for static_assert() for C++ on some platforms..
(cherry picked from commit e88bd96)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jul 22, 2024

GH-122108 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 22, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jul 22, 2024

GH-122109 is a backport of this pull request to the 3.12 branch.

vstinner pushed a commit that referenced this pull request Jul 22, 2024
…H-121974) (#122109)

Fix check for static_assert() for C++ on some platforms..
(cherry picked from commit e88bd96)
vstinner pushed a commit that referenced this pull request Jul 22, 2024
…H-121974) (#122108)

Fix check for static_assert() for C++ on some platforms..
(cherry picked from commit e88bd96)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants