diff --git a/src/api/arpa_inet.c b/src/api/arpa_inet.c index afbfca1..b6b6356 100644 --- a/src/api/arpa_inet.c +++ b/src/api/arpa_inet.c @@ -1,6 +1,7 @@ #include #define T(t) (t*)0; #define C(n) switch(n){case n:;} +#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};} static void f() { T(in_port_t) @@ -13,22 +14,22 @@ C(INET_ADDRSTRLEN) C(INET6_ADDRSTRLEN) #ifdef htonl -C(htonl(0)) +I(uint32_t, htonl(0LL)) #else {uint32_t(*p)(uint32_t) = htonl;} #endif #ifdef htons -C(htons(0)) +I(uint32_t, htons(0LL)) #else {uint16_t(*p)(uint16_t) = htons;} #endif #ifdef ntohl -C(ntohl(0)) +I(uint32_t, ntohl(0LL)) #else {uint32_t(*p)(uint32_t) = ntohl;} #endif #ifdef ntohs -C(ntohs(0)) +I(uint16_t, ntohs(0LL)) #else {uint16_t(*p)(uint16_t) = ntohs;} #endif diff --git a/src/api/float.c b/src/api/float.c index 5a29ecc..2a4a7c7 100644 --- a/src/api/float.c +++ b/src/api/float.c @@ -1,10 +1,10 @@ #include -#define I(n) {int i = n;} +#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};} #define C(n) switch(n){case n:;} #define D(n) {long double d = n;} static void f() { -I(FLT_ROUNDS) +I(int,FLT_ROUNDS) C(FLT_EVAL_METHOD) C(FLT_RADIX) C(FLT_MANT_DIG) diff --git a/src/api/math.c b/src/api/math.c index 2949140..5d6d3f0 100644 --- a/src/api/math.c +++ b/src/api/math.c @@ -1,26 +1,26 @@ #include #define T(t) (t*)0; #define C(n) switch(n){case n:;} -#define I(n) {int i = n;} +#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};} #define D(n) {double d = n;} static void f() { T(float_t) T(double_t) -I(fpclassify(.0)) -I(isfinite(.0)) -I(isgreater(.0,.0)) -I(isgreaterequal(.0,.0)) -I(isinf(.0)) -I(isless(.0,.0)) -I(islessequal(.0,.0)) -I(islessgreater(.0,.0)) -I(isnan(.0)) -I(isnormal(.0)) -I(isunordered(.0,.0)) -I(signbit(.0)) +I(int,fpclassify(.0)) +I(int,isfinite(.0)) +I(int,isgreater(.0,.0)) +I(int,isgreaterequal(.0,.0)) +I(int,isinf(.0)) +I(int,isless(.0,.0)) +I(int,islessequal(.0,.0)) +I(int,islessgreater(.0,.0)) +I(int,isnan(.0)) +I(int,isnormal(.0)) +I(int,isunordered(.0,.0)) +I(int,signbit(.0)) #ifdef _XOPEN_SOURCE -I(signgam) +I(int,signgam) D(M_E) D(M_LOG2E) D(M_LOG10E) diff --git a/src/api/netinet_in.c b/src/api/netinet_in.c index 648c794..1e95406 100644 --- a/src/api/netinet_in.c +++ b/src/api/netinet_in.c @@ -2,7 +2,7 @@ #define T(t) (t*)0; #define F(t,n) {t *y = &x.n;} #define C(n) switch(n){case n:;} -#define I(n) {int i = n;} +#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};} static void f() { T(in_port_t) @@ -50,10 +50,10 @@ C(IPPROTO_UDP) C(INADDR_ANY) C(INADDR_BROADCAST) C(INET_ADDRSTRLEN) -I(htonl(0)) -I(htons(0)) -I(ntohl(0)) -I(ntohs(0)) +I(uint32_t,htonl(0LL)) +I(uint16_t,htons(0LL)) +I(uint32_t,ntohl(0LL)) +I(uint16_t,ntohs(0LL)) C(INET6_ADDRSTRLEN) C(IPV6_JOIN_GROUP) C(IPV6_LEAVE_GROUP) @@ -62,16 +62,16 @@ C(IPV6_MULTICAST_IF) C(IPV6_MULTICAST_LOOP) C(IPV6_UNICAST_HOPS) C(IPV6_V6ONLY) -I(IN6_IS_ADDR_UNSPECIFIED(&in6addr_any)) -I(IN6_IS_ADDR_LOOPBACK(&in6addr_any)) -I(IN6_IS_ADDR_MULTICAST(&in6addr_any)) -I(IN6_IS_ADDR_LINKLOCAL(&in6addr_any)) -I(IN6_IS_ADDR_SITELOCAL(&in6addr_any)) -I(IN6_IS_ADDR_V4MAPPED(&in6addr_any)) -I(IN6_IS_ADDR_V4COMPAT(&in6addr_any)) -I(IN6_IS_ADDR_MC_NODELOCAL(&in6addr_any)) -I(IN6_IS_ADDR_MC_LINKLOCAL(&in6addr_any)) -I(IN6_IS_ADDR_MC_SITELOCAL(&in6addr_any)) -I(IN6_IS_ADDR_MC_ORGLOCAL(&in6addr_any)) -I(IN6_IS_ADDR_MC_GLOBAL(&in6addr_any)) +I(int,IN6_IS_ADDR_UNSPECIFIED(&in6addr_any)) +I(int,IN6_IS_ADDR_LOOPBACK(&in6addr_any)) +I(int,IN6_IS_ADDR_MULTICAST(&in6addr_any)) +I(int,IN6_IS_ADDR_LINKLOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_SITELOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_V4MAPPED(&in6addr_any)) +I(int,IN6_IS_ADDR_V4COMPAT(&in6addr_any)) +I(int,IN6_IS_ADDR_MC_NODELOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_MC_LINKLOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_MC_SITELOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_MC_ORGLOCAL(&in6addr_any)) +I(int,IN6_IS_ADDR_MC_GLOBAL(&in6addr_any)) } diff --git a/src/api/setjmp.c b/src/api/setjmp.c index afcf164..6b956c7 100644 --- a/src/api/setjmp.c +++ b/src/api/setjmp.c @@ -4,14 +4,26 @@ static void f() { T(jmp_buf) {void(*p)(jmp_buf,int) = longjmp;} +#ifdef setjmp +{int x = setjmp((jmp_buf){0});} +#else {int(*p)(jmp_buf) = setjmp;} +#endif #ifdef _POSIX_C_SOURCE T(sigjmp_buf) {void(*p)(sigjmp_buf,int) = siglongjmp;} +#ifdef sigsetjmp +{int x = sigsetjmp((sigjmp_buf){0});} +#else {int(*p)(sigjmp_buf,int) = sigsetjmp;} #endif +#endif #if defined _XOPEN_SOURCE && defined OBSOLETE {void(*p)(jmp_buf,int) = _longjmp;} +#ifdef _setjmp +{int x = _setjmp((jmp_buf){0});} +#else {int(*p)(jmp_buf) = _setjmp;} #endif +#endif } diff --git a/src/api/stdlib.c b/src/api/stdlib.c index 7a641d1..84ae68d 100644 --- a/src/api/stdlib.c +++ b/src/api/stdlib.c @@ -2,12 +2,13 @@ #define T(t) (t*)0; #define F(t,n) {t *y = &x.n;} #define C(n) switch(n){case n:;} +#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};} static void f() { C(EXIT_FAILURE) C(EXIT_SUCCESS) C(RAND_MAX) -C(MB_CUR_MAX) +I(size_t,MB_CUR_MAX) {void *x=NULL;} T(div_t) T(ldiv_t) diff --git a/src/api/unistd.c b/src/api/unistd.c index 93355a6..522ccdc 100644 --- a/src/api/unistd.c +++ b/src/api/unistd.c @@ -255,7 +255,6 @@ T(intptr_t) {int(*p)(const char*,uid_t,gid_t) = chown;} {int(*p)(int) = close;} {size_t(*p)(int,char*,size_t) = confstr;} -{char*(*p)(char*) = ctermid;} {int(*p)(int) = dup;} {int(*p)(int,int) = dup2;} {extern char **environ; char **x = environ;};