From: Uros Bizjak Date: Mon, 2 Oct 2006 06:04:28 +0000 (+0200) Subject: inclhack.def (glibc_mutex_init): New fix. X-Git-Tag: releases/gcc-4.0.4~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee3832b5ab08f355bfe85875385a802ac4e5e2d4;p=thirdparty%2Fgcc.git inclhack.def (glibc_mutex_init): New fix. * inclhack.def (glibc_mutex_init): New fix. * tests/base/pthread.h: Update. * fixincl.x: Regenerate. From-SVN: r117365 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index c8627dc3f811..e4433cce8ce1 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2006-10-01 Uros Bizjak + + * inclhack.def (glibc_mutex_init): New fix. + * tests/base/pthread.h: Update. + + * fixincl.x: Regenerate. + 2006-09-29 Kaveh R. Ghazi * inclhack.def (solaris_mutex_init_2): Update for Solaris9. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 7b3523e93b23..ec05f8175da7 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Friday September 29, 2006 at 03:27:04 PM EDT + * It has been AutoGen-ed Monday October 2, 2006 at 07:40:46 AM CEST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Sep 29 15:27:04 EDT 2006 +/* DO NOT CVS-MERGE THIS FILE, EITHER Mon Oct 2 07:40:46 CEST 2006 * * 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 195 fixup descriptions. + * This file contains 196 fixup descriptions. * * See README for more information. * @@ -1986,6 +1986,42 @@ static const char* apzFreebsd_Gcc4_BreakagePatch[] = { "#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Glibc_Mutex_Init fix + */ +tSCC zGlibc_Mutex_InitName[] = + "glibc_mutex_init"; + +/* + * File name selection pattern + */ +tSCC zGlibc_Mutex_InitList[] = + "|pthread.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzGlibc_Mutex_InitMachs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zGlibc_Mutex_InitSelect0[] = + "\\{ *\\{ *0, *\\} *\\}"; + +#define GLIBC_MUTEX_INIT_TEST_CT 1 +static tTestDesc aGlibc_Mutex_InitTests[] = { + { TT_EGREP, zGlibc_Mutex_InitSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Glibc_Mutex_Init + */ +static const char* apzGlibc_Mutex_InitPatch[] = { "sed", + "-e", "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/", + "-e", "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/N;s/^[ \t]*#[ \t]*\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n# \\1\\n { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# else\\n# \\1\\n { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# endif/", + "-e", "/define[ \t]\\+PTHREAD_COND_INITIALIZER/s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Gnu_Types fix @@ -7866,9 +7902,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 237 +#define REGEX_COUNT 238 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 195 +#define FIX_COUNT 196 /* * Enumerate the fixes @@ -7921,6 +7957,7 @@ typedef enum { EXCEPTION_STRUCTURE_FIXIDX, FREEBSD_GCC3_BREAKAGE_FIXIDX, FREEBSD_GCC4_BREAKAGE_FIXIDX, + GLIBC_MUTEX_INIT_FIXIDX, GNU_TYPES_FIXIDX, HP_INLINE_FIXIDX, HP_SYSFILE_FIXIDX, @@ -8307,6 +8344,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { FREEBSD_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aFreebsd_Gcc4_BreakageTests, apzFreebsd_Gcc4_BreakagePatch, 0 }, + { zGlibc_Mutex_InitName, zGlibc_Mutex_InitList, + apzGlibc_Mutex_InitMachs, + GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY, + aGlibc_Mutex_InitTests, apzGlibc_Mutex_InitPatch, 0 }, + { zGnu_TypesName, zGnu_TypesList, apzGnu_TypesMachs, GNU_TYPES_TEST_CT, FD_MACH_IFNOT | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 6ba04ead88e4..9b7748aa0a1c 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1161,6 +1161,38 @@ fix = { }; +/* glibc-2.3.5 defines pthread mutex initializers incorrectly, + * so we replace them with versions that correspond to the + * definition. + */ +fix = { + hackname = glibc_mutex_init; + files = pthread.h; + select = '\{ *\{ *0, *\} *\}'; + sed = "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1" + "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/"; + sed = "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/" + "N;s/^[ \t]*#[ \t]*" + "\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n" + "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n" + "# \\1\\n" + " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n" + "# else\\n" + "# \\1\\n" + " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n" + "# endif/"; + sed = "/define[ \t]\\+PTHREAD_COND_INITIALIZER/" + "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/"; + + test_text = + "#define PTHREAD_MUTEX_INITIALIZER \\\\\n" + " { { 0, } }\n" + "# define PTHREAD_RWLOCK_INITIALIZER \\\\\n" + " { { 0, } }\n" + "#define PTHREAD_COND_INITIALIZER { { 0, } }"; +}; + + /* * Fix these files to use the types we think they should for * ptrdiff_t, size_t, and wchar_t. diff --git a/fixincludes/tests/base/pthread.h b/fixincludes/tests/base/pthread.h index b8366bfe51f2..b1c4d517bce5 100644 --- a/fixincludes/tests/base/pthread.h +++ b/fixincludes/tests/base/pthread.h @@ -56,6 +56,20 @@ #endif /* ALPHA_PTHREAD_INIT_CHECK */ +#if defined( GLIBC_MUTEX_INIT_CHECK ) +#define PTHREAD_MUTEX_INITIALIZER \ + { { 0, 0, 0, 0, 0, 0 } } +# if __WORDSIZE == 64 +# define PTHREAD_RWLOCK_INITIALIZER \ + { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } +# else +# define PTHREAD_RWLOCK_INITIALIZER \ + { { 0, 0, 0, 0, 0, 0, 0, 0 } } +# endif +#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } } +#endif /* GLIBC_MUTEX_INIT_CHECK */ + + #if defined( PTHREAD_PAGE_SIZE_CHECK ) extern int __page_size; #endif /* PTHREAD_PAGE_SIZE_CHECK */