Remove configure's check for rl_completion_append_character.
authorTom Lane <[email protected]>
Thu, 3 Feb 2022 04:01:56 +0000 (23:01 -0500)
committerTom Lane <[email protected]>
Thu, 3 Feb 2022 04:01:56 +0000 (23:01 -0500)
The comment for PGAC_READLINE_VARIABLES says "Readline versions < 2.1
don't have rl_completion_append_character".  It seems certain that such
versions are extinct in the wild, though; for sure there are none in the
buildfarm.  Libedit has had this variable for at least twenty years too.
Also, tab-complete.c's behavior without it is quite unfriendly, since
we'll emit a space even when completion fails; but we've had no
complaints about that.

Therefore, let's assume this variable is always there, and drop the
configure check to save a few build cycles.

Discussion: https://postgr.es/m/147685.1643858911@sss.pgh.pa.us

config/programs.m4
configure
src/bin/psql/tab-complete.c
src/include/pg_config.h.in
src/tools/msvc/Solution.pm

index 6a118ece24eebfd8c00f849883f59b346440766e..e7908d87934102b16abf4dea79385a8dc87b6aaf 100644 (file)
@@ -211,29 +211,11 @@ fi
 
 # PGAC_READLINE_VARIABLES
 # -----------------------
-# Readline versions < 2.1 don't have rl_completion_append_character,
-# and some versions lack rl_completion_suppress_quote.
+# Some Readline versions lack rl_completion_suppress_quote.
 # Libedit lacks rl_filename_quote_characters and rl_filename_quoting_function
 
 AC_DEFUN([PGAC_READLINE_VARIABLES],
-[AC_CACHE_CHECK([for rl_completion_append_character], pgac_cv_var_rl_completion_append_character,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
-#if defined(HAVE_READLINE_READLINE_H)
-#include <readline/readline.h>
-#elif defined(HAVE_EDITLINE_READLINE_H)
-#include <editline/readline.h>
-#elif defined(HAVE_READLINE_H)
-#include <readline.h>
-#endif
-],
-[rl_completion_append_character = 'x';])],
-[pgac_cv_var_rl_completion_append_character=yes],
-[pgac_cv_var_rl_completion_append_character=no])])
-if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
-AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
-          [Define to 1 if you have the global variable 'rl_completion_append_character'.])
-fi
-AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
+[AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
 #if defined(HAVE_READLINE_READLINE_H)
 #include <readline/readline.h>
index 93a46a859b760df052d00fac656a34e9a08e8539..879f92202f31d2d838c0571a3c4331d0f3176639 100755 (executable)
--- a/configure
+++ b/configure
 LIBS="$LIBS_including_readline"
 
 if test "$with_readline" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_append_character" >&5
-$as_echo_n "checking for rl_completion_append_character... " >&6; }
-if ${pgac_cv_var_rl_completion_append_character+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-#if defined(HAVE_READLINE_READLINE_H)
-#include <readline/readline.h>
-#elif defined(HAVE_EDITLINE_READLINE_H)
-#include <editline/readline.h>
-#elif defined(HAVE_READLINE_H)
-#include <readline.h>
-#endif
-
-int
-main ()
-{
-rl_completion_append_character = 'x';
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  pgac_cv_var_rl_completion_append_character=yes
-else
-  pgac_cv_var_rl_completion_append_character=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_completion_append_character" >&5
-$as_echo "$pgac_cv_var_rl_completion_append_character" >&6; }
-if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
-
-$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
 $as_echo_n "checking for rl_completion_suppress_quote... " >&6; }
 if ${pgac_cv_var_rl_completion_suppress_quote+:} false; then :
   $as_echo_n "(cached) " >&6
index 0ee94d7362118516be885f743bce5bca3fea5876..d1e421bc0f1f8716531474d2fe2d6aa25cc55388 100644 (file)
@@ -1674,9 +1674,7 @@ psql_completion(const char *text, int start, int end)
    completion_last_char = (end > start) ? text[end - start - 1] : '\0';
 
    /* We usually want the append character to be a space. */
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
    rl_completion_append_character = ' ';
-#endif
 
    /* Clear a few things. */
    completion_charp = NULL;
@@ -4547,9 +4545,7 @@ psql_completion(const char *text, int start, int end)
    {
        COMPLETE_WITH_CONST(true, "");
        /* Also, prevent Readline from appending stuff to the non-match */
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
        rl_completion_append_character = '\0';
-#endif
 #ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
        rl_completion_suppress_quote = 1;
 #endif
@@ -5078,10 +5074,8 @@ _complete_from_query(const char *simple_query,
     * space afterwards.  Otherwise the schema will stop being part of the
     * completion subject text, which is not what we want.
     */
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
    if (num_schema_only > 0 && num_query_other == 0 && num_keywords == 0)
        rl_completion_append_character = '\0';
-#endif
 
    /* No more matches, so free the result structure and return null */
    PQclear(result);
@@ -5368,10 +5362,8 @@ complete_from_files(const char *text, int state)
 
            Assert(*retend == '\'');
            *retend = '/';
-           /* Try to prevent libedit from adding a space, too */
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
+           /* Prevent libedit from adding a space, too */
            rl_completion_append_character = '\0';
-#endif
        }
    }
 
index 9d9bd6b9efc54bbfca3c88836942b9cd3cc0c835..912efdbbd12e66d961834a68275577397ddf46c2 100644 (file)
 /* Define to 1 if you have the `readv' function. */
 #undef HAVE_READV
 
-/* Define to 1 if you have the global variable
-   'rl_completion_append_character'. */
-#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
-
 /* Define to 1 if you have the `rl_completion_matches' function. */
 #undef HAVE_RL_COMPLETION_MATCHES
 
index e47c2d648cb50cc5780af1c4b0cab0d420bd8c26..ed1c53000ff0c016b198557c9851c95d6d0e2848 100644 (file)
@@ -347,7 +347,6 @@ sub GenerateFiles
        HAVE_READLINE_READLINE_H    => undef,
        HAVE_READLINK               => undef,
        HAVE_READV                  => undef,
-       HAVE_RL_COMPLETION_APPEND_CHARACTER      => undef,
        HAVE_RL_COMPLETION_MATCHES               => undef,
        HAVE_RL_COMPLETION_SUPPRESS_QUOTE        => undef,
        HAVE_RL_FILENAME_COMPLETION_FUNCTION     => undef,