From: Guy Harris Date: Wed, 21 Mar 2018 03:39:49 +0000 (-0700) Subject: Give the value of qualifiers a defined type. X-Git-Tag: libpcap-1.9-bp~200 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/9137b6ad14b2674c8737f01172679e37abbcbe99 Give the value of qualifiers a defined type. This should also squelch warnings. --- diff --git a/gencode.h b/gencode.h index 58828ecd..41dcdf60 100644 --- a/gencode.h +++ b/gencode.h @@ -55,6 +55,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* Type of a qualifier. */ +typedef unsigned char qualval; + /* Address qualifiers. */ #define Q_HOST 1 @@ -278,9 +281,9 @@ struct arth { }; struct qual { - unsigned char addr; - unsigned char proto; - unsigned char dir; + qualval addr; + qualval proto; + qualval dir; unsigned char pad; }; diff --git a/grammar.y b/grammar.y index 9af9ac86..be62de5f 100644 --- a/grammar.y +++ b/grammar.y @@ -90,9 +90,9 @@ DIAG_ON_BYACC #include "os-proto.h" #endif -#define QSET(q, p, d, a) (q).proto = (unsigned char)(p),\ - (q).dir = (unsigned char)(d),\ - (q).addr = (unsigned char)(a) +#define QSET(q, p, d, a) (q).proto = (p),\ + (q).dir = (d),\ + (q).addr = (a) struct tok { int v; /* value */ @@ -272,6 +272,7 @@ DIAG_OFF_BYACC %union { int i; + qualval q; bpf_u_int32 h; u_char *e; char *s; @@ -288,7 +289,7 @@ DIAG_OFF_BYACC %type expr id nid pid term rterm qid %type head -%type pqual dqual aqual ndaqual +%type pqual dqual aqual ndaqual %type arth narth %type byteop pname pnum relop irelop %type and or paren not null prog