Date: Thu, 28 Jun 2018 12:04:59 -0700 From: Bryan Drewery <bdrewery@FreeBSD.org> To: dab@freebsd.org Cc: Justin Hibbits <jrh29@alumni.cwru.edu>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335765 - head/sys/sys Message-ID: <698a08ad-23e3-6ccd-ff72-b2b78444d176@FreeBSD.org> In-Reply-To: <CAHSQbTD5BtcvcMeA%2BZeAUfkdsB6F%2BY9G182rnOHwb-E%2ByGxCUw@mail.gmail.com> References: <201806281701.w5SH15eP011261@repo.freebsd.org> <CAHSQbTD5BtcvcMeA%2BZeAUfkdsB6F%2BY9G182rnOHwb-E%2ByGxCUw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IWnms8G3WcVcgr51gXrDJHJUx8WOaSil1 Content-Type: multipart/mixed; boundary="nIkdth3M1QNLo714JeLjdjtKuXRxU1QHP"; protected-headers="v1" From: Bryan Drewery <bdrewery@FreeBSD.org> To: dab@freebsd.org Cc: Justin Hibbits <jrh29@alumni.cwru.edu>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <698a08ad-23e3-6ccd-ff72-b2b78444d176@FreeBSD.org> Subject: Re: svn commit: r335765 - head/sys/sys References: <201806281701.w5SH15eP011261@repo.freebsd.org> <CAHSQbTD5BtcvcMeA+ZeAUfkdsB6F+Y9G182rnOHwb-E+yGxCUw@mail.gmail.com> In-Reply-To: <CAHSQbTD5BtcvcMeA+ZeAUfkdsB6F+Y9G182rnOHwb-E+yGxCUw@mail.gmail.com> --nIkdth3M1QNLo714JeLjdjtKuXRxU1QHP Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 6/28/2018 11:45 AM, Justin Hibbits wrote: > Hi David, >=20 > On Thu, Jun 28, 2018 at 12:01 PM David Bright <dab@freebsd.org> wrote: >> >> Author: dab >> Date: Thu Jun 28 17:01:04 2018 >> New Revision: 335765 >> URL: https://svnweb.freebsd.org/changeset/base/335765 >> >> Log: >> Remove potential identifier conflict in the EV_SET macro. >> >> PR43905 pointed out a problem with the EV_SET macro if the passed >> struct kevent pointer were specified with an expression with side >> effects (e.g., "kevp++"). This was fixed in rS110241, but by using a= >> local block that defined an internal variable (named "kevp") to get >> the pointer value once. This worked, but could cause issues if an >> existing variable named "kevp" is in scope. To avoid that issue, >> jilles@ pointed out that "C99 compound literals and designated >> initializers allow doing this cleanly using a macro". This change >> incorporates that suggestion, essentially verbatim from jilles@ >> comment on PR43905, except retaining the old definition for pre-C99 = or >> non-STDC (e.g., C++) compilers. >> >> PR: 43905 >> Submitted by: Jilles Tjoelker (jilles@) >> Reported by: Lamont Granquist <lamont@scriptkiddie.org> >> Reviewed by: jmg (no comments), jilles >> MFC after: 1 week >> Sponsored by: Dell EMC >> Differential Revision: https://bugs.freebsd.org/bugzilla/show= _bug.cgi?id=3D43905 >> >> Modified: >> head/sys/sys/event.h >> >> Modified: head/sys/sys/event.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/sys/event.h Thu Jun 28 15:30:51 2018 (r3357= 64) >> +++ head/sys/sys/event.h Thu Jun 28 17:01:04 2018 (r3357= 65) >> @@ -49,7 +49,26 @@ >> #define EVFILT_EMPTY (-13) /* empty send socket buf */ >> #define EVFILT_SYSCOUNT 13 >> >> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >=3D 199901L >> #define EV_SET(kevp_, a, b, c, d, e, f) do { \ >> + *(kevp_) =3D (struct kevent){ \ >> + .ident =3D (a), \ >> + .filter =3D (b), \ >> + .flags =3D (c), \ >> + .fflags =3D (d), \ >> + .data =3D (e), \ >> + .udata =3D (f), \ >> + .ext[0] =3D 0, \ >> + .ext[1] =3D 0, \ >> + .ext[2] =3D 0, \ >> + .ext[3] =3D 0, \ >> + }; \ >> +} while(0) >> +#else /* Pre-C99 or not STDC (e.g., C++) */ >> +/* The definition of the local variable kevp could possibly conflict >> + * with a user-defined value passed in parameters a-f. >> + */ >> +#define EV_SET(kevp_, a, b, c, d, e, f) do { \ >> struct kevent *kevp =3D (kevp_); \ >> (kevp)->ident =3D (a); \ >> (kevp)->filter =3D (b); \ >> @@ -62,6 +81,7 @@ >> (kevp)->ext[2] =3D 0; \ >> (kevp)->ext[3] =3D 0; \ >> } while(0) >> +#endif >> >> struct kevent { >> __uintptr_t ident; /* identifier for this event *= / >> >=20 > This breaks gcc builds, with the following errors: >=20 > 18:02:13 /usr/src/bin/pwait/pwait.c: In function 'main': > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization > for '(anonymous).ext') > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization > for '(anonymous).ext') > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization > for '(anonymous).ext') > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization > for '(anonymous).ext') > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization > for '(anonymous).ext') > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field ove= rwritten > 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization > for '(anonymous).ext') >=20 > This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox) >=20 > I encountered this as a failure in building usr.sbin/camdd, which > shows the same type of error. I think in this case it may break ports and other external builds too. If possible please try to fix the macro to avoid the issue. I didn't analyze it to see if it is feasible though. --=20 Regards, Bryan Drewery --nIkdth3M1QNLo714JeLjdjtKuXRxU1QHP-- --IWnms8G3WcVcgr51gXrDJHJUx8WOaSil1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJbNTFbAAoJEDXXcbtuRpfPDDQH/3JAx65MBLV1V+jXD55fZzBA RMMPBrRovpZo5oqCMVgqSYXtyAWe+MzV5o0HyO9rLnNAAYugnuWxQ5Rqs0k97o8Z qV9tDgEpXaoyhBulloaG141+j+aexka2VIcxLG6xBhT1PiqgCe5WbaVNrVmzy/dh nOaz9BVWubZ91DW9QSQlhX3JLm4w3As9q53UlAVaE8PqA57HSSoDDiZ1MKoQXUd5 z9Bm83lyCErU5qLJx2WmhJJagKULvI9npo5itNp7Du1074i395jFP7Dlj3u3pSq2 AZganhV3D0v4Hv3C6FCUtxQJYxZ3mtU+Gd+cLOvYsvcomKwWogOn9U8kbai9eI8= =swI8 -----END PGP SIGNATURE----- --IWnms8G3WcVcgr51gXrDJHJUx8WOaSil1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698a08ad-23e3-6ccd-ff72-b2b78444d176>