C++: Implement __has_cpp_attribute(indeterminate) for CWG3020
Adds support for the C++26 __has_cpp_attribute(indeterminate) preprocessor check.
GCC now correctly recognizes the __has_cpp_attribute(indeterminate) preprocessor directive, aligning with the C++26 standard. This feature, related to the indeterminate attribute, was missing from GCC’s preprocessor checks. The change updates c_common_has_attribute to handle this new attribute specifier, ensuring code using this feature can be correctly processed and tested with new test cases for C++26 and C++29.
In Details
This commit addresses CWG3020 by integrating support for __has_cpp_attribute(indeterminate) into GCC's preprocessor. The indeterminate attribute, introduced in C++26, signifies that an object's value is uninitialized or otherwise unset. The __has_cpp_attribute macro allows conditional compilation based on attribute support. The implementation modifies c_common_has_attribute in c-lex.cc to correctly identify this attribute, ensuring compliance with the latest C++ standards.
- __has_cpp_attribute
- A preprocessor macro in C and C++ that checks if a specific feature-test macro or attribute is supported by the compiler.
- indeterminate attribute
- An attribute in C++26 that marks an object as having an indeterminate value, useful for static analysis and correctness checks.
- CWG
- C++ Core Working Group, responsible for reviewing and resolving issues related to the C++ language standard.