This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
- To: Wolfgang Bangerth <wolfgang dot bangerth at iwr dot uni-heidelberg dot de>, gcc-patches at gcc dot gnu dot org
- Subject: Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
- From: Bruce Korb <bkorb at veritas dot com>
- Date: Fri, 11 May 2001 08:00:19 -0700
- CC: gcc-gnats at gcc dot gnu dot org
- References: <Pine.SOL.4.10.10105110847300.7653-100000@eros>
- Reply-To: bkorb at pacbell dot net
Wolfgang Bangerth wrote:
>
> I tried but it did not work, so I investigated a little more and to my
> surprise found the following
>
> #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
> typedef int64_t pad64_t;
> typedef uint64_t upad64_t;
> #else
> typedef union {
> double _d;
> int32_t _l[2];
> } pad64_t;
> typedef union {
> double _d;
> uint32_t _l[2];
> } upad64_t;
> #endif
>
> Please don't ask we why they don't change the declaration to be
> all-__STDC__ anyway. Nevertheless, the point is that if I give -ansi on
> the command line, then a different declaration is chosen than if I omitted
> it...
>
> In any case, the following works:
> #define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, {0}}
> i.e. a pair of braces around the last element. That works for both
> declarations of upad64_t, so if that could be fixincluded, that would be
> great!
Unfortunately, it breaks Solaris 2.8.
I think you will need to constrain the fix to your specific version.
Here is the pthread.h version for Solaris 2.8:
#pragma ident "@(#)pthread.h 1.28 99/11/15 SMI"
I suggest you try the following inclhack.def fix.
You will need to fetch AutoGen from the infrastructure
directory to try it. But, please fix the version in the
"select" clause :-) Also, please honor the "Reply-To:"
clause, or I won't see your replies until Monday.
fix = {
hackname = solaris27_mutex_init;
select = '@\(#\)pthread.h' "[ \t]+1.28[ \t]+99/11/15";
files = pthread.h;
c_fix = format;
c_fix_arg = "%1, {0}}";
c_fix_arg = "(define[ \t]+PTHREAD_MUTEX_INITIALIZER.*),[ \t]*0}$";
test_text = "#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}";
};