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 C81C8438F8; Thu, 18 Jan 2024 21:18:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5E0740E78; Thu, 18 Jan 2024 21:18:56 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id 3CEFE40E2D for ; Thu, 18 Jan 2024 21:18:55 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6d9c2db82b0so92805b3a.1 for ; Thu, 18 Jan 2024 12:18:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705609134; x=1706213934; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ykrb71ggv49FzaDpcOw0CH+qri7MsMKxMMKaS394J6U=; b=sGVkyMl386gzc0SVtU/mPehGWamhxVl3MONHj2v/rwFNub3soXvNNwyiE9WvcE/I51 54RvdrB7sYT8eTLyqCn44NAAtKWTvBsGAl0y/fdqimnzZXlg5C5V796vEoONMWhwwqpq GHY/aCP3V7OpY3VLdL0tp3xRkwBqRJMcIo345781xHJoX3zvd3FFwWcc/KQLfnoF5Zgq 97CavvHQwEAE2UIYo3QpArcTu+NesoeifYgAUC2lf/T/ckD+JONO9No7/IJSOY47OdRg 2K1T2O7hC9A/Zr2jdNl+4Z0HylHV/jS2wBi5QtCVg+h8phXomiAewIwv7pk8YEj+z3Fv YVEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705609134; x=1706213934; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ykrb71ggv49FzaDpcOw0CH+qri7MsMKxMMKaS394J6U=; b=hBwn7LhitlAZ9AssviUocwNkMGnYWi/ZXx2M+qd7LghTNO4o2fa9P6WqJVI7IvJ0aY CpCtUrbpdBne1Dbpx5Svj+HcCyZEYSeusIo5aJOCgFxeC7jDa07WESwvJcsQNUmv90TL sxF1bRl3mUCErOdIXHI5P7lAQ2hTFrE41qG0Agxe51iD9fYp00YAybX+hdMh/S6RcdDK 7XtP5jhr/Z52IwUTeX4uyWGMW4ROnf6lPJvNQefYTSWp5epqSWYrMrYfHcvBSBIxOzsj U247llXgNEmesKk9P1laWpqj5xYqhFN9nFY/zMohemZ+ojqmhGgmYz74BmcjvPGfbDkJ TYCg== X-Gm-Message-State: AOJu0YzxmHkpqzjic2JMiJY9typ6PCUxQBW5irY2J/P/cK7fQDeLHQcf AbjG3X129srYszFEJ/b1Hl3eKkYjk7Liv1s4srRuraNHFjdcgVQEr5KZ5OcIX2eOjmXL/PCgAgm oFhE= X-Google-Smtp-Source: AGHT+IEM2tyAlFAPtd0JT2xtGyhX1sCjdm1F7TRaAlefYtahZyxFSCr+RKaZF+U5wfTw3+y0oojy1Q== X-Received: by 2002:a05:6a00:99c:b0:6db:5fe:ba7c with SMTP id u28-20020a056a00099c00b006db05feba7cmr1336362pfg.63.1705609134404; Thu, 18 Jan 2024 12:18:54 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id h13-20020aa79f4d000000b006d92f081d9fsm3695020pfr.31.2024.01.18.12.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 12:18:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Andrew Rybchenko Subject: [PATCH] common/sfc: replace out of bounds condition with static_assert Date: Thu, 18 Jan 2024 12:18:09 -0800 Message-ID: <20240118201843.189978-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The sfc base code had its own definition of static assertions using the out of bound array access hack. Replace it with a static_assert like rte_common.h. Fixes: f67e4719147d ("net/sfc/base: fix coding style") Signed-off-by: Stephen Hemminger --- drivers/common/sfc_efx/base/efx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 3312c2fa8f81..9ce266c43610 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -17,8 +17,8 @@ extern "C" { #endif -#define EFX_STATIC_ASSERT(_cond) \ - ((void)sizeof (char[(_cond) ? 1 : -1])) +#define EFX_STATIC_ASSERT(_cond) \ + do { static_assert((_cond), "assert failed" #_cond); } while (0) #define EFX_ARRAY_SIZE(_array) \ (sizeof (_array) / sizeof ((_array)[0])) -- 2.43.0