]> granicus.if.org Git - postgresql/commitdiff
Rely on inline functions even if that causes warnings in older compilers.
authorAndres Freund <andres@anarazel.de>
Wed, 5 Aug 2015 16:19:52 +0000 (18:19 +0200)
committerAndres Freund <andres@anarazel.de>
Wed, 5 Aug 2015 16:19:52 +0000 (18:19 +0200)
So far we have worked around the fact that some very old compilers do
not support 'inline' functions by only using inline functions
conditionally (or not at all). Since such compilers are very rare by
now, we have decided to rely on inline functions from 9.6 onwards.

To avoid breaking these old compilers inline is defined away when not
supported. That'll cause "function x defined but not used" type of
warnings, but since nobody develops on such compilers anymore that's
ok.

This change in policy will allow us to more easily employ inline
functions.

I chose to remove code previously conditional on PG_USE_INLINE as it
seemed confusing to have code dependent on a define that's always
defined.

Blacklisting of compilers, like in c53f73879f, now has to be done
differently. A platform template can define PG_FORCE_DISABLE_INLINE to
force inline to be defined empty.

Discussion: 20150701161447.GB30708@awork2.anarazel.de

29 files changed:
config/c-compiler.m4
config/test_quiet_include.h [deleted file]
configure
configure.in
src/backend/lib/ilist.c
src/backend/nodes/list.c
src/backend/port/atomics.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/mmgr/mcxt.c
src/backend/utils/sort/sortsupport.c
src/include/access/gin_private.h
src/include/c.h
src/include/lib/ilist.h
src/include/nodes/pg_list.h
src/include/pg_config.h.in
src/include/pg_config.h.win32
src/include/port/atomics.h
src/include/port/atomics/arch-x86.h
src/include/port/atomics/fallback.h
src/include/port/atomics/generic-acc.h
src/include/port/atomics/generic-gcc.h
src/include/port/atomics/generic-msvc.h
src/include/port/atomics/generic-sunpro.h
src/include/port/atomics/generic-xlc.h
src/include/port/atomics/generic.h
src/include/utils/arrayaccess.h
src/include/utils/palloc.h
src/include/utils/sortsupport.h
src/template/aix

index 050bfa5c7d70fc9e047ab8fc89170a1d4f19f631..397e1b03797f3b9a4439903d4e5a9cd6e346bd20 100644 (file)
@@ -17,40 +17,6 @@ fi])# PGAC_C_SIGNED
 
 
 
-# PGAC_C_INLINE
-# -------------
-# Check if the C compiler understands inline functions without being
-# noisy about unused static inline functions. Some older compilers
-# understand inline functions (as tested by AC_C_INLINE) but warn about
-# them if they aren't used in a translation unit.
-#
-# This test used to just define an inline function, but some compilers
-# (notably clang) got too smart and now warn about unused static
-# inline functions when defined inside a .c file, but not when defined
-# in an included header. Since the latter is what we want to use, test
-# to see if the warning appears when the function is in a header file.
-# Not pretty, but it works.
-#
-# Defines: inline, PG_USE_INLINE
-AC_DEFUN([PGAC_C_INLINE],
-[AC_C_INLINE
-AC_CACHE_CHECK([for quiet inline (no complaint if unreferenced)], pgac_cv_c_inline_quietly,
-  [pgac_cv_c_inline_quietly=no
-  if test "$ac_cv_c_inline" != no; then
-    pgac_c_inline_save_werror=$ac_c_werror_flag
-    ac_c_werror_flag=yes
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "$srcdir/config/test_quiet_include.h"],[])],
-                   [pgac_cv_c_inline_quietly=yes])
-    ac_c_werror_flag=$pgac_c_inline_save_werror
-  fi])
-if test "$pgac_cv_c_inline_quietly" != no; then
-  AC_DEFINE_UNQUOTED([PG_USE_INLINE], 1,
-    [Define to 1 if "static inline" works without unwanted warnings from ]
-    [compilations where static inline functions are defined but not called.])
-fi
-])# PGAC_C_INLINE
-
-
 # PGAC_C_PRINTF_ARCHETYPE
 # -----------------------
 # Set the format archetype used by gcc to check printf type functions.  We
diff --git a/config/test_quiet_include.h b/config/test_quiet_include.h
deleted file mode 100644 (file)
index 732b231..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * For the raison d'etre of this file, check the comment above the definition
- * of the PGAC_C_INLINE macro in config/c-compiler.m4.
- */
-static inline int
-fun()
-{
-       return 0;
-}
-
-/*
- * "IBM XL C/C++ for AIX, V12.1" miscompiles, for 32-bit, some inline
- * expansions of ginCompareItemPointers() "long long" arithmetic.  To take
- * advantage of inlining, build a 64-bit PostgreSQL.
- */
-#if defined(__ILP32__) && defined(__IBMC__)
-#error "known inlining bug"
-#endif
index 5787ae8ee385274d48c7f7981fcccce66c402c1f..ebb5cac31c78d2f6dd1e340e6bb3ce2ae629ae0f 100755 (executable)
--- a/configure
+++ b/configure
@@ -11006,44 +11006,6 @@ _ACEOF
     ;;
 esac
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for quiet inline (no complaint if unreferenced)" >&5
-$as_echo_n "checking for quiet inline (no complaint if unreferenced)... " >&6; }
-if ${pgac_cv_c_inline_quietly+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_cv_c_inline_quietly=no
-  if test "$ac_cv_c_inline" != no; then
-    pgac_c_inline_save_werror=$ac_c_werror_flag
-    ac_c_werror_flag=yes
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include "$srcdir/config/test_quiet_include.h"
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  pgac_cv_c_inline_quietly=yes
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    ac_c_werror_flag=$pgac_c_inline_save_werror
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_inline_quietly" >&5
-$as_echo "$pgac_cv_c_inline_quietly" >&6; }
-if test "$pgac_cv_c_inline_quietly" != no; then
-
-cat >>confdefs.h <<_ACEOF
-#define PG_USE_INLINE 1
-_ACEOF
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf format archetype" >&5
 $as_echo_n "checking for printf format archetype... " >&6; }
 if ${pgac_cv_printf_archetype+:} false; then :
