]> git.ipfire.org Git - thirdparty/glibc.git/blame - gnulib/tst-gcc.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / gnulib / tst-gcc.c
CommitLineData
8fb81470 1/* Test program for the gcc interface.
f7a9f785 2 Copyright (C) 2000-2016 Free Software Foundation, Inc.
8fb81470
UD
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>.
5
6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
8fb81470
UD
10
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
41bdb6e2 14 Lesser General Public License for more details.
8fb81470 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
8fb81470
UD
19
20#include <stdio.h>
21
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
42
43
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; \
51 })
52
53
29955b5d
AS
54static int
55do_test (void)
8fb81470
UD
56{
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;
64
65 result |= TEST (integer);
66 result |= TEST (pointer);
67 result |= TEST (real);
68 result |= TEST (complex);
69 result |= TEST (record);
70 result |= TEST (union);
71
72 return result;
73}
29955b5d
AS
74
75#define TEST_FUNCTION do_test ()
76#include "../test-skeleton.c"