Check-in [a431979fb3]
Overview
Comment:Updated to deal with FreeBSD headers with respect to va_args
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a431979fb3936ac3100792942a139a4e339e928d
User & Date: rkeene on 2016-01-25 20:30:49
Other Links: manifest | tags
Context
2016-03-20
07:50
Updated to make dlclose more workable on win32 when building statically check-in: 50ae80c10b user: rkeene tags: trunk
2016-01-25
20:30
Updated to deal with FreeBSD headers with respect to va_args check-in: a431979fb3 user: rkeene tags: trunk
20:30
Updated to use more universal hash-bang lines for scripts check-in: 634ad56305 user: rkeene tags: trunk
Changes

Modified patch-headers.sh from [d0c4a0c4ce] to [834bd68ab4].

12
13
14
15
16
17
18

19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
















44
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40





41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57







+







+













-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

	print "#define __RENAME(x) no renaming on this platform"
	next
}
{print}

/^#warning /{ next }
	' sys/cdefs.h > sys/cdefs.h.new
	rm -f sys/cdefs.h
	cat sys/cdefs.h.new > sys/cdefs.h
	rm -f sys/cdefs.h.new
fi

## loff_t depends on __GNUC__ for some reason
if awk -v retval=1 '/__GNUC__/{ getline; if ($0 ~ /__kernel_loff_t/) {retval=0} } END{exit retval}' asm/posix_types.h >/dev/null 2>/dev/null; then
	awk '/__GNUC__/{ getline; if ($0 ~ /__kernel_loff_t/) { print "#if 1"; print; next } } { print }' asm/posix_types.h > asm/posix_types.h.new
	rm -f asm/posix_types.h
	cat asm/posix_types.h.new > asm/posix_types.h
	rm -f asm/posix_types.h.new
fi

# Busted wrapper fix-up
if grep '__STDC_HOSTED__' stdint.h >/dev/null 2>/dev/null && grep '_GCC_WRAP_STDINT_H' stdint.h >/dev/null 2>/dev/null; then
	echo '#include_next <stdint.h>' > stdint.h
fi

if grep '__CLANG_LIMITS_H' limits.h >/dev/null 2>/dev/null; then
	echo '#include_next <limits.h>' > limits.h
fi

# MUSL libc expects GCC
if grep ' __builtin_va_list ' bits/alltypes.h >/dev/null 2>/dev/null; then
	sed 's@ __builtin_va_list @ char * @' bits/alltypes.h > bits/alltypes.h.new
	cat bits/alltypes.h.new > bits/alltypes.h
	rm -f bits/alltypes.h.new
# MUSL libc expects GCC (bits/alltypes.h)
# FreeBSD expects some GCCisms (x86/_types.h)
for file in bits/alltypes.h x86/_types.h; do
	if grep '[[:space:]]__builtin_va_list[[:space:]]' "${file}" >/dev/null 2>/dev/null; then
		sed 's@[[:space:]]__builtin_va_list[[:space:]]@ char * @' "${file}" > "${file}.new"
		rm -f "${file}"
		cat "${file}.new" > "${file}"
		rm -f "${file}.new"
	fi
done

if grep __GNUCLIKE_BUILTIN_VARARGS x86/_types.h >/dev/null 2>/dev/null; then
	sed '/__GNUCLIKE_BUILTIN_VARARGS/ {h;s/.*/typedef char * __va_list;/;p;g;}' x86/_types.h > x86/_types.h.new
	rm -f x86/_types.h
	cat x86/_types.h.new > x86/_types.h
	rm -f x86/_types.h.new
fi