index ece5e2275112bdd7631b8947143d4f09daaf4d63..a28f9ddb2520ba40afae686ec7d742adf8bad07e 100644 (file)
@@ -1309,7 +1309,7 @@ fi
 
 m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
 AC_C_BIGENDIAN
-PGAC_C_INLINE
+AC_C_INLINE
 PGAC_PRINTF_ARCHETYPE
 AC_C_FLEXIBLE_ARRAY_MEMBER
 PGAC_C_SIGNED
index 58550f77442980d298281c3b86835f54dd5cf46c..c26baf35f079088ec12810e2fd084f16ecbd56c5 100644 (file)
@@ -18,9 +18,6 @@
  */
 #include "postgres.h"
 
-/* See ilist.h */
-#define ILIST_INCLUDE_DEFINITIONS
-
 #include "lib/ilist.h"
 
 /*
index a6737514ef176cc1cecce235c4d177fde6249fbf..1dce42f7b42339206a98095ee922af4bcda96dcd 100644 (file)
@@ -15,9 +15,6 @@
  */
 #include "postgres.h"
 
-/* see pg_list.h */
-#define PG_LIST_INCLUDE_DEFINITIONS
-
 #include "nodes/pg_list.h"
 
 
index 439b3c18c7b26ad3aa062bf1ca3cbac00b0b1438..cd953f964e26afe0435bbf797779dfc1c6ee10ff 100644 (file)
  */
 #include "postgres.h"
 
-/*
- * We want the functions below to be inline; but if the compiler doesn't
- * support that, fall back on providing them as regular functions.  See
- * STATIC_IF_INLINE in c.h.
- */
-#define ATOMICS_INCLUDE_DEFINITIONS
-
 #include "miscadmin.h"
 #include "port/atomics.h"
 #include "storage/spin.h"
index 42cdbc7d6e0d94216b39c8989234cba7272a69cd..67c9b357c852d5bb7b008589b2c8d62614e1d012 100644 (file)
@@ -20,9 +20,6 @@
 #endif
 #include <math.h>
 
-/* See arrayaccess.h */
-#define ARRAYACCESS_INCLUDE_DEFINITIONS
-
 #include "access/htup_details.h"
 #include "catalog/pg_type.h"
 #include "funcapi.h"
index 34f4e7202f25854d4493a24b33131f0a45f5c7c8..12d29f7440a7c217e7abd27ee39176c66885b597 100644 (file)
@@ -19,9 +19,6 @@
  *-------------------------------------------------------------------------
  */
 
-/* see palloc.h.  Must be before postgres.h */
-#define MCXT_INCLUDE_DEFINITIONS
-
 #include "postgres.h"
 
 #include "miscadmin.h"
index ffef9658e45a28e2a1ebcc6727304dc04f1e8c8b..daf38c74ff565887abc7d015c0e7584bbe4e6467 100644 (file)
@@ -15,9 +15,6 @@
 
 #include "postgres.h"
 
-/* See sortsupport.h */
-#define SORTSUPPORT_INCLUDE_DEFINITIONS
-
 #include "access/nbtree.h"
 #include "fmgr.h"
 #include "utils/lsyscache.h"
index 5f214d779ab5d6f2993abaf976b46e9d75c50db3..5095fc1dba85061970bf6cfdc8a2522ed5d6c3e7 100644 (file)
@@ -952,11 +952,8 @@ extern ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na,
 
 /*
  * Merging the results of several gin scans compares item pointers a lot,
- * so we want this to be inlined. But if the compiler doesn't support that,
- * fall back on the non-inline version from itemptr.c. See STATIC_IF_INLINE in
- * c.h.
+ * so we want this to be inlined.
  */
-#ifdef PG_USE_INLINE
 static inline int
 ginCompareItemPointers(ItemPointer a, ItemPointer b)
 {
@@ -970,8 +967,5 @@ ginCompareItemPointers(ItemPointer a, ItemPointer b)
        else
                return -1;
 }
-#else
-#define ginCompareItemPointers(a, b) ItemPointerCompare(a, b)
-#endif   /* PG_USE_INLINE */
 
 #endif   /* GIN_PRIVATE_H */
index 92c52021ffad74e5ace9f98ad041ded6c5a9c17c..e84c77460c0250c655ecddb5de171c887ba99f8c 100644 (file)
 #include "pg_config.h"
 #include "pg_config_manual.h"  /* must be after pg_config.h */
 
