Support gcc -fkeep-inline-functions
authorPeter Eisentraut <[email protected]>
Fri, 15 Jul 2022 10:05:01 +0000 (12:05 +0200)
committerPeter Eisentraut <[email protected]>
Fri, 15 Jul 2022 10:12:30 +0000 (12:12 +0200)
For some systems, we need to avoid unsatisfied-external-reference
errors in static inlines.  See
27d2693187d1bcf2563ee7142ba37d4788c8d52b for example.  In order to
test that on other systems, the gcc option -fkeep-inline-functions can
be used.  But it actually is a bit stricter than what we currently
have in place, so fix up a few more places along the lines of the
above commit.  (This undoes part of commit
2cd2569c72b8920048e35c31c9be30a6170e1410.)

(Note, this does not add that gcc option anywhere to the build system,
it just makes it possible to use it successfully manually.)

Discussion: https://www.postgresql.org/message-id/flat/E1oBgIW-002ehP-VJ%40gemulon.postgresql.org

src/include/storage/bufpage.h
src/include/utils/rel.h
src/include/utils/snapmgr.h

index fc67d396b6b93c0a7bb6b1dcb69c5445c3f82979..6a947021aca2c75ff187ebad6f608b6c23f9dd20 100644 (file)
@@ -466,6 +466,15 @@ do { \
 #define PIV_LOG_WARNING            (1 << 0)
 #define PIV_REPORT_STAT            (1 << 1)
 
+#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \
+   PageAddItemExtended(page, item, size, offsetNumber, \
+                       ((overwrite) ? PAI_OVERWRITE : 0) | \
+                       ((is_heap) ? PAI_IS_HEAP : 0))
+
+#define PageIsVerified(page, blkno) \
+   PageIsVerifiedExtended(page, blkno, \
+                          PIV_LOG_WARNING | PIV_REPORT_STAT)
+
 /*
  * Check that BLCKSZ is a multiple of sizeof(size_t).  In
  * PageIsVerifiedExtended(), it is much faster to check if a page is
@@ -480,21 +489,6 @@ extern void PageInit(Page page, Size pageSize, Size specialSize);
 extern bool PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags);
 extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
                                        OffsetNumber offsetNumber, int flags);
-
-static inline OffsetNumber
-PageAddItem(Page page, Item item, Size size, OffsetNumber offsetNumber, bool overwrite, bool is_heap)
-{
-   return PageAddItemExtended(page, item, size, offsetNumber,
-                              (overwrite ? PAI_OVERWRITE : 0) |
-                              (is_heap ? PAI_IS_HEAP : 0));
-}
-
-static inline bool
-PageIsVerified(Page page, BlockNumber blkno)
-{
-   return PageIsVerifiedExtended(page, blkno, PIV_LOG_WARNING | PIV_REPORT_STAT);
-}
-
 extern Page PageGetTempPage(Page page);
 extern Page PageGetTempPageCopy(Page page);
 extern Page PageGetTempPageCopySpecial(Page page);
index 2854839ec2cc123ce9c23f5c14c90b1d11708252..7dc401cf0df935e21379615f737aea1534ea42f5 100644 (file)
@@ -551,6 +551,7 @@ typedef struct ViewOptions
    (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
     ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
 
+#ifndef FRONTEND
 /*
  * RelationGetSmgr
  *     Returns smgr file handle for a relation, opening it if needed.
@@ -571,6 +572,7 @@ RelationGetSmgr(Relation rel)
        smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_locator, rel->rd_backend));
    return rel->rd_smgr;
 }
+#endif
 
 /*
  * RelationCloseSmgr
index 67b217b1c11999c2a89e54e4db00017c7fd25da3..06eafdf118a966eae4f600887e8101bd9c0424fb 100644 (file)
@@ -97,11 +97,13 @@ extern PGDLLIMPORT SnapshotData CatalogSnapshotData;
    ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \
     (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC)
 
+#ifndef FRONTEND
 static inline bool
 OldSnapshotThresholdActive(void)
 {
    return old_snapshot_threshold >= 0;
 }
+#endif
 
 extern Snapshot GetTransactionSnapshot(void);
 extern Snapshot GetLatestSnapshot(void);