111
|
1 /* Copyright (C) 2004 Free Software Foundation.
|
|
2
|
|
3 Verify that built-in ctype function attributes are correctly set by
|
|
4 the compiler.
|
|
5
|
|
6 Written by Kaveh Ghazi, 2004-03-23. */
|
|
7
|
|
8 /* { dg-do link } */
|
|
9
|
|
10
|
|
11 void test(int i)
|
|
12 {
|
|
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()
|
|
20
|
|
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__ */
|
|
39 }
|
|
40
|
|
41 int main (void)
|
|
42 {
|
|
43 return 0;
|
|
44 }
|