problem with __errno_location in pthread.h

"Dr. Uwe Girlich" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>
Hello list!

I just found another problem with NGPT: If I have
#include <pthread.h>
#include <errno.h>
and try to compile this with the GNU C++ compiler, I get the error:

/usr/include/bits/errno.h:39: declaration of `int *__errno_location ()
throw ()' throws different exceptions
/home/girlich/ngpt/include/pthread.h:648: than previous declaration `int        *__errno_location ()'

The work-around is to include <errno.h> before <pthread.h>.

The attached patch corrects the problem in pthread.h.in by duplicating the
definition of __errno_location() from my system. Another possibility
would be to #include <errno.h> in <pthread.h> and remove the redefinition
of __errno_location().

What is the preferred solution?

Bye, Uwe

-- 
Dr. Uwe Girlich              email: [email protected]
Philosys Software GmbH       www: www.philosys.de
Edisonstrasse 6              phone: +49 89 321407-44
D-85716 Unterschleissheim    fax: +49 89 321407-12
library-errno.diff (text/plain, 805 B)
diff -u -r --exclude='*.o' ngpt-2.0.1-orig/pthread.h.in ngpt-2.0.1/pthread.h.in
--- ngpt-2.0.1-orig/pthread.h.in	Thu Aug  8 15:27:33 2002
+++ ngpt-2.0.1/pthread.h.in	Tue Sep  3 11:49:38 2002
@@ -645,7 +645,11 @@
 extern ssize_t            __pthread_sendmsg(int, const struct msghdr *, int); /*ibm*/
 extern ssize_t            __pthread_recvfrom(int, void *, size_t, int, struct sockaddr *, int *); /*ibm*/
 extern ssize_t            __pthread_sendto(int, const void *, size_t, int, struct sockaddr *, int); /*ibm*/
+#if 0
 extern int *		  __errno_location(void); /*ibm*/
+#else
+extern int *		  __errno_location(void) __THROW __attribute__ ((__const__)); /*ibm*/
+#endif
 extern void		  __flockfile(FILE *stream);
 extern void		  __funlockfile(FILE *stream);
 extern int		  __ftrylockfile(FILE *stream);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.