diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 050bfa5c7d..397e1b0379 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -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 index 732b23149e..0000000000 --- a/config/test_quiet_include.h +++ /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 diff --git a/configure b/configure index 5787ae8ee3..ebb5cac31c 100755 --- 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 : diff --git a/configure.in b/configure.in index ece5e22751..a28f9ddb25 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/src/backend/lib/ilist.c b/src/backend/lib/ilist.c index 58550f7744..c26baf35f0 100644 --- a/src/backend/lib/ilist.c +++ b/src/backend/lib/ilist.c @@ -18,9 +18,6 @@ */ #include "postgres.h" -/* See ilist.h */ -#define ILIST_INCLUDE_DEFINITIONS - #include "lib/ilist.h" /* diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index a6737514ef..1dce42f7b4 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -15,9 +15,6 @@ */ #include "postgres.h" -/* see pg_list.h */ -#define PG_LIST_INCLUDE_DEFINITIONS - #include "nodes/pg_list.h" diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c index 439b3c18c7..cd953f964e 100644 --- a/src/backend/port/atomics.c +++ b/src/backend/port/atomics.c @@ -13,13 +13,6 @@ */ #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" diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 42cdbc7d6e..67c9b357c8 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -20,9 +20,6 @@ #endif #include -/* See arrayaccess.h */ -#define ARRAYACCESS_INCLUDE_DEFINITIONS - #include "access/htup_details.h" #include "catalog/pg_type.h" #include "funcapi.h" diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 34f4e7202f..12d29f7440 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -19,9 +19,6 @@ *------------------------------------------------------------------------- */ -/* see palloc.h. Must be before postgres.h */ -#define MCXT_INCLUDE_DEFINITIONS - #include "postgres.h" #include "miscadmin.h" diff --git a/src/backend/utils/sort/sortsupport.c b/src/backend/utils/sort/sortsupport.c index ffef9658e4..daf38c74ff 100644 --- a/src/backend/utils/sort/sortsupport.c +++ b/src/backend/utils/sort/sortsupport.c @@ -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" diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index 5f214d779a..5095fc1dba 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -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 */ diff --git a/src/include/c.h b/src/include/c.h index 92c52021ff..e84c77460c 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -53,6 +53,20 @@ #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 * ---------------------------------------------------------------- diff --git a/src/include/lib/ilist.h b/src/include/lib/ilist.h index 7c20b9a1a1..3954ae034c 100644 --- a/src/include/lib/ilist.h +++ b/src/include/lib/ilist.h @@ -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); +/* singly linked list implementation */ -/* slist macro support function */ -extern void *slist_head_element_off(slist_head *head, size_t off); -#endif - -#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 diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h index 729456d6e5..b7040df62d 100644 --- a/src/include/nodes/pg_list.h +++ b/src/include/nodes/pg_list.h @@ -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 diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 5688f750af..9285c6214c 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -733,10 +733,6 @@ /* 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 diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 22bbb9158d..ad61392841 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -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 */ @@ -622,10 +622,6 @@ /* 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 */ diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h index d94fea60f1..bb87945088 100644 --- a/src/include/port/atomics.h +++ b/src/include/port/atomics.h @@ -118,46 +118,6 @@ */ #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 */ diff --git a/src/include/port/atomics/arch-x86.h b/src/include/port/atomics/arch-x86.h index 168a49c793..3f65accae8 100644 --- a/src/include/port/atomics/arch-x86.h +++ b/src/include/port/atomics/arch-x86.h @@ -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) */ diff --git a/src/include/port/atomics/fallback.h b/src/include/port/atomics/fallback.h index 4e04f9758b..df8ae56b30 100644 --- a/src/include/port/atomics/fallback.h +++ b/src/include/port/atomics/fallback.h @@ -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) */ diff --git a/src/include/port/atomics/generic-acc.h b/src/include/port/atomics/generic-acc.h index c5639aadda..c224691782 100644 --- a/src/include/port/atomics/generic-acc.h +++ b/src/include/port/atomics/generic-acc.h @@ -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) */ diff --git a/src/include/port/atomics/generic-gcc.h b/src/include/port/atomics/generic-gcc.h index 591c9fe1eb..306c38f6f7 100644 --- a/src/include/port/atomics/generic-gcc.h +++ b/src/include/port/atomics/generic-gcc.h @@ -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) */ diff --git a/src/include/port/atomics/generic-msvc.h b/src/include/port/atomics/generic-msvc.h index d259d6f51d..436baefb5d 100644 --- a/src/include/port/atomics/generic-msvc.h +++ b/src/include/port/atomics/generic-msvc.h @@ -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) */ diff --git a/src/include/port/atomics/generic-sunpro.h b/src/include/port/atomics/generic-sunpro.h index d369207fb3..867fab71c7 100644 --- a/src/include/port/atomics/generic-sunpro.h +++ b/src/include/port/atomics/generic-sunpro.h @@ -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) */ diff --git a/src/include/port/atomics/generic-xlc.h b/src/include/port/atomics/generic-xlc.h index 0ad9168ed2..4e26f88d70 100644 --- a/src/include/port/atomics/generic-xlc.h +++ b/src/include/port/atomics/generic-xlc.h @@ -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) */ diff --git a/src/include/port/atomics/generic.h b/src/include/port/atomics/generic.h index bb31df3623..56a7c286af 100644 --- a/src/include/port/atomics/generic.h +++ b/src/include/port/atomics/generic.h @@ -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) */ diff --git a/src/include/utils/arrayaccess.h b/src/include/utils/arrayaccess.h index 72575d4a82..af808fd9ad 100644 --- a/src/include/utils/arrayaccess.h +++ b/src/include/utils/arrayaccess.h @@ -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 */ diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index e56f5014a3..f2bcd00b4c 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -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 */ diff --git a/src/include/utils/sortsupport.h b/src/include/utils/sortsupport.h index 787404ed90..4258630556 100644 --- a/src/include/utils/sortsupport.h +++ b/src/include/utils/sortsupport.h @@ -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); diff --git a/src/template/aix b/src/template/aix index b566ff129d..414430a22f 100644 --- a/src/template/aix +++ b/src/template/aix @@ -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