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
This commit is contained in:
Baptiste Daroussin 2021-03-01 15:58:34 +01:00
parent a5f9fe2bab
commit 95da5e131a
2 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,8 @@
#endif
#ifdef HAVE_SYS_PARAM_H
#undef MIN
#undef MAX
#include <sys/param.h>
#endif

View File

@ -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