summaryrefslogtreecommitdiff
path: root/config/c-compiler.m4
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2019-02-13 20:09:48 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2019-02-13 20:09:48 -0300
commit109de05cbb034b032cd60f50708716c8ff0afdf2 (patch)
treed851e8295a7df4f306650cf763948a8149bacb78 /config/c-compiler.m4
parent80c468b4a454881b56e1c73c6fedcb2978c5b415 (diff)
downloadpostgresql-109de05cbb034b032cd60f50708716c8ff0afdf2.tar.gz
Fix portability issues in pg_bitutils
We were using uint64 function arguments as "long int" arguments to compiler builtins, which fails on machines where long ints are 32 bits: the upper half of the uint64 was being ignored. Fix by using the "ll" builtin variants instead, which on those machines take 64 bit arguments. Also, remove configure tests for __builtin_popcountl() (as well as "long" variants for ctz and clz): the theory here is that any compiler version will provide all widths or none, so one test suffices. Were this theory to be wrong, we'd have to add tests for __builtin_popcountll() and friends, which would be tedious. Per failures in buildfarm member lapwing and ensuing discussion.
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r--config/c-compiler.m458
1 files changed, 0 insertions, 58 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 7cdcaee0b2..05fa82518f 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -400,28 +400,6 @@ undefine([Ac_cachevar])dnl
-# PGAC_C_BUILTIN_POPCOUNTL
-# -------------------------
-AC_DEFUN([PGAC_C_BUILTIN_POPCOUNTL],
-[define([Ac_cachevar], [AS_TR_SH([pgac_cv_popcountl])])dnl
-AC_CACHE_CHECK([for __builtin_popcountl], [Ac_cachevar],
-[pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -mpopcnt"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-[static int x = __builtin_popcountl(255);])],
-[Ac_cachevar=yes],
-[Ac_cachevar=no])
-CFLAGS="$pgac_save_CFLAGS"])
-if test x"$Ac_cachevar" = x"yes"; then
- CFLAGS_POPCNT="-mpopcnt"
-AC_DEFINE(HAVE__BUILTIN_POPCOUNTL, 1,
- [Define to 1 if your compiler understands __builtin_popcountl.])
-fi
-undefine([Ac_cachevar])dnl
-])# PGAC_C_BUILTIN_POPCOUNTL
-
-
-
# PGAC_C_BUILTIN_CTZ
# -------------------------
# Check if the C compiler understands __builtin_ctz(),
@@ -440,24 +418,6 @@ fi])# PGAC_C_BUILTIN_CTZ
-# PGAC_C_BUILTIN_CTZL
-# -------------------------
-# Check if the C compiler understands __builtin_ctzl(),
-# and define HAVE__BUILTIN_CTZL if so.
-AC_DEFUN([PGAC_C_BUILTIN_CTZL],
-[AC_CACHE_CHECK(for __builtin_ctzl, pgac_cv__builtin_ctzl,
-[AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-[static int x = __builtin_ctzl(256);]
-)],
-[pgac_cv__builtin_ctzl=yes],
-[pgac_cv__builtin_ctzl=no])])
-if test x"$pgac_cv__builtin_ctzl" = xyes ; then
-AC_DEFINE(HAVE__BUILTIN_CTZL, 1,
- [Define to 1 if your compiler understands __builtin_ctzl.])
-fi])# PGAC_C_BUILTIN_CTZL
-
-
-
# PGAC_C_BUILTIN_CLZ
# -------------------------
# Check if the C compiler understands __builtin_clz(),
@@ -476,24 +436,6 @@ fi])# PGAC_C_BUILTIN_CLZ
-# PGAC_C_BUILTIN_CLZL
-# -------------------------
-# Check if the C compiler understands __builtin_clzl(),
-# and define HAVE__BUILTIN_CLZL if so.
-AC_DEFUN([PGAC_C_BUILTIN_CLZL],
-[AC_CACHE_CHECK(for __builtin_clzl, pgac_cv__builtin_clzl,
-[AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-[static int x = __builtin_clzl(256);]
-)],
-[pgac_cv__builtin_clzl=yes],
-[pgac_cv__builtin_clzl=no])])
-if test x"$pgac_cv__builtin_clzl" = xyes ; then
-AC_DEFINE(HAVE__BUILTIN_CLZL, 1,
- [Define to 1 if your compiler understands __builtin_clzl.])
-fi])# PGAC_C_BUILTIN_CLZL
-
-
-
# PGAC_C_BUILTIN_UNREACHABLE
# --------------------------
# Check if the C compiler understands __builtin_unreachable(),