]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: implement CWG3020 - Missing specification for __has_cpp_attribute(indeterminate...
authorJakub Jelinek <jakub@redhat.com>
Mon, 20 Jul 2026 21:32:40 +0000 (23:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 20 Jul 2026 21:32:40 +0000 (23:32 +0200)
The paper which introduced indeterminate attribute has not added a value
for __has_cpp_attribute, so I've missed it and didn't add it to
c_common_has_attribute.  Later CWG issue fixed this up.

2026-07-20  Jakub Jelinek  <jakub@redhat.com>

PR c++/126309
* c-lex.cc: Implement CWG3020 - Missing specification for
__has_cpp_attribute(indeterminate).
(c_common_has_attribute): Handle __has_cpp_attribute (indeterminate).

* g++.dg/cpp26/feat-cxx26.C: Test __has_cpp_attribute (indeterminate).
* g++.dg/cpp29/feat-cxx29.C: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/c-family/c-lex.cc
gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
gcc/testsuite/g++.dg/cpp29/feat-cxx29.C

index c987618c24e786940c8d5a696b5e5bfd54a77116..33ccab3a02140b3014739c38bf268580dfab6b61 100644 (file)
@@ -449,6 +449,8 @@ c_common_has_attribute (cpp_reader *pfile, bool std_syntax)
                result = 201907;
              else if (is_attribute_p ("assume", attr_name))
                result = 202207;
+             else if (is_attribute_p ("indeterminate", attr_name))
+               result = 202403;
              else if (is_attribute_p ("init_priority", attr_name))
                {
                  /* The (non-standard) init_priority attribute is always
index d3ab72901240c7775b11273db4c79bb48117561d..6db7b06a27e934eff456e1b1739ba5dcada47edd 100644 (file)
 #elif __cpp_trivial_union != 202502
 #  error "__cpp_trivial_union != 202502"
 #endif
+
+// C++26 attributes:
+
+#ifdef __has_cpp_attribute
+#  if ! __has_cpp_attribute(indeterminate)
+#    error "__has_cpp_attribute(indeterminate)"
+#  elif __has_cpp_attribute(indeterminate) != 202403
+#    error "__has_cpp_attribute(indeterminate) != 202403"
+#  endif
+#else
+#  error "__has_cpp_attribute"
+#endif
index 1beb50dc4ad4e979699eba40299aee2209850df1..2474e43409004f8942f3f7a74fee5f35ca00fa1e 100644 (file)
 #elif __cpp_trivial_union != 202502
 #  error "__cpp_trivial_union != 202502"
 #endif
+
+// C++26 attributes:
+
+#ifdef __has_cpp_attribute
+#  if ! __has_cpp_attribute(indeterminate)
+#    error "__has_cpp_attribute(indeterminate)"
+#  elif __has_cpp_attribute(indeterminate) != 202403
+#    error "__has_cpp_attribute(indeterminate) != 202403"
+#  endif
+#else
+#  error "__has_cpp_attribute"
+#endif