Subject: port-i386/1927: 386 kernel fails to build with options DEBUG
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@arhpc214.uni-c.dk>
List: netbsd-bugs
Date: 01/11/1996 16:55:23
>Number:         1927
>Category:       port-i386
>Synopsis:       386 kernel fails to build with options DEBUG in configuration file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 11 10:05:01 1996
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
UNI-C
>Release:        NetBSD-current 10-jan-1996
>Environment:
	
System: NetBSD arhpc214.uni-c.dk 1.1A NetBSD 1.1A (EBE) #6: Tue Dec 19 12:32:29 MET 1995 erik@arhpc214.uni-c.dk:/usr/sup/netbsd/src/sys/arch/i386/compile/EBE i386


>Description:
Kernel build fails with following compiler error message:

ERIC -D_KERNEL -Di386  ../../../../dev/isa/wt.c
../../../../dev/isa/wt.c:74: warning: `DEBUG' redefined
*Initialization*:1: warning: this is the location of the previous definition
*** Error code 1

The reason for this is that the C standard requires a diagnostic if a macro is defined
several times, but not with the exactly same replacement text. After the addition
of -Werror to the compiler call, this now causes the bove error message.

In fact in this file, DEBUG is defined and used as a macro
with parameters and not just as a flag to in/exclude debug
code.
Suggested fix: rename the DEBUG macro in wt.c to e.g. DEBUGPRINT.
>How-To-Repeat:
	Configure a kernel with "option DEBUG" in the kernel configuration file
	and try to compile it. Or just use the BOATANCHOR configuration file.
>Fix:
Most other kernel files uses DEBUG as a flag (if atall used). wt.c is different as it
uses DEBUG as an internal macro with a parameter and expands it in a lot of places.
Suggested Fix: rename DEBUG to e.g. DODEBUG in this source file.
>Audit-Trail:
>Unformatted: