mirror of
https://github.com/postgres/postgres.git
synced 2025-11-03 09:13:20 +03:00
Rely on inline functions even if that causes warnings in older compilers.
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user