=====================================================================
The version number and release status of Readline (e.g., 4.2-release)
8.2-release
========================================
The machine and OS that it is running on
macOS Ventura 13.4
=============================================================================
A list of the compilation flags or the contents of `config.h', if appropriate
========================
a description of the bug
clang-14 (and later) warns on rl_message().
$ cat rl_message_warn.c
#include <stdio.h>
#include "readline/readline.h"
void test() {
rl_message("hello");
}
$ cc -c -I$HOME/opt/include rl_message_warn.c
rl_message_warn.c:4:15: warning: passing arguments to 'rl_message' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
rl_message("hello");
^
1 warning generated.
$ cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
...
I found the following links about this warning.
https://reviews.llvm.org/D122895https://www.redhat.com/ja/blog/new-warnings-and-errors-clang-15rl_message() is declared as follows in readline.h.
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
USE_VARARGS and PREFER_STDARG are defined as follows in rlstdc.h.
/* Moved from
config.h.in because readline.h:rl_message depends on these
defines. */
#if defined (__STDC__) && defined (HAVE_STDARG_H)
# define PREFER_STDARG
# define USE_VARARGS
#else
# if defined (HAVE_VARARGS_H)
# define PREFER_VARARGS
# define USE_VARARGS
# endif
#endif
When readline.h is used as a standalone library, HAVE_STDARG_H nor HAVE_VARARGS_H are not defined.
As result rl_message() is declared as:
extern int rl_message ();
On C2x this will be equivalent with:
extern int rl_message (void);
Due to this the recent clang warns on:
rl_message("hello");
========================================
a recipe for recreating the bug reliably
See above.
==================================
a fix for the bug if you have one!
The declaration in readline could be:
#if (defined (HAVE_CONFIG_H) \
&& ((defined (__STDC__) && defined (HAVE_STDARG_H)) || defined (HAVE_VARARGS_H))) \
|| (!defined (HAVE_CONFIG_H) && defined (__STDC__))
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
Or simply:
#if defined (__STDC__)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
-- Hiroo Hayashi