File uClibc.fix-pthread-warnings.patch of Package uClibc

Subject: fix pthread warnings

From: Stefan Assmann <sassmann@suse.de>

This patch declares prototypes of several functions to get rid of the
following compiler warnings:
./libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h:44: warning: no previous prototype for 'testandset'
./libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h:62: warning: no previous prototype for '__compare_and_swap'
./libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h:101: warning: no previous prototype for '__compare_and_swap_with_release_semantics'

Signed-off-by: Stefan Assmann <sassmann@suse.de>
---
 libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h   |    2 ++
 libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h     |    1 +
 libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h   |    2 ++
 libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h    |    2 ++
 libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h    |    1 +
 libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h     |    1 +
 libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h   |    1 +
 libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h    |    2 ++
 libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h    |    4 ++++
 libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h    |    2 ++
 libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h    |    2 ++
 libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h    |    1 +
 libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h   |    1 +
 libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h |    3 +++
 libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h      |    1 +
 libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h    |    1 +
 libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h  |    2 ++
 libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h  |    1 +
 18 files changed, 30 insertions(+)

--- a/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h
@@ -40,6 +40,7 @@ register char * stack_pointer __asm__ ("


 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *__spinlock);
 PT_EI long int
 testandset (int *__spinlock)
 {
@@ -58,6 +59,7 @@ testandset (int *__spinlock)
 /* Compare-and-swap for semaphores.  */
 # define HAS_COMPARE_AND_SWAP

+PT_EI int __compare_and_swap (long int *__p, long int __oldval, long int __newval);
 PT_EI int
 __compare_and_swap (long int *__p, long int __oldval, long int __newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h
@@ -48,6 +48,7 @@ register char *stack_pointer __asm__("$3


 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -95,6 +96,7 @@ testandset (int *spinlock)
 /* Compare-and-swap for semaphores. */

 #define HAS_COMPARE_AND_SWAP
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
@@ -33,6 +33,7 @@
    time; let's hope nobody tries to use one.  */

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
@@ -34,6 +34,7 @@ extern long int testandset (int *spinloc
 extern int __compare_and_swap (long int *p, long int oldval, long int newval);

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -49,6 +50,7 @@ register char * stack_pointer __asm__ ("
 /* Compare-and-swap for semaphores. */

 #define HAS_COMPARE_AND_SWAP
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap(long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
@@ -36,6 +36,7 @@
    It's ugly. But it's the only thing we can do now.
    The handler of EXCPT 0x4 expects the address of the lock is passed through
    R0. And the result is returned by R0.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -51,6 +52,7 @@ testandset (int *spinlock)
 }

 #define HAS_COMPARE_AND_SWAP
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h
@@ -26,6 +26,7 @@
 # define PT_EI __extern_always_inline
 #endif

+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h
@@ -31,6 +31,7 @@
 #endif

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h
@@ -29,6 +29,7 @@
 #endif

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
@@ -43,6 +43,7 @@ extern int __compare_and_swap (long int
     defined __athlon__ || defined __k8__)

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -60,6 +61,7 @@ testandset (int *spinlock)
 /* Compare-and-swap for semaphores.  It's always available on i686.  */
 #define HAS_COMPARE_AND_SWAP

+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h
@@ -82,6 +82,7 @@ register struct _pthread_descr_struct *_

 #define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS

+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
@@ -96,6 +97,8 @@ __compare_and_swap (long int *p, long in
   return readval == oldval;
 }

+PT_EI int __compare_and_swap_with_release_semantics (long int *p, long int
+		oldval, long int newval);
 PT_EI int
 __compare_and_swap_with_release_semantics (long int *p,
 					   long int oldval,
@@ -115,6 +118,7 @@ __compare_and_swap_with_release_semantic
 #endif /* ELF_MACHINE_NAME */

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
@@ -29,6 +29,7 @@
 #endif

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -58,6 +59,7 @@ register char * stack_pointer __asm__ ("

 #if !defined(__mcoldfire__) && !defined(__mcf5200__) && !defined(__mc68000)
 #define HAS_COMPARE_AND_SWAP
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h
@@ -61,6 +61,7 @@ __NTH (_test_and_set (int *p, int v))

 /* Spinlock implementation; required.  */

+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
@@ -77,6 +78,7 @@ register char * stack_pointer __asm__ ("
 /* Compare-and-swap for semaphores. */

 #define HAS_COMPARE_AND_SWAP
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
--- a/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h
@@ -28,6 +28,7 @@
 #endif

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h
@@ -33,6 +33,7 @@
    what else we can do before we have a swap like instruction?  This is better
    than nothing
  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
@@ -32,6 +32,7 @@
 extern long int testandset (int *spinlock);

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h
@@ -33,6 +33,7 @@
 #define MEMORY_BARRIER() __asm__ ("memw" : : : "memory")

 /* Spinlock implementation; required.  */
+PT_EI long int testandset (int *spinlock);
 PT_EI long int
 testandset (int *spinlock)
 {
--- a/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h
@@ -56,6 +56,7 @@ register struct _pthread_descr_struct *_
 #define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
 #define IMPLEMENT_TAS_WITH_CAS

+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long int *p, long int oldval, long int newval)
 {
@@ -79,6 +80,8 @@ __compare_and_swap (long int *p, long in
   return ret == 0;
 }

+PT_EI int __compare_and_swap_with_release_semantics (long int *p, long int
+		oldval, long int newval);
 PT_EI int
 __compare_and_swap_with_release_semantics (long int *p,
 					   long int oldval, long int newval)
--- a/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h
@@ -29,6 +29,7 @@ register char *__stack_pointer __asm__ (

 /* Atomically:  If *PTR == OLD, set *PTR to NEW and return true,
    otherwise do nothing and return false.  */
+PT_EI int __compare_and_swap (long int *p, long int oldval, long int newval);
 PT_EI int
 __compare_and_swap (long *ptr, long old, long new)
 {