Skip to content

Add a Clang-specific diagnostic ignore push-pop for module std;Β #5975

@sharadhr

Description

@sharadhr

STL/stl/modules/std.ixx

Lines 39 to 40 in cbe2ee9

#pragma warning(push)
#pragma warning(disable : 5244) // '#include <meow>' in the purview of module 'std' appears erroneous.

It seems the MSVC STL module works with clang++.exe (this is the driver with the GNU-like command-line interface, but targets the MSVC ABI). However, the module needs to have additional guards for Clang so that the same warnings of having #include <angle> and defining module std are suppressed. The core of it is:

#if defined(__clang__)
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
    #pragma clang diagnostic ignored "-Wreserved-module-identifier"
#endif

...

#if defined(__clang__)
    #pragma clang diagnostic pop
#endif

But I suspect we need to be much more judicious about the macro guards, because clang-cl.exe disguises itself as MSVC to source code, with the exception that __clang__ is also defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    modulesC++23 modules, C++20 header units

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions