[m-rev.] diff: update handling of readline

Julien Fischer jfischer at opturion.com
Wed Jun 6 03:06:20 AEST 2018


Update handling of readline.

trace/Mmakefile:
trace/mercury_trace_readline.c:
     Do not disable C compiler warnings when compiling this file.
     This was previously done in order to avoid warnings from ancient
     versions of the readline headers.

trace/mercury_trace_completion.c:
     Add a missing const qualifier to a declaration.

Julien.

diff --git a/trace/Mmakefile b/trace/Mmakefile
index 8eb07bf..44b9540 100644
--- a/trace/Mmakefile
+++ b/trace/Mmakefile
@@ -177,13 +177,6 @@ MGNUCFLAGS	+= --c-debug --no-ansi

  #-----------------------------------------------------------------------------#

-# mercury_readline.c #includes the GNU readline headers, which
-# lack prototypes and `const', so we need to disable warnings
-# when compiling that file.
-MGNUCFLAGS-mercury_trace_readline = --no-check
-
-#-----------------------------------------------------------------------------#
-
  # Stuff for Windows DLLs

  ifeq ($(USE_DLLS),yes)
diff --git a/trace/mercury_trace_completion.c b/trace/mercury_trace_completion.c
index 176203e..d371e96 100644
--- a/trace/mercury_trace_completion.c
+++ b/trace/mercury_trace_completion.c
@@ -1,6 +1,7 @@
  // vim: ts=4 sw=4 expandtab ft=c

  // Copyright (C) 2002, 2005-2006 The University of Melbourne.
+// Copyright (C) 2014-2016, 2018 The Mercury team.
  // This file may only be copied under the terms of the GNU Library General
  // Public License - see the file COPYING.LIB in the Mercury distribution.

@@ -28,7 +29,7 @@
    #else
      extern char     *rl_line_buffer;
      extern int      rl_point;
-    extern char     *filename_completion_function(char *word, int state);
+    extern char     *filename_completion_function(const char *word, int state);
    #endif
  #endif

diff --git a/trace/mercury_trace_readline.c b/trace/mercury_trace_readline.c
index 020e42f..e7c3a78 100644
--- a/trace/mercury_trace_readline.c
+++ b/trace/mercury_trace_readline.c
@@ -1,14 +1,12 @@
  // vim: ts=4 sw=4 expandtab ft=c

  // Copyright (C) 1998-2002, 2005-2007 The University of Melbourne.
+// Copyright (C) 2014-2016, 2018 The Mercury team.
  // This file may only be copied under the terms of the GNU Library General
  // Public License - see the file COPYING.LIB in the Mercury distribution.

  // A simple interface to read a line, normally done using GNU readline.
  //
-// This module is compiled with warnings disabled (mgnuc --no-check),
-// since the GNU readline headers don't use prototypes, const, etc.
-//
  // Main authors: fjh, zs.

  #include "mercury_imp.h"
@@ -22,7 +20,7 @@

  #ifndef MR_NO_USE_READLINE
    #ifdef MR_HAVE_READLINE_READLINE_H
-    #include "readline/readline.h"
+    #include <readline/readline.h>
    #else
      extern FILE         *rl_instream;
      extern FILE         *rl_outstream;
@@ -32,7 +30,7 @@
      extern void         (*rl_deprep_term_function)(void);
    #endif
    #ifdef MR_HAVE_READLINE_HISTORY_H
-    #include "readline/history.h"
+    #include <readline/history.h>
    #endif
    #ifdef MR_HAVE_UNISTD_H
       #include <unistd.h>    // for isatty()


More information about the reviews mailing list