Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp581795pxb; Fri, 15 Oct 2021 11:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgha/7Qal3Xp7mZ8nNIPs4VPgOxQbos9KVKk8QHa1Dwp5Nxi/qmyvTyWAhIekRM2RZwK82 X-Received: by 2002:a17:90b:3695:: with SMTP id mj21mr5736746pjb.194.1634322544425; Fri, 15 Oct 2021 11:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634322544; cv=none; d=google.com; s=arc-20160816; b=VBGwF7LXmuBhcg6WQkSYdEZXL3/u0A1E/i3EtHRLvaWWLGjznJhNWPAWIYfLfEjfvp cmxQcnhQ2nBSwNYJxKTsKVNMzONB7DyYymKVYy3Vvpa+PMtVBk444N46ZxqlzXQSOXIi NUciguICyzJ4k++PqZx1EfJ1IRNo0CcIcnhGKayHsKzbk60A1yXP4vRTy+hlPRV+jM81 5lRPsLMTxmUtEl7mJv/sAfqNCFQLaa1fgnV1i5g7ufVLXNUOoQERkHokGu+Lk3kSMvVm emNeKIzDrZIWNy5ft6Z0i0yW/bUhiG0vltIAFd9WfCHes9EqLtuqDxoSxdUPXSUXVrL9 bRJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6JC/T/iGOIIOV4Pzu2I0awaQ2JoLDY0FUiVe9OS4aKM=; b=VySdlKYaGccmnZ2Rc9SAnaSj2dhBNYNr9/0U1+FeJ0n7VFdya+plYX/xboFYxap3+7 AKh88RfHWkxpSZk9zfpRHs0gwxbZ8MLJC0pW+Lgl4eGnSl8kr6ApGPT9iaen4EIp5Ger 9mmodynFfImK70h7XEJ6/8xgZbcHA88cFUejaYVPpbnxmVKzCYxbBtf+l5tUNGJaIIXG QTlXRIX6+3co684kBr5suI4n2wpubgXuD9WEuyEdhHSJg4bme3V3DkzsFwNHrl8xsIT1 idHD/30MfgrV4gR5hlM2yu+r2eWn3+PQPTl/CzFJXNYKyloK4YIeLi6OrS1e6fjBk7/V ogeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rj6si20980977pjb.129.2021.10.15.11.28.51; Fri, 15 Oct 2021 11:29:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234095AbhJOKNk (ORCPT + 99 others); Fri, 15 Oct 2021 06:13:40 -0400 Received: from mga03.intel.com ([134.134.136.65]:61305 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232265AbhJOKNh (ORCPT ); Fri, 15 Oct 2021 06:13:37 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="227842309" X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="227842309" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 03:11:19 -0700 X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="592935094" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.159]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 03:11:17 -0700 Received: from andy by smile with local (Exim 4.95) (envelope-from ) id 1mbMzF-000Owa-Ny; Fri, 15 Oct 2021 16:11:01 +0300 Date: Fri, 15 Oct 2021 16:11:01 +0300 From: Andy Shevchenko To: Rasmus Villemoes Cc: akpm@linux-foundation.org, Miguel Ojeda , Nick Desaulniers , linux-kernel@vger.kernel.org Subject: Re: [PATCH] linux/container_of.h: switch to static_assert Message-ID: References: <20211015090530.2774079-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211015090530.2774079-1-linux@rasmusvillemoes.dk> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 15, 2021 at 11:05:30AM +0200, Rasmus Villemoes wrote: > _Static_assert() is evaluated already in the compiler's frontend, and > gives a somehat more to-the-point error, compared to the BUILD_BUG_ON > macro, which only fires after the optimizer has had a chance to > eliminate calls to functions marked with > __attribute__((error)). In theory, this might make builds a tiny bit > faster. > > There's also a little less gunk in the error message emitted: > > lib/sort.c: In function ‘foo’: > ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > compared to > > lib/sort.c: In function ‘foo’: > ././include/linux/compiler_types.h:322:38: error: call to ‘__compiletime_assert_2’ declared with attribute error: pointer type mismatch in container_of() > 322 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > While at it, fix the copy-pasto in container_of_safe(). Thanks, Rasmus! Make sense to me. Acked-by: Andy Shevchenko > Signed-off-by: Rasmus Villemoes > --- > akpm: This is obviously on top of Andy's kernel.h splitup series, so > should go along with those if acked. Nevertheless, kbuild bot is not happy about bottom_half.h (_RET_IP_, _THIS_IP_ definitions). Do you have any idea what to do the best? (I think those macros deserve a separate header as well). -- With Best Regards, Andy Shevchenko