From owner-svn-src-head@freebsd.org Sun Feb 25 14:18:38 2018 Return-Path: Delivered-To: svn-src-head@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 A636BF30139; Sun, 25 Feb 2018 14:18:38 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (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 27B8B7E692; Sun, 25 Feb 2018 14:18:38 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id f75so13565007lfg.6; Sun, 25 Feb 2018 06:18:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=GL7W2o5RtvEUVV0w4nQOeTPCxUzWQUOEtNfHpS9DuVo=; b=SUD3fKfZaDuA2tuiki4a5Zxq2iGm7+4KMhd9OJgtRNdOVh82uA4jSo6/Nrkz8/tmj2 FYyHXPR44p68S9Gx8EJW+0JmxgCNl/hFMEwEhWFcINKBrPv4hhCcfRdd1vzMcuV/Wc4N ThcHZpxPweDung2obqrBd6dJMo32HQS9DOH9auqxaftg19ouNeZOMzCERNoMHMnO+0DE JBx8NW5rn9XTWT+zeAwJiARBnMZGfos8sZ1N5qEyx6KN31lZ4YAnAig9STFROCrp3wFy WnLFAPxuymcMUZb0hbTbgY8GdMr5tRqGK6CUqypFbcl6x0gDS8j6UMqJUKA2RSQnxTls 96ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=GL7W2o5RtvEUVV0w4nQOeTPCxUzWQUOEtNfHpS9DuVo=; b=mUNVWWq7xiNDTUf/V/KGchBni5ltKUw19Ko6FIw6rwSxkDMo8ugjHAzE1PLEMAWYL0 KxQyHTYj82v0s+yYanWMavU9a+EzVvngImrwzCtVh0Ue9cDnswx8qcrHaqBU4TQWgKQO 25lokh9laWuU6/uTZi2aY1ljmedjqq6pyymvo2yZ6IyXdLozm/jt77xXP7Zit1Ic8gwG UtHceTqyZsFJ7uGWOg4AuW0rmQIsmdsVv13JdI7exeoY3RStdO5uvqpb72A7Hx5hqb5M /TDOy2DtIgzzYXFumWEgUlFqygUIxQPMdz+/lVWOE6U+Es1FSdg1X5VNFDTykdKTMRAG 5wqg== X-Gm-Message-State: APf1xPB2uwZWvbv00ONGr5k2ToiZOUea3d2Cr6ktB11ku/whPs6xxM2C KUPw6PJ20pvaRN9qr+dw2cUovZVZvmmKDcio2CI= X-Google-Smtp-Source: AG47ELujdV7nQxPKtTwRlPqn0J9Gl932Zl/f9BM50tfY69QP2upLhCU7/qvRnKFqhWmwgWCMcE/VibwI9Zmz6V6pTPM= X-Received: by 10.25.119.27 with SMTP id s27mr3352094lfc.138.1519568316248; Sun, 25 Feb 2018 06:18:36 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Sun, 25 Feb 2018 06:18:35 -0800 (PST) In-Reply-To: References: <201802241601.w1OG1LQ3043733@repo.freebsd.org> From: Alan Somers Date: Sun, 25 Feb 2018 07:18:35 -0700 X-Google-Sender-Auth: wlepparW2KtjkeF-btKgZMnwEYs Message-ID: Subject: Re: svn commit: r329910 - head/sys/cddl/contrib/opensolaris/uts/common/sys To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 14:18:38 -0000 On Sun, Feb 25, 2018 at 6:52 AM, Dimitry Andric wrote: > On 24 Feb 2018, at 17:01, Alan Somers wrote: > > > > Author: asomers > > Date: Sat Feb 24 16:01:21 2018 > > New Revision: 329910 > > URL: https://svnweb.freebsd.org/changeset/base/329910 > > > > Log: > > Implement CTASSERT using _Static_assert > > > > Prevents warnings about "unused typedef" with GCC-6 > > > > Reported by: GCC-6 > > MFC after: 18 days > > X-MFC-With: 329722 > > > > Modified: > > head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h > > > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h > > ============================================================ > ================== > > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb > 24 15:13:20 2018 (r329909) > > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb > 24 16:01:21 2018 (r329910) > > @@ -133,8 +133,8 @@ _NOTE(CONSTCOND) } while (0) > > #ifndef CTASSERT > > #define CTASSERT(x) _CTASSERT(x, __LINE__) > > #define _CTASSERT(x, y) __CTASSERT(x, y) > > -#define __CTASSERT(x, y) \ > > - typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] > > +#define __CTASSERT(x, y) \ > > + _Static_assert((x), "Static assert failed at " #y) > > #endif > > > > #ifdef _KERNEL > > Note that the trick with the negatively indexed array is to support > older versions of gcc, which did not yet recognize _Static_assert. It > looks like this was added in gcc 4.6. > > -Dimitry > > sys/cdefs.h defines _Static_assert similarly on GCC 4.3-4.5, and defines it to nothingness on GCC-4.2. So we should be covered for all compilers that we care about. -Alan