From owner-svn-src-all@freebsd.org Thu Jun 28 18:45:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEBE11023CB2; Thu, 28 Jun 2018 18:45:39 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BF7288D7A; Thu, 28 Jun 2018 18:45:39 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lj1-x234.google.com with SMTP id t22-v6so5301150ljc.11; Thu, 28 Jun 2018 11:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zae0Pk/1iwRZsTxy4Pvcd4iYG2Dh4TFxduuxJu8XYj0=; b=oBxLv+BVaGWuGqmm0Qz2hsab2C23VY8e+51t5METZM8IacLRb4PODlJJwJCBO3EHqS cBqqnCvctZwPiKPr6CeAAxzcAyUnwh41nZciqnx46RV3pmCcwuc+E2RCyNdsh9houYyu 4yIjqqdfs+0f3w1N+2xk9rT0HTzvvsy8q9Y+SJmGotbMadzzwbNMCZs+FkTj6yZua9vl L5QzMxk1GWa5fw7iWa7AOCiso7l0OHBa8/s/z5IEr2OB0SgZqQMuZvx2d2kSbp3jzmpK 8k5P5V12VWp+W/xRYl9n2eYrntWMVax7iQte8E2VIkBBaxnetcvpprTNXQdUc/+qHcSp ew+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zae0Pk/1iwRZsTxy4Pvcd4iYG2Dh4TFxduuxJu8XYj0=; b=Oj4C0KKrP6mvvHpwAZ1R6j55CzHnUrjT9ImL1Q+Jmb0Q/ZEXenTrG2SV0lvlfwSsbR 2KYo+TkNbIOC5z3x0nz5BjGHm0yJaX0Cvj/NuXHeeNePE6I/8p4PQjxRp2w/N6L9/olZ B5oBHr0PVulon3M45rpJb6JFruElA4OBgcQn1OqFikIwTpiM7kjD4+M85VWy6IbDJzNR qFe+EoeYV2kfCOSzYW0JhgWut6N2qTiJIW2/IgoPdbaWpu2kTERgslbHvjcI+4aDnoFb 8LeXxp04du6S/8DreHshvFlNrxcggD/ILiZfQhcOxo4srnUa1ZfT+1LjivSieiQ7g/Xo J4mw== X-Gm-Message-State: APt69E3ZBKmPSkXq4Qn9jqdT6Xd526aeJWRWOH5vzdXm+Z6agiZMn6aa pAYrfOnFyJxuF2jWN6ScwYLdQ7IsNUuufeGIAuoGYA== X-Google-Smtp-Source: AAOMgpcVdmv2BTHXeNDyOeuVanzdVMaNJjaChueZBBoOOZUhrhxRG6lJxQ+n+wPDFk1Ptccbn/+dzQwvozFHDX0JTvo= X-Received: by 2002:a2e:9c04:: with SMTP id s4-v6mr7846847lji.97.1530211537348; Thu, 28 Jun 2018 11:45:37 -0700 (PDT) MIME-Version: 1.0 References: <201806281701.w5SH15eP011261@repo.freebsd.org> In-Reply-To: <201806281701.w5SH15eP011261@repo.freebsd.org> From: Justin Hibbits Date: Thu, 28 Jun 2018 13:45:24 -0500 Message-ID: Subject: Re: svn commit: r335765 - head/sys/sys To: dab@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 18:45:40 -0000 Hi David, On Thu, Jun 28, 2018 at 12:01 PM David Bright 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 > 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=43905 > > Modified: > head/sys/sys/event.h > > Modified: head/sys/sys/event.h > ============================================================================== > --- head/sys/sys/event.h Thu Jun 28 15:30:51 2018 (r335764) > +++ head/sys/sys/event.h Thu Jun 28 17:01:04 2018 (r335765) > @@ -49,7 +49,26 @@ > #define EVFILT_EMPTY (-13) /* empty send socket buf */ > #define EVFILT_SYSCOUNT 13 > > +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L > #define EV_SET(kevp_, a, b, c, d, e, f) do { \ > + *(kevp_) = (struct kevent){ \ > + .ident = (a), \ > + .filter = (b), \ > + .flags = (c), \ > + .fflags = (d), \ > + .data = (e), \ > + .udata = (f), \ > + .ext[0] = 0, \ > + .ext[1] = 0, \ > + .ext[2] = 0, \ > + .ext[3] = 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 = (kevp_); \ > (kevp)->ident = (a); \ > (kevp)->filter = (b); \ > @@ -62,6 +81,7 @@ > (kevp)->ext[2] = 0; \ > (kevp)->ext[3] = 0; \ > } while(0) > +#endif > > struct kevent { > __uintptr_t ident; /* identifier for this event */ > This breaks gcc builds, with the following errors: 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 overwritten 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 overwritten 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 overwritten 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 overwritten 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 overwritten 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 overwritten 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization for '(anonymous).ext') This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox) I encountered this as a failure in building usr.sbin/camdd, which shows the same type of error. - Justin