Skip to content

Commit

Permalink
*: use unsigned for bit-fields
Browse files Browse the repository at this point in the history
This should resolve Clang's warning

error: implicit truncation from 'int' to a one-bit wide bit-field
changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
  • Loading branch information
grobian committed Apr 27, 2024
1 parent 9a4321d commit 583aa4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions conffile.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ typedef struct _validate {
typedef struct _cluster {
char *name;
enum clusttype type;
char isdynamic:1;
unsigned char isdynamic:1;
union {
chashring *ch;
servers *forward;
Expand All @@ -95,7 +95,7 @@ typedef struct _route {
char *strmatch; /* string to search for if type not REGEX or MATCHALL */
destinations *dests; /* where matches should go */
char *masq; /* when set, what to feed to the hashfunc when routing */
char stop:1; /* whether to continue matching rules after this one */
unsigned char stop:1;/* whether to continue matching rules after this one */
enum {
MATCHALL, /* the '*', don't do anything, just match everything */
REGEX, /* a regex match */
Expand Down
8 changes: 4 additions & 4 deletions dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ typedef struct _connection {
char srcaddr[24]; /* string representation of source address */
char buf[METRIC_BUFSIZ];
int buflen;
char needmore:1;
char noexpire:1;
char isaggr:1;
char isudp:1;
unsigned char needmore:1;
unsigned char noexpire:1;
unsigned char isaggr:1;
unsigned char isudp:1;
char datawaiting; /* full byte for atomic access */
char metric[METRIC_BUFSIZ];
destination dests[CONN_DESTS_SIZE];
Expand Down
4 changes: 2 additions & 2 deletions server.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ struct _server {
char *instance;
struct addrinfo *saddr;
struct addrinfo *hint;
char reresolve:1;
int fd;
z_strm *strm;
queue *queue;
Expand All @@ -111,7 +110,8 @@ struct _server {
pthread_t tid;
struct _server **secondaries;
size_t secondariescnt;
char failover:1;
unsigned char reresolve:1;
unsigned char failover:1;
char failure; /* full byte for atomic access */
char running; /* full byte for atomic access */
char keep_running; /* full byte for atomic access */
Expand Down

0 comments on commit 583aa4e

Please sign in to comment.