Skip to content

Commit abad556

Browse files
committed
Fix GCC-builtin fetcher to work with current GCC
GCC has moved from Subversion to Git, and the files providing definitions of built-ins have changed.
1 parent d4f9c45 commit abad556

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

src/ansi-c/get-gcc-builtins.sh

+27-12
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ fi
99

1010
builtin_defs=" \
1111
builtin-types.def builtins.def sync-builtins.def \
12-
omp-builtins.def gtm-builtins.def cilk-builtins.def cilkplus.def \
13-
sanitizer.def chkp-builtins.def hsa-builtins.def brig-builtins.def \
12+
omp-builtins.def gtm-builtins.def \
13+
sanitizer.def brig-builtins.def coroutine-builtins.def \
1414
config/i386/i386-builtin.def config/i386/i386-builtin-types.def"
1515

1616
for f in $builtin_defs ; do
17-
[ ! -s `basename $f` ] || continue
18-
echo Downloading http://gcc.gnu.org/svn/gcc/trunk/gcc/$f
19-
svn export http://gcc.gnu.org/svn/gcc/trunk/gcc/$f > /dev/null
17+
bn=`basename $f`
18+
[ ! -s $bn ] || continue
19+
echo Downloading git://gcc.gnu.org/git/gcc/$f
20+
if [ `dirname $f` = "." ] ; then
21+
git archive --remote=git://gcc.gnu.org/git/gcc.git HEAD:gcc/ $bn | tar -x > $bn
22+
else
23+
git archive --remote=git://gcc.gnu.org/git/gcc.git HEAD:gcc/`dirname $f`/ $bn | tar -x > $bn
24+
fi
2025
done
2126

2227
cat > gcc-builtins.h <<EOF
@@ -25,6 +30,7 @@ cat > gcc-builtins.h <<EOF
2530
#include <unistd.h>
2631
#include <stdio.h>
2732
#include <wctype.h>
33+
#include <fenv.h>
2834
2935
typedef char __gcc_v8qi __attribute__ ((__vector_size__ (8)));
3036
typedef char __gcc_v16qi __attribute__ ((__vector_size__ (16)));
@@ -49,7 +55,7 @@ typedef long long __gcc_v1di __attribute__ ((__vector_size__ (8)));
4955
typedef long long __gcc_v2di __attribute__ ((__vector_size__ (16)));
5056
typedef long long __gcc_v4di __attribute__ ((__vector_size__ (32)));
5157
typedef long long __gcc_v8di __attribute__ ((__vector_size__ (64)));
52-
typedef unsigned long long __gcc_di;
58+
typedef long long __gcc_di;
5359
5460
EOF
5561

@@ -98,6 +104,10 @@ cat > builtins.h <<EOF
98104
#define short_unsigned_type_node unsigned short
99105
#define short_integer_type_node short
100106
#define unsigned_char_type_node unsigned char
107+
#define fenv_t_ptr_type_node fenv_t*
108+
#define const_fenv_t_ptr_type_node const fenv_t*
109+
#define fexcept_t_ptr_type_node fexcept_t*
110+
#define const_fexcept_t_ptr_type_node const fexcept_t*
101111
102112
// some newer versions of GCC apparently support __floatXYZ
103113
#define dfloat32_type_node __float32
@@ -167,9 +177,9 @@ TYPE(MANGLE(NAME));
167177
168178
#include "i386-builtin-types-expanded.def"
169179
170-
NEXTDEF BDESC(mask, icode, name, code, comparison, flag) \
180+
NEXTDEF BDESC(mask, mask2, icode, name, code, comparison, flag) \
171181
flag(MANGLEi386(name));
172-
NEXTDEF BDESC_FIRST(kind, KIND, mask, icode, name, code, comparison, flag) \
182+
NEXTDEF BDESC_FIRST(kind, KIND, mask, mask2, icode, name, code, comparison, flag) \
173183
flag(MANGLEi386(name));
174184
EOF
175185

@@ -192,9 +202,18 @@ cat i386-builtin-types.def | tr -c -d ',\n' | awk '{ print length }' | \
192202
sed 's/^\([0-9]\)[[:space:]]*\([^[:space:]]*\)[[:space:]]*DEF_FUNCTION_TYPE[[:space:]]*(/DEF_FUNCTION_TYPE_\1(\2, /' | \
193203
grep ^DEF_FUNCTION_TYPE >> i386-builtin-types-expanded.def
194204

205+
cat >> i386-builtin-types-expanded.def <<EOF
206+
DEF_FUNCTION_TYPE_4(UHI_FTYPE_V16SI_V16SI_INT_UHI, UHI, V16SI, V16SI, INT, UHI)
207+
DEF_FUNCTION_TYPE_2(UQI_FTYPE_UQI_UQI_CONST, UQI, UQI, UQI)
208+
EOF
209+
195210
gcc -E builtins.h | sed 's/^NEXTDEF/#define/' | \
196211
cat - builtins.def i386-builtin.def | \
212+
sed 's/_\(COUNT\|CONVERT\|ROUND\|PTEST\|SWAP\|VEC_MERGE\))$/)/' | \
197213
gcc -E -P - | \
214+
sed 's/BT_FN_VOID_VAR\*/void (*)()/g' |
215+
sed 's/BT_FN_VOID_PTR\*/void (*)(void *)/g' |
216+
sed 's/BT_FN_VOID_PTR_PTR\*/void (*)(void *, void *)/g' |
198217
sed 's/MANGLE("__builtin_" "\(.*\)")/__builtin_\1/' | \
199218
sed 's/MANGLEi386("__builtin_\(.*\)")/__builtin_\1/' | \
200219
sed 's/^(int) //' | \
@@ -222,16 +241,12 @@ remove_line() {
222241

223242
remove_line MANGLE
224243
remove_line builtin_type_for_size
225-
remove_line BT_FN
226244
remove_line lang_hooks.types.type_for_mode
227-
remove_line __float
228-
remove_line pointer_bounds_type_node
229245
remove_line BT_LAST
230246
remove_line BDESC_END
231247
remove_line error_mark_node
232248
remove_line '^0('
233249
remove_line 'CC.mode('
234-
remove_line FTYPE
235250
remove_line MULTI_ARG
236251

237252
ifs=$IFS

0 commit comments

Comments
 (0)