NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/58582: [PATCH] Do not rely on outside inclusion in rasops.h and wsdisplay_vconsvar.h



>Number:         58582
>Category:       kern
>Synopsis:       Do not rely on outside inclusion in rasops.h and wsdisplay_vconsvar.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 11 14:20:00 +0000 2024
>Originator:     gorg%gorgnet.net@localhost
>Release:        NetBSD 10.0
>Organization:
>Environment:
System: NetBSD 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
In their current forms, rasops.h and wsdisplay_vconsvar.h require the inclusion
of either wsdisplayvar.h or wsdisplayvar.h and rasops.h, respectively, by the
source file that includes them. This is because they use symbols from these
other header files without including such header files themselves, contrary to
the NetBSD source code style guide:

http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=1.77&content-type=text/x-cvsweb-markup

   155	 * If a header file requires structures, defines, typedefs, etc. from
   156	 * another header file it should include that header file and not depend
   157	 * on the including file for that header including both.  If there are

These nonconformities require wsdisplay drivers to adhere to a certain relative
order of inclusion of these headers in order to compile, going against another
rule in the style guide pertaining to the order of includes. While this does
not seem like a very large problem to me, I hope it makes sense to submit this
PR as fixing nonconformant code.

I apologize if I missed or have misunderstood anything.

>How-To-Repeat:

>Fix:
If it is desirable for me to also correct the inclusion order within wsdisplay
drivers in this patch, please let me know and I will add changes to them.

Index: sys/dev/rasops/rasops.h
===================================================================
RCS file: /cvsroot/src/sys/dev/rasops/rasops.h,v
retrieving revision 1.50
diff -u -r1.50 rasops.h
--- sys/dev/rasops/rasops.h	24 Dec 2021 18:12:58 -0000	1.50
+++ sys/dev/rasops/rasops.h	10 Aug 2024 23:06:54 -0000
@@ -35,6 +35,7 @@
 #include <sys/param.h>
 
 #include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
 #include <dev/wsfont/wsfont.h>
 
 /* For rasops_info::ri_flg */
Index: sys/dev/wscons/wsdisplay_vconsvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay_vconsvar.h,v
retrieving revision 1.34
diff -u -r1.34 wsdisplay_vconsvar.h
--- sys/dev/wscons/wsdisplay_vconsvar.h	14 Feb 2023 08:22:02 -0000	1.34
+++ sys/dev/wscons/wsdisplay_vconsvar.h	10 Aug 2024 23:06:54 -0000
@@ -36,6 +36,9 @@
 
 #include <sys/atomic.h>
 
+#include <dev/rasops/rasops.h>
+#include <dev/wscons/wsdisplayvar.h>
+
 struct vcons_data;
 
 struct vcons_screen {
Index: share/man/man9/rasops.9
===================================================================
RCS file: /cvsroot/src/share/man/man9/rasops.9,v
retrieving revision 1.19
diff -u -r1.19 rasops.9
--- share/man/man9/rasops.9	8 Aug 2019 00:20:54 -0000	1.19
+++ share/man/man9/rasops.9	10 Aug 2024 23:06:54 -0000
@@ -36,7 +36,6 @@
 .Nm rasops_reconfig
 .Nd raster display operations
 .Sh SYNOPSIS
-.In dev/wscons/wsdisplayvar.h
 .In dev/rasops/rasops.h
 .Ft int
 .Fn rasops_init "struct rasops_info *ri" "int wantrows" "int wantcols"



Home | Main Index | Thread Index | Old Index