Subject: kern/6161: compile errors in sys/dev/audio.c with NAUDIO==0 and NMIDI>0
To: None <gnats-bugs@gnats.netbsd.org>
From: None <apb@iafrica.com>
List: netbsd-bugs
Date: 09/15/1998 15:47:24
>Number:         6161
>Category:       kern
>Synopsis:       compile errors in sys/dev/audio.c with NAUDIO==0 and NMIDI>0
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 15 09:05:01 1998
>Last-Modified:
>Originator:     Alan Barrett
>Organization:
not much
>Release:        NetBSD-current 1998-09-09
>Environment:
	Observed on NetBSD/i386 -current, but appears to be MI.

>Description:
        If you try to build a kernel with midi devices but no audio
        devices, then compilation of sys/dev/audio.c fails with
        complaints about the AUDIODEV_TYPE_* symbols being undefined.

>How-To-Repeat:
	Try to build a kernel from a config file that includes

		midi* at pcppi?

	but no audio* devices.  Watch it fail.
	
>Fix:
	Need to include <dev/audio_if.h> if (NAUDIO > 0 || NMIDI > 0).
Might as well include the whole slew of include files to reduce ifdef
proliferation.

--- src/sys/dev/audio.c	Tue Sep  1 11:10:04 1998
+++ src/sys/dev/audio.c	Tue Sep 15 09:35:33 1998
@@ -61,7 +61,9 @@
  */
 
 #include "audio.h"
-#if NAUDIO > 0
+#include "midi.h"
+
+#if NAUDIO > 0 || NMIDI > 0
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -87,6 +89,8 @@
 
 #include <machine/endian.h>
 
+#if NAUDIO > 0
+
 #ifdef AUDIO_DEBUG
 #define DPRINTF(x)	if (audiodebug) printf x
 #define DPRINTFN(n,x)	if (audiodebug>(n)) printf x
@@ -2792,9 +2796,6 @@
 }
 #endif /* NAUDIO > 0 */
 
-#include "midi.h"
-
-#if NAUDIO > 0 || NMIDI > 0
 int
 audioprint(aux, pnp)
 	void *aux;

>Audit-Trail:
>Unformatted: