Re: [xslt] more warnings cleanup



Hi,

On 09.05.2011 14:47, Stefan Kost wrote:
> hi Daniel,
>
> 0001-testWriter-xmlTextWriterWriteFormatElement-wants-an-.patch
> more cast fixes.
>
> 0003-various-use-STDOUT_FILENO-instead-of-1-in-write-call.patch
> this imho makes the code more readable
>
> 0004-python-flag-two-unused-args.patch
> 0005-python-remove-unused-variable.patch
> two more trivial ones
>
>
> one source of warnings left is the compilation of threads.c
>
> $ make threads.o
> gcc -DHAVE_CONFIG_H -I. -I./include -I./include -D_REENTRANT -g -O2
> -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch
> -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized
> -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings
> -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
> -Wnested-externs -Winline -Wredundant-decls -MT threads.o -MD -MP -MF
> .deps/threads.Tpo -c -o threads.o threads.c
> threads.c:53: warning: redundant redeclaration of ‘pthread_once’
> /usr/include/pthread.h:478: note: previous declaration of ‘pthread_once’
> was here
> threads.c:56: warning: redundant redeclaration of ‘pthread_getspecific’
> /usr/include/pthread.h:1103: note: previous declaration of
> ‘pthread_getspecific’ was here
> threads.c:58: warning: redundant redeclaration of ‘pthread_setspecific’
> /usr/include/pthread.h:1106: note: previous declaration of
> ‘pthread_setspecific’ was here
> threads.c:61: warning: redundant redeclaration of ‘pthread_key_create’
> /usr/include/pthread.h:1095: note: previous declaration of
> ‘pthread_key_create’ was here
> threads.c:64: warning: redundant redeclaration of ‘pthread_key_delete’
> /usr/include/pthread.h:1100: note: previous declaration of
> ‘pthread_key_delete’ was here
> threads.c:67: warning: function declaration isn’t a prototype
> threads.c:66: warning: redundant redeclaration of ‘pthread_mutex_init’
> /usr/include/pthread.h:733: note: previous declaration of
> ‘pthread_mutex_init’ was here
> threads.c:69: warning: function declaration isn’t a prototype
> threads.c:68: warning: redundant redeclaration of ‘pthread_mutex_destroy’
> /usr/include/pthread.h:738: note: previous declaration of
> ‘pthread_mutex_destroy’ was here
>
> It comes from this commit: git show dbfe05af
> commit dbfe05aff4d242e31fcd7621a4901a6fa10b988e
> Author: Daniel Veillard <veillard src gnome org>
> Date: Wed May 4 09:18:00 2005 +0000
>
> on linux/gcc use weak definitions to avoid linking with pthread library on
>
> * Makefile.am configure.in threads.c: on linux/gcc use weak definitions
> to avoid linking with pthread library on non-threaded environments.
> * xpath.c: applied patch from Mark Vakoc w.r.t. a buggy namespace
> list allocation.
> Daniel
>
> I see the point in adding the weak-attribute. Altough I wonder why most
> of the functions are not completely defines (e.g. pthread_mutex_init)
> but some others are. If I complete them those warnings disappear. I'll
> try if there is a way to avoid the warnings about the redeclaration.
> http://stackoverflow.com/questions/5935539/using-attribute-weak-leads-to-warning-redundant-redeclaration-of-xxx-a
>
I've received a good answer on stackoverflow! Patch attached.

Stefan

> Stefan
>
>
>
>
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt gnome org
> http://mail.gnome.org/mailman/listinfo/xslt

>From 84549055a54b4e0a45570601e9bbeb10eccd4737 Mon Sep 17 00:00:00 2001
From: Stefan Kost <ensonic users sf net>
Date: Mon, 9 May 2011 15:28:24 +0300
Subject: [PATCH 31/36] threads: use a pragma instead of redeclaring the function prototypes

Avoids warnings and eases maintenance.
---
 threads.c |   52 +++++++++++++++-------------------------------------
 1 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/threads.c b/threads.c
index 1eeac0e..9194741 100644
--- a/threads.c
+++ b/threads.c
@@ -50,43 +50,21 @@ static int libxml_is_threaded = -1;
 #ifdef __GNUC__
 #ifdef linux
 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
-extern int pthread_once (pthread_once_t *__once_control,
-                         void (*__init_routine) (void))
-	   __attribute((weak));
-extern void *pthread_getspecific (pthread_key_t __key)
-	   __attribute((weak));
-extern int pthread_setspecific (pthread_key_t __key,
-                                __const void *__pointer)
-	   __attribute((weak));
-extern int pthread_key_create (pthread_key_t *__key,
-                               void (*__destr_function) (void *))
-	   __attribute((weak));
-extern int pthread_key_delete (pthread_key_t __key)
-	   __attribute((weak));
-extern int pthread_mutex_init ()
-	   __attribute((weak));
-extern int pthread_mutex_destroy ()
-	   __attribute((weak));
-extern int pthread_mutex_lock ()
-	   __attribute((weak));
-extern int pthread_mutex_unlock ()
-	   __attribute((weak));
-extern int pthread_cond_init ()
-	   __attribute((weak));
-extern int pthread_cond_destroy ()
-	   __attribute((weak));
-extern int pthread_cond_wait ()
-	   __attribute((weak));
-extern int pthread_equal ()
-	   __attribute((weak));
-extern pthread_t pthread_self ()
-	   __attribute((weak));
-extern int pthread_key_create ()
-	   __attribute((weak));
-extern int pthread_key_delete ()
-	   __attribute((weak));
-extern int pthread_cond_signal ()
-	   __attribute((weak));
+#pragma weak pthread_once
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+#pragma weak pthread_key_create
+#pragma weak pthread_key_delete
+#pragma weak pthread_mutex_init
+#pragma weak pthread_mutex_destroy
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+#pragma weak pthread_cond_init
+#pragma weak pthread_cond_destroy
+#pragma weak pthread_cond_wait
+#pragma weak pthread_cond_signal
+#pragma weak pthread_equal
+#pragma weak pthread_self
 #endif
 #endif /* linux */
 #endif /* __GNUC__ */
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]