GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — clang-cl issues many warnings when building on Windows · Issue #131296 · python/cpython

clang-cl issues many warnings when building on Windows #131296

New issue
Copy link
New issue
Copy link
Closed
Closed
clang-cl issues many warnings when building on Windows#131296
Copy link
Labels
OS-windowsbuildThe build process and cross-buildThe build process and cross-buildtype-featureA feature request or enhancementA feature request or enhancement

Description

@chris-eibl
chris-eibl
opened on Mar 15, 2025
Issue body actions

See e.g. https://github.com/python/cpython/actions/runs/13681800146/job/38255779088.

I went through roughly 100 warnings to find this one #131020.

Others are mostly benign, yet I'd like to reduce them.

Since many of the warnings stem from pythoncore, we see them twice, because the _freeze_module compiles a lot of those *.c files, too - and in case of PGO we see them a third time in the PGUpdate phase.

E.g. a bunch of warnings will disappear after the next sync with hacl-star upstream, since @msprotz thankfully already merged hacl-star/hacl-star#1028.

I think it is best to do them in small PRs per *.c file.

Ideally, I'd like to end up with the same warning configuration as used on Linux. When I configure for clang in WSL, I get

CONFIGURE_CFLAGS_NODIST= -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden

This would currently generate even more warnings, since we currently use

cpython/PCbuild/pyproject-clangcl.props

Line 41 in faa80fc

<AdditionalOptions>-Wno-deprecated-non-prototype -Wno-unused-label -Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions>

So maybe I should do this after a first round of cleaning?

Linked PRs

  • GH-131296: fix clang-cl warning on Windows in pytime.c #131297
  • GH-131296: fix clang-cl warnings on Windows in blake2module.c #131299
  • GH-131296: fix clang-cl warnings on Windows in pyshellext.cpp #131300
  • GH-131296: fix clang-cl warnings in fileutils.c #131301
  • GH-131296: clang-cl: fix "unused variable flags" warning #131302
  • GH-131296: clang-cl on Windows: fix unused warning "self" in fileio.c #131303
  • GH-131296: fix clang-cl warnings in sysmodule.c #131304
  • GH-131296: fix clang-cl warning in tracemalloc.c #131374
  • gh-131296: fix clang-cl warning in tracemalloc.c #131514
  • GH-131296: fix clang-cl warning on Windows in pegen.h #131584
  • GH-131296: fix clang-cl warning on Windows in _wmimodule.cpp #131587
  • GH-131296: fix clang-cl warning on Windows in thread_nt.h #131589
  • GH-131296: fix clang-cl warning on Windows in overlapped.c #131590
  • GH-131296: fix clang-cl warning on Windows in sre.c #131593
  • GH-131296: fix clang-cl warning on Windows in getpath.c #131594
  • GH-131296: fix clang-cl warning on Windows in semaphore.c #131595
  • GH-131296: fix clang-cl warning on Windows in _winapi.c #131600
  • GH-131296: fix clang-cl warning on Windows in longobject.c for 32bit builds #131604
  • GH-131296: fix clang-cl warning on Windows in socketmodule.c #131821
  • GH-131296: fix clang-cl warning on Windows in socketmodule.h #131832
  • GH-131296: fix clang-cl warning on Windows in liblzma #131897
  • GH-131296: move suppression of "unused label" warning for clang-cl on Windows #131900
  • GH-131296: fix clang-cl parentheses warnings on Windows #131905
  • GH-131296: fix clang-cl warnings on Windows in sqlite3 #131906
  • gh-131296: Fix clang-cl warning on Windows in posixmodule.c #133142
  • [3.14] GH-131296: Suppress clang-cl warnings in socketmodule.c (GH-131821) #146339
  • [3.14] GH-131296: Fix clang-cl warning on Windows in socketmodule.h (GH-131832) #146340

Activity

