pike.git / src / global.h

version» Context lines:

pike.git/src/global.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id$ +    */      #ifndef GLOBAL_H   #define GLOBAL_H      /* Mingw32 workarounds */   #if (defined(__WINNT__) || defined(__WIN32__)) && !defined(__NT__)   #define __NT__   #endif   
pike.git/src/global.h:38: Inside #if defined(__NT__) and #if undefined(WIN32_LEAN_AND_MEAN)
   */   #ifndef WIN32_LEAN_AND_MEAN   #define WIN32_LEAN_AND_MEAN   #endif      /* We also need to ensure that we get the WIN32 APIs. */   #ifndef WIN32   #define WIN32 100 /* WinNT 1.0 */   #endif    - /* We want WinNT 5.0 API's if available. */ - #if !defined(_WIN32_WINDOWS) || (_WIN32_WINDOWS < 0x500) + /* We want WinNT 5.0+ API's if available. +  * +  * We avoid the WinNT 6.0+ API's for now. +  */ + #if !defined(_WIN32_WINDOWS) || (_WIN32_WINDOWS < 0x5ff)   #undef _WIN32_WINDOWS - #define _WIN32_WINDOWS 0x0500 + #define _WIN32_WINDOWS 0x05ff   #endif    - #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x500) + #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x5ff)   #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0500 + #define _WIN32_WINNT 0x05ff   #endif      /* In later versions of the WIN32 SDKs, we also need to define this one. */ - #if !defined(NTDDI_VERSION) || (NTDDI_VERSION < 0x05000000) + #if !defined(NTDDI_VERSION) || (NTDDI_VERSION < 0x05ffffff)   #undef NTDDI_VERSION - #define NTDDI_VERSION 0x05000000 + #define NTDDI_VERSION 0x05ffffff   #endif      #endif /* __NT__ */      #ifdef __amigaos__   /* Avoid getting definitions of struct in_addr from <unistd.h>... */   #define __USE_NETINET_IN_H   #endif      /*
pike.git/src/global.h:125:   #undef PACKAGE_STRING   #endif   #ifdef PACKAGE_BUGREPORT   #define ORIG_PACKAGE_BUGREPORT PACKAGE_BUGREPORT   #undef PACKAGE_BUGREPORT   #endif   #ifdef PACKAGE_URL   #define ORIG_PACKAGE_URL PACKAGE_URL   #undef PACKAGE_URL   #endif - #endif + #endif /* PIKE_CORE */      #include "machine.h"      #ifndef PIKE_CORE   #undef PACKAGE_NAME   #ifdef ORIG_PACKAGE_NAME   #define PACKAGE_NAME ORIG_PACKAGE_NAME   #undef ORIG_PACKAGE_NAME   #endif   #undef PACKAGE_TARNAME
pike.git/src/global.h:160: Inside #if defined(ORIG_PACKAGE_BUGREPORT)
  #undef PACKAGE_BUGREPORT   #ifdef ORIG_PACKAGE_BUGREPORT   #define PACKAGE_BUGREPORT ORIG_PACKAGE_BUGREPORT   #undef ORIG_PACKAGE_BUGREPORT   #endif   #undef PACKAGE_URL   #ifdef ORIG_PACKAGE_URL   #define PACKAGE_URL ORIG_PACKAGE_URL   #undef ORIG_PACKAGE_URL   #endif - #endif + #endif /* PIKE_CORE */    - #endif + #endif /* CONFIGURE_TEST */      /* Some identifiers used as flags in the machine.h defines. */   #define PIKE_YES 1   #define PIKE_NO 2   #define PIKE_UNKNOWN 3      /* We want to use errno later */   #ifdef _SGI_SPROC_THREADS   /* Magic define of _SGI_MP_SOURCE above might redefine errno below */   #include <errno.h>
