blob: fcddf327eecb7a09e8f34fdb07aa5a03c26e5a5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
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
|
wchar.h: only include other headers if _FORTIFY_SOURCE is enabled
unexpectedly including other headers can cause problems with
sensitive/brittle code, particularly with alternative compilers
(clang) which are already operating on the margins of what's
supported/expected by some projects.
having a way to almost entirely short-circuit these headers (by
disabling _FORTIFY_SOURCE) is therefore important.
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -17,6 +17,13 @@
#ifndef _FORTIFY_WCHAR_H
#define _FORTIFY_WCHAR_H
+#if !defined(__cplusplus) && !defined(__clang__)
+__extension__
+#endif
+#include_next <wchar.h>
+
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
@@ -32,9 +39,7 @@ __extension__
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
-#include_next <wchar.h>
-#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
#include "fortify-headers.h"
#ifdef __cplusplus
|