Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Jun 26, 2024

@vstinner
Copy link
MemberAuthor

This PR fix the following warnings:

/home/vstinner/python/main/Include/cpython/pyatomic_gcc.h: In function ‘_Py_atomic_load_ptr’: /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h:300:34: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 300 |{return (void *)__atomic_load_n((void **)obj, __ATOMIC_SEQ_CST)} | ^ /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h: In function ‘_Py_atomic_load_ptr_relaxed’: /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h:359:34: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 359 |{return (void *)__atomic_load_n((const void **)obj, __ATOMIC_RELAXED)} | ^ /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h:359:10: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 359 |{return (void *)__atomic_load_n((const void **)obj, __ATOMIC_RELAXED)} | ^ /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h: In function ‘_Py_atomic_load_ptr_acquire’: /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h:493:34: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 493 |{return (void *)__atomic_load_n((void **)obj, __ATOMIC_ACQUIRE)} | ^ /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h: In function ‘_Py_atomic_load_uintptr_acquire’: /home/vstinner/python/main/Include/cpython/pyatomic_gcc.h:497:37: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 497 |{return (uintptr_t)__atomic_load_n((uintptr_t *)obj, __ATOMIC_ACQUIRE)} | ^ cc1: all warnings being treated as errors error: command '/usr/bin/gcc' failed with exit code 1 

@vstinner
Copy link
MemberAuthor

My previous attempt using (const void * const *) cast didn't work well. The correct cast is to (void * const *).

Copy link
Contributor

@colesburycolesbury left a comment

Choose a reason for hiding this comment

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

LGTM!

@vstinnervstinner merged commit 9cd2dcb into python:mainJun 26, 2024
@vstinnervstinner deleted the pyatomic_fix_const branch June 26, 2024 18:10
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 26, 2024
(cherry picked from commit 9cd2dcb) Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

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

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Jun 26, 2024
vstinner added a commit that referenced this pull request Jun 26, 2024
) gh-120593: Fix const qualifier in pyatomic.h (GH-121055) (cherry picked from commit 9cd2dcb) Co-authored-by: Victor Stinner <vstinner@python.org>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for freeto 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.

2 participants

@vstinner@colesbury