Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
gcc's support for __attribute__((noinline)) hasn't been around forever.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 14 Oct 2017 19:52:00 +0000 (15:52 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 14 Oct 2017 19:52:00 +0000 (15:52 -0400)
Buildfarm member gaur says it wasn't there in 2.95.3.  Guess that 3.0
and later have it.

src/include/c.h

index b39bbd7c713ed00b3ef2848c1694b65408740794..62df4d5b0c11c692a6466c2c8c72dc1983e60295 100644 (file)
@@ -644,12 +644,13 @@ typedef NameData *Name;
 
 
 /*
- * Forcing a function not to be inlined can be useful if it's the slow-path of
- * a performance critical function, or should be visible in profiles to allow
- * for proper cost attribution.
+ * Forcing a function not to be inlined can be useful if it's the slow path of
+ * a performance-critical function, or should be visible in profiles to allow
+ * for proper cost attribution.  Note that unlike the pg_attribute_XXX macros
+ * above, this should be placed before the function's return type and name.
  */
-/* GCC, Sunpro and XLC support noinline via __attribute */
-#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+/* GCC, Sunpro and XLC support noinline via __attribute__ */
+#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C) || defined(__IBMC__)
 #define pg_noinline __attribute__((noinline))
 /* msvc via declspec */
 #elif defined(_MSC_VER)