kernel/ath: Limit check index variables before using them.
[dragonfly.git] / test / debug / chkincludes
blob923af055511abd736ebcda66fa1fc1e4634b33ea
1 #!/bin/csh
3 # check that all major header files can be #include'd
4 # singly with various combinations of _KERNEL, _KERNEL_STRUCTURES, and
5 # userland access.
7 # The goal is that the only error reported should be a specific #error
8 # indicating that particular support is not available.
10 cd /usr/src/sys
11 set files = ( sys/*.h vm/*.h net*/*.h ddb/*.h i386/include/*.h )
12 rm -rf /tmp/chkdir
13 mkdir /tmp/chkdir
14 cd /tmp/chkdir
16 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/kern/device_if.m
17 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/kern/bus_if.m
18 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/dev/netif/mii_layer/miibus_if.m
19 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/ppbus/ppbus_if.m
20 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pccard/card_if.m
21 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pccard/power_if.m
22 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/dev/agp/agp_if.m
23 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pci/pci_if.m
24 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pci/pcib_if.m
25 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/usb/usb_if.m
26 awk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/isa/isa_if.m
28 echo -n > opt_cam.h
29 echo -n > opt_scsi.h
30 echo -n > opt_ktr.h
31 echo -n > opt_icmp_bandlim.h
32 echo "#define INET 1" > opt_inet.h
34 ln -s /usr/src/sys/arch/i386/include machine
36 foreach i ( $files )
37 if ( "$i" == "sys/sysunion.h" ) then
38 continue
39 endif
41 cat > chkincl.c << EOF
42 #include <$i>
43 EOF
44 echo "TRY $i (_KERNEL)"
45 cc -D_KERNEL -DKLD_MODULE -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
46 end
47 foreach i ( $files )
48 if ( "$i" == "sys/sysunion.h" ) then
49 continue
50 endif
52 cat > chkincl.c << EOF
53 #include <$i>
54 EOF
55 echo "TRY $i (_KERNEL_STRUCTURES)"
56 cc -D_KERNEL_STRUCTURES -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
57 end
59 foreach i ( $files )
60 if ( "$i" == "sys/sysunion.h" ) then
61 continue
62 endif
64 cat > chkincl.c << EOF
65 #include <$i>
66 EOF
67 echo "TRY $i (USER)"
68 cc -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
69 end