This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch/testsuite] Fix gcc.dg/torture/builtin-wctype-1.c, for targets with __WINT_TYPE__ != int
- From: Danny Smith <danny_smith_0000 at yahoo dot co dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 3 Aug 2005 22:20:36 +1200 (NZST)
- Subject: [Patch/testsuite] Fix gcc.dg/torture/builtin-wctype-1.c, for targets with __WINT_TYPE__ != int
- Reply-to: dannysmith at users dot sourceforge dot net
gcc.dg/torture/builtin-wctype-1.c fails on mingw32 target (maybe other
targets too) because the macro-generated prototypes do not match the
builtins, so the builtins are not used. __WCHAR_TYPE__ and __WINT_TYPE__
are unsigned short on mingw32.
The following patch fixes:
2005-08-03 Danny Smith <dannysmith@users.sourceforge.net>
* gcc.dg/torture/builtin-wctype-1.c: Use __WCHAR_TYPE__ and
__WINT_TYPE__ in generated prototypes if possible.
Index: gcc.dg/torture/builtin-wctype-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 builtin-wctype-1.c
--- gcc.dg/torture/builtin-wctype-1.c 27 Mar 2004 05:29:40 -0000 1.1
+++ gcc.dg/torture/builtin-wctype-1.c 3 Aug 2005 10:08:55 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation.
+/* Copyright (C) 2004, 2005 Free Software Foundation.
Verify that built-in wctype function attributes are correctly set
by the compiler.
@@ -7,32 +7,47 @@
/* { dg-do link } */
+/* Use the target type definitions if we can. */
+#ifndef __WINT_TYPE__
+#define __WINT_TYPE__ int
+#endif
+
+#ifndef __WCHAR_TYPE__
+#define __WCHAR_TYPE__ int
+#endif
void test(int i)
{
/* All of these ctype functions should be const/pure and thus
eliminated. */
-#define TEST_CTYPE(FN) \
- extern int FN(int); \
+#define TEST_IS_WCTYPE(FN) \
+ extern int FN(__WINT_TYPE__); \
extern void link_failure_##FN(void); \
if (FN(i) != FN(i)) \
link_failure_##FN()
+
+#define TEST_TO_WCTYPE(FN) \
+ extern __WCHAR_TYPE__ FN(__WCHAR_TYPE__); \
+ extern void link_failure_##FN(void); \
+ if (FN(i) != FN(i)) \
+ link_failure_##FN()
+
#ifdef __OPTIMIZE__
- TEST_CTYPE(iswalnum);
- TEST_CTYPE(iswalpha);
- TEST_CTYPE(iswblank);
- TEST_CTYPE(iswcntrl);
- TEST_CTYPE(iswdigit);
- TEST_CTYPE(iswgraph);
- TEST_CTYPE(iswlower);
- TEST_CTYPE(iswprint);
- TEST_CTYPE(iswpunct);
- TEST_CTYPE(iswspace);
- TEST_CTYPE(iswupper);
- TEST_CTYPE(iswxdigit);
- TEST_CTYPE(towlower);
- TEST_CTYPE(towupper);
+ TEST_IS_WCTYPE(iswalnum);
+ TEST_IS_WCTYPE(iswalpha);
+ TEST_IS_WCTYPE(iswblank);
+ TEST_IS_WCTYPE(iswcntrl);
+ TEST_IS_WCTYPE(iswdigit);
+ TEST_IS_WCTYPE(iswgraph);
+ TEST_IS_WCTYPE(iswlower);
+ TEST_IS_WCTYPE(iswprint);
+ TEST_IS_WCTYPE(iswpunct);
+ TEST_IS_WCTYPE(iswspace);
+ TEST_IS_WCTYPE(iswupper);
+ TEST_IS_WCTYPE(iswxdigit);
+ TEST_TO_WCTYPE(towlower);
+ TEST_TO_WCTYPE(towupper);
#endif /* __OPTIMIZE__ */
}
Send instant messages to your online friends http://au.messenger.yahoo.com