Merge remote branch 'origin/master' into fedora/master
[glibc.git] / gnulib / tst-gcc.c
blobf5e95120c5650f93bc0434c48a4f0f54d81737af
1 /* Test program for the gcc interface.
2 Copyright (C) 2000 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, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <stdio.h>
23 #define __no_type_class -1
24 #define __void_type_class 0
25 #define __integer_type_class 1
26 #define __char_type_class 2
27 #define __enumeral_type_class 3
28 #define __boolean_type_class 4
29 #define __pointer_type_class 5
30 #define __reference_type_class 6
31 #define __offset_type_class 7
32 #define __real_type_class 8
33 #define __complex_type_class 9
34 #define __function_type_class 10
35 #define __method_type_class 11
36 #define __record_type_class 12
37 #define __union_type_class 13
38 #define __array_type_class 14
39 #define __string_type_class 15
40 #define __set_type_class 16
41 #define __file_type_class 17
42 #define __lang_type_class 18
45 #define TEST(var) \
46 ({ int wrong = (__builtin_classify_type (__##var##_type) \
47 != __##var##_type_class); \
48 printf ("%-15s is %d: %s\n", \
49 #var, __builtin_classify_type (__##var##_type), \
50 wrong ? "WRONG" : "OK"); \
51 wrong; \
55 int
56 main (void)
58 int result = 0;
59 int __integer_type;
60 void *__pointer_type;
61 double __real_type;
62 __complex__ double __complex_type;
63 struct { int a; } __record_type;
64 union { int a; int b; } __union_type;
66 result |= TEST (integer);
67 result |= TEST (pointer);
68 result |= TEST (real);
69 result |= TEST (complex);
70 result |= TEST (record);
71 result |= TEST (union);
73 return result;