dart-sass: 1.83.0 -> 1.83.1 (#372038)
[NixPkgs.git] / pkgs / by-name / fo / fortify-headers / restore-macros.patch
blobf7d31a329e354e0558acc17357023c6fee13b6b4
1 restore #undef'ed macro values after we're done
3 some programs that define these miss them if removed
5 push_macro and pop_macro pragmas allegedly well supported
6 by gcc, clang and msvc
8 --- a/include/fortify/poll.h
9 +++ b/include/fortify/poll.h
10 @@ -29,6 +29,7 @@ __extension__
11 extern "C" {
12 #endif
14 +#pragma push_macro("poll")
15 #undef poll
17 _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __s)
18 @@ -40,6 +41,8 @@ _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __
19 return __orig_poll(__f, __n, __s);
22 +#pragma pop_macro("poll")
24 #ifdef __cplusplus
26 #endif
27 --- a/include/fortify/stdio.h
28 +++ b/include/fortify/stdio.h
29 @@ -29,12 +29,19 @@ __extension__
30 extern "C" {
31 #endif
33 +#pragma push_macro("fgets")
34 #undef fgets
35 +#pragma push_macro("fread")
36 #undef fread
37 +#pragma push_macro("fwrite")
38 #undef fwrite
39 +#pragma push_macro("vsprintf")
40 #undef vsprintf
41 +#pragma push_macro("vsnprintf")
42 #undef vsnprintf
43 +#pragma push_macro("snprintf")
44 #undef snprintf
45 +#pragma push_macro("sprintf")
46 #undef sprintf
48 _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f)
49 @@ -140,6 +147,14 @@ _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...)
50 #endif /* __has_builtin(__builtin_va_arg_pack) */
51 #endif /* defined(__has_builtin) */
53 +#pragma pop_macro("fgets")
54 +#pragma pop_macro("fread")
55 +#pragma pop_macro("fwrite")
56 +#pragma pop_macro("vsprintf")
57 +#pragma pop_macro("vsnprintf")
58 +#pragma pop_macro("snprintf")
59 +#pragma pop_macro("sprintf")
61 #ifdef __cplusplus
63 #endif
64 --- a/include/fortify/stdlib.h
65 +++ b/include/fortify/stdlib.h
66 @@ -38,7 +38,10 @@ extern "C" {
68 /* FIXME clang */
69 #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__)
71 +#pragma push_macro("realpath")
72 #undef realpath
74 _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r)
76 #ifndef PATH_MAX
77 @@ -60,6 +63,9 @@ _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r)
78 return __orig_realpath(__p, __r);
79 #endif
82 +#pragma pop_macro("realpath")
84 #endif
86 #ifdef __cplusplus
87 --- a/include/fortify/string.h
88 +++ b/include/fortify/string.h
89 @@ -29,12 +29,19 @@ __extension__
90 extern "C" {
91 #endif
93 +#pragma push_macro("memcpy")
94 #undef memcpy
95 +#pragma push_macro("memmove")
96 #undef memmove
97 +#pragma push_macro("memset")
98 #undef memset
99 +#pragma push_macro("strcat")
100 #undef strcat
101 +#pragma push_macro("strcpy")
102 #undef strcpy
103 +#pragma push_macro("strncat")
104 #undef strncat
105 +#pragma push_macro("strncpy")
106 #undef strncpy
108 _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od,
109 @@ -183,6 +190,14 @@ _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d,
111 #endif
113 +#pragma pop_macro("memcpy")
114 +#pragma pop_macro("memmove")
115 +#pragma pop_macro("memset")
116 +#pragma pop_macro("strcat")
117 +#pragma pop_macro("strcpy")
118 +#pragma pop_macro("strncat")
119 +#pragma pop_macro("strncpy")
121 #ifdef __cplusplus
123 #endif
124 --- a/include/fortify/strings.h
125 +++ b/include/fortify/strings.h
126 @@ -29,8 +29,12 @@ extern "C" {
127 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
128 || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
129 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
131 +#pragma push_macro("bcopy")
132 #undef bcopy
133 +#pragma push_macro("bzero")
134 #undef bzero
136 _FORTIFY_FN(bcopy) void bcopy(const void * _FORTIFY_POS0 __s,
137 void * _FORTIFY_POS0 __d, size_t __n)
139 @@ -52,6 +56,9 @@ _FORTIFY_FN(bzero) void bzero(void * _FORTIFY_POS0 __s, size_t __n)
141 #endif
143 +#pragma pop_macro("bcopy")
144 +#pragma pop_macro("bzero")
146 #ifdef __cplusplus
148 #endif
149 --- a/include/fortify/sys/socket.h
150 +++ b/include/fortify/sys/socket.h
151 @@ -29,9 +29,13 @@ __extension__
152 extern "C" {
153 #endif
155 +#pragma push_macro("recv")
156 #undef recv
157 +#pragma push_macro("recvfrom")
158 #undef recvfrom
159 +#pragma push_macro("send")
160 #undef send
161 +#pragma push_macro("sendto")
162 #undef sendto
164 _FORTIFY_FN(recv) ssize_t recv(int __f, void * _FORTIFY_POS0 __s, size_t __n,
165 @@ -76,6 +80,11 @@ _FORTIFY_FN(sendto) ssize_t sendto(int __f, const void * _FORTIFY_POS0 __s,
166 return __orig_sendto(__f, __s, __n, __fl, __a, __l);
169 +#pragma push_macro("recv")
170 +#pragma push_macro("recvfrom")
171 +#pragma push_macro("send")
172 +#pragma push_macro("sendto")
174 #ifdef __cplusplus
176 #endif
177 --- a/include/fortify/unistd.h
178 +++ b/include/fortify/unistd.h
179 @@ -29,16 +29,27 @@ __extension__
180 extern "C" {
181 #endif
183 +#pragma push_macro("confstr")
184 #undef confstr
185 +#pragma push_macro("getcwd")
186 #undef getcwd
187 +#pragma push_macro("getgroups")
188 #undef getgroups
189 +#pragma push_macro("gethostname")
190 #undef gethostname
191 +#pragma push_macro("getlogin_r")
192 #undef getlogin_r
193 +#pragma push_macro("pread")
194 #undef pread
195 +#pragma push_macro("read")
196 #undef read
197 +#pragma push_macro("readlink")
198 #undef readlink
199 +#pragma push_macro("readlinkat")
200 #undef readlinkat
201 +#pragma push_macro("ttyname_r")
202 #undef ttyname_r
203 +#pragma push_macro("write")
204 #undef write
206 _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l)
207 @@ -158,6 +169,18 @@ _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s,
208 return __orig_write(__f, __s, __n);
211 +#pragma pop_macro("confstr")
212 +#pragma pop_macro("getcwd")
213 +#pragma pop_macro("getgroups")
214 +#pragma pop_macro("gethostname")
215 +#pragma pop_macro("getlogin_r")
216 +#pragma pop_macro("pread")
217 +#pragma pop_macro("read")
218 +#pragma pop_macro("readlink")
219 +#pragma pop_macro("readlinkat")
220 +#pragma pop_macro("ttyname_r")
221 +#pragma pop_macro("write")
223 #ifdef __cplusplus
225 #endif
226 --- a/include/fortify/wchar.h
227 +++ b/include/fortify/wchar.h
228 @@ -43,19 +43,33 @@ __extension__
229 extern "C" {
230 #endif
232 +#pragma push_macro("fgetws")
233 #undef fgetws
234 +#pragma push_macro("mbsrtowcs")
235 #undef mbsrtowcs
236 +#pragma push_macro("mbstowcs")
237 #undef mbstowcs
238 +#pragma push_macro("wcrtomb")
239 #undef wcrtomb
240 +#pragma push_macro("wcscat")
241 #undef wcscat
242 +#pragma push_macro("wcscpy")
243 #undef wcscpy
244 +#pragma push_macro("wcsncat")
245 #undef wcsncat
246 +#pragma push_macro("wcsncpy")
247 #undef wcsncpy
248 +#pragma push_macro("wcsrtombs")
249 #undef wcsrtombs
250 +#pragma push_macro("wcstombs")
251 #undef wcstombs
252 +#pragma push_macro("wctomb")
253 #undef wctomb
254 +#pragma push_macro("wmemcpy")
255 #undef wmemcpy
256 +#pragma push_macro("wmemmove")
257 #undef wmemmove
258 +#pragma push_macro("wmemset")
259 #undef wmemset
261 _FORTIFY_FN(fgetws) wchar_t *fgetws(wchar_t * _FORTIFY_POS0 __s,
262 @@ -269,6 +283,21 @@ _FORTIFY_FN(wmemset) wchar_t *wmemset(wchar_t * _FORTIFY_POS0 __s,
263 return __orig_wmemset(__s, __c, __n);
266 +#pragma pop_macro("fgetws")
267 +#pragma pop_macro("mbsrtowcs")
268 +#pragma pop_macro("mbstowcs")
269 +#pragma pop_macro("wcrtomb")
270 +#pragma pop_macro("wcscat")
271 +#pragma pop_macro("wcscpy")
272 +#pragma pop_macro("wcsncat")
273 +#pragma pop_macro("wcsncpy")
274 +#pragma pop_macro("wcsrtombs")
275 +#pragma pop_macro("wcstombs")
276 +#pragma pop_macro("wctomb")
277 +#pragma pop_macro("wmemcpy")
278 +#pragma pop_macro("wmemmove")
279 +#pragma pop_macro("wmemset")
281 #ifdef __cplusplus
283 #endif