diff --git a/authd/reslib.cc b/authd/reslib.cc index e52e795ed..22b4a48a6 100644 --- a/authd/reslib.cc +++ b/authd/reslib.cc @@ -76,12 +76,13 @@ * - Dianora */ +#ifndef _WIN32 +#include +#endif + #include #ifndef _WIN32 - -#include - typedef struct addrinfo rb_addrinfo; #else diff --git a/include/ircd/stdinc.h b/include/ircd/stdinc.h index 9ac6bde8d..4a801e5a8 100644 --- a/include/ircd/stdinc.h +++ b/include/ircd/stdinc.h @@ -22,64 +22,4 @@ */ #include -#include "defaults.h" /* Needed for some reasons here -- dwr */ - -/* AIX requires this to be the first thing in the file. */ -#ifdef __GNUC__ -#undef alloca -#define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -#ifdef HAVE_ERRNO_H -#else -extern int errno; -#endif - -#if defined(__INTEL_COMPILER) || defined(__GNUC__) -# ifdef __unused -# undef __unused -# endif -# ifdef __printf -# undef __printf -# endif -# ifdef __noreturn -# undef __noreturn -# endif - -# define __unused __attribute__((__unused__)) -# define __printf(x) __attribute__((__format__ (__printf__, x, x + 1))) -# define __noreturn __attribute__((__noreturn__)) -#else -# define __unused -# define __printf -# define __noreturn -#endif - - - -#ifdef strdupa -#define LOCAL_COPY(s) strdupa(s) -#else -#if defined(__INTEL_COMPILER) || defined(__GNUC__) -# define LOCAL_COPY(s) __extension__({ char *_s = (char *)alloca(strlen(s) + 1); strcpy(_s, s); _s; }) -#else -# define LOCAL_COPY(s) strcpy((char *)alloca(strlen(s) + 1), s) -#endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */ -#endif /* strdupa */ +#include "defaults.h" diff --git a/include/rb/system.h b/include/rb/system.h index 984402d55..7b60212c8 100644 --- a/include/rb/system.h +++ b/include/rb/system.h @@ -92,6 +92,41 @@ char *alloca(); #define rb_unlikely(x) (x) #endif +#if defined(__INTEL_COMPILER) || defined(__GNUC__) + + #ifdef __unused + #undef __unused + #endif + + #ifdef __printf + #undef __printf + #endif + + #ifdef __noreturn + #undef __noreturn + #endif + + #define __unused __attribute__((__unused__)) + #define __printf(x) __attribute__((__format__ (__printf__, x, x + 1))) + #define __noreturn __attribute__((__noreturn__)) + +#else + + #ifndef __unused + #define __unused + #endif + + #ifndef __printf + #define __printf + #endif + + #ifndef __noreturn + #define __noreturn + #endif + +#endif + + #ifdef _WIN32 #define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) typedef SOCKET rb_platform_fd_t; @@ -321,6 +356,17 @@ while(0) #endif +#ifdef strdupa + #define LOCAL_COPY(s) strdupa(s) +#else + #if defined(__INTEL_COMPILER) || defined(__GNUC__) + #define LOCAL_COPY(s) __extension__({ char *_s = (char *)alloca(strlen(s) + 1); strcpy(_s, s); _s; }) + #else + #define LOCAL_COPY(s) strcpy((char *)alloca(strlen(s) + 1), s) + #endif +#endif + + #ifdef __cplusplus } // extern "C" #endif