blob: 86fb22ffd35efc80c0b112a9c97c20f746ddcd13 [file] [log] [blame]
Patrick Williams03907ee2022-05-01 06:28:52 -05001From 07a06aa8e8285c1bb06d0bebeaa9ad04eb76f2e2 Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Feb 2017 12:56:00 -0800
Andrew Geisslerc182c622020-05-15 14:13:32 -05004Subject: [PATCH] sync gcc stddef.h with musl
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
6musl defines ptrdiff_t size_t and wchar_t
7so dont define them here if musl is definining them
8
Andrew Geissler595f6302022-01-24 19:11:47 +00009Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=85a438fc78dd12249ca854a3e5c577fefeb1a5cd]
Andrew Geissler82c905d2020-04-13 13:39:40 -050010
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gcc/ginclude/stddef.h | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
Andrew Geisslerc926e172021-05-07 16:11:35 -050017index 66619fe43b1..3f843d6f365 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050018--- a/gcc/ginclude/stddef.h
19+++ b/gcc/ginclude/stddef.h
20@@ -128,6 +128,7 @@ _TYPE_wchar_t;
21 #ifndef ___int_ptrdiff_t_h
22 #ifndef _GCC_PTRDIFF_T
23 #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
24+#ifndef __DEFINED_ptrdiff_t /* musl */
25 #define _PTRDIFF_T
26 #define _T_PTRDIFF_
27 #define _T_PTRDIFF
28@@ -137,10 +138,12 @@ _TYPE_wchar_t;
29 #define ___int_ptrdiff_t_h
30 #define _GCC_PTRDIFF_T
31 #define _PTRDIFF_T_DECLARED
32+#define __DEFINED_ptrdiff_t /* musl */
33 #ifndef __PTRDIFF_TYPE__
34 #define __PTRDIFF_TYPE__ long int
35 #endif
36 typedef __PTRDIFF_TYPE__ ptrdiff_t;
37+#endif /* __DEFINED_ptrdiff_t */
38 #endif /* _PTRDIFF_T_DECLARED */
39 #endif /* _GCC_PTRDIFF_T */
40 #endif /* ___int_ptrdiff_t_h */
41@@ -178,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
42 #ifndef _GCC_SIZE_T
43 #ifndef _SIZET_
44 #ifndef __size_t
45+#ifndef __DEFINED_size_t /* musl */
46 #define __size_t__ /* BeOS */
47 #define __SIZE_T__ /* Cray Unicos/Mk */
48 #define _SIZE_T
49@@ -194,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
50 #define ___int_size_t_h
51 #define _GCC_SIZE_T
52 #define _SIZET_
53+#define __DEFINED_size_t /* musl */
54 #if defined (__FreeBSD__) \
55 || defined(__DragonFly__) \
56 || defined(__FreeBSD_kernel__) \
57@@ -228,6 +233,7 @@ typedef long ssize_t;
58 #endif /* _SIZE_T */
59 #endif /* __SIZE_T__ */
60 #endif /* __size_t__ */
61+#endif /* __DEFINED_size_t */
62 #undef __need_size_t
63 #endif /* _STDDEF_H or __need_size_t. */
64
65@@ -257,6 +263,7 @@ typedef long ssize_t;
66 #ifndef ___int_wchar_t_h
67 #ifndef __INT_WCHAR_T_H
68 #ifndef _GCC_WCHAR_T
69+#ifndef __DEFINED_wchar_t /* musl */
70 #define __wchar_t__ /* BeOS */
71 #define __WCHAR_T__ /* Cray Unicos/Mk */
72 #define _WCHAR_T
73@@ -272,6 +279,7 @@ typedef long ssize_t;
74 #define __INT_WCHAR_T_H
75 #define _GCC_WCHAR_T
76 #define _WCHAR_T_DECLARED
77+#define __DEFINED_wchar_t /* musl */
78
79 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
80 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
81@@ -337,6 +345,7 @@ typedef __WCHAR_TYPE__ wchar_t;
82 #endif
83 #endif /* __WCHAR_T__ */
84 #endif /* __wchar_t__ */
85+#endif /* __DEFINED_wchar_t musl */
86 #undef __need_wchar_t
87 #endif /* _STDDEF_H or __need_wchar_t. */
88