From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ECB2C71133 for ; Fri, 25 Aug 2023 15:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240685AbjHYP0i (ORCPT ); Fri, 25 Aug 2023 11:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240497AbjHYP00 (ORCPT ); Fri, 25 Aug 2023 11:26:26 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE29D212C for ; Fri, 25 Aug 2023 08:26:24 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1bb29dc715bso11266155ad.1 for ; Fri, 25 Aug 2023 08:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692977184; x=1693581984; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uT9B5IhwSieTS/lycgAO9B5cbkxabumJT7OeFCsXGMk=; b=vvVTkRT+VuK5043ahLb/u/zj4f8sB0vqgAunodyYuRhNLeufoefzhoe4WNJFWBlqnT fOjWSwwVNPHbk3edqUSOVA+XxAEjDCKjxs3HxwUIlookvW4KiCnYLFtt1qTalqSJOVGF sScsGhUtVxEoQK15lzMQlLomYBvjcE2Sz4k/e1Oy+HS/9hhEtZcDcaVdaQEeyjXxZh3R TzsVUTWd7XZcUj1STnMDvCZ5q8x5tT67ioP2DbuxoS8Xvt4bmsdKfkLeTHrNoo93HISk V1NYfBP6/ZvZCCCq3TieE6qyCIY3XWbSHhfJP0iP2R+QQbrK8/8rYTZUS4Q+EnvzC4ai inOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977184; x=1693581984; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uT9B5IhwSieTS/lycgAO9B5cbkxabumJT7OeFCsXGMk=; b=a2topNB9PTuynUQ8sTB7Xh4r86XGgFUDju+47UGflEV9j9hk59EKDiinG3uFcKp8jQ atVLiHezOOSImZ/8hkbRjDFaZVd1x/oieu/3RUiY4ed3a/z1RfDIpdtRMMlpcGfme3M0 a3NPSR1NHLx3yvij25sxNFPEyIykMf87f3qbp2cNF9DzoSGbKMFXuKjIY05zWSdtrjbH zHLLTV6/aqM41mw/HhtIL2h1MOt/gxVM6JPBHO+byHC/8k6xm5lpf084L5ZgIludd3fL tSM+uVmH6gLZ8QhqCcQJYhxC72x/4FbvqBpIiF98+ybLPs7vmUdrXyhT+gL2bSZEndHw Xi0g== X-Gm-Message-State: AOJu0YyDFz25dDxzXf6qFGWyeU7GPBDaEL7ZrSvsOfdYa9qXL/m5IrQc QXnclTwTonU5wXp9as/H90noiq460ys= X-Google-Smtp-Source: AGHT+IHBe26z5RAiUFUIi9mr/ywY4xvfcSUx9IiaElkVhEpKpN2zZSyFkiUVw2XIEkVi8AWhgt40SvUlcq8= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:e801:b0:1bc:4452:59c4 with SMTP id u1-20020a170902e80100b001bc445259c4mr7073353plg.4.1692977184048; Fri, 25 Aug 2023 08:26:24 -0700 (PDT) Date: Fri, 25 Aug 2023 08:26:22 -0700 In-Reply-To: <20230824202415.131824-1-mahmoudmatook.mm@gmail.com> Mime-Version: 1.0 References: <20230824202415.131824-1-mahmoudmatook.mm@gmail.com> Message-ID: Subject: Re: [PATCH v2 1/2] selftests: Provide local define of min() and max() From: Sean Christopherson To: Mahmoud Maatuq Cc: keescook@chromium.org, edumazet@google.com, willemdebruijn.kernel@gmail.com, wad@chromium.org, luto@amacapital.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org, shuah@kernel.org, pabeni@redhat.com, linux-kselftest@vger.kernel.org, davem@davemloft.net, linux-kernel-mentees@lists.linuxfoundation.org, David Laight Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 25, 2023, Mahmoud Maatuq wrote: > to avoid manual calculation of min and max values > and fix coccinelle warnings such WARNING opportunity for min()/max() > adding one common definition that could be used in multiple files > under selftests. > there are also some defines for min/max scattered locally inside sources > under selftests. > this also prepares for cleaning up those redundant defines and include > kselftest.h instead. > > Signed-off-by: Mahmoud Maatuq > Suggested-by: David Laight > --- > changes in v2: > redefine min/max in a more strict way to avoid > signedness mismatch and multiple evaluation. > is_signed_type() moved from selftests/kselftest_harness.h > to selftests/kselftest.h. > --- > tools/testing/selftests/kselftest.h | 24 +++++++++++++++++++++ Heh, reminds me of https://xkcd.com/927. All of these #defines are available in tools/include/linux/kernel.h, and it's trivially easy for selftests to add all of tools/include to their include path. I don't see any reason for the selftests framework to define yet another version, just fix the individual tests.