This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] Make cstddef / cstdarg more robust (PR 69881)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Cc: Jonathan Wakely <jwakely at redhat dot com>
- Date: Tue, 23 Feb 2016 07:15:47 +0000
- Subject: [PATCH] Make cstddef / cstdarg more robust (PR 69881)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=hotmail.de;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Hi,
as described in the PR 69881 it happens quite often that cstddef is
called with __need_size_t because we still support gmp-4.3.2 which
is installed by contrib/download_prerequisites. This causes a kind
of undefined behavior. It is just by chance that this does not cause
the gcc-6 boot-strap to fail, but it causes gcc-4.9 bootstrap to fail
when the gcc-6 version of cstddef is around. So it looks like a
regression, because the new cstddef is more fragile than before.
As it looks like, neither c/* nor c_std/* headers will compile without
major bug-fixing first, and they are likely not in use by anybody.
Therefore I think it is best not to touch these at all, because it is
hard to test anything there.
So I propose to undefine all problematic __need_* that may cause
cstddef or cstdarg fail to compile.
Boot-strapped and reg-tested on x86_64-pc-linux-gnu
OK for trunk?
Thanks
Bernd.
2016-02-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR libstdc++/69881
* include/c_global/cstdarg: Undefine __need___va_list.
* include/c_global/cstddef: Undefine all kinds of __need_*.
Index: libstdc++-v3/include/c_global/cstdarg
===================================================================
--- libstdc++-v3/include/c_global/cstdarg (revision 233604)
+++ libstdc++-v3/include/c_global/cstdarg (working copy)
@@ -38,6 +38,7 @@
#pragma GCC system_header
+#undef __need___va_list
#include <bits/c++config.h>
#include <stdarg.h>
Index: libstdc++-v3/include/c_global/cstddef
===================================================================
--- libstdc++-v3/include/c_global/cstddef (revision 233604)
+++ libstdc++-v3/include/c_global/cstddef (working copy)
@@ -41,6 +41,11 @@
#pragma GCC system_header
+#undef __need_wchar_t
+#undef __need_ptrdiff_t
+#undef __need_size_t
+#undef __need_NULL
+#undef __need_wint_t
#include <bits/c++config.h>
#include <stddef.h>