nixpkgs/pkgs/by-name/fo/fortify-headers/wchar-imports-skip.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

42 lines
1.2 KiB
Diff

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/fortify/wchar.h
+++ b/include/fortify/wchar.h
@@ -20,21 +20,23 @@
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
-#include_next <limits.h>
+#include_next <wchar.h>
+
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
-#include_next <stdlib.h>
+#include_next <limits.h>
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
-#include_next <string.h>
+#include_next <stdlib.h>
#if !defined(__cplusplus) && !defined(__clang__)
__extension__
#endif
-#include_next <wchar.h>
+#include_next <string.h>
-#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
#include "fortify-headers.h"
#ifdef __cplusplus