Skip to content

[libc++] Feature guards are checked too late #76620

@mordante

Description

@mordante

In this example:

In file included from weird.cc:1:
In file included from /home/luca/wasm-compilers/build/sysroot/include/c++/v1/thread:93:
In file included from /home/luca/wasm-compilers/build/sysroot/include/c++/v1/__thread/jthread.h:18:
/home/luca/wasm-compilers/build/sysroot/include/c++/v1/__thread/thread.h:55:34: error: unknown type name 'condition_variable'
   55 |   void notify_all_at_thread_exit(condition_variable*, mutex*);
      |                                  ^

The header thread validates the _LIBCPP_HAS_NO_THREADS macro after including its granularized headers. We should validate the top-level header before starting to include unguarded headers. This should be done for all feature macros.

Metadata

Metadata

Assignees

Labels

confirmedVerified by a second partylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions