1#!/bin/bash 2# Copyright (C) 2003-2022 Free Software Foundation, Inc. 3# This file is part of the GNU C Library. 4 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. 9 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. 14 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/>. 18 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. 25 26# 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# grep -E '^typedef.*;$' | 36# sed 's/^typedef[[:space:]]*//;s/\([[:space:]]\{1,\}__attribute__.*\);/;/;s/.*[[:space:]]\([*]\|\)\(.*\);/\2/' | 37# grep -E -v '^_' | 38# LC_ALL=C sort -u 39# 40data=$1 41shift 42cxx=$(echo $* | sed 's/-fgnu89-inline//') 43while 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> 50void foo ($t) { } 51EOF 52) | 53 sed 's/[[:space:]]*[.]globa\?l[[:space:]]*_Z3foo\([_[:alnum:]]*\).*/\1/p;d' 54done <<EOF | 55blkcnt64_t 56blkcnt_t 57blksize_t 58caddr_t 59clockid_t 60clock_t 61daddr_t 62dev_t 63fd_mask 64fsblkcnt64_t 65fsblkcnt_t 66fsfilcnt64_t 67fsfilcnt_t 68fsid_t 69gid_t 70id_t 71ino64_t 72ino_t 73int16_t 74int32_t 75int64_t 76int8_t 77intptr_t 78key_t 79loff_t 80mode_t 81nlink_t 82off64_t 83off_t 84pid_t 85pthread_attr_t 86pthread_barrier_t 87pthread_barrierattr_t 88pthread_cond_t 89pthread_condattr_t 90pthread_key_t 91pthread_mutex_t 92pthread_mutexattr_t 93pthread_once_t 94pthread_rwlock_t 95pthread_rwlockattr_t 96pthread_spinlock_t 97pthread_t 98quad_t 99register_t 100rlim64_t 101rlim_t 102sigset_t 103size_t 104socklen_t 105ssize_t 106suseconds_t 107time_t 108u_char 109uid_t 110uint 111u_int 112u_int16_t 113u_int32_t 114u_int64_t 115u_int8_t 116ulong 117u_long 118u_quad_t 119useconds_t 120ushort 121u_short 122EOF 123diff -N -U0 $data - 124