Next
  1. gpshead
    added a commit that references this issue on Mar 15, 2025

    GH-131296: fix clang-cl warnings on Windows in blake2module.c (#131299)

    faa80fc
  2. picnixz
    added
    type-featureA feature request or enhancementA feature request or enhancement
    OS-windows
    buildThe build process and cross-buildThe build process and cross-build
    on Mar 15, 2025
  3. picnixz commented on Mar 15, 2025

    @picnixz
    picnixz
    on Mar 15, 2025
    Member
    More actions

    Let's not backport those because I suspect it will sometimes be hard (hence the "feature")

    Reacted by Gregory P. Smith and Chris Eibl
  4. gpshead
    added a commit that references this issue on Mar 15, 2025

    GH-131296: fix clang-cl warning on Windows in pytime.c (GH-131297)

    f104c19
  5. chris-eibl commented on Mar 15, 2025

    @chris-eibl
    chris-eibl
    on Mar 15, 2025
    MemberAuthor
    More actions

    Oh sure, no backport - I'd consider this a (minor) feature, anyway. Are warnings generally treated as bug issues here?

  6. gpshead commented on Mar 15, 2025

    @gpshead
    gpshead
    on Mar 15, 2025
    Member
    More actions

    thanks! all three of those should merge. actually looking at compiler warnings and minimizing them is a good thing...

    we do have some CI tests that check for changes in number of warnings on other platforms, if we get clang-cl in CI, even non-blocking, we should add the same for it. ex the "Check compiler warnings" ones in .github/workflows/reusable-{macos,ubuntu}.yml.

    I do consider uninvestigated warnings to be bugs. But when it isn't a https://peps.python.org/pep-0011/ tier platform arguing for it can be hard. I think clang-cl is close enough even if not on a tier yet as we obviously already care about clang warnings on other platforms that its value is demonstrable.

    Reacted by Chris Eibl
  7. gpshead
    closed this as completedon Mar 15, 2025
  8. gpshead
    added a commit that references this issue on Mar 15, 2025

    GH-131296: fix clang-cl warnings on Windows in pyshellext.cpp (GH-131300

    e82c2ca
  9. chris-eibl commented on Mar 15, 2025

    @chris-eibl
    chris-eibl
    on Mar 15, 2025
    MemberAuthor
    More actions

    Yupp. I fully agree. My main motivation is, that clang-cl "sees all the Windows code" for which MSVC with the currently selected warning level produces no warnings. Some are really easy to fix, and will no longer cover the "real" ones like #131020.

  10. chris-eibl commented on Mar 15, 2025

    @chris-eibl
    chris-eibl
    on Mar 15, 2025
    MemberAuthor
    More actions

    Ups, did you close the issue on purpose? Still a lot of warnings to go ... I am not that fast in creating the PRs :)

  11. chris-eibl commented on Mar 15, 2025

    @chris-eibl
    chris-eibl
    on Mar 15, 2025
    MemberAuthor
    More actions

    I've created three more PRs. Still more than 40 warnings to go ...

  12. picnixz
    reopened this on Mar 15, 2025
  13. plashchynski
    added a commit that references this issue on Mar 17, 2025

    pythonGH-131296: fix clang-cl warnings on Windows in blake2module.c (p…

    1b7fc96
  14. 25 remaining items

  15. Pranjal095
    added 2 commits that reference this issue on Jul 12, 2025

    pythongh-131296: Avoid posixmodule.c warning (pythonGH-133142)

    5359cb0

    pythonGH-131296: Suppress clang-cl warnings in socketmodule.c (python…

    6eaa4ac
  16. zooba
    added a commit that references this issue on Jul 28, 2025

    GH-131296: Fixes clang-cl warning on Windows in socketmodule.h (GH-13…

    59e2330
  17. chris-eibl commented on Aug 2, 2025

    @chris-eibl
    chris-eibl
    on Aug 2, 2025
    MemberAuthor
    More actions

    Having #131832 merged (thanks @zooba, not only for this one, but also for all the many others you've merged), we are now warning free in case of clang-cl on Windows with the currently used warning level and ignores

          <AdditionalOptions>-Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions>
    

    as we can e.g. see in the latest Windows tail calling CI build; https://github.com/python/cpython/actions/runs/16678905900/job/47212440421

    We can either stop here and close this issue or continue (quoting my initial post)

    Ideally, I'd like to end up with the same warning configuration as used on Linux.

    if there is interest in it.

    If so, please let me know and also whether this should be done in a follow-up issue.

  18. vstinner commented on Aug 4, 2025

    @vstinner
    vstinner
    on Aug 4, 2025
    Member
    More actions

    I suggest closing this issue, and maybe open a new one if more warnings are found.

  19. chris-eibl commented on Aug 4, 2025

    @chris-eibl
    chris-eibl
    on Aug 4, 2025
    MemberAuthor
    More actions

    Sure, if we'd like to stick with the current warning settings, I'd vote for closing this issue (and create a new one if new warnings arise).

    The question is, whether there is appetite by some core devs to go with stricter warning settings - like used on Linux. Using something like set via CONFIGURE_CFLAGS_NODIST for clang on Linux would produce a lot of new warnings with clang-cl on Windows.

    Seems this should be done in a new issue - or not at all, if not worth to do ...

  20. taegyunkim
    added a commit that references this issue on Aug 4, 2025

    pythonGH-131296: Suppress clang-cl warnings in socketmodule.c (python…

    2657bcd
  21. zooba commented on Aug 4, 2025

    @zooba
    zooba
    on Aug 4, 2025
    Member
    More actions

    Definitely a new issue.

    It's worth seeing what issues are created - some are likely to be worth fixing (because they represent real bugs), even if we ultimately decide not to change the warning level. If you're able to write a commit message other than "fixes a warning" then it's probably worth fixing, but if the best reason for making the change is to suppress a compiler message then I think we're okay to leave them at this point.

  22. zooba
    closed this as completedon Aug 4, 2025
  23. Agent-Hellboy
    added 2 commits that reference this issue on Aug 19, 2025

    pythonGH-131296: Suppress clang-cl warnings in socketmodule.c (python…

    c1e5480

    pythonGH-131296: Fixes clang-cl warning on Windows in socketmodule.h (p…

    d37ba26
  24. miss-islington
    added 2 commits that reference this issue on Mar 23, 2026

    pythonGH-131296: Suppress clang-cl warnings in socketmodule.c (python…

    59ec96b

    pythonGH-131296: Fixes clang-cl warning on Windows in socketmodule.h (p…

    934011b
  25. ambv
    added 2 commits that reference this issue on Mar 23, 2026

    [3.14] GH-131296: Fix clang-cl warning on Windows in socketmodule.h (G…

    c334bde

    [3.14] GH-131296: Suppress clang-cl warnings in socketmodule.c (GH-13…

    cbb1985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsbuildThe build process and cross-buildThe build process and cross-buildtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.