From 117dc0e5a72db2bb292819955804ed1e48b723e7 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Thu, 4 Jan 2018 22:16:28 +1300
Subject: [PATCH] Fix warnings about pg_attribute_always_inline.

MSVC warned about the use of both __forceinline and inline.  We can't just
remove inline or GCC 7 will complain, so move it into the macro.  GCC 2.95
warned that it didn't understand always_inline, so choose GCC 4.x as a pretty
old cut-off point that is known to understand it.

Thomas Munro, per buildfarm and Tom Lane.
Discussion: https://postgr.es/m/32278.1514863068@sss.pgh.pa.us
---
 src/backend/executor/nodeHashjoin.c | 3 +--
 src/include/c.h                     | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 8f2b634b124..03d78042fa0 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -161,8 +161,7 @@ static void ExecParallelHashJoinPartitionOuter(HashJoinState *node);
  *			  the other one is "outer".
  * ----------------------------------------------------------------
  */
-pg_attribute_always_inline
-static inline TupleTableSlot *
+static pg_attribute_always_inline TupleTableSlot *
 ExecHashJoinImpl(PlanState *pstate, bool parallel)
 {
 	HashJoinState *node = castNode(HashJoinState, pstate);
diff --git a/src/include/c.h b/src/include/c.h
index 34a7fa67b45..01f943a1392 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -147,8 +147,8 @@
 #endif
 
 /* GCC, Sunpro and XLC support always_inline via __attribute__ */
-#if defined(__GNUC__)
-#define pg_attribute_always_inline __attribute__((always_inline))
+#if (defined(__GNUC__) && __GNUC__ > 3) || defined(__SUNPRO_C) || defined(__IBMC__)
+#define pg_attribute_always_inline __attribute__((always_inline)) inline
 /* msvc via a special keyword */
 #elif defined(_MSC_VER)
 #define pg_attribute_always_inline __forceinline
-- 
2.15.0

