Commit 7a9cdb10 by DJ Delorie Committed by Bruce Korb

fix Solaris 2.6 initializers

Co-Authored-By: Bruce Korb <bkorb@gnu.org>

From-SVN: r64727
parent 8330e2c6
2003-03-22 DJ Delorie <dj at redhat dot com>,
Bruce Korb <bkorb at gnu dot org>
* fixinc/inclhack.def (solaris_mutex_init_1): New; Fix
buggy Solaris 2.6 mutex/cond initializers.
(solaris_mutex_init): Rename to solaris_mutex_init_2.
* fixinc/fixincl.x: Regenerate.
* fixinc/tests/base/pthread.h: Update.
2003-03-22 Andreas Jaeger <aj@suse.de> 2003-03-22 Andreas Jaeger <aj@suse.de>
* config/i386/i386.c (ix86_init_machine_status): Return value. * config/i386/i386.c (ix86_init_machine_status): Return value.
......
...@@ -17,7 +17,7 @@ TARGET_MACHINE='*' ...@@ -17,7 +17,7 @@ TARGET_MACHINE='*'
DESTDIR=`${PWDCMD-pwd}`/res DESTDIR=`${PWDCMD-pwd}`/res
SRCDIR=`${PWDCMD-pwd}`/inc SRCDIR=`${PWDCMD-pwd}`/inc
FIND_BASE='.' FIND_BASE='.'
VERBOSE=1 VERBOSE=[=` echo ${VERBOSE-1} `=]
INPUT=`${PWDCMD-pwd}` INPUT=`${PWDCMD-pwd}`
ORIGDIR=${INPUT} ORIGDIR=${INPUT}
......
...@@ -284,6 +284,7 @@ ENV_TABLE ...@@ -284,6 +284,7 @@ ENV_TABLE
case 'A': case 'A':
verbose_level = VERB_APPLIES; break; verbose_level = VERB_APPLIES; break;
default:
case 'p': case 'p':
case 'P': case 'P':
verbose_level = VERB_PROGRESS; break; verbose_level = VERB_PROGRESS; break;
...@@ -296,7 +297,10 @@ ENV_TABLE ...@@ -296,7 +297,10 @@ ENV_TABLE
case 'E': case 'E':
verbose_level = VERB_EVERYTHING; break; verbose_level = VERB_EVERYTHING; break;
} }
if (verbose_level >= VERB_EVERYTHING) {
verbose_level = VERB_EVERYTHING;
fputs ("fixinc verbosity: EVERYTHING\n", stderr);
}
while ((pz_find_base[0] == '.') && (pz_find_base[1] == '/')) while ((pz_find_base[0] == '.') && (pz_find_base[1] == '/'))
pz_find_base += 2; pz_find_base += 2;
if ((pz_find_base[0] != '.') || (pz_find_base[1] != NUL)) if ((pz_find_base[0] != '.') || (pz_find_base[1] != NUL))
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* files which are fixed to work correctly with ANSI C and placed in a * files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search. * directory that GNU C will search.
* *
* This file contains 147 fixup descriptions. * This file contains 148 fixup descriptions.
* *
* See README for more information. * See README for more information.
* *
...@@ -2338,6 +2338,46 @@ static const char* apzIp_Missing_SemiPatch[] = { "sed", ...@@ -2338,6 +2338,46 @@ static const char* apzIp_Missing_SemiPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Irix___Restrict fix
*/
tSCC zIrix___RestrictName[] =
"irix___restrict";
/*
* File name selection pattern
*/
tSCC zIrix___RestrictList[] =
"|internal/sgimacros.h|";
/*
* Machine/OS name selection pattern
*/
tSCC* apzIrix___RestrictMachs[] = {
"mips-sgi-irix6.5",
(const char*)NULL };
/*
* content selection pattern - do fix if pattern found
*/
tSCC zIrix___RestrictSelect0[] =
"(#ifdef __c99\n\
)(#[ \t]*define __restrict restrict)";
#define IRIX___RESTRICT_TEST_CT 1
static tTestDesc aIrix___RestrictTests[] = {
{ TT_EGREP, zIrix___RestrictSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Irix___Restrict
*/
static const char* apzIrix___RestrictPatch[] = {
"format",
"%1# ifndef __cplusplus\n\
%2\n\
# endif",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Irix_Asm_Apostrophe fix * Description of Irix_Asm_Apostrophe fix
*/ */
tSCC zIrix_Asm_ApostropheName[] = tSCC zIrix_Asm_ApostropheName[] =
...@@ -2409,46 +2449,6 @@ static const char* apzIrix_Limits_ConstPatch[] = { ...@@ -2409,46 +2449,6 @@ static const char* apzIrix_Limits_ConstPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Irix___Restrict fix
*/
tSCC zIrix___RestrictName[] =
"irix___restrict";
/*
* File name selection pattern
*/
tSCC zIrix___RestrictList[] =
"|internal/sgimacros.h|";
/*
* Machine/OS name selection pattern
*/
tSCC* apzIrix___RestrictMachs[] = {
"mips-sgi-irix6.5",
(const char*)NULL };
/*
* content selection pattern - do fix if pattern found
*/
tSCC zIrix___RestrictSelect0[] =
"(#ifdef __c99\n\
)(#[ \t]*define __restrict restrict)";
#define IRIX___RESTRICT_TEST_CT 1
static tTestDesc aIrix___RestrictTests[] = {
{ TT_EGREP, zIrix___RestrictSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Irix___Restrict
*/
static const char* apzIrix___RestrictPatch[] = {
"format",
"%1# ifndef __cplusplus\n\
%2\n\
# endif",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Irix_Socklen_T fix * Description of Irix_Socklen_T fix
*/ */
tSCC zIrix_Socklen_TName[] = tSCC zIrix_Socklen_TName[] =
...@@ -3749,35 +3749,70 @@ static const char* apzSco_UtimePatch[] = { ...@@ -3749,35 +3749,70 @@ static const char* apzSco_UtimePatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description of Solaris_Mutex_Init fix * Description of Solaris_Mutex_Init_1 fix
*/ */
tSCC zSolaris_Mutex_InitName[] = tSCC zSolaris_Mutex_Init_1Name[] =
"solaris_mutex_init"; "solaris_mutex_init_1";
/* /*
* File name selection pattern * File name selection pattern
*/ */
tSCC zSolaris_Mutex_InitList[] = tSCC zSolaris_Mutex_Init_1List[] =
"|pthread.h|"; "|pthread.h|";
/* /*
* Machine/OS name selection pattern * Machine/OS name selection pattern
*/ */
#define apzSolaris_Mutex_InitMachs (const char**)NULL #define apzSolaris_Mutex_Init_1Machs (const char**)NULL
/* /*
* content selection pattern - do fix if pattern found * content selection pattern - do fix if pattern found
*/ */
tSCC zSolaris_Mutex_InitSelect0[] = tSCC zSolaris_Mutex_Init_1Select0[] =
"@\\(#\\)pthread.h[ \t]+1.1[0-9][ \t]+97/[0-9/]+ SMI";
#define SOLARIS_MUTEX_INIT_1_TEST_CT 1
static tTestDesc aSolaris_Mutex_Init_1Tests[] = {
{ TT_EGREP, zSolaris_Mutex_Init_1Select0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Solaris_Mutex_Init_1
*/
static const char* apzSolaris_Mutex_Init_1Patch[] = { "sed",
"-e", "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n\
/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Solaris_Mutex_Init_2 fix
*/
tSCC zSolaris_Mutex_Init_2Name[] =
"solaris_mutex_init_2";
/*
* File name selection pattern
*/
tSCC zSolaris_Mutex_Init_2List[] =
"|pthread.h|";
/*
* Machine/OS name selection pattern
*/
#define apzSolaris_Mutex_Init_2Machs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zSolaris_Mutex_Init_2Select0[] =
"@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
#define SOLARIS_MUTEX_INIT_TEST_CT 1 #define SOLARIS_MUTEX_INIT_2_TEST_CT 1
static tTestDesc aSolaris_Mutex_InitTests[] = { static tTestDesc aSolaris_Mutex_Init_2Tests[] = {
{ TT_EGREP, zSolaris_Mutex_InitSelect0, (regex_t*)NULL }, }; { TT_EGREP, zSolaris_Mutex_Init_2Select0, (regex_t*)NULL }, };
/* /*
* Fix Command Arguments for Solaris_Mutex_Init * Fix Command Arguments for Solaris_Mutex_Init_2
*/ */
static const char* apzSolaris_Mutex_InitPatch[] = { static const char* apzSolaris_Mutex_Init_2Patch[] = {
"format", "format",
"#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n\ "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n\
%0\n\ %0\n\
...@@ -5803,9 +5838,9 @@ static const char* apzX11_SprintfPatch[] = { ...@@ -5803,9 +5838,9 @@ static const char* apzX11_SprintfPatch[] = {
* *
* List of all fixes * List of all fixes
*/ */
#define REGEX_COUNT 159 #define REGEX_COUNT 160
#define MACH_LIST_SIZE_LIMIT 261 #define MACH_LIST_SIZE_LIMIT 261
#define FIX_COUNT 147 #define FIX_COUNT 148
/* /*
* Enumerate the fixes * Enumerate the fixes
...@@ -5867,9 +5902,9 @@ typedef enum { ...@@ -5867,9 +5902,9 @@ typedef enum {
IO_QUOTES_DEF_FIXIDX, IO_QUOTES_DEF_FIXIDX,
IO_QUOTES_USE_FIXIDX, IO_QUOTES_USE_FIXIDX,
IP_MISSING_SEMI_FIXIDX, IP_MISSING_SEMI_FIXIDX,
IRIX___RESTRICT_FIXIDX,
IRIX_ASM_APOSTROPHE_FIXIDX, IRIX_ASM_APOSTROPHE_FIXIDX,
IRIX_LIMITS_CONST_FIXIDX, IRIX_LIMITS_CONST_FIXIDX,
IRIX___RESTRICT_FIXIDX,
IRIX_SOCKLEN_T_FIXIDX, IRIX_SOCKLEN_T_FIXIDX,
IRIX_STDIO_VA_LIST_FIXIDX, IRIX_STDIO_VA_LIST_FIXIDX,
IRIX_WCSFTIME_FIXIDX, IRIX_WCSFTIME_FIXIDX,
...@@ -5904,7 +5939,8 @@ typedef enum { ...@@ -5904,7 +5939,8 @@ typedef enum {
RS6000_PARAM_FIXIDX, RS6000_PARAM_FIXIDX,
SCO_STATIC_FUNC_FIXIDX, SCO_STATIC_FUNC_FIXIDX,
SCO_UTIME_FIXIDX, SCO_UTIME_FIXIDX,
SOLARIS_MUTEX_INIT_FIXIDX, SOLARIS_MUTEX_INIT_1_FIXIDX,
SOLARIS_MUTEX_INIT_2_FIXIDX,
SOLARIS_STDIO_TAG_FIXIDX, SOLARIS_STDIO_TAG_FIXIDX,
SOLARIS_WIDEC_FIXIDX, SOLARIS_WIDEC_FIXIDX,
STATSSWTCH_FIXIDX, STATSSWTCH_FIXIDX,
...@@ -6241,6 +6277,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -6241,6 +6277,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
IP_MISSING_SEMI_TEST_CT, FD_MACH_ONLY, IP_MISSING_SEMI_TEST_CT, FD_MACH_ONLY,
aIp_Missing_SemiTests, apzIp_Missing_SemiPatch, 0 }, aIp_Missing_SemiTests, apzIp_Missing_SemiPatch, 0 },
{ zIrix___RestrictName, zIrix___RestrictList,
apzIrix___RestrictMachs,
IRIX___RESTRICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIrix___RestrictTests, apzIrix___RestrictPatch, 0 },
{ zIrix_Asm_ApostropheName, zIrix_Asm_ApostropheList, { zIrix_Asm_ApostropheName, zIrix_Asm_ApostropheList,
apzIrix_Asm_ApostropheMachs, apzIrix_Asm_ApostropheMachs,
IRIX_ASM_APOSTROPHE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, IRIX_ASM_APOSTROPHE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
...@@ -6251,11 +6292,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -6251,11 +6292,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
IRIX_LIMITS_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, IRIX_LIMITS_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIrix_Limits_ConstTests, apzIrix_Limits_ConstPatch, 0 }, aIrix_Limits_ConstTests, apzIrix_Limits_ConstPatch, 0 },
{ zIrix___RestrictName, zIrix___RestrictList,
apzIrix___RestrictMachs,
IRIX___RESTRICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aIrix___RestrictTests, apzIrix___RestrictPatch, 0 },
{ zIrix_Socklen_TName, zIrix_Socklen_TList, { zIrix_Socklen_TName, zIrix_Socklen_TList,
apzIrix_Socklen_TMachs, apzIrix_Socklen_TMachs,
IRIX_SOCKLEN_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, IRIX_SOCKLEN_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
...@@ -6426,10 +6462,15 @@ tFixDesc fixDescList[ FIX_COUNT ] = { ...@@ -6426,10 +6462,15 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SCO_UTIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, SCO_UTIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSco_UtimeTests, apzSco_UtimePatch, 0 }, aSco_UtimeTests, apzSco_UtimePatch, 0 },
{ zSolaris_Mutex_InitName, zSolaris_Mutex_InitList, { zSolaris_Mutex_Init_1Name, zSolaris_Mutex_Init_1List,
apzSolaris_Mutex_InitMachs, apzSolaris_Mutex_Init_1Machs,
SOLARIS_MUTEX_INIT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, SOLARIS_MUTEX_INIT_1_TEST_CT, FD_MACH_ONLY,
aSolaris_Mutex_InitTests, apzSolaris_Mutex_InitPatch, 0 }, aSolaris_Mutex_Init_1Tests, apzSolaris_Mutex_Init_1Patch, 0 },
{ zSolaris_Mutex_Init_2Name, zSolaris_Mutex_Init_2List,
apzSolaris_Mutex_Init_2Machs,
SOLARIS_MUTEX_INIT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSolaris_Mutex_Init_2Tests, apzSolaris_Mutex_Init_2Patch, 0 },
{ zSolaris_Stdio_TagName, zSolaris_Stdio_TagList, { zSolaris_Stdio_TagName, zSolaris_Stdio_TagList,
apzSolaris_Stdio_TagMachs, apzSolaris_Stdio_TagMachs,
......
...@@ -2057,6 +2057,25 @@ fix = { ...@@ -2057,6 +2057,25 @@ fix = {
/* /*
* Sun Solaris 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER incorrectly,
* so we replace them with versions that correspond to the definition. We
* also explicitly name this fix "1" and the next fix "2" because this one
* does not deal with the last field. This fix needs to run before the next.
*/
fix = {
hackname = solaris_mutex_init_1;
select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+97/[0-9/]+ SMI";
files = pthread.h;
sed = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
"/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
test_text =
'#ident "@(#)pthread.h 1.16 97/05/05 SMI"'"\n"
"#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
"#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
};
/*
* Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
* "0" for the last field of the pthread_mutex_t structure, which is * "0" for the last field of the pthread_mutex_t structure, which is
* of type upad64_t, which itself is typedef'd to int64_t, but with * of type upad64_t, which itself is typedef'd to int64_t, but with
...@@ -2064,7 +2083,7 @@ fix = { ...@@ -2064,7 +2083,7 @@ fix = {
* initializer to "{0}" instead * initializer to "{0}" instead
*/ */
fix = { fix = {
hackname = solaris_mutex_init; hackname = solaris_mutex_init_2;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI"; select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h; files = pthread.h;
c_fix = format; c_fix = format;
......
...@@ -20,7 +20,23 @@ extern int __page_size; ...@@ -20,7 +20,23 @@ extern int __page_size;
#endif /* PTHREAD_PAGE_SIZE_CHECK */ #endif /* PTHREAD_PAGE_SIZE_CHECK */
#if defined( SOLARIS_MUTEX_INIT_CHECK ) #if defined( SOLARIS_MUTEX_INIT_1_CHECK )
#ident "@(#)pthread.h 1.16 97/05/05 SMI"
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
#define PTHREAD_MUTEX_INITIALIZER {{{0}, 0}, {{{0}}}, 0}
#else
#define PTHREAD_MUTEX_INITIALIZER {{{0}, 0}, {{{0}}}, {0}}
#endif
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
#define PTHREAD_COND_INITIALIZER {{{0},0}, 0} /* */
#else
#define PTHREAD_COND_INITIALIZER {{{0},0}, {0}} /* */
#endif
#endif /* SOLARIS_MUTEX_INIT_1_CHECK */
#if defined( SOLARIS_MUTEX_INIT_2_CHECK )
#ident "@(#)pthread.h 1.26 98/04/12 SMI" #ident "@(#)pthread.h 1.26 98/04/12 SMI"
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0} #define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}
...@@ -33,7 +49,7 @@ extern int __page_size; ...@@ -33,7 +49,7 @@ extern int __page_size;
#define PTHREAD_COND_INITIALIZER {{{0}, 0}, {0}} /* DEFAULTCV */ #define PTHREAD_COND_INITIALIZER {{{0}, 0}, {0}} /* DEFAULTCV */
#endif #endif
#define PTHREAD_RWLOCK_INITIALIZER {0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}} #define PTHREAD_RWLOCK_INITIALIZER {0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}
#endif /* SOLARIS_MUTEX_INIT_CHECK */ #endif /* SOLARIS_MUTEX_INIT_2_CHECK */
#if defined( THREAD_KEYWORD_CHECK ) #if defined( THREAD_KEYWORD_CHECK )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment