small problem in sdk with unistd.h and closesocket()

Have a question about our Software Developer Kit? Ask them here.

small problem in sdk with unistd.h and closesocket()

Postby kas1e » Mon Oct 24, 2011 1:24 pm

Hi

Have found for now a small problem in SDK, which easy to reproduce. The problem happens _ONLY_ when uses __USE_ONLINE__ . The code for reproduce:

Code: Select all
#include <proto/socket.h>  // or for example <proto/bsdsocket.h> will give the same
#include <unistd.h>

test()
{
closesocket(NULL);
}


Then just try to make an object , like:

Code: Select all
ppc-amigaos-gcc -D__USE_INLINE -c test.c


Or via ppc-amigaos-g++ , does not matter. And it will give you in result such bunch of errors:

Code: Select all
In file included from /usr/local/amiga/ppc-amigaos/SDK/newlib/include/unistd.h:4,
                 from closesocket.c:2:
/usr/local/amiga/ppc-amigaos/SDK/newlib/include/sys/unistd.h:96:33: error: macro "getdtablesize" passed 1 arguments, but takes just 0
In file included from /usr/local/amiga/ppc-amigaos/SDK/newlib/include/unistd.h:4,
                 from closesocket.c:2:
/usr/local/amiga/ppc-amigaos/SDK/newlib/include/sys/unistd.h:98: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token


Then, just swap in the test-example includes, and put <unistd.h> at top, but <proto/socket.h> or <proto/bsdsocket.h> at bottom, to have in end such test case:

Code: Select all
#include <unistd.h>
#include <proto/socket.h>  // or for example <proto/bsdsocket.h> will give the same

test()
{
closesocket(NULL);
}


And try again to compile an object by ppc-amigaos-gcc -D__USE_INLINE__ , and you will see that there is no warnings, and object compiles fine.

Without __USE_INLINE__ no errors at all. They happens only with __USE_INLINE__ provided, and only when including of socket's protos are at top.

Of course, one can say something like "plz, unistd.h firstly all the time" , but, as i see in all the sources of many projects, and from all my past expirience, its all not so matter will i put it at top, or at bottom. Includes imho should worry about such kind of stuff, and parse it correctly (and as i say without __USE_INLINE__ test case works in any orders, be unistd.h at top, or at bottom, not so matter).

Can someone from core-devs check this out and fix ?

Thanks for
kas1e
Beta Tester
Beta Tester
 
Posts: 469
Joined: Sat Jun 18, 2011 8:56 am

Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest