2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / builtin-ctype-1.c
blobad6fc1c60b6908665e889325923389e1ab4a3fa3
1 /* Copyright (C) 2004 Free Software Foundation.
3 Verify that built-in ctype function attributes are correctly set by
4 the compiler.
6 Written by Kaveh Ghazi, 2004-03-23. */
8 /* { dg-do link } */
11 void test(int i)
13 /* All of these ctype functions should be const/pure and thus
14 eliminated. */
15 #define TEST_CTYPE(FN) \
16 extern int FN(int); \
17 extern void link_failure_##FN(void); \
18 if (FN(i) != FN(i)) \
19 link_failure_##FN()
21 #ifdef __OPTIMIZE__
22 TEST_CTYPE(isalnum);
23 TEST_CTYPE(isalpha);
24 TEST_CTYPE(isascii);
25 TEST_CTYPE(isblank);
26 TEST_CTYPE(iscntrl);
27 TEST_CTYPE(isdigit);
28 TEST_CTYPE(isgraph);
29 TEST_CTYPE(islower);
30 TEST_CTYPE(isprint);
31 TEST_CTYPE(ispunct);
32 TEST_CTYPE(isspace);
33 TEST_CTYPE(isupper);
34 TEST_CTYPE(isxdigit);
35 TEST_CTYPE(toascii);
36 TEST_CTYPE(tolower);
37 TEST_CTYPE(toupper);
38 #endif /* __OPTIMIZE__ */
41 int main (void)
43 return 0;