From owner-svn-src-all@freebsd.org Wed Jun 6 17:24:19 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 D8C00FDB817; Wed, 6 Jun 2018 17:24:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) (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 783157E668; Wed, 6 Jun 2018 17:24:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f53.google.com with SMTP id v83-v6so9075948itc.3; Wed, 06 Jun 2018 10:24:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=8VBGrRDXya9AunICKUbDFcGazcepTOS7Tkt0zVUDZ48=; b=f2C71j4tPLU9R1okl3QP7wbKULo4rfxBUR6bxTrPK7Fnvf6NqRgoLJ/llbbNQOuPg7 UJcg4cPz3B2egSSC1EzJzV3hAwUZWzr2XeYAlUZsMVP7N8wb8SxxRiD5I1vLn6s0IFd9 uxtsBQwr9LadY0dThwi6PE9vtfytyYo+fj/vUYz5iqtszjcVWxJLAs5uRC6DoVAIqCd6 ZDmNj0ALbndmmRhubAUp9xa+ZkcaaSEfZ/WspwlSs9WbEgTeuUtHlbsU6IfNkwTiLGh1 DOQlX3zMjHowZJDN9AlsDDGQQCcwvTus/BZ1LEnkqLnMK9LycszSKNSBbuogozZ8i2q7 6rlQ== X-Gm-Message-State: APt69E3asi1LwJPWavliwsIuofg5lqiZ307gADCB9sxZM316tJxU/vdE tBffxL4sol5C+1KZlQ/rQvtN9MmU X-Google-Smtp-Source: ADUXVKKBnBn0+BShbN+uc3TgrGE5Nr/BjdgCLNEO/CjFxqwjuPnX/q2D0pxf9ypN9ONAwc3Rm/j8iA== X-Received: by 2002:a24:f6c2:: with SMTP id u185-v6mr3387094ith.146.1528304002851; Wed, 06 Jun 2018 09:53:22 -0700 (PDT) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com. [209.85.214.47]) by smtp.gmail.com with ESMTPSA id 63-v6sm7074686ioz.71.2018.06.06.09.53.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 09:53:22 -0700 (PDT) Received: by mail-it0-f47.google.com with SMTP id 76-v6so9060233itx.4; Wed, 06 Jun 2018 09:53:22 -0700 (PDT) X-Received: by 2002:a24:19ca:: with SMTP id b193-v6mr3451409itb.135.1528304002374; Wed, 06 Jun 2018 09:53:22 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:5995:0:0:0:0:0 with HTTP; Wed, 6 Jun 2018 09:53:21 -0700 (PDT) In-Reply-To: References: <201806060508.w56586c9053686@repo.freebsd.org> <6E6E92B2-7536-4281-8EAF-72823E84902E@panasas.com> From: Conrad Meyer Date: Wed, 6 Jun 2018 09:53:21 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334702 - head/sys/sys To: Benjamin Kaduk , Ravi Pokala Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: Wed, 06 Jun 2018 17:24:19 -0000 Hi Ben, Ravi, GCC/Clang are fine with the just curly braces, or just do/while(0). The core benefit of the ({ }) syntax is to allow multiple-statement macros to have expression syntax externally (i.e., yield a value) =E2=80=94 which is not possible in standard C due to concession to simplistic parsers. Ben's link is a good one and does cover this in more detail. The URL ("Statement-Exprs") is a hint ;-). Best, Conrad On Wed, Jun 6, 2018 at 4:40 AM, Benjamin Kaduk wrote: > On Wed, Jun 6, 2018 at 6:35 AM, Ravi Pokala wrote: >> >> Hi Mateusz, >> >> =EF=BB=BF-----Original Message----- >> From: on behalf of Mateusz Guzik >> >> Date: 2018-06-06, Wednesday at 01:08 >> To: , , >> >> Subject: svn commit: r334702 - head/sys/sys >> >> > ... >> > #ifdef _KERNEL >> > #define malloc(size, type, flags) ({ >> > \ >> >> Now that I'm taking another look at this, I'm confused as to why the >> entire macro expansion is inside parentheses? (The braces make sense, si= nce >> this is a block with local variables which need to be contained.) > > > This is a gcc (and clang) extension to allow the macro body to be a code > block -- standard C gets unhappy with just the curly braces. > https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html is a maybe-releva= nt > page that google found me. > > -Ben