[pfx-dev] Re: NIT: compile warning for implicit truncation
On Sun, Mar 19, 2023 at 11:39:13AM -0400, Wietse Venema via Postfix-devel wrote: > And all this is because C did not have a proper boolean type. I'll > change this but do ot expected any effort to shut up warnings that > result from compiler settings. No such effort is expected. I just thought this one might be worth doing. The code base is amazing actually, especially considering its age and its organic growth which basically is a sign for the care and thinking that went into it throughout the years. We build our computers the way we build our cities: over time, without a plan, on top of ruins. - Ellen Ullman I find the above quote true in general, but in postfix's case not so much. Thanks again -- Eray ___ Postfix-devel mailing list -- postfix-devel@postfix.org To unsubscribe send an email to postfix-devel-le...@postfix.org
[pfx-dev] Re: NIT: compile warning for implicit truncation
Eray Aslan via Postfix-devel: > Hi, > > With postfix-3.8-20230314: > > clang -fPIC -I. -I../../include -DHAS_PCRE=2 -DUSE_TLS -DHAS_LMDB -DNO_NIS > -DNO_DB -DDEF_DB_TYPE=\"lmdb\" -DHAS_CDB -I/usr/include/cdb -DHAS_DEV_URANDOM > -DSNAPSHOT -DDEF_SHLIB_DIR=\"/usr/lib64/postfix/\${mail_version}\" > -DUSE_DYNAMIC_LIBS -UUSE_DYNAMIC_MAPS -Wmissing-prototypes -Wformat > -Wno-comment -fno-common -O2 -march=native -I. -I../../include -DLINUX6 -c > smtp_proto.c > > I am getting > > smtp_proto.c:1200:39: warning: implicit truncation from 'int' to a one-bit > wide bit-field changes value from 1 to -1 > [-Wsingle-bit-bitfield-constant-conversion] > state->logged_line_length_limit = 1; > ^ ~ > 1 warning generated. > > It is nit in the sense that it is still not zero and hence no change in > behaviour. GCC gives a similar warning with -Wpedantic. Still, it might > be a good idea to change logged_line_length_limit from int to unsigned. > > -- > Eray > > diff --git a/src/smtp/smtp.h b/src/smtp/smtp.h > index 0864313..8f86425 100644 > --- a/src/smtp/smtp.h > +++ b/src/smtp/smtp.h > @@ -204,7 +204,7 @@ typedef struct SMTP_STATE { > * One-bit counters to avoid logging the same warning multiple times per > * delivery request. > */ > -int logged_line_length_limit:1; > +unsigned logged_line_length_limit:1; > } SMTP_STATE; > > /* And all this is because C did not have a proper boolean type. I'll change this but do ot expected any effort to shut up warnings that result from compiler settings. Wietse ___ Postfix-devel mailing list -- postfix-devel@postfix.org To unsubscribe send an email to postfix-devel-le...@postfix.org