# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
# define HASATTRIBUTE_WARN_UNUSED_RESULT
# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3 /* 3.1 -> */
+# 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
+# define __attribute__always_inline__ __attribute__((always_inline))
+#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
#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
# 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)