* tests/test-stdcountof-h.c (test_func) [__SUNPRO_C]: Omit tests
involving u"xxx" and u8"...", as Oracle Developer Studio 12.6
lacks support for this despite claiming C11 conformance.
(a, b, c) [__SUNPRO_C]: Define; ODS 12.6 has the same bug as MSVC 14.
---
 ChangeLog                 |  8 ++++++++
 tests/test-stdcountof-h.c | 15 +++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a1228c2cd1..bac7f4919f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-10-27  Paul Eggert  <[email protected]>
+
+       stdcountof-tests: pacify ODS 12.6
+       * tests/test-stdcountof-h.c (test_func) [__SUNPRO_C]: Omit tests
+       involving u"xxx" and u8"...", as Oracle Developer Studio 12.6
+       lacks support for this despite claiming C11 conformance.
+       (a, b, c) [__SUNPRO_C]: Define; ODS 12.6 has the same bug as MSVC 14.
+
 2025-10-23  Bruno Haible  <[email protected]>
 
        stdioext: Add support for OpenBSD >= 7.8.
diff --git a/tests/test-stdcountof-h.c b/tests/test-stdcountof-h.c
index 615cccda16..42f2f82537 100644
--- a/tests/test-stdcountof-h.c
+++ b/tests/test-stdcountof-h.c
@@ -48,7 +48,8 @@ test_func (int parameter[3])
   (void) _gl_verify_is_array (multidimensional);
   (void) _gl_verify_is_array ("string");
   (void) _gl_verify_is_array (L"wide string");
-# if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+# if ((__STDC_VERSION__ >= 201112L || __cplusplus >= 201103L) \
+      && !defined __SUNPRO_C)
   (void) _gl_verify_is_array (u8"UTF-8 string");
   (void) _gl_verify_is_array (u"UTF-16 string");
   (void) _gl_verify_is_array (U"UTF-32 string");
@@ -60,7 +61,8 @@ test_func (int parameter[3])
   ASSERT (countof (local_bounded) == 20);
   ASSERT (countof ("string") == 6 + 1);
   ASSERT (countof (L"wide string") == 11 + 1);
-#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+# if ((__STDC_VERSION__ >= 201112L || __cplusplus >= 201103L) \
+      && !defined __SUNPRO_C)
   ASSERT (countof (u8"UTF-8 string") == 12 + 1);
   ASSERT (countof (u"UTF-16 string") == 13 + 1);
   ASSERT (countof (U"UTF-32 string") == 13 + 1);
@@ -88,7 +90,7 @@ test_func (int parameter[3])
   ASSERT (_Generic (countof (local_bounded),    size_t: 1, default: 0));
   ASSERT (_Generic (countof ("string"),         size_t: 1, default: 0));
   ASSERT (_Generic (countof (L"wide string"),   size_t: 1, default: 0));
-# if __STDC_VERSION__ >= 201112L
+# if __STDC_VERSION__ >= 201112L && !defined __SUNPRO_C
   ASSERT (_Generic (countof (u8"UTF-8 string"), size_t: 1, default: 0));
   ASSERT (_Generic (countof (u"UTF-16 string"), size_t: 1, default: 0));
   ASSERT (_Generic (countof (U"UTF-32 string"), size_t: 1, default: 0));
@@ -109,8 +111,9 @@ main ()
 /* A definition of the variables a, b, c is not required by ISO C, because
    these identifiers are only used as part of 'sizeof' expressions whose
    results are integer expressions.  See ISO C 23 ยง 6.9.1.(5).  However,
-   MSVC 14 generates actual references to these variables.  We thus need
-   to define these variables; otherwise we get link errors.  */
-#if defined _MSC_VER && !defined __clang__
+   MSVC 14 and Oracle Developer Studio 12.6 generate actual references
+   to these variables.  We thus need to define these variables;
+   otherwise we get link errors.  */
+#if (defined _MSC_VER && !defined __clang__) || defined __SUNPRO_C
 int a, b, c;
 #endif
-- 
2.48.1


Reply via email to