pike.git/src/global.h:198:   #else   #define ATTRIBUTE(X)   #endif      #ifdef HAVE_DECLSPEC   #define DECLSPEC(X) __declspec(X)   #else /* !HAVE_DECLSPEC */   #define DECLSPEC(X)   #endif /* HAVE_DECLSPEC */    + #ifdef HAS___BUILTIN_EXPECT + # define UNLIKELY(X) __builtin_expect( (long)(X), 0 ) + # define LIKELY(X) __builtin_expect( (long)(X), 1 ) + #else + # define UNLIKELY(X) X + # define LIKELY(X) X + #endif +  + #ifdef HAS___BUILTIN_UNREACHABLE + # define UNREACHABLE(X) __builtin_unreachable() + #else + # define UNREACHABLE(X) X + #endif +    #ifndef HAVE_WORKING_REALLOC_NULL   #define realloc(PTR, SZ) pike_realloc(PTR,SZ)   #endif      /* NOTE:    * PIKE_CONCAT doesn't get defined if there isn't any way to    * concatenate symbols    */   #ifdef HAVE_ANSI_CONCAT   #define PIKE_CONCAT(X,Y) X##Y
pike.git/src/global.h:266:   # ifdef _AIX    #pragma alloca   # else   # ifndef alloca /* predefined by HP cc +Olibcalls */   void *alloca();   # endif   # endif   # endif   #endif    - #ifdef __NT__ - /* We are running NT */ - #undef FD_SETSIZE - #define FD_SETSIZE MAX_OPEN_FILEDESCRIPTORS - #endif -  +    #ifdef HAVE_DEVICES_TIMER_H   /* On AmigaOS, struct timeval is defined in a variety of places    and a variety of ways. Making sure <devices/timer.h> is included    first brings some amount of order to the chaos. */   #include <devices/timer.h>   #endif      #include <stdio.h>   #include <stdarg.h> -  - #ifdef HAVE_STDLIB_H +    #include <stdlib.h> - #endif -  - #ifdef HAVE_STDDEF_H +    #include <stddef.h> - #endif + #include <string.h> + #include <limits.h> + #include <float.h>      #ifdef HAVE_MALLOC_H   #if !defined(__FreeBSD__) && !defined(__OpenBSD__)   /* FreeBSD and OpenBSD has <malloc.h>, but it just contains a warning... */   #include <malloc.h>   #endif /* !__FreeBSD__ && !__OpenBSD */   #endif      #ifdef HAVE_UNISTD_H   #include <unistd.h>   #endif    - #ifdef HAVE_STRING_H - #include <string.h> - #endif -  - #ifdef HAVE_LIMITS_H - #include <limits.h> - #endif -  +    #ifdef HAVE_SYS_TYPES_H   #include <sys/types.h>   #endif      #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif      #ifdef HAVE_WINDOWS_H   #include <windows.h>   #endif    - #include <float.h> -  +    /* Get INT64, INT32, INT16, INT8, et al. */   #include "pike_int_types.h"      #define SIZE_T unsigned INT32      #define TYPE_T unsigned int   #define TYPE_FIELD unsigned INT16      #define B1_T char   
pike.git/src/global.h:477:   #endif      /* Conceptually a char is a 32 bit signed value. Implementationwise    * that means that the shorter ones don't have space for the sign bit. */   typedef unsigned char p_wchar0;   typedef unsigned INT16 p_wchar1;   typedef signed INT32 p_wchar2;      typedef struct p_wchar_p   { -  p_wchar0 *ptr; +  void *ptr;    int shift;   } PCHARP;      /* Pointless in git. */   #define RCSID(X)      #ifdef PIKE_DEBUG      #define DO_IF_DEBUG(X) X   #define DO_IF_DEBUG_ELSE(DEBUG, NO_DEBUG) DEBUG
pike.git/src/global.h:501:   /* Set of macros to simplify passing __FILE__ and __LINE__ to    * functions only in debug mode. */   #define DLOC __FILE__, __LINE__   #define COMMA_DLOC , __FILE__, __LINE__   #define DLOC_DECL const char *dloc_file, int dloc_line   #define COMMA_DLOC_DECL , const char *dloc_file, int dloc_line   #define DLOC_ARGS dloc_file, dloc_line   #define DLOC_PF(PRE, SUF) PRE "%s:%d" SUF   #define DLOC_ARGS_OPT dloc_file, dloc_line   #define COMMA_DLOC_ARGS_OPT , dloc_file, dloc_line + #define USE_DLOC_ARGS() ((void)(DLOC_ARGS_OPT))   #define DLOC_ENABLED      #else /* !PIKE_DEBUG */      #define DO_IF_DEBUG(X)   #define DO_IF_DEBUG_ELSE(DEBUG, NO_DEBUG) NO_DEBUG   #define NDEBUG      #define DLOC   #define COMMA_DLOC   #define DLOC_DECL   #define COMMA_DLOC_DECL   #define DLOC_ARGS __FILE__, __LINE__   #define DLOC_PF(PRE, SUF)   #define DLOC_ARGS_OPT   #define COMMA_DLOC_ARGS_OPT -  + #define USE_DLOC_ARGS()      #endif /* !PIKE_DEBUG */      #include <assert.h>      #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)   #define DO_IF_DEBUG_OR_CLEANUP(X) X   #else   #define DO_IF_DEBUG_OR_CLEANUP(X)   #endif
pike.git/src/global.h:542:   #endif      #ifndef INLINE   #if defined(__GNUC__) && !defined(PIKE_DEBUG) && !defined(lint)   #define INLINE inline   #else   #define INLINE   #endif   #endif    + /* Suppress compiler warnings for unused parameters if possible. The mangling of +  argument name is required to catch when an unused argument later is used without +  removing the annotation. */ + #ifndef PIKE_UNUSED_ATTRIBUTE + # ifdef __GNUC__ + # define PIKE_UNUSED_ATTRIBUTE __attribute__((unused)) + # if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + # define PIKE_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__((warn_unused_result)) + # else /* GCC < 3.4 */ + # define PIKE_WARN_UNUSED_RESULT_ATTRIBUTE + # endif + # else + # define PIKE_UNUSED_ATTRIBUTE + # define PIKE_WARN_UNUSED_RESULT_ATTRIBUTE + # endif + #endif + #ifndef PIKE_UNUSED + # define PIKE_UNUSED(x) PIKE_CONCAT(x,_UNUSED) PIKE_UNUSED_ATTRIBUTE + #endif + #ifndef UNUSED + # define UNUSED(x) PIKE_UNUSED(x) + #endif + #ifdef PIKE_DEBUG + # define DEBUGUSED(x) x + #else + # define DEBUGUSED(x) PIKE_UNUSED(x) + #endif + #ifdef DEBUG_MALLOC + # define DMALLOCUSED(x) x + #else + # define DMALLOCUSED(x) PIKE_UNUSED(x) + #endif +  +    /* PMOD_EXPORT exports a function / variable vfsh. */   #ifndef PMOD_EXPORT   # if defined (__NT__) && defined (USE_DLL)   # ifdef DYNAMIC_MODULE   # define PMOD_EXPORT __declspec(dllimport)   # else   /* A pmod export becomes an import in the dynamic module. This means    * that modules can't use PMOD_EXPORT for identifiers they export    * themselves, unless they are compiled statically. */   # define PMOD_EXPORT __declspec(dllexport)   # endif -  + # elif defined(__clang__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) + /* According to Clang source the protected behavior is ELF-specific and not +  applicable to OS X. */ + # define PMOD_EXPORT __attribute__ ((visibility("default")))   # elif __GNUC__ >= 4   # ifdef DYNAMIC_MODULE   # define PMOD_EXPORT __attribute__ ((visibility("default")))   # else   # define PMOD_EXPORT __attribute__ ((visibility("protected")))   # endif   # else   # define PMOD_EXPORT   # endif   #endif
pike.git/src/global.h:574:   #ifndef PMOD_PROTO   #define PMOD_PROTO   #endif      #ifndef DO_PIKE_CLEANUP   #if defined(PURIFY) || defined(__CHECKER__) || defined(DEBUG_MALLOC)   #define DO_PIKE_CLEANUP   #endif   #endif    - #ifdef PIKE_SECURITY - #define DO_IF_SECURITY(X) X - #else - #define DO_IF_SECURITY(X) - #endif -  - /* Used by the AutoBuild system to mark known warnings. */ - #define DO_NOT_WARN(X) (X) -  +    /* Some functions/macros used to avoid loss of precision warnings. */   #ifdef __ECL   static INLINE long PTRDIFF_T_TO_LONG(ptrdiff_t x)   { -  return DO_NOT_WARN((long)x); +  return (long)x;   }   #else /* !__ECL */   #define PTRDIFF_T_TO_LONG(x) ((long)(x))   #endif /* __ECL */      #ifndef HAVE_STRUCT_IOVEC   #define HAVE_STRUCT_IOVEC   struct iovec {    void *iov_base;    size_t iov_len;
pike.git/src/global.h:621:   #define PROT_STDIO(x) ()   #endif      #ifdef __STDC__   #define PROT(x) x   #else   #define PROT(x) ()   #endif      #ifdef MALLOC_DECL_MISSING - char *malloc PROT((int)); - char *realloc PROT((char *,int)); - void free PROT((char *)); - char *calloc PROT((int,int)); + void *malloc PROT((int)); + void *realloc PROT((void *,int)); + void free PROT((void *)); + void *calloc PROT((int,int));   #endif      #ifdef GETPEERNAME_DECL_MISSING   int getpeername PROT((int, struct sockaddr *, int *));   #endif      #ifdef GETHOSTNAME_DECL_MISSING   void gethostname PROT((char *,int));   #endif   
pike.git/src/global.h:656:      /* If this define is present, error() has been renamed to Pike_error() and    * error.h has been renamed to pike_error.h    * Expect to see other similar defines in the future. -Hubbe    */   #define Pike_error_present      /* Compatibility... */   #define USE_PIKE_TYPE 2    - #ifdef PIKE_RUN_UNLOCKED - #define DO_IF_RUN_UNLOCKED(X) X - #else - #define DO_IF_RUN_UNLOCKED(X) - #endif -  +    /* Used in more than one place, better put it here */ -  +    #if defined(PROFILING)   #define DO_IF_PROFILING(X) X   #else   #define DO_IF_PROFILING(X)   #endif      /* #define PROFILING_DEBUG */      #ifdef PROFILING_DEBUG   #define DO_IF_PROFILING_DEBUG(X) X   #else /* !PROFILING_DEBUG */   #define DO_IF_PROFILING_DEBUG(X)   #endif /* PROFILING_DEBUG */      #endif