git: 95da5e131a0a - main - dialog: fix macro redefinition

Baptiste Daroussin bapt at FreeBSD.org
Mon Mar 1 15:01:54 UTC 2021


The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=95da5e131a0a9e48f0a063e3ff75000434cc5c52

commit 95da5e131a0a9e48f0a063e3ff75000434cc5c52
Author:     Baptiste Daroussin <bapt at FreeBSD.org>
AuthorDate: 2021-03-01 14:58:34 +0000
Commit:     Baptiste Daroussin <bapt at FreeBSD.org>
CommitDate: 2021-03-01 15:01:44 +0000

    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 <sys/param.h>
 #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
 


More information about the dev-commits-src-all mailing list