lol

fortify-headers: patch wchar.h's include behaviour

authored by

Robert Scott and committed by
Yureka
36d3eb27 fc462da7

+45
+4
pkgs/development/libraries/fortify-headers/default.nix
··· 15 15 hash = "sha256-8A8JcKHIBgXpUuIP4zs3Q1yBs5jCGd5F3H2E8UN/S2g="; 16 16 }; 17 17 18 + patches = [ 19 + ./wchar-imports-skip.patch 20 + ]; 21 + 18 22 installPhase = '' 19 23 runHook preInstall 20 24
+41
pkgs/development/libraries/fortify-headers/wchar-imports-skip.patch
··· 1 + wchar.h: only include other headers if _FORTIFY_SOURCE is enabled 2 + 3 + unexpectedly including other headers can cause problems with 4 + sensitive/brittle code, particularly with alternative compilers 5 + (clang) which are already operating on the margins of what's 6 + supported/expected by some projects. 7 + 8 + having a way to almost entirely short-circuit these headers (by 9 + disabling _FORTIFY_SOURCE) is therefore important. 10 + 11 + --- a/include/fortify/wchar.h 12 + +++ b/include/fortify/wchar.h 13 + @@ -20,21 +20,23 @@ 14 + #if !defined(__cplusplus) && !defined(__clang__) 15 + __extension__ 16 + #endif 17 + -#include_next <limits.h> 18 + +#include_next <wchar.h> 19 + + 20 + +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 21 + + 22 + #if !defined(__cplusplus) && !defined(__clang__) 23 + __extension__ 24 + #endif 25 + -#include_next <stdlib.h> 26 + +#include_next <limits.h> 27 + #if !defined(__cplusplus) && !defined(__clang__) 28 + __extension__ 29 + #endif 30 + -#include_next <string.h> 31 + +#include_next <stdlib.h> 32 + #if !defined(__cplusplus) && !defined(__clang__) 33 + __extension__ 34 + #endif 35 + -#include_next <wchar.h> 36 + +#include_next <string.h> 37 + 38 + -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 39 + #include "fortify-headers.h" 40 + 41 + #ifdef __cplusplus