include/bits/socket.h

Khem Raj raj.khem at gmail.com
Tue Dec 2 18:30:21 UTC 2008


On (02/12/08 17:04), Tobias Poschwatta wrote:
> Hi,
> 
> I think there's a problem with include/bits/socket.h when compiling
> with g++. My test program is trivial:
> 
> #include <sys/socket.h>
> int main(int argc, char **argv) { return 0; }
> 
> It compiles fine with gcc, but doesn't with g++:
> 
> # g++ -Wall -o s socket.c
> .../include/bits/socket.h:271: error: expected initializer before 'throw'
> 
> Preprocessor output (g++ -E) shows the problem:
> 
> extern struct cmsghdr * __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *_
> _cmsg) throw () throw ();
> 
> The orginal socket.h contains:
> 
> extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr,
>                                       struct cmsghdr *__cmsg)) __THROW;
> 
> It seems that for g++, both __NTH and __THROW add a 'throw ()' to the
> declaration.
> 
> This was tested with 0.9.30 on mipsel.

Tobias,

Its a bug. Can you try attached patch please.

Thx

-Khem
-------------- next part --------------
Index: libc/sysdeps/linux/mips/bits/socket.h
===================================================================
--- libc/sysdeps/linux/mips/bits/socket.h	(revision 24233)
+++ libc/sysdeps/linux/mips/bits/socket.h	(working copy)
@@ -268,8 +268,8 @@
 			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
 #define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
 
-extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr,
-				      struct cmsghdr *__cmsg)) __THROW;
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+				      struct cmsghdr *__cmsg) __THROW;
 libc_hidden_proto(__cmsg_nxthdr)
 #ifdef __USE_EXTERN_INLINES
 # ifndef _EXTERN_INLINE


More information about the uClibc mailing list