FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-131296: fix clang-cl warning on Windows in sre.c by chris-eibl · Pull Request #131593 · python/cpython · GitHub

/ cpython Public

GH-131296: fix clang-cl warning on Windows in sre.c - #131593

Merged
zooba merged 2 commits into
python:mainfrom
chris-eibl:fix_clangcl_sre
Apr 1, 2025
Merged

GH-131296: fix clang-cl warning on Windows in sre.c#131593
zooba merged 2 commits into
python:mainfrom
chris-eibl:fix_clangcl_sre

Conversation

chris-eibl commented Mar 22, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Comment thread Modules/_sre/sre.c Outdated
#if defined(_MSC_VER)
#pragma optimize("agtw", on) /* doesn't seem to make much difference... */
# if defined(__clang__)
# pragma optimize("", on)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Fix warning : unexpected argument 'agtw' to '#pragma optimize'; expected "" [-Wignored-pragmas]

Comment thread Modules/_sre/sre.c Outdated
# if defined(__clang__)
# pragma optimize("", on)
# else
# pragma optimize("gt", on) /* doesn't seem to make much difference... */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

agtw has been used in PY_LOCAL_AGGRESSIVE until #87332. Quote from @gvanrossum #87332 (comment)

A coworker happened to look at our use of #pragma optimize() for Windows (VS 2017) and noticed:

unless there’s something I’m missing, the ‘a’ and ‘w’ portions of the string being passed to the optimize pragma are not doing anything; I’m pretty sure they’ve been useless for 10+ years. The ‘g’ means turn on global optimizations and the ‘t’ means optimize for “time” (i.e. speed). See the documentation at https://docs.microsoft.com/en-us/cpp/preprocessor/optimize?view=msvc-160

It was then changed to gt (https://github.com/python/cpython/pull/24485/files) and entirely removed in https://github.com/python/cpython/pull/32023/files.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@zooba Again a very Windows (MSVC) specific one. Back then, you've changed PY_LOCAL_AGGRESSIVE from agtw to gt - agtw is really dusty.

OTOH, even though the comment says /* doesn't seem to make much difference... */ - I think it does, because this is also done for debug builds. But since /Ob1 is now used for debug builds (AFAIR by Victor), maybe this is not needed anymore at all?

zooba commented Mar 31, 2025

Copy link
Copy Markdown
Member

I expect @mdboom will have looked more closely at this one.

Chances are we just want a !__clang__ condition and to do nothing at all in ClangCL.

Copy link
Copy Markdown
Member Author

Sure, that's the easiest thing to do in case we do not want to care about

unless there’s something I’m missing, the ‘a’ and ‘w’ portions of the string being passed to the optimize pragma are not doing anything; I’m pretty sure they’ve been useless for 10+ years.

mdboom commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I expect @mdboom will have looked more closely at this one.

Chances are we just want a !__clang__ condition and to do nothing at all in ClangCL.

Yeah, I agree.

mdboom closed this Apr 1, 2025

Copy link
Copy Markdown
Member Author

Ups - I wanted to update the PR, but the PR is closed - do you want me to create a new PR instead of addressing the suggested fix:
#if defined(_MSC_VER) && !defined(__clang__)

mdboom reopened this Apr 1, 2025

mdboom commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

Ups - I wanted to update the PR, but the PR is closed - do you want me to create a new PR instead of addressing the suggested fix: #if defined(_MSC_VER) && !defined(__clang__)

No, sorry. Just human error (I pressed the wrong button).

Comment thread Modules/_sre/sre.c
# else
# pragma optimize("gt", on) /* doesn't seem to make much difference... */
# endif
#if defined(_MSC_VER) && !defined(__clang__)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Much simpler - just ignore __clang__ and keep agtw for MSVC.

zooba merged commit e9556e1 into python:main Apr 1, 2025
chris-eibl deleted the fix_clangcl_sre branch April 1, 2025 16:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL