This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, testsuite] memchr-1.c wide char and AIX


memchr-1.c tests for char (test_narrow) and wchar (test_wide).  The
wide character test assumes 32 bit wide character, while 32 bit AIX
uses 16 bit wide character.  This assumption causes the wide character
part of the test to fail in 32 bit mode on AIX (it succeeds on 64 bit
AIX).

The testcase already includes ifdefs for endianness.  The "narrow"
part of the test succeeds and is a useful test on AIX.  Me proposed
solution adds an AIX-specific ifdef in the testcase to avoid the
compile-time errors in 32 bit mode.

Because of the structure of the testcase, I need to #ifdef test_wide()
and its constants, and separately it's invocation in main(), as
opposed to making test_wide() a no-op that is called.

Another alternative is to split memchr-1.c into memchr-1.c for
test_narrow and memchr-2.c for test_wide, with the latter skipped on
AIX using a DejaGNU directive.

Is the #ifdef okay or would others prefer that I split the testcase?
No solution is particularly elegant.

Thanks, David

* gcc.c-torture/execute/memchr-1.c (test_wide): Skip on 32 bit AIX.

Index: memchr-1.c
===================================================================
--- memchr-1.c  (revision 264869)
+++ memchr-1.c  (working copy)
@@ -106,6 +106,7 @@
   A (memchr (&s5_3[1][i0], 0, sizeof s5_3[1] - i0) == &s5_3[1][4]);
 }

+#if !defined(_AIX) || defined(__64BIT__)
 static const wchar_t wc = L'1';
 static const wchar_t ws1[] = L"1";
 static const wchar_t ws4[] = L"\x00123456\x12005678\x12340078\x12345600";
@@ -144,10 +145,13 @@
   A (memchr (&ws4[3], 0, nb - 3 * nwb) == pws4 + 3 * nwb + 3);
 #endif
 }
+#endif


 int main ()
 {
   test_narrow ();
+#if !defined(_AIX) || defined(__64BIT__)
   test_wide ();
+#endif
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]