From 8bca7d07a43efeeb3e8161d88c7e90fd6ae1f9b9 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Fri, 16 Dec 2005 18:18:36 +0000 Subject: [PATCH] backport: inclhack.def (stdio_va_list): Break out clients from here... Backport from mainline: 2004-11-01 Mike Stump * 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. From-SVN: r108666 --- gcc/ChangeLog | 10 ++++++ gcc/fixinc/fixincl.x | 77 +++++++++++++++++++++++++++++++++++------ gcc/fixinc/inclhack.def | 50 ++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7d56286dac2..d8dac6a9f0e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2005-12-16 John David Anglin + + Backport from mainline: + 2004-11-01 Mike Stump + + * 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. + 2005-12-13 Alan Modra * config/rs6000/linux64.h (TARGET_ALIGN_NATURAL): Define. diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index b9eb929b4b97..88d005bbfeea 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Monday November 7, 2005 at 02:33:08 PM PST + * It has been AutoGen-ed Friday December 16, 2005 at 01:14:56 PM EST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT CVS-MERGE THIS FILE, EITHER Mon Nov 7 14:33:08 PST 2005 +/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Dec 16 13:14:56 EST 2005 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 188 fixup descriptions. + * This file contains 189 fixup descriptions. * * See README for more information. * @@ -26,8 +26,7 @@ * * You may redistribute it and/or modify it under the terms of the * GNU General Public License, as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. + * Foundation; either version 2, or (at your option) any later version. * * inclhack is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -35,10 +34,10 @@ * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with inclhack. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. + * along with inclhack. See the file "COPYING". If not, + * write to: The Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -5359,6 +5358,56 @@ s@VA_LIST@DUMMY_VA_LIST@\n\ s@_Va_LIST@_VA_LIST@", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Stdio_Va_List_Clients fix + */ +tSCC zStdio_Va_List_ClientsName[] = + "stdio_va_list_clients"; + +/* + * File name selection pattern + */ +tSCC zStdio_Va_List_ClientsList[] = + "|com_err.h|cps.h|curses.h|krb5.h|lc_core.h|pfmt.h|wchar.h|curses_colr/curses.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzStdio_Va_List_ClientsMachs (const char**)NULL + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zStdio_Va_List_ClientsBypass0[] = + "__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list"; +tSCC zStdio_Va_List_ClientsBypass1[] = + "include |#ifdef va_start"; + +#define STDIO_VA_LIST_CLIENTS_TEST_CT 2 +static tTestDesc aStdio_Va_List_ClientsTests[] = { + { TT_NEGREP, zStdio_Va_List_ClientsBypass0, (regex_t*)NULL }, + { TT_NEGREP, zStdio_Va_List_ClientsBypass1, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Stdio_Va_List_Clients + */ +static const char* apzStdio_Va_List_ClientsPatch[] = { "sed", + "-e", "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@", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Strict_Ansi_Not fix @@ -7553,9 +7602,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 223 +#define REGEX_COUNT 225 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 188 +#define FIX_COUNT 189 /* * Enumerate the fixes @@ -7692,6 +7741,7 @@ typedef enum { STATSSWTCH_FIXIDX, STDIO_STDARG_H_FIXIDX, STDIO_VA_LIST_FIXIDX, + STDIO_VA_LIST_CLIENTS_FIXIDX, STRICT_ANSI_NOT_FIXIDX, STRICT_ANSI_NOT_CTD_FIXIDX, STRICT_ANSI_ONLY_FIXIDX, @@ -8407,6 +8457,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { STDIO_VA_LIST_TEST_CT, FD_MACH_IFNOT, aStdio_Va_ListTests, apzStdio_Va_ListPatch, 0 }, + { zStdio_Va_List_ClientsName, zStdio_Va_List_ClientsList, + apzStdio_Va_List_ClientsMachs, + STDIO_VA_LIST_CLIENTS_TEST_CT, FD_MACH_ONLY, + aStdio_Va_List_ClientsTests, apzStdio_Va_List_ClientsPatch, 0 }, + { zStrict_Ansi_NotName, zStrict_Ansi_NotList, apzStrict_Ansi_NotMachs, STRICT_ANSI_NOT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index 3bd13ad06aa4..5fdb41ecc61b 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -2941,6 +2941,56 @@ fix = { }; +/* + * 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 |#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__ )" -- 2.47.2