summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-10-19 18:21:58 +0200
committerPeter Eisentraut <peter@eisentraut.org>2019-10-19 18:31:38 +0200
commit5d3587d14b753cb25b0ebcd549d95e1b6ceebce4 (patch)
treebd56a49e3cf4056f0012d6f96604a67c5eed3cb9 /src/include
parent48cc59ed24f95fa171b12ba1b461e6dc72d62b2b (diff)
Fix most -Wundef warnings
In some cases #if was used instead of #ifdef in an inconsistent style. Cleaning this up also helps when analyzing cases like 38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd where this makes a difference. There are no behavior changes here, but the change in pg_bswap.h would prevent possible accidental misuse by third-party code. Discussion: https://www.postgresql.org/message-id/flat/3b615ca5-c595-3f1d-fdf7-a429e564f614%402ndquadrant.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/port/pg_bswap.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/port/pg_bswap.h b/src/include/port/pg_bswap.h
index dbf9df61559..d2e0605a662 100644
--- a/src/include/port/pg_bswap.h
+++ b/src/include/port/pg_bswap.h
@@ -139,7 +139,14 @@ pg_bswap64(uint64 x)
* the same result as a memcmp() of the corresponding original Datums, but can
* be much cheaper. It's generally safe to do this on big-endian systems
* without any special transformation occurring first.
+ *
+ * If SIZEOF_DATUM is not defined, then postgres.h wasn't included and these
+ * macros probably shouldn't be used, so we define nothing. Note that
+ * SIZEOF_DATUM == 8 would evaluate as 0 == 8 in that case, potentially
+ * leading to the wrong implementation being selected and confusing errors, so
+ * defining nothing is safest.
*/
+#ifdef SIZEOF_DATUM
#ifdef WORDS_BIGENDIAN
#define DatumBigEndianToNative(x) (x)
#else /* !WORDS_BIGENDIAN */
@@ -149,5 +156,6 @@ pg_bswap64(uint64 x)
#define DatumBigEndianToNative(x) pg_bswap32(x)
#endif /* SIZEOF_DATUM == 8 */
#endif /* WORDS_BIGENDIAN */
+#endif /* SIZEOF_DATUM */
#endif /* PG_BSWAP_H */