I am very unhappy to see use of #undef

It doesn't feel like the right approach.


Karel Gardas <gard...@gmail.com> wrote:

> 
> 
> Hello,
> 
> following small patch fixes compilation failure when SR_DEBUG is defined in 
> softraidvar.h which results in definition of DPRINTF which results in error 
> about already defined macro in machdep.c
> 
> Index: arch/amd64/amd64/machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v
> retrieving revision 1.248
> diff -u -p -u -r1.248 machdep.c
> --- arch/amd64/amd64/machdep.c        12 Jul 2018 14:11:11 -0000      1.248
> +++ arch/amd64/amd64/machdep.c        18 Jul 2018 22:52:40 -0000
> @@ -142,9 +142,11 @@ extern int db_console;
>  #endif
>  
>  /* #define MACHDEP_DEBUG */
> -
>  #ifdef MACHDEP_DEBUG
> -#define DPRINTF(x...)        do { printf(x); } while(0)
> +#ifdef DPRINTF
> +#undef DPRINTF
> +#endif
> +##define DPRINTF(x...)       do { printf(x); } while(0)
>  #else
>  #define DPRINTF(x...)
>  #endif /* MACHDEP_DEBUG */
> 
> 

Reply via email to