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