From 19e2a37731a80d16a612c4263daa7f26b1584d54 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Tue, 21 Jun 2022 14:51:46 +0100 Subject: Include properly. Follow up on earlier commits (0c21cb2, 341acb8, f4840dc, 69f105d) and try to fix the last remaining issue. In pcap/bpf.h do not try to duplicate the contents of pcap-types.h, it was a bad idea of mine because in a public header HAVE_SYS_TYPES_H is out of place. Instead of that in pcap/bpf.h trust the including file to have unsiged integer types defined (usually by means of including either pcap/pcap.h or pcap-types.h). Include pcap-types.h not from gencode.c, but from gencode.h, so the latter can include pcap/bpf.h and itself can be included early. Add a comment. --- gencode.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gencode.h') diff --git a/gencode.h b/gencode.h index 9631dd02..93ca5216 100644 --- a/gencode.h +++ b/gencode.h @@ -23,6 +23,14 @@ #define gencode_h #include "pcap/funcattrs.h" +/* + * pcap/bpf.h (a public header) needs u_char, u_short and u_int, which can be + * made available via either pcap-types.h (a private header) or pcap/pcap.h + * (a public header), none of which pcap/bpf.h includes. Include the private + * header to keep things simple, this way this private header should compile + * even if included early from another file. + */ +#include "pcap-types.h" #include "pcap/bpf.h" /* bpf_u_int32 and BPF_MEMWORDS */ /* -- cgit v1.2.3