Make build-many-glibcs.py support running as a bot.
[glibc.git] / scripts / check-c++-types.sh
blob489c4f066f578d7c165b0f20438ad184c4b8a8f5
1 #!/bin/bash
2 # Copyright (C) 2003-2016 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 # <http://www.gnu.org/licenses/>.
19 # The list of data types has been created with
20 # cat <<EOF |
21 # #include <sys/types.h>
22 # #include <unistd.h>
23 # #include <sys/resource.h>
24 # #include <sys/stat.h>
25 # EOF
26 # gcc -D_GNU_SOURCE -E - |
27 # egrep '^typedef.*;$' |
28 # sed 's/^typedef[[:space:]]*//;s/\([[:space:]]\{1,\}__attribute__.*\);/;/;s/.*[[:space:]]\([*]\|\)\(.*\);/\2/' |
29 # egrep -v '^_' |
30 # LC_ALL=C sort -u
32 data=$1
33 shift
34 cxx=$(echo $* | sed 's/-fgnu89-inline//')
35 while read t; do
36 echo -n "$t:"
37 $cxx -S -xc++ -o - -D_GNU_SOURCE <(cat <<EOF
38 #include <sys/types.h>
39 #include <sys/stat.h>
40 #include <sys/resource.h>
41 #include <unistd.h>
42 void foo ($t) { }
43 EOF
44 ) |
45 sed 's/[[:space:]]*[.]globa\?l[[:space:]]*_Z3foo\([_[:alnum:]]*\).*/\1/p;d'
46 done <<EOF |
47 blkcnt64_t
48 blkcnt_t
49 blksize_t
50 caddr_t
51 clockid_t
52 clock_t
53 daddr_t
54 dev_t
55 fd_mask
56 fsblkcnt64_t
57 fsblkcnt_t
58 fsfilcnt64_t
59 fsfilcnt_t
60 fsid_t
61 gid_t
62 id_t
63 ino64_t
64 ino_t
65 int16_t
66 int32_t
67 int64_t
68 int8_t
69 intptr_t
70 key_t
71 loff_t
72 mode_t
73 nlink_t
74 off64_t
75 off_t
76 pid_t
77 pthread_attr_t
78 pthread_barrier_t
79 pthread_barrierattr_t
80 pthread_cond_t
81 pthread_condattr_t
82 pthread_key_t
83 pthread_mutex_t
84 pthread_mutexattr_t
85 pthread_once_t
86 pthread_rwlock_t
87 pthread_rwlockattr_t
88 pthread_spinlock_t
89 pthread_t
90 quad_t
91 register_t
92 rlim64_t
93 rlim_t
94 sigset_t
95 size_t
96 socklen_t
97 ssize_t
98 suseconds_t
99 time_t
100 u_char
101 uid_t
102 uint
103 u_int
104 u_int16_t
105 u_int32_t
106 u_int64_t
107 u_int8_t
108 ulong
109 u_long
110 u_quad_t
111 useconds_t
112 ushort
113 u_short
115 diff -N -U0 $data -