+/*
+ * Force disable inlining if PG_FORCE_DISABLE_INLINE is defined. This is used
+ * to work around compiler bugs and might also be useful for investigatory
+ * purposes.
+ *
+ * This is done early (in slightly the wrong section) for two reasons: a) we
+ * don't want to include headers with different settings of this b)
+ * functionality later in this file might want to rely on inline functions.
+ */
+#ifdef PG_FORCE_DISABLE_INLINE
+#undef inline
+#define inline
+#endif
+
 /*
  * We always rely on the WIN32 macro being set by our build system,
  * but _WIN32 is the compiler pre-defined macro. So make sure we define
@@ -920,34 +934,6 @@ typedef NameData *Name;
 #endif
 
 
-/*
- * Function inlining support -- Allow modules to define functions that may be
- * inlined, if the compiler supports it.
- *
- * The function bodies must be defined in the module header prefixed by
- * STATIC_IF_INLINE, protected by a cpp symbol that the module's .c file must
- * define.  If the compiler doesn't support inline functions, the function
- * definitions are pulled in by the .c file as regular (not inline) symbols.
- *
- * The header must also declare the functions' prototypes, protected by
- * !PG_USE_INLINE.
- */
-
-/* declarations which are only visible when not inlining and in the .c file */
-#ifdef PG_USE_INLINE
-#define STATIC_IF_INLINE static inline
-#else
-#define STATIC_IF_INLINE
-#endif   /* PG_USE_INLINE */
-
-/* declarations which are marked inline when inlining, extern otherwise */
-#ifdef PG_USE_INLINE
-#define STATIC_IF_INLINE_DECLARE static inline
-#else
-#define STATIC_IF_INLINE_DECLARE extern
-#endif   /* PG_USE_INLINE */
-
-
 /* ----------------------------------------------------------------
  *                             Section 8:      random stuff
  * ----------------------------------------------------------------
index 7c20b9a1a1b11f3dbc22c78444a3f706f7952dae..3954ae034c7c96d76761d133ab96d33504d3a6b1 100644 (file)
@@ -268,40 +268,13 @@ extern void slist_check(slist_head *head);
 #define slist_check(head)      ((void) (head))
 #endif   /* ILIST_DEBUG */
 
+/* doubly linked list implementation */
 
-/*
- * We want the functions below to be inline; but if the compiler doesn't
- * support that, fall back on providing them as regular functions.  See
- * STATIC_IF_INLINE in c.h.
- */
-#ifndef PG_USE_INLINE
-extern void dlist_init(dlist_head *head);
-extern bool dlist_is_empty(dlist_head *head);
-extern void dlist_push_head(dlist_head *head, dlist_node *node);
-extern void dlist_push_tail(dlist_head *head, dlist_node *node);
-extern void dlist_insert_after(dlist_node *after, dlist_node *node);
-extern void dlist_insert_before(dlist_node *before, dlist_node *node);
-extern void dlist_delete(dlist_node *node);
-extern dlist_node *dlist_pop_head_node(dlist_head *head);
-extern void dlist_move_head(dlist_head *head, dlist_node *node);
-extern bool dlist_has_next(dlist_head *head, dlist_node *node);
-extern bool dlist_has_prev(dlist_head *head, dlist_node *node);
-extern dlist_node *dlist_next_node(dlist_head *head, dlist_node *node);
-extern dlist_node *dlist_prev_node(dlist_head *head, dlist_node *node);
-extern dlist_node *dlist_head_node(dlist_head *head);
-extern dlist_node *dlist_tail_node(dlist_head *head);
-
-/* dlist macro support functions */
-extern void *dlist_tail_element_off(dlist_head *head, size_t off);
-extern void *dlist_head_element_off(dlist_head *head, size_t off);
-#endif   /* !PG_USE_INLINE */
-
-#if defined(PG_USE_INLINE) || defined(ILIST_INCLUDE_DEFINITIONS)
 /*
  * Initialize a doubly linked list.
  * Previous state will be thrown away without any cleanup.
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_init(dlist_head *head)
 {
        head->head.next = head->head.prev = &head->head;
@@ -312,7 +285,7 @@ dlist_init(dlist_head *head)
  *
  * An empty list has either its first 'next' pointer set to NULL, or to itself.
  */
