Add AC_PROG_CC_C99 in configure.ac file and fix build error introduced by commit...
authorBo Peng <pengbo@sraoss.co.jp>
Wed, 9 Sep 2020 11:43:07 +0000 (20:43 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Wed, 9 Sep 2020 11:43:07 +0000 (20:43 +0900)
configure
configure.ac
src/context/pool_session_context.c

index 37fef4270c33fb934c716297a6ae426c61fda028..b6c150c4cb9d17801d3e76ba26e8bb138b65471a 100755 (executable)
--- a/configure
+++ b/configure
@@ -3355,11 +3355,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-   case $ac_cv_prog_cc_stdc in #(
-  no) :
-    ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
-  *) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
 if ${ac_cv_prog_cc_c99+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -3532,121 +3528,16 @@ $as_echo "unsupported" >&6; } ;;
 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
 esac
 if test "x$ac_cv_prog_cc_c99" != xno; then :
-  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
 
 fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
-else
-  ac_cv_prog_cc_stdc=no
-fi
 
-fi
- ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
-$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
-  if ${ac_cv_prog_cc_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
 
-  case $ac_cv_prog_cc_stdc in #(
-  no) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;; #(
-  '') :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;; #(
-  *) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
-$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
-esac
 
+# Error out if the compiler does not support C99, as the codebase
+# relies on that.
+if test "$ac_cv_prog_cc_c99" = no; then
+    as_fn_error $? "C compiler \"$CC\" does not support C99" "$LINENO" 5
+fi
 
 am__api_version='1.13'
 
index a632dc7af9c4492a1e844bcb4d56ef4c8cfac093..2777706955546bb86371f0877c4797f977273372 100644 (file)
@@ -2,7 +2,14 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT([pgpool-II], [4.2devel], [pgpool-hackers@pgpool.net], [pgpool-II])
 
 dnl Checks for programs.
-AC_PROG_CC_STDC
+AC_PROG_CC
+AC_PROG_CC_C99()
+
+# Error out if the compiler does not support C99, as the codebase
+# relies on that.
+if test "$ac_cv_prog_cc_c99" = no; then
+    AC_MSG_ERROR([C compiler "$CC" does not support C99])
+fi
 
 AM_INIT_AUTOMAKE([foreign no-dependencies subdir-objects])
 
index 23a48111e6e38ac2d3a3c64607d0bfcb2d6236ac..b4d4b1f2ef49054940c3be2386a7786c937c33b4 100644 (file)
@@ -1081,9 +1081,6 @@ can_query_context_destroy(POOL_QUERY_CONTEXT * qc)
                {
                        count++;
                }
-               if (!session_context->pending_messages)
-                       return;
-
                next = lnext(session_context->pending_messages, cell);
        }
 
@@ -1419,9 +1416,6 @@ pool_pending_message_get(POOL_MESSAGE_TYPE type)
        {
                POOL_PENDING_MESSAGE *m = (POOL_PENDING_MESSAGE *) lfirst(cell);
 
-               if (!session_context->pending_messages)
-                       return;
-
                next = lnext(session_context->pending_messages, cell);
 
                if (m->type == type)
@@ -1711,9 +1705,6 @@ pool_pending_message_get_message_num_by_backend_id(int backend_id)
                        }
                }
 
-               if (!session_context->pending_messages)
-                       return;
-
                next = lnext(session_context->pending_messages, cell);
        }
        return cnt;
@@ -1747,9 +1738,6 @@ dump_pending_message(void)
                                                message->type, message->contents_len, message->query, message->statement, message->portal,
                                                message->node_ids[0], message->node_ids[1])));
 
-               if (!session_context->pending_messages)
-                       return;
-
                next = lnext(session_context->pending_messages, cell);
        }