Blame scripts/check-c++-types.sh

Packit 6c4009
#!/bin/bash
Packit 6c4009
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
# This script creates a list of data types where each type is followed
Packit 6c4009
# by the C++ mangled name for that type.  That list is then compared
Packit 6c4009
# against the list in the c++-types.data file for the platform being
Packit 6c4009
# checked.  Any difference between the two would mean that the C++ ABI
Packit 6c4009
# had changed and that should not happen even if the change is compatible
Packit 6c4009
# at the C language level.
Packit 6c4009
Packit 6c4009
#
Packit 6c4009
# The list of data types has been created with
Packit 6c4009
# cat <
Packit 6c4009
# #include <sys/types.h>
Packit 6c4009
# #include <unistd.h>
Packit 6c4009
# #include <sys/resource.h>
Packit 6c4009
# #include <sys/stat.h>
Packit 6c4009
# EOF
Packit 6c4009
# gcc -D_GNU_SOURCE -E - |
Packit 6c4009
# egrep '^typedef.*;$' |
Packit 6c4009
# sed 's/^typedef[[:space:]]*//;s/\([[:space:]]\{1,\}__attribute__.*\);/;/;s/.*[[:space:]]\([*]\|\)\(.*\);/\2/' |
Packit 6c4009
# egrep -v '^_' |
Packit 6c4009
# LC_ALL=C sort -u
Packit 6c4009
#
Packit 6c4009
data=$1
Packit 6c4009
shift
Packit 6c4009
cxx=$(echo $* | sed 's/-fgnu89-inline//')
Packit 6c4009
while read t; do
Packit 6c4009
  echo -n "$t:"
Packit 6c4009
  $cxx -S -xc++ -o - -D_GNU_SOURCE <(cat <
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
#include <sys/stat.h>
Packit 6c4009
#include <sys/resource.h>
Packit 6c4009
#include <unistd.h>
Packit 6c4009
void foo ($t) { }
Packit 6c4009
EOF
Packit 6c4009
) |
Packit 6c4009
  sed 's/[[:space:]]*[.]globa\?l[[:space:]]*_Z3foo\([_[:alnum:]]*\).*/\1/p;d'
Packit 6c4009
done <
Packit 6c4009
blkcnt64_t
Packit 6c4009
blkcnt_t
Packit 6c4009
blksize_t
Packit 6c4009
caddr_t
Packit 6c4009
clockid_t
Packit 6c4009
clock_t
Packit 6c4009
daddr_t
Packit 6c4009
dev_t
Packit 6c4009
fd_mask
Packit 6c4009
fsblkcnt64_t
Packit 6c4009
fsblkcnt_t
Packit 6c4009
fsfilcnt64_t
Packit 6c4009
fsfilcnt_t
Packit 6c4009
fsid_t
Packit 6c4009
gid_t
Packit 6c4009
id_t
Packit 6c4009
ino64_t
Packit 6c4009
ino_t
Packit 6c4009
int16_t
Packit 6c4009
int32_t
Packit 6c4009
int64_t
Packit 6c4009
int8_t
Packit 6c4009
intptr_t
Packit 6c4009
key_t
Packit 6c4009
loff_t
Packit 6c4009
mode_t
Packit 6c4009
nlink_t
Packit 6c4009
off64_t
Packit 6c4009
off_t
Packit 6c4009
pid_t
Packit 6c4009
pthread_attr_t
Packit 6c4009
pthread_barrier_t
Packit 6c4009
pthread_barrierattr_t
Packit 6c4009
pthread_cond_t
Packit 6c4009
pthread_condattr_t
Packit 6c4009
pthread_key_t
Packit 6c4009
pthread_mutex_t
Packit 6c4009
pthread_mutexattr_t
Packit 6c4009
pthread_once_t
Packit 6c4009
pthread_rwlock_t
Packit 6c4009
pthread_rwlockattr_t
Packit 6c4009
pthread_spinlock_t
Packit 6c4009
pthread_t
Packit 6c4009
quad_t
Packit 6c4009
register_t
Packit 6c4009
rlim64_t
Packit 6c4009
rlim_t
Packit 6c4009
sigset_t
Packit 6c4009
size_t
Packit 6c4009
socklen_t
Packit 6c4009
ssize_t
Packit 6c4009
suseconds_t
Packit 6c4009
time_t
Packit 6c4009
u_char
Packit 6c4009
uid_t
Packit 6c4009
uint
Packit 6c4009
u_int
Packit 6c4009
u_int16_t
Packit 6c4009
u_int32_t
Packit 6c4009
u_int64_t
Packit 6c4009
u_int8_t
Packit 6c4009
ulong
Packit 6c4009
u_long
Packit 6c4009
u_quad_t
Packit 6c4009
useconds_t
Packit 6c4009
ushort
Packit 6c4009
u_short
Packit 6c4009
EOF
Packit 6c4009
diff -N -U0 $data -