This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: pthread.h INITIALIZER macros on solaris (solaris9 & 10 need fixes)
Kaveh R. Ghazi wrote:
> Here's a really simple approach: remove all initialization values
> after the first element. They are all zero and omitted elements are
> zeroed. :) (Or, even plain ``{}'' as an initializer???)
> Cheers - Bruce
I don't think that's -Wall clean, it'll complain about the missing
initializers.
It's -Wall clean with my GCC:
$ gcc --version
gcc (GCC) 4.1.1
Would you try my testcase using "-c -W -Wall" and "-c -W -Wall -ansi"
and tell me that it says on solaris8?
OK. I give. Why in the world would GCC *NOT* complain about
an empty initializer on Linux and yet complain on Solaris?
I was not expecting such an inconsistency.
Based on what you showed me, I suspect the results should be
consistent with solaris7, i.e. it'll complain about PTHREAD_ONCE_INIT,
and with -ansi it'll complain on PTHREAD_RWLOCK_INITIALIZER and twice
for PTHREAD_ONCE_INIT.
$ gcc -c -W -Wall -ansi test.c
test.c: In function `test_it':
test.c:17: warning: missing initializer
test.c:17: warning: (near initialization for `pc.__pthread_cond_flags')
I also think it is wrong to warn about unused argc/argv in the main function.
(Yes, I know special exceptions are ugly to code...)
Anyway, glad you found it helpful.
Regards, Bruce