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