Fix ChangeLog formatting
[glibc.git] / scripts / check-c++-types.sh
blobd02e77d23b3758e3c7e1454e937789564df4d83a
1 #!/bin/bash
2 # Copyright (C) 2003-2018 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 # This script creates a list of data types where each type is followed
20 # by the C++ mangled name for that type. That list is then compared
21 # against the list in the c++-types.data file for the platform being
22 # checked. Any difference between the two would mean that the C++ ABI
23 # had changed and that should not happen even if the change is compatible
24 # at the C language level.
27 # The list of data types has been created with
28 # cat <<EOF |
29 # #include <sys/types.h>
30 # #include <unistd.h>
31 # #include <sys/resource.h>
32 # #include <sys/stat.h>
33 # EOF
34 # gcc -D_GNU_SOURCE -E - |
35 # egrep '^typedef.*;$' |
36 # sed 's/^typedef[[:space:]]*//;s/\([[:space:]]\{1,\}__attribute__.*\);/;/;s/.*[[:space:]]\([*]\|\)\(.*\);/\2/' |
37 # egrep -v '^_' |
38 # LC_ALL=C sort -u
40 data=$1
41 shift
42 cxx=$(echo $* | sed 's/-fgnu89-inline//')
43 while read t; do
44 echo -n "$t:"
45 $cxx -S -xc++ -o - -D_GNU_SOURCE <(cat <<EOF
46 #include <sys/types.h>
47 #include <sys/stat.h>
48 #include <sys/resource.h>
49 #include <unistd.h>
50 void foo ($t) { }
51 EOF
52 ) |
53 sed 's/[[:space:]]*[.]globa\?l[[:space:]]*_Z3foo\([_[:alnum:]]*\).*/\1/p;d'
54 done <<EOF |
55 blkcnt64_t
56 blkcnt_t
57 blksize_t
58 caddr_t
59 clockid_t
60 clock_t
61 daddr_t
62 dev_t
63 fd_mask
64 fsblkcnt64_t
65 fsblkcnt_t
66 fsfilcnt64_t
67 fsfilcnt_t
68 fsid_t
69 gid_t
70 id_t
71 ino64_t
72 ino_t
73 int16_t
74 int32_t
75 int64_t
76 int8_t
77 intptr_t
78 key_t
79 loff_t
80 mode_t
81 nlink_t
82 off64_t
83 off_t
84 pid_t
85 pthread_attr_t
86 pthread_barrier_t
87 pthread_barrierattr_t
88 pthread_cond_t
89 pthread_condattr_t
90 pthread_key_t
91 pthread_mutex_t
92 pthread_mutexattr_t
93 pthread_once_t
94 pthread_rwlock_t
95 pthread_rwlockattr_t
96 pthread_spinlock_t
97 pthread_t
98 quad_t
99 register_t
100 rlim64_t
101 rlim_t
102 sigset_t
103 size_t
104 socklen_t
105 ssize_t
106 suseconds_t
107 time_t
108 u_char
109 uid_t
110 uint
111 u_int
112 u_int16_t
113 u_int32_t
114 u_int64_t
115 u_int8_t
116 ulong
117 u_long
118 u_quad_t
119 useconds_t
120 ushort
121 u_short
123 diff -N -U0 $data -