Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
GH-131296: fix clang-cl warning on Windows in socketmodule.h#131832
GH-131296: fix clang-cl warning on Windows in socketmodule.h#131832zooba merged 1 commit intopython:mainfrom
Conversation
| @@ -18,6 +18,10 @@ | |||
| */ | |||
| #ifdef AF_BTH | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Strictly speaking, we're in the#else of#ifndef MS_WINDOWS here and we most probably should indent, but I wanted to keep the diff small.
| # include <ws2bth.h> | ||
| # ifdef __clang__ | ||
| # pragma clang diagnostic push | ||
| # pragma clang diagnostic ignored "-Wpragma-pack" |
chris-eiblMar 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fix clang-cl warning:
the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]This will silence 16 occurrences inhttps://github.com/python/cpython/actions/runs/14044831663/job/39366560293?pr=131690#step:4:60.
Actually,pshpack1.h takes care of this warning
#if ! (defined(lint)|| defined(RC_INVOKED))#if (_MSC_VER >=800&& !defined(_M_I86))|| defined(_PUSHPOP_SUPPORTED)#pragma warning(disable:4103)#if !(defined(MIDL_PASS ))|| defined(__midl )#pragma pack(push,1)#else#pragma pack(1)#endif#else#pragma pack(1)#endif#endif/* ! (defined(lint) || defined(RC_INVOKED)) */
using#pragma warning(disable:4103), but clang-cl only supportsdisable for some warnings so far (and doesn't supportsuppress for those few supported, see also#131821 (comment)).
A different approach would be, to entirely get rid ofpshpack1.h, since we are in theMS_WINDOWS code path here. We could do a simple#pragma pack(push,1), which clang-cl understands and neither MSVC nor clang-cl would warn about, but
- I wanted to do the minimal needed stuff to silence clang ...
- ... without having to care about other compilers (mingw, etc), which might then be broken (see
An include file is needed because various compilers do this in different waysinpshpack1.h)
| }; | ||
| # include <poppack.h> | ||
| #endif | ||
| # ifdef __clang__ |
chris-eiblMar 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Must be done afterpoppack.h, because there the previous packing is restored and we'd get the same[-Wpragma-pack] warning.
chris-eibl commentedJun 9, 2025
@zooba May I ask you for a review? |
59e2330 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@chris-eibl for the PR, and@zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…ythonGH-131832)(cherry picked from commit59e2330)Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
GH-146340 is a backport of this pull request to the3.14 branch. |
GH-146340 is a backport of this pull request to the3.14 branch. |
Uh oh!
There was an error while loading.Please reload this page.
I think this is a skip news?