summaryrefslogtreecommitdiff
path: root/config/c-compiler.m4
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-03-20 13:35:21 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-03-20 13:35:26 -0400
commitbc18126a6bcb85b51dc082c3ef4417dc016ebd9c (patch)
tree9e6de7632a69ac8ee7980dcb537b49cf1692524b /config/c-compiler.m4
parent14a72525d2cf88a024ade4c10944c7abb900dda9 (diff)
downloadpostgresql-bc18126a6bcb85b51dc082c3ef4417dc016ebd9c.tar.gz
Add configure test to see if the C compiler has gcc-style computed gotos.
We'll need this for the upcoming patch to speed up expression evaluation. Might as well push it now to see if it behaves sanely in the buildfarm. Andres Freund Discussion: https://postgr.es/m/20170320062511.hp5qeurtxrwsvfxr@alap3.anarazel.de
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r--config/c-compiler.m424
1 files changed, 24 insertions, 0 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 7d901e1f1a..3321f226f3 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -273,6 +273,30 @@ fi])# PGAC_C_BUILTIN_UNREACHABLE
+# PGAC_C_COMPUTED_GOTO
+# -----------------------
+# Check if the C compiler knows computed gotos (gcc extension, also
+# available in at least clang). If so, define HAVE_COMPUTED_GOTO.
+#
+# Checking whether computed gotos are supported syntax-wise ought to
+# be enough, as the syntax is otherwise illegal.
+AC_DEFUN([PGAC_C_COMPUTED_GOTO],
+[AC_CACHE_CHECK(for computed goto support, pgac_cv_computed_goto,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+[[void *labeladdrs[] = {&&my_label};
+ goto *labeladdrs[0];
+ my_label:
+ return 1;
+]])],
+[pgac_cv_computed_goto=yes],
+[pgac_cv_computed_goto=no])])
+if test x"$pgac_cv_computed_goto" = xyes ; then
+AC_DEFINE(HAVE_COMPUTED_GOTO, 1,
+ [Define to 1 if your compiler handles computed gotos.])
+fi])# PGAC_C_COMPUTED_GOTO
+
+
+
# PGAC_C_VA_ARGS
# --------------
# Check if the C compiler understands C99-style variadic macros,