[PATCH][v2] Clean pthread types namespace for all archs.

Juan Manuel Torres Palma j.m.torrespalma@gmail.com
Wed Jun 24 21:05:00 GMT 2015


This patch sorts out pthread_mutex_t and pthread_cond_t in
new files, so new C11 types could be based on pthread types
without corrupting namespaces and exposing pthread symbols.

Common pthread types like pthread_mutex_t and pthread_cond_t are now
defined in bits/pthreadtypes-common.h, while the internal implementation
is moved to bits/thread-shared-types.h. File pthreadtypes.h has just
been cleaned up of those definitions and some related macros and
structures.

This is a second version of a patch that I submitted yesterday. Joseph
Myers found a few issue that I think I have solved for this version.
It consists in moving some code around some files, so it should work
in all architectures. However, I might have messed something and I
have only had the chance to test it in x86_64.

ChangeLog is attached to the email too, I haven't configured my email
client yet, sorry.

Cheers.

2015-06-24  Juan Manuel Torres Palma  <jmtorrespalma@gmail.com>

    * posix/Makefile (headers): Add files bits/pthreadtypes-common.h
    and bits/thread-shared-types.h to this variable.
    * bits/pthreadtypes-common.h: New file.
    (pthread_mutex_t): Move struct definition.
    (pthread_cond_t): Likewise.
    * bits/thread-shared-types.h: New file.
    * sysdeps/x86/bits/thread-shared-types.h: New file.
    (__SIZEOF_PTHREAD_MUTEX_T): Definition.
    (__SIZEOF_PTHREAD_COND_T): Likewise.
    (__pthread_list_t) [__x86_64__]: Likewise.
    (__pthread_slist_t) [!__x86_64__]: Likewise.
    (__pthread_mutex_s): Likewise.
    (__PTHREAD_MUTEX_T_CONTENT): Likewise.
    (__PTHREAD_COND_T_CONTENT): Likewise.
    (__PTHREAD_MUTEX_HAVE_PREV)[__x86_64__]: Likewise
    (__elision)[!__x86_64__]: Likewise
    (__spins)[!__x86_64__]: Likewise
    (__PTHREAD_SPINS): Likewise
    * sysdeps/aarch64/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/arm/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/hppa/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/ia64/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/m68k/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/microblaze/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/mips/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/nios2/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/s390/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/sh/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/sparc/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/tile/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h: Likewise.
    * sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h: Likewise.
    * sysdeps/x86/bits/pthreadtypes.h: Include
    <bits/pthreadtypes-common.h>.
    (__SIZEOF_PTHREAD_MUTEX_T): Remove.
    (__SIZEOF_PTHREAD_COND_T): Likewise.
    (__pthread_list_t): Likewise.
    (__pthread_slist_t): Likewise.
    (__pthread_mutex_s): Likewise.
    (__PTHREAD_MUTEX_T_CONTENT): Likewise.
    (__PTHREAD_COND_T_CONTENT): Likewise.
    (__PTHREAD_MUTEX_HAVE_PREV): Likewise
    (__elision): Likewise
    (__spins): Likewise
    (__PTHREAD_SPINS): Likewise
    * sysdeps/aarch64/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/hppa/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/ia64/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/m68k/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/microblaze/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/mips/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/nios2/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/s390/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/sh/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/sparc/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/tile/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Likewise.
    * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.

-- 
Juan Manuel Torres Palma.
Computer Science Student at Universidad de Granada.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangeLog-0001
Type: application/octet-stream
Size: 2880 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150624/42bb7f41/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clean-pthread-types.patch
Type: text/x-patch
Size: 91212 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150624/42bb7f41/attachment.bin>


More information about the Libc-alpha mailing list