[libvirt] [PATCH] virsh: ignore readline -Wstrict-prototypes warning

When building with clang 4.0.0, virsh build fails like this: gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools' CC virsh-virsh.o In file included from virsh.c:45: In file included from /usr/local/include/readline/readline.h:31: /usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef int Function () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef void VFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char *CPFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char **CPPFunction () __attribute__ ((deprecated)); ^ void In file included from virsh.c:45: /usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int rl_message (); ^ void 5 errors generated. gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1 Fix that by adding VIR_WARNINGS_NO_STRICT_PROTOTYPES macro that uses "GCC diagnostic push" to ignore -Wstrict-prototypes and wrapping readline includes with it and VIR_WARNINGS_RESET. Bug report on the readline mailing list: http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html --- src/internal.h | 4 ++++ tools/virsh.c | 2 ++ tools/virt-admin.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/internal.h b/src/internal.h index 03a973ccd..57b6da7ff 100644 --- a/src/internal.h +++ b/src/internal.h @@ -266,6 +266,10 @@ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +# define VIR_WARNINGS_NO_STRICT_PROTOTYPES \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wstrict-prototypes\"") + # if HAVE_SUGGEST_ATTRIBUTE_FORMAT # define VIR_WARNINGS_NO_PRINTF \ _Pragma ("GCC diagnostic push") \ diff --git a/tools/virsh.c b/tools/virsh.c index 1f5c2b11c..1a28a2620 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -41,8 +41,10 @@ #include <signal.h> #if WITH_READLINE +VIR_WARNINGS_NO_STRICT_PROTOTYPES # include <readline/readline.h> # include <readline/history.h> +VIR_WARNINGS_RESET #endif #include "internal.h" diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 0fa1c000c..7ad4c29e1 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -27,8 +27,10 @@ #include <getopt.h> #if WITH_READLINE +VIR_WARNINGS_NO_STRICT_PROTOTYPES # include <readline/readline.h> # include <readline/history.h> +VIR_WARNINGS_RESET #endif #include "internal.h" -- 2.13.0

Roman Bogorodskiy wrote:
When building with clang 4.0.0, virsh build fails like this:
gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools' CC virsh-virsh.o In file included from virsh.c:45: In file included from /usr/local/include/readline/readline.h:31: /usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef int Function () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef void VFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char *CPFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char **CPPFunction () __attribute__ ((deprecated)); ^ void In file included from virsh.c:45: /usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int rl_message (); ^ void 5 errors generated. gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1
Fix that by adding VIR_WARNINGS_NO_STRICT_PROTOTYPES macro that uses "GCC diagnostic push" to ignore -Wstrict-prototypes and wrapping readline includes with it and VIR_WARNINGS_RESET.
Bug report on the readline mailing list:
http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html --- src/internal.h | 4 ++++ tools/virsh.c | 2 ++ tools/virt-admin.c | 2 ++ 3 files changed, 8 insertions(+)
ping? Roman Bogorodskiy

On Fri, May 26, 2017 at 09:49:15PM +0400, Roman Bogorodskiy wrote:
When building with clang 4.0.0, virsh build fails like this:
gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools' CC virsh-virsh.o In file included from virsh.c:45: In file included from /usr/local/include/readline/readline.h:31: /usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef int Function () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef void VFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char *CPFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char **CPPFunction () __attribute__ ((deprecated)); ^ void In file included from virsh.c:45: /usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int rl_message (); ^ void 5 errors generated. gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1
Fix that by adding VIR_WARNINGS_NO_STRICT_PROTOTYPES macro that uses "GCC diagnostic push" to ignore -Wstrict-prototypes and wrapping readline includes with it and VIR_WARNINGS_RESET.
Bug report on the readline mailing list:
http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html --- src/internal.h | 4 ++++ tools/virsh.c | 2 ++ tools/virt-admin.c | 2 ++ 3 files changed, 8 insertions(+)
ACK Jan

Ján Tomko wrote:
On Fri, May 26, 2017 at 09:49:15PM +0400, Roman Bogorodskiy wrote:
When building with clang 4.0.0, virsh build fails like this:
gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools' CC virsh-virsh.o In file included from virsh.c:45: In file included from /usr/local/include/readline/readline.h:31: /usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef int Function () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef void VFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char *CPFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char **CPPFunction () __attribute__ ((deprecated)); ^ void In file included from virsh.c:45: /usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int rl_message (); ^ void 5 errors generated. gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1
Fix that by adding VIR_WARNINGS_NO_STRICT_PROTOTYPES macro that uses "GCC diagnostic push" to ignore -Wstrict-prototypes and wrapping readline includes with it and VIR_WARNINGS_RESET.
Bug report on the readline mailing list:
http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html --- src/internal.h | 4 ++++ tools/virsh.c | 2 ++ tools/virt-admin.c | 2 ++ 3 files changed, 8 insertions(+)
ACK
Jan
Thanks! I decided not to push it before release, it's not critical anyway. In the meantime, upstream says that this is not going to be changed and suggests trying -D_FUNCTION_DEF to avoid this. I'll try the CFLAGS-based solution and if this works, I'll submit v2 (as this appears to be more clear and compact fix), otherwise will push this one. Roman Bogorodskiy

Roman Bogorodskiy wrote:
Ján Tomko wrote:
On Fri, May 26, 2017 at 09:49:15PM +0400, Roman Bogorodskiy wrote:
When building with clang 4.0.0, virsh build fails like this:
gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools' CC virsh-virsh.o In file included from virsh.c:45: In file included from /usr/local/include/readline/readline.h:31: /usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef int Function () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef void VFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char *CPFunction () __attribute__ ((deprecated)); ^ void /usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] typedef char **CPPFunction () __attribute__ ((deprecated)); ^ void In file included from virsh.c:45: /usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int rl_message (); ^ void 5 errors generated. gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1
Fix that by adding VIR_WARNINGS_NO_STRICT_PROTOTYPES macro that uses "GCC diagnostic push" to ignore -Wstrict-prototypes and wrapping readline includes with it and VIR_WARNINGS_RESET.
Bug report on the readline mailing list:
http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html --- src/internal.h | 4 ++++ tools/virsh.c | 2 ++ tools/virt-admin.c | 2 ++ 3 files changed, 8 insertions(+)
ACK
Jan
Thanks! I decided not to push it before release, it's not critical anyway.
In the meantime, upstream says that this is not going to be changed and suggests trying -D_FUNCTION_DEF to avoid this. I'll try the CFLAGS-based solution and if this works, I'll submit v2 (as this appears to be more clear and compact fix), otherwise will push this one.
Here goes v2 with a fix I like better: https://www.redhat.com/archives/libvir-list/2017-June/msg00105.html Roman Bogorodskiy
participants (2)
-
Ján Tomko
-
Roman Bogorodskiy