xref: /dflybsd-src/test/debug/chkincludes (revision 948bb6a23548088615acb8d979b7aa5398b73f72)
1bad1ff7bSMatthew Dillon#!/bin/csh
2bad1ff7bSMatthew Dillon#
3bad1ff7bSMatthew Dillon# check that all major header files can be #include'd
4bad1ff7bSMatthew Dillon# singly with various combinations of _KERNEL, _KERNEL_STRUCTURES, and
5bad1ff7bSMatthew Dillon# userland access.
6bad1ff7bSMatthew Dillon#
7bad1ff7bSMatthew Dillon# The goal is that the only error reported should be a specific #error
8bad1ff7bSMatthew Dillon# indicating that particular support is not available.
9bad1ff7bSMatthew Dillon
10bad1ff7bSMatthew Dilloncd /usr/src/sys
11bad1ff7bSMatthew Dillonset files = ( sys/*.h vm/*.h net*/*.h ddb/*.h i386/include/*.h )
12bad1ff7bSMatthew Dillonrm -rf /tmp/chkdir
13bad1ff7bSMatthew Dillonmkdir /tmp/chkdir
14bad1ff7bSMatthew Dilloncd /tmp/chkdir
15bad1ff7bSMatthew Dillon
16bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/kern/device_if.m
17bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/kern/bus_if.m
18bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/dev/netif/mii_layer/miibus_if.m
19bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/ppbus/ppbus_if.m
20bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pccard/card_if.m
21bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pccard/power_if.m
22bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/dev/agp/agp_if.m
23bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pci/pci_if.m
24bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/pci/pcib_if.m
25bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/usb/usb_if.m
26bad1ff7bSMatthew Dillonawk -f /usr/src/sys/tools/makeobjops.awk -- -h /usr/src/sys/bus/isa/isa_if.m
27bad1ff7bSMatthew Dillon
28bad1ff7bSMatthew Dillonecho -n > opt_cam.h
29bad1ff7bSMatthew Dillonecho -n > opt_scsi.h
30bad1ff7bSMatthew Dillonecho -n > opt_ktr.h
31bad1ff7bSMatthew Dillonecho -n > opt_icmp_bandlim.h
32bad1ff7bSMatthew Dillonecho "#define INET 1" > opt_inet.h
33bad1ff7bSMatthew Dillon
34*23e12d00SSascha Wildnerln -s /usr/src/sys/arch/i386/include machine
35bad1ff7bSMatthew Dillon
36bad1ff7bSMatthew Dillonforeach i ( $files )
37bad1ff7bSMatthew Dillon    if ( "$i" == "sys/sysunion.h" ) then
38bad1ff7bSMatthew Dillon	continue
39bad1ff7bSMatthew Dillon    endif
40bad1ff7bSMatthew Dillon
41bad1ff7bSMatthew Dillon    cat > chkincl.c << EOF
42bad1ff7bSMatthew Dillon#include <$i>
43bad1ff7bSMatthew DillonEOF
44bad1ff7bSMatthew Dillon    echo "TRY $i (_KERNEL)"
45bad1ff7bSMatthew Dillon    cc -D_KERNEL -DKLD_MODULE -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
46bad1ff7bSMatthew Dillonend
47bad1ff7bSMatthew Dillonforeach i ( $files )
48bad1ff7bSMatthew Dillon    if ( "$i" == "sys/sysunion.h" ) then
49bad1ff7bSMatthew Dillon	continue
50bad1ff7bSMatthew Dillon    endif
51bad1ff7bSMatthew Dillon
52bad1ff7bSMatthew Dillon    cat > chkincl.c << EOF
53bad1ff7bSMatthew Dillon#include <$i>
54bad1ff7bSMatthew DillonEOF
55bad1ff7bSMatthew Dillon    echo "TRY $i (_KERNEL_STRUCTURES)"
56bad1ff7bSMatthew Dillon    cc -D_KERNEL_STRUCTURES -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
57bad1ff7bSMatthew Dillonend
58bad1ff7bSMatthew Dillon
59bad1ff7bSMatthew Dillonforeach i ( $files )
60bad1ff7bSMatthew Dillon    if ( "$i" == "sys/sysunion.h" ) then
61bad1ff7bSMatthew Dillon	continue
62bad1ff7bSMatthew Dillon    endif
63bad1ff7bSMatthew Dillon
64bad1ff7bSMatthew Dillon    cat > chkincl.c << EOF
65bad1ff7bSMatthew Dillon#include <$i>
66bad1ff7bSMatthew DillonEOF
67bad1ff7bSMatthew Dillon    echo "TRY $i (USER)"
68bad1ff7bSMatthew Dillon    cc -fno-builtin -I/usr/src/sys -I. -Wall -Wstrict-prototypes -c chkincl.c -o chkincl.o
69bad1ff7bSMatthew Dillonend
70bad1ff7bSMatthew Dillon
71