]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Move test for __cpp_lib_not_fn to version.cc
authorLuc Grosheintz <luc.grosheintz@gmail.com>
Tue, 23 Sep 2025 12:34:41 +0000 (14:34 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 24 Sep 2025 12:35:19 +0000 (14:35 +0200)
When running the tests without pre-compiled headers
(--disable-libstdcxx-pch), the test fails, because the feature
testing macro (FTM) isn't defined yet.

This commit moves checking the FTM to a dedicated file (version.cc)
that's run without PCH.

libstdc++-v3/ChangeLog:

* testsuite/20_util/function_objects/not_fn/nttp.cc: Move
test of feature testing macro to version.cc
* testsuite/20_util/function_objects/not_fn/version.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/testsuite/20_util/function_objects/not_fn/nttp.cc
libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc [new file with mode: 0644]

index d35d828f14c673e88f6f5c3bb2764b9d69e25d70..d24ccf8a1872e244dcdfa4a15303a284d4a44793 100644 (file)
@@ -2,12 +2,6 @@
 
 // { dg-do run { target c++26 } }
 
-#ifndef __cpp_lib_not_fn
-# error "Feature test macro for not_fn is missing in <functional>"
-#elif __cpp_lib_not_fn < 202306L
-# error "Feature test macro for not_fn has wrong value in <functional>"
-#endif
-
 #include <functional>
 #include <testsuite_hooks.h>
 
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc
new file mode 100644 (file)
index 0000000..fc8a3c9
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do preprocess { target c++17 } }
+// { dg-add-options no_pch }
+
+#include <functional>
+
+#ifndef __cpp_lib_not_fn
+# error "Feature test macro for not_fn is missing in <functional>"
+#elif __cpp_lib_not_fn < 201603L
+# error "Feature test macro __cpp_lib_not_fn has the wrong value for C++17 or later"
+#elif __cplusplus > 202302L && __cpp_lib_not_fn < 202306L
+# error "Feature test macro __cpp_lib_not_fn has the wrong value for C++26 or later"
+#endif