summaryrefslogtreecommitdiff
path: root/dev-cpp/libmcpp/files/mcpp-c99.patch
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-03-18 20:31:31 -0400
committerSam James <sam@gentoo.org>2024-03-19 03:20:51 +0000
commite572c88554dd14921c39809f3b780cea49ce9c56 (patch)
tree2e14aab00eeeb9853140aefb5cea30eb2f78013f /dev-cpp/libmcpp/files/mcpp-c99.patch
parentcd038fa2c680a1bd5a11d0ed88d3ab392a8aa273 (diff)
downloadgentoo-e572c88554dd14921c39809f3b780cea49ce9c56.tar.gz
gentoo-e572c88554dd14921c39809f3b780cea49ce9c56.tar.bz2
gentoo-e572c88554dd14921c39809f3b780cea49ce9c56.zip
dev-cpp/libmcpp: add patches to build with Modern C
Closes: https://bugs.gentoo.org/919186 Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-cpp/libmcpp/files/mcpp-c99.patch')
-rw-r--r--dev-cpp/libmcpp/files/mcpp-c99.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/dev-cpp/libmcpp/files/mcpp-c99.patch b/dev-cpp/libmcpp/files/mcpp-c99.patch
new file mode 100644
index 000000000000..e6538e7955f4
--- /dev/null
+++ b/dev-cpp/libmcpp/files/mcpp-c99.patch
@@ -0,0 +1,59 @@
+Florian Weimer's c99 patch from https://sourceforge.net/p/mcpp/patches/7/
+
+Do not define and undefine _*_SOURCE macros. These have special
+semantics to glibc. <limits.h> may include <features.h>, and which
+point the feature configuration gets frozen. Without this change,
+when system.c includes <unistd.h>, the feature macros are hard-coded
+as baseline POSIX, which does not include readlink. This will lead to
+compilation errors with future compilers.
+
+diff --git a/src/configed.H b/src/configed.H
+index b4d1ebf3a6bfa280..bde16fc8db38a2c4 100644
+--- a/src/configed.H
++++ b/src/configed.H
+@@ -295,20 +295,7 @@
+ * ULONGMAX should be defined to the ULONG_MAX in <limits.h>.
+ */
+
+-/* _POSIX_* only to get PATH_MAX */
+-#define _POSIX_ 1
+-#define _POSIX_SOURCE 1
+-#ifndef _POSIX_C_SOURCE
+-#define _POSIX_C_SOURCE 1
+-#define _POSIX_C_SOURCE_defined 1
+-#endif
+ #include "limits.h"
+-#undef _POSIX_
+-#undef _POSIX_SOURCE
+-#ifdef _POSIX_C_SOURCE_defined
+-#undef _POSIX_C_SOURCE
+-#undef _POSIX_C_SOURCE_defined
+-#endif
+ #define CHARBIT CHAR_BIT
+ #define UCHARMAX UCHAR_MAX
+ #define USHRTMAX USHRT_MAX
+diff --git a/src/noconfig.H b/src/noconfig.H
+index 6b634fe0b32ff67c..7c923c900c8865dd 100644
+--- a/src/noconfig.H
++++ b/src/noconfig.H
+@@ -570,20 +570,7 @@
+ #include "stdio.h"
+
+ /* PATHMAX is the maximum length of path-list on the host system. */
+-/* _POSIX_* only to get PATH_MAX */
+-#define _POSIX_ 1
+-#define _POSIX_SOURCE 1
+-#ifndef _POSIX_C_SOURCE
+-#define _POSIX_C_SOURCE 1
+-#define _POSIX_C_SOURCE_defined 1
+-#endif
+ #include "limits.h"
+-#undef _POSIX_
+-#undef _POSIX_SOURCE
+-#ifdef _POSIX_C_SOURCE_defined
+-#undef _POSIX_C_SOURCE
+-#undef _POSIX_C_SOURCE_defined
+-#endif
+ #ifdef PATH_MAX
+ #define PATHMAX PATH_MAX /* Posix macro */
+ #else