Subject: port-m68k/3653: Reduce redundant includes of frame.h.
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@sockdev.uni-c.dk>
List: netbsd-bugs
Date: 05/19/1997 22:51:36
>Number:         3653
>Category:       port-m68k
>Synopsis:       Reduce redundant includes of frame.h.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 19 13:50:00 1997
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	<organization of PR author (multiple lines)>
>Release:        NetBSD-current 19 May 1997
>Environment:
	<machine, os, target, libraries (multiple lines)>
System: NetBSD q610.ebe.dk 1.2E NetBSD 1.2E (Q610) #47: Sat May 17 04:05:44 MEST 1997 erik@q610.ebe.dk:/home/src/sys/arch/mac68k/compile/Q610 mac68k


>Description:
	Recently a change was made to m68k/include/frame.h just to be
	removed a couple of days later.

	Watching the kernel compilation, I wondered why so many kernel
	source files were recompiled just because of changes to this header.

	I decided to investigate a little, and I tried to reduce the
	set of files that included this header -- in particular other
	headers including frame.h.

	The following patch will remove some of the unnecessary includes
	of frame.h. In particular the removals of frame.h from db_machdep.h
	and from pcb.h helps reduce the total amount of source files
	depending on this header.

	The only file outside of arch/{m68k,mac68k} being patched
	is ddb/db_print.c. Here frame.h must be included explicitly
	if db_machdep.h does not do it.

	Also several .c files in arch/mac68k included frame.h without
	needing it. All in all the number of occurrences of frame.h in 
	mac68/compile/GENERIC/.depend was reduced from 168 to 144. That
	this number has not been reduced further is probably caused by
	pcb.h to be included by "everyone".

	One of the files patched below (mac68k/mac68k/macrom.h) is changed
	to replace the inclusion of frame.h with an incomplete struct
	declaration of struct frame. If this is not an acceptable coding
	practice, this part of the patch can easily be omitted.

	regards
	Erik Bertelsen
>How-To-Repeat:
>Fix:
Index: sys/arch/m68k/include/db_machdep.h
===================================================================
RCS file: /home/cvs-base/src/sys/arch/m68k/include/db_machdep.h,v
retrieving revision 1.1.1.6
diff -c -r1.1.1.6 db_machdep.h
*** db_machdep.h	1997/02/19 17:46:25	1.1.1.6
--- db_machdep.h	1997/05/18 19:09:25
***************
*** 40,46 ****
   */
  #include <vm/vm_param.h>
  
- #include <machine/frame.h>
  #include <machine/psl.h>
  #include <machine/trap.h>
  
--- 40,45 ----
Index: sys/arch/m68k/m68k/db_trace.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/m68k/m68k/db_trace.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 db_trace.c
*** db_trace.c	1997/02/08 10:35:00	1.1.1.4
--- db_trace.c	1997/05/18 19:16:06
***************
*** 31,36 ****
--- 31,37 ----
  #include <sys/systm.h>
  
  #include <machine/db_machdep.h>
+ #include <machine/frame.h>
  
  #include <ddb/db_interface.h>
  #
>Audit-Trail:
>Unformatted: