Skip to content

Commit

Permalink
dialog: fix macro redefinition
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bapt committed Mar 1, 2021
1 parent a5f9fe2 commit 95da5e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions contrib/dialog/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#endif

#ifdef HAVE_SYS_PARAM_H
#undef MIN
#undef MAX
#include <sys/param.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion gnu/lib/libdialog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 95da5e1

Please sign in to comment.