This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: add tests for pthread initialization macros
> +/* glibc-2.3.5 defines PTHREAD_{MUTEX|COND}_INITIALIZER
> + * incorrectly, so we replace them with versions that
> + * correspond to the definition.
> + */
> +fix = {
> + hackname = pthread_mutex_init;
> + files = pthread.h;
> + mach = *-*-linux-gnu;
> + sed = "/define[ \t]*PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1"
> + "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n"
> + "/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_COND_INITIALIZER { { 0, } }";
> +
> +};
> +
Uros,
Thanks for the patch, I looked it over and have a couple of notes.
First you probably want to cc: the fixincludes maintainer so he's more
likely to see your patch which was kind of hidden as it came
downstream in my thread about a testcase. I've copied Bruce in so he
won't miss your post.
Second, this fix seems to address a problem with glibc, not linux
specific. I don't know that there's a way to select glibc boxes but I
think we'll want to add maybe the bsd's and maybe others in the "mach"
line.
Third, I can't speak for Bruce, but you'll probably be asked to use a
"format" fix rather than a sed fix since the format style is faster.
If you look at fixincludes/README in section 4.4.v, it explains it a
little.
With regards to the testcase, I agree we should add any glibc extra
bits you want to test. If you want to apply a patch over mine, please
do so. I'm going to install my testcase as "obvious" in a day or two
so that people have time to comment. After that you can add yours.
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu