From 95da5e131a0a9e48f0a063e3ff75000434cc5c52 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Mon, 1 Mar 2021 15:58:34 +0100 Subject: [PATCH] dialog: fix macro redefinition dialog.h defines MIN and MAX (making sure to undefine the previous macros if it already exists), but sys/param.h also defines those macros (without guards) and is included after dialog.h resulting in both gcc and clang complaining about macro redefiniton While clang do accept -Wno-macro-redefined to ignore the redefinition warning, gcc does not [1] Undefine both macros prior inclusion of sys/param.h to avoid the warning Reported by: arichardson --- contrib/dialog/util.c | 2 ++ gnu/lib/libdialog/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/dialog/util.c b/contrib/dialog/util.c index 992be3f433f5..726a36a5031d 100644 --- a/contrib/dialog/util.c +++ b/contrib/dialog/util.c @@ -39,6 +39,8 @@ #endif #ifdef HAVE_SYS_PARAM_H +#undef MIN +#undef MAX #include #endif diff --git a/gnu/lib/libdialog/Makefile b/gnu/lib/libdialog/Makefile index 8c6b84b64f90..b97e4df9373a 100644 --- a/gnu/lib/libdialog/Makefile +++ b/gnu/lib/libdialog/Makefile @@ -15,7 +15,7 @@ MAN= dialog.3 LIBADD= ncursesw m -CFLAGS+= -I${.CURDIR} -I${DIALOG} -D_XOPEN_SOURCE_EXTENDED -Wno-macro-redefined +CFLAGS+= -I${.CURDIR} -I${DIALOG} -D_XOPEN_SOURCE_EXTENDED .PATH: ${DIALOG} WARNS?= 1