: (REGEXP *)NULL)
#endif
+/* some compilers impersonate gcc */
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
+# define PERL_IS_GCC 1
+#endif
+
/* In case Configure was not used (we are using a "canned config"
* such as Win32, or a cross-compilation setup, for example) try going
* by the gcc major and minor versions. One useful URL is
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
# define HASATTRIBUTE_WARN_UNUSED_RESULT
# endif
+/* always_inline is buggy in gcc <= 4.6 and causes compilation errors */
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 7 || __GNUC__ > 4 /* 4.7 -> */
+# define HASATTRIBUTE_ALWAYS_INLINE
+# endif
#endif
#endif /* #ifndef PERL_MICRO */
#ifdef HASATTRIBUTE_WARN_UNUSED_RESULT
# define __attribute__warn_unused_result__ __attribute__((warn_unused_result))
#endif
+#ifdef HASATTRIBUTE_ALWAYS_INLINE
+/* always_inline is buggy in gcc <= 4.6 and causes compilation errors */
+# if !defined(PERL_IS_GCC) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7 || __GNUC__ > 4)
+# define __attribute__always_inline__ __attribute__((always_inline))
+# endif
+#endif
/* If we haven't defined the attributes yet, define them to blank. */
#ifndef __attribute__deprecated__
#ifndef __attribute__warn_unused_result__
# define __attribute__warn_unused_result__
#endif
+#ifndef __attribute__always_inline__
+# define __attribute__always_inline__
+#endif
/* Some OS warn on NULL format to printf */
#ifdef PRINTF_FORMAT_NULL_OK
#include <sys/types.h>
+/* EVC 4 SDK headers includes a bad definition of MB_CUR_MAX in stdlib.h
+ which is included from stdarg.h. Bad definition not present in SD 2008
+ SDK headers. wince.h is not yet included, so we cant fix this from there
+ since by then MB_CUR_MAX will be defined from stdlib.h.
+ cewchar.h includes a correct definition of MB_CUR_MAX and it is copied here
+ since cewchar.h can't be included this early */
+#if defined(UNDER_CE) && (_MSC_VER < 1300)
+# define MB_CUR_MAX 1uL
+#endif
+
+# ifdef I_WCHAR
+# include <wchar.h>
+# endif
+
# include <stdarg.h>
#ifdef I_STDINT
#if defined(USE_64_BIT_INT) && defined(HAS_QUAD)
# if QUADKIND == QUAD_IS_INT64_T && defined(INT64_MAX)
-# define IV_MAX INT64_MAX
-# define IV_MIN INT64_MIN
-# define UV_MAX UINT64_MAX
+# define IV_MAX ((IV)INT64_MAX)
+# define IV_MIN ((IV)INT64_MIN)
+# define UV_MAX ((UV)UINT64_MAX)
# ifndef UINT64_MIN
# define UINT64_MIN 0
# endif
-# define UV_MIN UINT64_MIN
+# define UV_MIN ((UV)UINT64_MIN)
# else
# define IV_MAX PERL_QUAD_MAX
# define IV_MIN PERL_QUAD_MIN
# define UV_IS_QUAD
#else
# if defined(INT32_MAX) && IVSIZE == 4
-# define IV_MAX INT32_MAX
-# define IV_MIN INT32_MIN
+# define IV_MAX ((IV)INT32_MAX)
+# define IV_MIN ((IV)INT32_MIN)
# ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */
-# define UV_MAX UINT32_MAX
+# define UV_MAX ((UV)UINT32_MAX)
# else
-# define UV_MAX 4294967295U
+# define UV_MAX ((UV)4294967295U)
# endif
# ifndef UINT32_MIN
# define UINT32_MIN 0
# endif
-# define UV_MIN UINT32_MIN
+# define UV_MIN ((UV)UINT32_MIN)
# else
# define IV_MAX PERL_LONG_MAX
# define IV_MIN PERL_LONG_MIN
# define USE_ENVIRON_ARRAY
#endif
+#ifdef USE_ITHREADS
+ /* On some platforms it would be safe to use a read/write mutex with many
+ * readers possible at the same time. On other platforms, notably IBM ones,
+ * subsequent getenv calls destroy earlier ones. Those platforms would not
+ * be able to handle simultaneous getenv calls */
+# define ENV_LOCK MUTEX_LOCK(&PL_env_mutex)
+# define ENV_UNLOCK MUTEX_UNLOCK(&PL_env_mutex)
+# define ENV_INIT MUTEX_INIT(&PL_env_mutex);
+# define ENV_TERM MUTEX_DESTROY(&PL_env_mutex);
+#else
+# define ENV_LOCK NOOP;
+# define ENV_UNLOCK NOOP;
+# define ENV_INIT NOOP;
+# define ENV_TERM NOOP;
+#endif
+
+/* Some critical sections need to lock both the locale and the environment.
+ * XXX khw intends to change this to lock both mutexes, but that brings up
+ * issues of potential deadlock, so should be done at the beginning of a
+ * development cycle. So for now, it just locks the environment. Note that
+ * many modern platforms are locale-thread-safe anyway, so locking the locale
+ * mutex is a no-op anyway */
+#define ENV_LOCALE_LOCK ENV_LOCK
+#define ENV_LOCALE_UNLOCK ENV_UNLOCK
+
+/* And some critical sections care only that no one else is writing either the
+ * locale nor the environment. XXX Again this is for the future. This can be
+ * simulated with using COND_WAIT in thread.h */
+#define ENV_LOCALE_READ_LOCK ENV_LOCALE_LOCK
+#define ENV_LOCALE_READ_UNLOCK ENV_LOCALE_UNLOCK
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
/* having sigaction(2) means that the OS supports both 1-arg and 3-arg
# define PERL_STATIC_INLINE_NO_RET PERL_STATIC_INLINE
#endif
+#ifndef PERL_STATIC_FORCE_INLINE
+# define PERL_STATIC_FORCE_INLINE PERL_STATIC_INLINE
+#endif
+
+#ifndef PERL_STATIC_FORCE_INLINE_NO_RET
+# define PERL_STATIC_FORCE_INLINE_NO_RET PERL_STATIC_INLINE
+#endif
+
#if !defined(OS2)
# include "iperlsys.h"
#endif
/* macros to define bit-fields in structs. */
#ifndef PERL_BITFIELD8
-# define PERL_BITFIELD8 unsigned char
+# define PERL_BITFIELD8 U8
#endif
#ifndef PERL_BITFIELD16
-# define PERL_BITFIELD16 unsigned short int
+# define PERL_BITFIELD16 U16
#endif
#ifndef PERL_BITFIELD32
-# define PERL_BITFIELD32 unsigned long int
+# define PERL_BITFIELD32 U32
#endif
#include "sv.h"
# define DEBUG_f(a) DEBUG__(DEBUG_f_TEST, a)
-# ifndef PERL_EXT_RE_BUILD
-# define DEBUG_r(a) DEBUG__(DEBUG_r_TEST, a)
-# else
+/* For re_comp.c, re_exec.c, assume -Dr has been specified */
+# ifdef PERL_EXT_RE_BUILD
# define DEBUG_r(a) STMT_START {a;} STMT_END
+# else
+# define DEBUG_r(a) DEBUG__(DEBUG_r_TEST, a)
# endif /* PERL_EXT_RE_BUILD */
# define DEBUG_x(a) DEBUG__(DEBUG_x_TEST, a)