This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch 3.4] Backport stdio_va_list_clients fix
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: bkorb at gnu dot org, gdr at integrable-solutions dot net
- Date: Fri, 16 Dec 2005 12:00:54 -0500 (EST)
- Subject: [patch 3.4] Backport stdio_va_list_clients fix
The stdio_va_list_clients contains an import fix for various hpux
headers. Including any of these headers results in a compilation
error when using the 3.4 branch. I noticed this trying to build
gdb with 3.4.4. Thus, I would like to backport the current fix from
the mainline.
Tested with full bootstraps and checks on hppa2.0w-hp-hpux11.11
and hppa64-hp-hpux11.11.
Ok?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2005-12-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Backport from mainline:
2004-11-01 Mike Stump <mrs@apple.com>
* inclhack.def (stdio_va_list): Break out clients from here...
(stdio_va_list_clients): ...to here. Also, don't fix if stdarg.h is
included or ifdef va_start.
* fixincl.x: Regenerate.
Index: fixinc/inclhack.def
===================================================================
--- fixinc/inclhack.def (revision 108513)
+++ fixinc/inclhack.def (working copy)
@@ -2942,6 +2942,56 @@
/*
+ * Fix headers that use va_list from stdio.h to use the updated
+ * va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
+ * dealt with elsewhere. The presence of __gnuc_va_list,
+ * __DJ_va_list, or _G_va_list is taken to indicate that the header
+ * knows what it's doing.
+ */
+fix = {
+ hackname = stdio_va_list_clients;
+ files = com_err.h;
+ files = cps.h;
+ files = curses.h;
+ files = krb5.h;
+ files = lc_core.h;
+ files = pfmt.h;
+ files = wchar.h;
+ files = curses_colr/curses.h;
+ bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
+ /* Don't fix, if we use va_list from stdarg.h, or if the use is
+ otherwise protected. */
+ bypass = 'include <stdarg\.h>|#ifdef va_start';
+
+ /*
+ * Use __gnuc_va_list in arg types in place of va_list.
+ * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
+ * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
+ * trailing parentheses and semicolon save all other systems from this.
+ * Define __not_va_list__ (something harmless and unused)
+ * instead of va_list.
+ * Don't claim to have defined va_list.
+ */
+ sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
+ "s@(va_list)&@(__gnuc_va_list)\\&@\n"
+ "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
+ "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
+ "s@ va_list@ __not_va_list__@\n"
+ "s@\\*va_list@*__not_va_list__@\n"
+ "s@ __va_list)@ __gnuc_va_list)@\n"
+ "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
+ "@typedef \\1 __not_va_list__;@\n"
+ "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
+ "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
+ "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
+ "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
+ "s@VA_LIST@DUMMY_VA_LIST@\n"
+ "s@_Va_LIST@_VA_LIST@";
+ test_text = "extern void mumble( va_list);";
+};
+
+
+/*
* "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
* is "!defined( __STRICT_ANSI__ )"
*/