[gcc r17-2989] c++/objective-c++; Do not claim feature(modules), it is clang-specific.

Iain D Sandoe via Gcc-cvs <[email protected]> Wed, 5 Aug 2026 19:05:33 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:08ede4fbbe6d38e08bcc72c4df2cf6720b9f4717

commit r17-2989-g08ede4fbbe6d38e08bcc72c4df2cf6720b9f4717
Author: Iain Sandoe <[email protected]>
Date:   Tue Aug 4 09:44:46 2026 +0100

    c++/objective-c++; Do not claim feature(modules), it is clang-specific.
    
    It appears that we misinterpreted the modules feature and that it is intended
    to signal that the compiler supports "clang modules".  These are a similar
    approach to PCH and tightly coupled to clang AST - so not something that we
    are realistically likely to implement.
    
    Unfortunately, the macOS SDKs use this feature test to decide on some
    header declaration ordering where it needs to change for clang modules.
    
    This causes a fail to build the std. module sources on macOS meaning that we
    get an empty std.cc. Our intention should be parity with/without -fmodules.
    
    The solution is not to claim feature(modules) - C++20 modules are gated on
    __cpp_module and so do not need it.
    
    gcc/cp/ChangeLog:
    
            * cp-objcp-common.cc: Remove claim to support clang modules.
    
    Signed-off-by: Iain Sandoe <[email protected]>

Diff:
---
 gcc/cp/cp-objcp-common.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc
index 0a67aa8ce14b..8c9930bb2f37 100644
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc
@@ -148,7 +148,6 @@ static constexpr cp_feature_info cp_feature_table[] =
   { "cxx_relaxed_constexpr", cxx14 },
   { "cxx_return_type_deduction", cxx14 },
   { "cxx_variable_templates", cxx14 },
-  { "modules", &flag_modules },
 };
 
 /* Register C++ language features for __has_{feature,extension}.  */