]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Prevent redefinition of WCHAR_MAX from testsuite/gcc.dg/cpp/ucs.c
authorOlivier Hainque <hainque@adacore.com>
Mon, 30 Dec 2019 22:31:37 +0000 (22:31 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Mon, 30 Dec 2019 22:31:37 +0000 (22:31 +0000)
gcc/testsuite/gcc.dg/cpp/ucs.c #include <limits.h>
and then crafts a definition of WCHAR_MAX depending
on __WCHAR_TYPE__.

The test fails in VxWorks configurations because WCHAR_MAX
is already exposed by the system limits.h.

The patch simply guards the tentative definition
by a check verifying if the macro is defined already, so
we're using the value exposed by limits.h in this case.

2019-12-30  Olivier Hainque  <hainque@adacore.com>

* testsuite/gcc.dg/cpp/ucs.c: Prevent redefinition
of WCHAR_MAX if already exposed by limits.h.

From-SVN: r279795

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/ucs.c

index d894655c84356cb87b341f5074afe99f880f0b9a..809b8a4e67095c799d2426266c1691d37d93dde0 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-20  Olivier Hainque  <hainque@adacore.com>
+
+       * testsuite/gcc.dg/cpp/ucs.c: Prevent redefinition
+       of WCHAR_MAX if already exposed by limits.h.
+
 2019-12-20  Olivier Hainque  <hainque@adacore.com>
            Jerome Lambourg  <lambourg@adacore.com>
 
index cac83f3cf1492a82af44cf7f83e9f5881bfabe89..f52cd5712587f34b0c38d213bfd50d5664cb9555 100644 (file)
@@ -16,6 +16,8 @@
 #define short           +2 
 #define long            +3
 
+#if !defined(WCHAR_MAX)
+
 #if __WCHAR_TYPE__ == 0
 # define WCHAR_MAX      INT_MAX
 #elif __WCHAR_TYPE__ == 1
@@ -28,6 +30,8 @@
 # error wacky wchar_t
 #endif
 
+#endif
+
 #undef unsigned
 #undef int
 #undef char