Replace an alloca use with a variable-length array.
[glibc.git] / gnulib / tst-gcc.c
blobf81a3507695ca2968bcdf8ffa429c139e200ffd8
1 /* Test program for the gcc interface.
2 Copyright (C) 2000-2013 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #include <stdio.h>
22 #define __no_type_class -1
23 #define __void_type_class 0
24 #define __integer_type_class 1
25 #define __char_type_class 2
26 #define __enumeral_type_class 3
27 #define __boolean_type_class 4
28 #define __pointer_type_class 5
29 #define __reference_type_class 6
30 #define __offset_type_class 7
31 #define __real_type_class 8
32 #define __complex_type_class 9
33 #define __function_type_class 10
34 #define __method_type_class 11
35 #define __record_type_class 12
36 #define __union_type_class 13
37 #define __array_type_class 14
38 #define __string_type_class 15
39 #define __set_type_class 16
40 #define __file_type_class 17
41 #define __lang_type_class 18
44 #define TEST(var) \
45 ({ int wrong = (__builtin_classify_type (__##var##_type) \
46 != __##var##_type_class); \
47 printf ("%-15s is %d: %s\n", \
48 #var, __builtin_classify_type (__##var##_type), \
49 wrong ? "WRONG" : "OK"); \
50 wrong; \
54 int
55 main (void)
57 int result = 0;
58 int __integer_type;
59 void *__pointer_type;
60 double __real_type;
61 __complex__ double __complex_type;
62 struct { int a; } __record_type;
63 union { int a; int b; } __union_type;
65 result |= TEST (integer);
66 result |= TEST (pointer);
67 result |= TEST (real);
68 result |= TEST (complex);
69 result |= TEST (record);
70 result |= TEST (union);
72 return result;