From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C39043F74; Fri, 3 May 2024 11:46:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6648F402D0; Fri, 3 May 2024 11:46:10 +0200 (CEST) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mails.dpdk.org (Postfix) with ESMTP id 18935402C5 for ; Fri, 3 May 2024 11:46:09 +0200 (CEST) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-43ae9962c17so15562491cf.3 for ; Fri, 03 May 2024 02:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1714729568; x=1715334368; darn=dpdk.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=3Qil9n8UjmyKUcGkTr73Xxx1/MzkJEa1BrqAoIvMxVU=; b=XC7pet4ld6gqNqxlqd68fVknXimIGR0olrSw2lTlWWhC4/8I9U13L7NnIZYuJa1ZXm h4Za1J6aLgmzk1EYEqUYg5lmeZwKEGtVYg5E0bfYr1F0FJOMWGDz2MviQgy2CpxGKE2K J4LMLEGXnIjCOIyVDbcuzlT9DlPwEQiDKmpEunABBGgO3cKmB9Nj9mQ/hArZfr/XXi5E x3awYv2XE9KkXXFd7NStiiSZTIuDbn7QuomV1OsXw/sS9ah5Ayt4fUmvd0Rz5Lnhsh3f JkTVjMu1LKVCthrxsJVfukxrBPggbYkRo2xH0ET9h8qfCtOP1hrfs7GHTwIP1vlKhFyf Py6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714729568; x=1715334368; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3Qil9n8UjmyKUcGkTr73Xxx1/MzkJEa1BrqAoIvMxVU=; b=mJ7b92dn6bowDrQ9HEkXC9oNkcfQD6lJjf2UQvc0zwW4HulnrKaEE+W9ZtqSmWhzKs tYHd/nL5xbFF4FtgEDeAiSHjF7OtJyA+lwuqc4KoCJ6CWbSwduJaxEOFBKMDLoe7BHWW v2wMSFmrkTxqUBQMTZSrnWfixqPiVddb4Lymbtb5lN2JTAmsLLSYC/GQbrthW7o1dLXO ZsJYhph/XdKSQtxONxah114jAbIRIc5ry38a1AIj6VUEt+5provlslLeAjhy+GsJBIHk QbZ/SjZEWHGs3XUDERySODmV9fuJ8kvwmTcNBVFU197p7vJU3i24AmqCgH6NLRGXLQ9m cHIw== X-Forwarded-Encrypted: i=1; AJvYcCU/ZZ7GYLga1I/Jyaur8hainaRop99zSxx/Hl1twMTYEVk0zqU5KbgByPJuydHZnqK8mBaaccivEtfg47Y= X-Gm-Message-State: AOJu0YxPSDS+dveGS4xVuPqSZnflU+nFLQBBc9ZYZZAilF91IuXpGQgp SPTj//maq3a8p6JKtCmhDRDZXRzTCk8srwexOklF1wQM8fNSyEKMVMcayw0UJlU= X-Google-Smtp-Source: AGHT+IG6HAjvNeqyPdXaRhm3kPmzh6QPg+QmYCt/xRUD/wzlhiTMBYdSEqXfeEVfrt26X0IS1FYibA== X-Received: by 2002:ac8:5713:0:b0:43a:ed55:f3a9 with SMTP id 19-20020ac85713000000b0043aed55f3a9mr2296843qtw.30.1714729568323; Fri, 03 May 2024 02:46:08 -0700 (PDT) Received: from ste-uk-lab-gw ([79.173.157.19]) by smtp.gmail.com with ESMTPSA id fi4-20020a05622a58c400b00436bb57faddsm1390531qtb.25.2024.05.03.02.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 02:46:07 -0700 (PDT) Date: Fri, 3 May 2024 10:46:05 +0100 From: Daniel Gregory To: Stephen Hemminger Cc: Ruifeng Wang , dev@dpdk.org, Punit Agrawal , Liang Ma Subject: Re: [PATCH] eal/arm: replace RTE_BUILD_BUG on non-constant Message-ID: <20240503094605.GB3883350@ste-uk-lab-gw> Mail-Followup-To: Stephen Hemminger , Ruifeng Wang , dev@dpdk.org, Punit Agrawal , Liang Ma References: <20240502142116.63760-1-daniel.gregory@bytedance.com> <20240502092045.02a426fe@hermes.local> <20240502174420.GA3883350@ste-uk-lab-gw> <20240502144826.42d7012a@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240502144826.42d7012a@hermes.local> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, May 02, 2024 at 02:48:26PM -0700, Stephen Hemminger wrote: > There are already constant checks like this elsewhere in the file. Yes, but they're in macros, rather than inlined functions, so my understanding was that at compile time, macro expansion has put the memorder constant in the _Static_assert call as opposed to still being a function parameter in the inline definition. This is also the same approach used by the generic implementation (lib/eal/include/generic/rte_pause.h), the inline functions use assert and the macros use RTE_BUILD_BUG_ON. To give a minimal example, the following inline function doesn't compile (Godbolt demo here https://godbolt.org/z/aPqTf3v4o ): static inline __attribute__((always_inline)) void add(int *dst, int val) { _Static_assert(val != 0, "adding zero does nothing"); *dst += val; } But as a macro it does ( https://godbolt.org/z/x4a8fTf8h ): #define add(dst, val) do { \ _Static_assert(val != 0, "adding zero does nothing"); \ *(dst) += (val); \ } while(0); I don't believe this is a compiler bug as both GCC and Clang produce the same error message.