-STATIC_IF_INLINE bool
+static inline bool
 dlist_is_empty(dlist_head *head)
 {
        dlist_check(head);
@@ -323,7 +296,7 @@ dlist_is_empty(dlist_head *head)
 /*
  * Insert a node at the beginning of the list.
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_push_head(dlist_head *head, dlist_node *node)
 {
        if (head->head.next == NULL)    /* convert NULL header to circular */
@@ -340,7 +313,7 @@ dlist_push_head(dlist_head *head, dlist_node *node)
 /*
  * Insert a node at the end of the list.
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_push_tail(dlist_head *head, dlist_node *node)
 {
        if (head->head.next == NULL)    /* convert NULL header to circular */
@@ -357,7 +330,7 @@ dlist_push_tail(dlist_head *head, dlist_node *node)
 /*
  * Insert a node after another *in the same list*
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_insert_after(dlist_node *after, dlist_node *node)
 {
        node->prev = after;
@@ -369,7 +342,7 @@ dlist_insert_after(dlist_node *after, dlist_node *node)
 /*
  * Insert a node before another *in the same list*
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_insert_before(dlist_node *before, dlist_node *node)
 {
        node->prev = before->prev;
@@ -381,7 +354,7 @@ dlist_insert_before(dlist_node *before, dlist_node *node)
 /*
  * Delete 'node' from its list (it must be in one).
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_delete(dlist_node *node)
 {
        node->prev->next = node->next;
@@ -391,7 +364,7 @@ dlist_delete(dlist_node *node)
 /*
  * Remove and return the first node from a list (there must be one).
  */
-STATIC_IF_INLINE dlist_node *
+static inline dlist_node *
 dlist_pop_head_node(dlist_head *head)
 {
        dlist_node *node;
@@ -408,7 +381,7 @@ dlist_pop_head_node(dlist_head *head)
  *
  * Undefined behaviour if 'node' is not already part of the list.
  */
-STATIC_IF_INLINE void
+static inline void
 dlist_move_head(dlist_head *head, dlist_node *node)
 {
        /* fast path if it's already at the head */
@@ -425,7 +398,7 @@ dlist_move_head(dlist_head *head, dlist_node *node)
  * Check whether 'node' has a following node.
  * Caution: unreliable if 'node' is not in the list.
  */
-STATIC_IF_INLINE bool
+static inline bool
 dlist_has_next(dlist_head *head, dlist_node *node)
 {
        return node->next != &head->head;
@@ -435,7 +408,7 @@ dlist_has_next(dlist_head *head, dlist_node *node)
  * Check whether 'node' has a preceding node.
  * Caution: unreliable if 'node' is not in the list.
  */
-STATIC_IF_INLINE bool
+static inline bool
 dlist_has_prev(dlist_head *head, dlist_node *node)
 {
        return node->prev != &head->head;
@@ -444,7 +417,7 @@ dlist_has_prev(dlist_head *head, dlist_node *node)
 /*
  * Return the next node in the list (there must be one).
  */
-STATIC_IF_INLINE dlist_node *
+static inline dlist_node *
 dlist_next_node(dlist_head *head, dlist_node *node)
 {
        Assert(dlist_has_next(head, node));
@@ -454,7 +427,7 @@ dlist_next_node(dlist_head *head, dlist_node *node)
 /*
  * Return previous node in the list (there must be one).
  */
-STATIC_IF_INLINE dlist_node *
+static inline dlist_node *
 dlist_prev_node(dlist_head *head, dlist_node *node)
 {
        Assert(dlist_has_prev(head, node));
@@ -462,7 +435,7 @@ dlist_prev_node(dlist_head *head, dlist_node *node)
 }
 
 /* internal support function to get address of head element's struct */
-STATIC_IF_INLINE void *
+static inline void *
 dlist_head_element_off(dlist_head *head, size_t off)
 {
        Assert(!dlist_is_empty(head));
@@ -472,14 +445,14 @@ dlist_head_element_off(dlist_head *head, size_t off)
 /*
  * Return the first node in the list (there must be one).
  */
-STATIC_IF_INLINE dlist_node *
+static inline dlist_node *
 dlist_head_node(dlist_head *head)
 {
        return (dlist_node *) dlist_head_element_off(head, 0);
 }
 
 /* internal support function to get address of tail element's struct */
-STATIC_IF_INLINE void *
+static inline void *
 dlist_tail_element_off(dlist_head *head, size_t off)
 {
        Assert(!dlist_is_empty(head));
@@ -489,12 +462,11 @@ dlist_tail_element_off(dlist_head *head, size_t off)
 /*
  * Return the last node in the list (there must be one).
  */
-STATIC_IF_INLINE dlist_node *
+static inline dlist_node *
 dlist_tail_node(dlist_head *head)
 {
        return (dlist_node *) dlist_tail_element_off(head, 0);
 }
-#endif   /* PG_USE_INLINE || ILIST_INCLUDE_DEFINITIONS */
 
 /*
  * Return the containing struct of 'type' where 'membername' is the dlist_node
@@ -572,32 +544,13 @@ dlist_tail_node(dlist_head *head)
                 (iter).cur = (iter).cur->prev)
 
 
-/*
- * We want the functions below to be inline; but if the compiler doesn't
- * support that, fall back on providing them as regular functions.  See
- * STATIC_IF_INLINE in c.h.
- */
-#ifndef PG_USE_INLINE
-extern void slist_init(slist_head *head);
-extern bool slist_is_empty(slist_head *head);
-extern void slist_push_head(slist_head *head, slist_node *node);
-extern void slist_insert_after(slist_node *after, slist_node *node);
-extern slist_node *slist_pop_head_node(slist_head *head);
-extern bool slist_has_next(slist_head *head, slist_node *node);
-extern slist_node *slist_next_node(slist_head *head, slist_node *node);
-extern slist_node *slist_head_node(slist_head *head);
-extern void slist_delete_current(slist_mutable_iter *iter);
-
-/* slist macro support function */
-extern void *slist_head_element_off(slist_head *head, size_t off);
-#endif
+/* singly linked list implementation */
 
-#if defined(PG_USE_INLINE) || defined(ILIST_INCLUDE_DEFINITIONS)
 /*
  * Initialize a singly linked list.
  * Previous state will be thrown away without any cleanup.
  */
-STATIC_IF_INLINE void
+static inline void
 slist_init(slist_head *head)
 {
        head->head.next = NULL;
@@ -606,7 +559,7 @@ slist_init(slist_head *head)
 /*
  * Is the list empty?
  */
-STATIC_IF_INLINE bool
+static inline bool
 slist_is_empty(slist_head *head)
 {
        slist_check(head);
@@ -617,7 +570,7 @@ slist_is_empty(slist_head *head)
 /*
  * Insert a node at the beginning of the list.
  */
-STATIC_IF_INLINE void
+static inline void
 slist_push_head(slist_head *head, slist_node *node)
 {
        node->next = head->head.next;
@@ -629,7 +582,7 @@ slist_push_head(slist_head *head, slist_node *node)
 /*
  * Insert a node after another *in the same list*
  */
-STATIC_IF_INLINE void
+static inline void
 slist_insert_after(slist_node *after, slist_node *node)
 {
        node->next = after->next;
@@ -639,7 +592,7 @@ slist_insert_after(slist_node *after, slist_node *node)
 /*
  * Remove and return the first node from a list (there must be one).
  */
-STATIC_IF_INLINE slist_node *
+static inline slist_node *
 slist_pop_head_node(slist_head *head)
 {
        slist_node *node;
@@ -654,7 +607,7 @@ slist_pop_head_node(slist_head *head)
 /*
  * Check whether 'node' has a following node.
  */
-STATIC_IF_INLINE bool
+static inline bool
 slist_has_next(slist_head *head, slist_node *node)
 {
        slist_check(head);
@@ -665,7 +618,7 @@ slist_has_next(slist_head *head, slist_node *node)
 /*
  * Return the next node in the list (there must be one).
  */
-STATIC_IF_INLINE slist_node *
+static inline slist_node *
 slist_next_node(slist_head *head, slist_node *node)
 {
        Assert(slist_has_next(head, node));
@@ -673,7 +626,7 @@ slist_next_node(slist_head *head, slist_node *node)
 }
 
 /* internal support function to get address of head element's struct */
-STATIC_IF_INLINE void *
+static inline void *
 slist_head_element_off(slist_head *head, size_t off)
 {
        Assert(!slist_is_empty(head));
@@ -683,7 +636,7 @@ slist_head_element_off(slist_head *head, size_t off)
 /*
  * Return the first node in the list (there must be one).
  */
-STATIC_IF_INLINE slist_node *
+static inline slist_node *
 slist_head_node(slist_head *head)
 {
        return (slist_node *) slist_head_element_off(head, 0);
@@ -695,7 +648,7 @@ slist_head_node(slist_head *head)
  * Caution: this modifies iter->cur, so don't use that again in the current
  * loop iteration.
  */
-STATIC_IF_INLINE void
+static inline void
 slist_delete_current(slist_mutable_iter *iter)
 {
        /*
@@ -711,7 +664,6 @@ slist_delete_current(slist_mutable_iter *iter)
         */
        iter->cur = iter->prev;
 }
-#endif   /* PG_USE_INLINE || ILIST_INCLUDE_DEFINITIONS */
 
 /*
  * Return the containing struct of 'type' where 'membername' is the slist_node
index 729456d6e5d12c3ebec5efe70c050408d898e96f..b7040df62de276f6e694491f78cf634b1a04766e 100644 (file)
@@ -71,34 +71,25 @@ struct ListCell
 /*
  * These routines are used frequently. However, we can't implement
  * them as macros, since we want to avoid double-evaluation of macro
- * arguments. Therefore, we implement them using static inline functions
- * if supported by the compiler, or as regular functions otherwise.
- * See STATIC_IF_INLINE in c.h.
+ * arguments.
  */
-#ifndef PG_USE_INLINE
-extern ListCell *list_head(const List *l);
-extern ListCell *list_tail(List *l);
-extern int     list_length(const List *l);
-#endif   /* PG_USE_INLINE */
-#if defined(PG_USE_INLINE) || defined(PG_LIST_INCLUDE_DEFINITIONS)
-STATIC_IF_INLINE ListCell *
+static inline ListCell *
 list_head(const List *l)
 {
        return l ? l->head : NULL;
 }
 
-STATIC_IF_INLINE ListCell *
+static inline ListCell *
 list_tail(List *l)
 {
        return l ? l->tail : NULL;
 }
 
-STATIC_IF_INLINE int
+static inline int
 list_length(const List *l)
 {
        return l ? l->length : 0;
 }
-#endif   /*-- PG_USE_INLINE || PG_LIST_INCLUDE_DEFINITIONS */
 
 /*
  * NB: There is an unfortunate legacy from a previous incarnation of
index 5688f750af9b212a1f89a9a062bab9e223c0cab0..9285c6214ce618929baa008ebc43b3133030a47a 100644 (file)
 /* Define to gnu_printf if compiler supports it, else printf. */
 #undef PG_PRINTF_ATTRIBUTE
 
-/* Define to 1 if "static inline" works without unwanted warnings from
-   compilations where static inline functions are defined but not called. */
-#undef PG_USE_INLINE
-
 /* PostgreSQL version as a string */
 #undef PG_VERSION
 
index 22bbb9158d3ccd31c0019e77e4c644e272692a0a..ad61392841ef9736ba4d21451efaffcc31c6bdbf 100644 (file)
@@ -6,7 +6,7 @@
  *
  * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_GETOPT, HAVE_GETOPT_H, HAVE_INTTYPES_H,
  * HAVE_GETOPT_LONG, HAVE_LOCALE_T, HAVE_RINT, HAVE_STRINGS_H, HAVE_STRTOLL,
- * HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY, PG_USE_INLINE,
+ * HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY,
  * inline, USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
  */
 
 /* Define to 1 to build with Bonjour support. (--with-bonjour) */
 /* #undef USE_BONJOUR */
 
-/* Define to 1 if "static inline" works without unwanted warnings from
-   compilations where static inline functions are defined but not called. */
-#define PG_USE_INLINE 1
-
 /* Define to 1 if you want 64-bit integer timestamp and interval support.
    (--enable-integer-datetimes) */
 /* #undef USE_INTEGER_DATETIMES */
index d94fea60f150300e74e39c04429c896b269171b8..bb87945088938e1414595e1b984faeab82352d8b 100644 (file)
  */
 #include "port/atomics/generic.h"
 
-/*
- * Provide declarations for all functions here - on most platforms static
- * inlines are used and these aren't necessary, but when static inline is
- * unsupported these will be external functions.
- */
-STATIC_IF_INLINE_DECLARE void pg_atomic_init_flag(volatile pg_atomic_flag *ptr);
-STATIC_IF_INLINE_DECLARE bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr);
-STATIC_IF_INLINE_DECLARE bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr);
-STATIC_IF_INLINE_DECLARE void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr);
-
-STATIC_IF_INLINE_DECLARE void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr);
-STATIC_IF_INLINE_DECLARE void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval);
-STATIC_IF_INLINE_DECLARE bool pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr,
-                                                          uint32 *expected, uint32 newval);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_);
-STATIC_IF_INLINE_DECLARE uint32 pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_);
-
-#ifdef PG_HAVE_ATOMIC_U64_SUPPORT
-
-STATIC_IF_INLINE_DECLARE void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr);
-STATIC_IF_INLINE_DECLARE void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval);
-STATIC_IF_INLINE_DECLARE bool pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
-                                                          uint64 *expected, uint64 newval);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_);
-STATIC_IF_INLINE_DECLARE uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_);
-
-#endif   /* PG_HAVE_64_BIT_ATOMICS */
-
 
 /*
  * pg_compiler_barrier - prevent the compiler from moving code across
@@ -201,18 +161,12 @@ STATIC_IF_INLINE_DECLARE uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint6
  */
 #define pg_spin_delay() pg_spin_delay_impl()
 
-/*
- * The following functions are wrapper functions around the platform specific
- * implementation of the atomic operations performing common checks.
- */
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 /*
  * pg_atomic_init_flag - initialize atomic flag.
  *
  * No barrier semantics.
  */
-STATIC_IF_INLINE_DECLARE void
+static inline void
 pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
 {
        AssertPointerAlignment(ptr, sizeof(*ptr));
@@ -227,7 +181,7 @@ pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
  *
  * Acquire (including read barrier) semantics.
  */
-STATIC_IF_INLINE_DECLARE bool
+static inline bool
 pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
 {
        AssertPointerAlignment(ptr, sizeof(*ptr));
@@ -242,7 +196,7 @@ pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
  *
  * No barrier semantics.
  */
-STATIC_IF_INLINE_DECLARE bool
+static inline bool
 pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
 {
        AssertPointerAlignment(ptr, sizeof(*ptr));
@@ -255,7 +209,7 @@ pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
  *
  * Release (including write barrier) semantics.
  */
-STATIC_IF_INLINE_DECLARE void
+static inline void
 pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
 {
        AssertPointerAlignment(ptr, sizeof(*ptr));
@@ -271,7 +225,7 @@ pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
  *
  * No barrier semantics.
  */
-STATIC_IF_INLINE_DECLARE void
+static inline void
 pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
 {
        AssertPointerAlignment(ptr, 4);
@@ -289,7 +243,7 @@ pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
  *
  * No barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
 {
        AssertPointerAlignment(ptr, 4);
@@ -304,7 +258,7 @@ pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
  *
  * No barrier semantics.
  */
-STATIC_IF_INLINE_DECLARE void
+static inline void
 pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
 {
        AssertPointerAlignment(ptr, 4);
@@ -319,7 +273,7 @@ pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
 {
        AssertPointerAlignment(ptr, 4);
@@ -338,7 +292,7 @@ pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE bool
+static inline bool
 pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr,
                                                           uint32 *expected, uint32 newval)
 {
@@ -355,7 +309,7 @@ pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr,
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -370,7 +324,7 @@ pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -385,7 +339,7 @@ pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -399,7 +353,7 @@ pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -413,7 +367,7 @@ pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -428,7 +382,7 @@ pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
  *
  * Full barrier semantics.
  */
-STATIC_IF_INLINE uint32
+static inline uint32
 pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
 {
        AssertPointerAlignment(ptr, 4);
@@ -444,7 +398,7 @@ pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
  */
 #ifdef PG_HAVE_ATOMIC_U64_SUPPORT
 
-STATIC_IF_INLINE_DECLARE void
+static inline void
 pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
 {
        AssertPointerAlignment(ptr, 8);
@@ -452,21 +406,21 @@ pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
        pg_atomic_init_u64_impl(ptr, val);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
 {
        AssertPointerAlignment(ptr, 8);
        return pg_atomic_read_u64_impl(ptr);
 }
 
-STATIC_IF_INLINE void
+static inline void
 pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
 {
        AssertPointerAlignment(ptr, 8);
        pg_atomic_write_u64_impl(ptr, val);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval)
 {
        AssertPointerAlignment(ptr, 8);
@@ -474,7 +428,7 @@ pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval)
        return pg_atomic_exchange_u64_impl(ptr, newval);
 }
 
-STATIC_IF_INLINE bool
+static inline bool
 pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
                                                           uint64 *expected, uint64 newval)
 {
@@ -483,14 +437,14 @@ pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
        return pg_atomic_compare_exchange_u64_impl(ptr, expected, newval);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
 {
        AssertPointerAlignment(ptr, 8);
        return pg_atomic_fetch_add_u64_impl(ptr, add_);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
 {
        AssertPointerAlignment(ptr, 8);
@@ -498,28 +452,28 @@ pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
        return pg_atomic_fetch_sub_u64_impl(ptr, sub_);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_)
 {
        AssertPointerAlignment(ptr, 8);
        return pg_atomic_fetch_and_u64_impl(ptr, and_);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_)
 {
        AssertPointerAlignment(ptr, 8);
        return pg_atomic_fetch_or_u64_impl(ptr, or_);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
 {
        AssertPointerAlignment(ptr, 8);
        return pg_atomic_add_fetch_u64_impl(ptr, add_);
 }
 
-STATIC_IF_INLINE uint64
+static inline uint64
 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
 {
        AssertPointerAlignment(ptr, 8);
@@ -529,9 +483,6 @@ pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
 
 #endif   /* PG_HAVE_64_BIT_ATOMICS */
 
-#endif   /* defined(PG_USE_INLINE) ||
-                                                                * defined(ATOMICS_INCLUDE_DEFINITIONS) */
-
 #undef INSIDE_ATOMICS_H
 
 #endif   /* ATOMICS_H */
index 168a49c79345a7309f769e6cc07c2a3e7f0bb375..3f65accae8866a53304ef776a965bd415f65d4cb 100644 (file)
@@ -82,8 +82,6 @@ typedef struct pg_atomic_uint64
 
 #endif /* defined(__GNUC__) && !defined(__INTEL_COMPILER) */
 
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 #if !defined(PG_HAVE_SPIN_DELAY)
 /*
  * This sequence is equivalent to the PAUSE instruction ("rep" is
@@ -251,5 +249,3 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
 #endif /* defined(__GNUC__) && !defined(__INTEL_COMPILER) */
 
 #endif /* HAVE_ATOMICS */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index 4e04f9758b971ac8a97d727c653e7d9ef8ea17b9..df8ae56b306073d1e4e0a335aec8e6107d18c3da 100644 (file)
@@ -102,8 +102,6 @@ typedef struct pg_atomic_uint32
 
 #endif /* PG_HAVE_ATOMIC_U32_SUPPORT */
 
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 #ifdef PG_HAVE_ATOMIC_FLAG_SIMULATION
 
 #define PG_HAVE_ATOMIC_INIT_FLAG
@@ -143,6 +141,3 @@ extern bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
 extern uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_);
 
 #endif /* PG_HAVE_ATOMIC_U32_SIMULATION */
-
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index c5639aadda0b6d11b3f6f653af41934f0e0dd2cd..c2246917822f0874bf10e611ec5abe376b60ae02 100644 (file)
@@ -49,18 +49,12 @@ typedef struct pg_atomic_uint64
        volatile uint64 value;
 } pg_atomic_uint64;
 
-#endif /* defined(HAVE_ATOMICS) */
-
-
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
-#if defined(HAVE_ATOMICS)
 
 #define MINOR_FENCE (_Asm_fence) (_UP_CALL_FENCE | _UP_SYS_FENCE | \
                                                                 _DOWN_CALL_FENCE | _DOWN_SYS_FENCE )
 
 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
-STATIC_IF_INLINE bool
+static inline bool
 pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
                                                                        uint32 *expected, uint32 newval)
 {
@@ -88,7 +82,7 @@ pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
 
 
 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
-STATIC_IF_INLINE bool
+static inline bool
 pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
                                                                        uint64 *expected, uint64 newval)
 {
@@ -110,5 +104,3 @@ pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
 #undef MINOR_FENCE
 
 #endif /* defined(HAVE_ATOMICS) */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index 591c9fe1eb3efcb4987a04eff991aeb13af6efd0..306c38f6f7fc09401e337b387bf7c734e3c78597 100644 (file)
@@ -57,6 +57,7 @@
 #              define pg_write_barrier_impl()          __atomic_thread_fence(__ATOMIC_RELEASE)
 #endif
 
+
 #ifdef HAVE_ATOMICS
 
 /* generic gcc based atomic flag implementation */
@@ -103,11 +104,6 @@ typedef struct pg_atomic_uint64
 
 #endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */
 
-/*
- * Implementation follows. Inlined or directly included from atomics.c
- */
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 #ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT
 
 #if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS)
@@ -231,6 +227,4 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
 
 #endif /* !defined(PG_DISABLE_64_BIT_ATOMICS) */
 
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
-
 #endif /* defined(HAVE_ATOMICS) */
index d259d6f51d085c1e056eb74479b2e51b702e13b7..436baefb5da1ac9854377f06bca995b6a619fee7 100644 (file)
@@ -46,12 +46,6 @@ typedef struct __declspec(align(8)) pg_atomic_uint64
        volatile uint64 value;
 } pg_atomic_uint64;
 
-#endif /* defined(HAVE_ATOMICS) */
-
-
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
-#if defined(HAVE_ATOMICS)
 
 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
 static inline bool
@@ -107,5 +101,3 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
 #endif /* _WIN64 */
 
 #endif /* HAVE_ATOMICS */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index d369207fb34a41ede28bf7e125ec75fc34affedb..867fab71c711c5f00acdf542c110b1b424b9f686 100644 (file)
@@ -69,8 +69,6 @@ typedef struct pg_atomic_uint64
 #endif /* defined(HAVE_ATOMICS) */
 
 
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 #if defined(HAVE_ATOMICS)
 
 #ifdef HAVE_ATOMIC_H
@@ -106,5 +104,3 @@ pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
 #endif /* HAVE_ATOMIC_H */
 
 #endif /* defined(HAVE_ATOMICS) */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index 0ad9168ed2849fb0ede1e54372110d08a04dcc6e..4e26f88d70ccd6b7c19ff86f6acfe0642de3e885 100644 (file)
@@ -35,12 +35,6 @@ typedef struct pg_atomic_uint64
 
 #endif /* __64BIT__ */
 
-#endif /* defined(HAVE_ATOMICS) */
-
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
-#if defined(HAVE_ATOMICS)
-
 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
 static inline bool
 pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
@@ -91,5 +85,3 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
 #endif /* PG_HAVE_ATOMIC_U64_SUPPORT */
 
 #endif /* defined(HAVE_ATOMICS) */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index bb31df3623715f2356a1f647f39c2cf4a493e219..56a7c286af9b605073ccd406d7fed20f88c54979 100644 (file)
@@ -40,8 +40,6 @@
 typedef pg_atomic_uint32 pg_atomic_flag;
 #endif
 
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
 #ifndef PG_HAVE_ATOMIC_READ_U32
 #define PG_HAVE_ATOMIC_READ_U32
 static inline uint32
@@ -383,5 +381,3 @@ pg_atomic_sub_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_)
 #endif
 
 #endif /* PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
index 72575d4a829534269b6e48e6d0500de51e5896fd..af808fd9add0ce8c8b1f8b6588b86ddee4b68b74 100644 (file)
@@ -44,20 +44,8 @@ typedef struct array_iter
        int                     bitmask;                /* mask for current bit in nulls bitmap */
 } array_iter;
 
-/*
- * We want the functions below to be inline; but if the compiler doesn't
- * support that, fall back on providing them as regular functions.  See
- * STATIC_IF_INLINE in c.h.
- */
-#ifndef PG_USE_INLINE
-extern void array_iter_setup(array_iter *it, AnyArrayType *a);
-extern Datum array_iter_next(array_iter *it, bool *isnull, int i,
-                               int elmlen, bool elmbyval, char elmalign);
-#endif   /* !PG_USE_INLINE */
 
-#if defined(PG_USE_INLINE) || defined(ARRAYACCESS_INCLUDE_DEFINITIONS)
-
-STATIC_IF_INLINE void
+static inline void
 array_iter_setup(array_iter *it, AnyArrayType *a)
 {
        if (VARATT_IS_EXPANDED_HEADER(a))
@@ -89,7 +77,7 @@ array_iter_setup(array_iter *it, AnyArrayType *a)
        it->bitmask = 1;
 }
 
-STATIC_IF_INLINE Datum
+static inline Datum
 array_iter_next(array_iter *it, bool *isnull, int i,
                                int elmlen, bool elmbyval, char elmalign)
 {
@@ -127,7 +115,4 @@ array_iter_next(array_iter *it, bool *isnull, int i,
        return ret;
 }
 
-#endif   /* defined(PG_USE_INLINE) ||
-                                                                * defined(ARRAYACCESS_INCLUDE_DEFINITIONS) */
-
 #endif   /* ARRAYACCESS_H */
index e56f5014a3d7212d0230a34cf4968c172a52cfa7..f2bcd00b4cb159843f204ab9dc5eafb89c6096b0 100644 (file)
@@ -98,10 +98,6 @@ extern void *MemoryContextAllocHuge(MemoryContext context, Size size);
 extern void *repalloc_huge(void *pointer, Size size);
 
 /*
- * MemoryContextSwitchTo can't be a macro in standard C compilers.
- * But we can make it an inline function if the compiler supports it.
- * See STATIC_IF_INLINE in c.h.
- *
  * Although this header file is nominally backend-only, certain frontend
  * programs like pg_controldata include it via postgres.h.  For some compilers
  * it's necessary to hide the inline definition of MemoryContextSwitchTo in
@@ -109,11 +105,7 @@ extern void *repalloc_huge(void *pointer, Size size);
  */
 
 #ifndef FRONTEND
-#ifndef PG_USE_INLINE
-extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
-#endif   /* !PG_USE_INLINE */
-#if defined(PG_USE_INLINE) || defined(MCXT_INCLUDE_DEFINITIONS)
-STATIC_IF_INLINE MemoryContext
+static inline MemoryContext
 MemoryContextSwitchTo(MemoryContext context)
 {
        MemoryContext old = CurrentMemoryContext;
@@ -121,7 +113,6 @@ MemoryContextSwitchTo(MemoryContext context)
        CurrentMemoryContext = context;
        return old;
 }
-#endif   /* PG_USE_INLINE || MCXT_INCLUDE_DEFINITIONS */
 #endif   /* FRONTEND */
 
 /* Registration of memory context reset/delete callbacks */
index 787404ed903a837b907935d9ba843ab53cb04407..425863055631208bc4b48c8dc0ec95e025876d3b 100644 (file)
@@ -192,24 +192,11 @@ typedef struct SortSupportData
 } SortSupportData;
 
 
-/*
- * ApplySortComparator should be inlined if possible.  See STATIC_IF_INLINE
- * in c.h.
- */
-#ifndef PG_USE_INLINE
-extern int ApplySortComparator(Datum datum1, bool isNull1,
-                                       Datum datum2, bool isNull2,
-                                       SortSupport ssup);
-extern int ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
-                                                         Datum datum2, bool isNull2,
-                                                         SortSupport ssup);
-#endif   /* !PG_USE_INLINE */
-#if defined(PG_USE_INLINE) || defined(SORTSUPPORT_INCLUDE_DEFINITIONS)
 /*
  * Apply a sort comparator function and return a 3-way comparison result.
  * This takes care of handling reverse-sort and NULLs-ordering properly.
  */
-STATIC_IF_INLINE int
+static inline int
 ApplySortComparator(Datum datum1, bool isNull1,
                                        Datum datum2, bool isNull2,
                                        SortSupport ssup)
@@ -247,7 +234,7 @@ ApplySortComparator(Datum datum1, bool isNull1,
  * authoritative comparator.  This takes care of handling reverse-sort and
  * NULLs-ordering properly.
  */
-STATIC_IF_INLINE int
+static inline int
 ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
                                                          Datum datum2, bool isNull2,
                                                          SortSupport ssup)
@@ -279,7 +266,6 @@ ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
 
        return compare;
 }
-#endif   /*-- PG_USE_INLINE || SORTSUPPORT_INCLUDE_DEFINITIONS */
 
 /* Other functions in utils/sort/sortsupport.c */
 extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup);
index b566ff129df6008b28d3b90470371e30e4f4adb4..414430a22ff9c929d7ca14d1540afab05e683f17 100644 (file)
@@ -12,6 +12,14 @@ if test "$GCC" != yes ; then
   esac
 fi
 
+# "IBM XL C/C++ for AIX, V12.1" miscompiles, for 32-bit, some inline
+# expansions of ginCompareItemPointers() "long long" arithmetic.  To
+# take advantage of inlining, build a 64-bit PostgreSQL.
+test "$GCC" != yes -a $(getconf HARDWARE_BITMODE) == '32'; then
+  echo "$as_me: WARNING: disabling inlining on 32 bit aix due to a bug in xlc" 2>&1
+  CPPFLAGS="$CPPFLAGS -DPG_FORCE_DISABLE_INLINE"
+fi
+
 # Native memset() is faster, tested on:
 #      AIX 5.1 and 5.2, XLC 6.0 (IBM's cc)
 #      AIX 5.3 ML3, gcc 4.0.1