From bc18126a6bcb85b51dc082c3ef4417dc016ebd9c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 20 Mar 2017 13:35:21 -0400 Subject: 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 --- config/c-compiler.m4 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'config/c-compiler.m4') diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 7d901e1f1aa..3321f226f3e 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, -- cgit v1.2.3