]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tst-assert-c++.cc: Return EXIT_UNSUPPORTED for GCC 4.9 or older
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Dec 2024 21:31:05 +0000 (05:31 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Dec 2024 11:27:45 +0000 (19:27 +0800)
Since assert/tst-assert-c++.cc fails to compile with GCC 4.9:

./tst-assert-c++.cc: In function ‘constexpr int check_constexpr()’:
./tst-assert-c++.cc:30:1: error: body of constexpr function ‘constexpr int check_constexpr()’ not a return-statement
 }
 ^

return EXIT_UNSUPPORTED for GCC 4.9 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
assert/tst-assert-c++.cc

index 9d587a16fa6af4af0a4f54cddb4d28553917e5d7..8f06ff82237659b518438f5d55fa2295b5929af3 100644 (file)
@@ -21,6 +21,7 @@
 #undef NDEBUG
 #include <assert.h>
 
+#if __GNUC_PREREQ (5, 0)
 /* The C++ standard requires that if the assert argument is a constant
    subexpression, then the assert itself is one, too.  */
 constexpr int
@@ -77,5 +78,14 @@ do_test ()
 
   return 0;
 }
+#else
+#include <support/test-driver.h>
+
+static int
+do_test ()
+{
+  return EXIT_UNSUPPORTED;
+}
+#endif
 
 #include <support/test-driver.c>