summaryrefslogtreecommitdiff
path: root/includes/Stg.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Stg.h')
-rw-r--r--includes/Stg.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/includes/Stg.h b/includes/Stg.h
index f377e50d98..19069d8c1a 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -196,7 +196,7 @@
#define GNUC3_ATTRIBUTE(at)
#endif
-#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3
+#if !defined(DEBUG) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define GNUC_ATTR_HOT __attribute__((hot))
#else
#define GNUC_ATTR_HOT /* nothing */
@@ -204,6 +204,16 @@
#define STG_UNUSED GNUC3_ATTRIBUTE(__unused__)
+/* Prevent functions from being optimized.
+ See Note [Windows Stack allocations] */
+#if defined(__clang__)
+#define STG_NO_OPTIMIZE __attribute__((optnone))
+#elif defined(__GNUC__) || defined(__GNUG__)
+#define STG_NO_OPTIMIZE __attribute__((optimize("O0")))
+#else
+#define STG_NO_OPTIMIZE /* nothing */
+#endif
+
/* -----------------------------------------------------------------------------
Global type definitions
-------------------------------------------------------------------------- */