Skip to content

MSVC 5274 warning suppression for _Py_ALIGN_AS should be local #135183

@encukou

Description

@encukou

Bug report

In #133966 (comment) we added a Python.h-wide suppression for MSVC warning 5274 “Application of _Alignas on a structured type in C”.

I think it should be instead applied locally, after a bit of thought.

AFAICS, 5274 warns that structs compiled with MSVC versions older than 17.9 might end up with a different layout (ABI) than ones compiled with 17.9+. That can cause trouble for extensions.

In PyASCIIObject, _Py_ALIGN_AS is applied to an anonymous struct. I think we can assume that no one is pulling state's type out with something like typeof(my_PyASCIIObject.state) – and if they do, getting an 4B-aligned struct is very unlikely to cause trouble in practice.
But, that is the kind of analysis one should do when a 5274 warning pops up.

Linked PRs

Metadata

Metadata

Assignees

Labels

buildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy