Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4969976rwb; Mon, 31 Jul 2023 15:50:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAlHPLtWtGXXyaDrTMWI50xxHLgZivG8qzRgR28qEU2eI53oqiF08Z2gDmHn5+J3/M/RHw X-Received: by 2002:adf:ed4c:0:b0:314:44c8:aa98 with SMTP id u12-20020adfed4c000000b0031444c8aa98mr963020wro.67.1690843837199; Mon, 31 Jul 2023 15:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690843837; cv=none; d=google.com; s=arc-20160816; b=JGLVMuEEhqkq3Io1bl7NsaC96H68pH/FjySRwbzvZRwch/NWhCOwGIgxbku6HjHL/1 3rdw2s//FDjDidx0I00PQ7IIEeyYL+5oufNa+h3TUL+0CFVPWxG+HEG3lSzAPi7hj7wa LJdABPLOLsH4qjiSig73nj8l8EEF22qo9JqufHPiuAqQfKiKdDmFPiTiWUgRTUOgLKV6 ScbG8OGbwgouy299EfyHohQPSdLBzy1GFnd4x1QuWn2bdh1wVEkLWZkgImRt0fbavLit jx6l3Y9bBitvOHmZoTp20iv6yfNW51Mnqj98ulaDTso/VW3T/SFP6pi3anuNSA966DuE MnuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y5fZa3nxgrAxiLRg3xh5740CS3A9Y0a1suHTQV4f7qE=; fh=TKT6BwOlGJrEdTj5J9iYvVJ5gOaltQayamM1huSPlCo=; b=sF+1Fg+z7YKr2lfToPTLEo6dzianPq9P8vaBXcSaMewkYZFUUVbHguI2DtqCk1VO/3 YZgtyp4Zk3ap0K6XFh4FuW/AGTYgxTYiygzTK9yzMjpBiT8rPoH0xaYyvOTb/ihK3DF7 lzoAk7FePmORbiArtjzPyWObnIkVxP6b5qIWohVLQq5kcXX8ozB/3Kr986kAKXPO2s0P 9YbFQgTVeRoHZow3JNVluO4ntaE9GaUgBjJDxxKu+kRbzd4htiTIFY4t3t2dog+M9RQU eCbICNTarvbZIVAHe0LQdwdg0J4q5+fJXofarrV5msqd0rMUeZ7YaWQB6QBTNX084vtk mWng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BRGq3BOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba11-20020a0564021acb00b00522384df47fsi7843128edb.319.2023.07.31.15.50.12; Mon, 31 Jul 2023 15:50:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BRGq3BOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjGaVQp (ORCPT + 99 others); Mon, 31 Jul 2023 17:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjGaVQn (ORCPT ); Mon, 31 Jul 2023 17:16:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7472110E3; Mon, 31 Jul 2023 14:16:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04529612DC; Mon, 31 Jul 2023 21:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3CDEC433C8; Mon, 31 Jul 2023 21:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690838201; bh=xcTqF7aOrNrqWKo1l81zdilo1yPMMlcZ5Ml2JwWWdb8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BRGq3BOfZl80YdgbPrb8M6ohUD9whYS9/PsDu6NVEknEnY3dd4+SKNBze0XeaBZAv 7ZeObuIDTBvBEf6U4o0TQabfkPafjWyaLejNGzUPwSGyBNb15aMJkI30oOCF/MUQTN tTX2S4GI3oso1b5Mrl2moGGMWVzc81jJy/8vTTHQQM9eJG/0wzf8DRC6/4RTR4xFkk F8KPx2pqslJIHiHPRKNIdR1TplXa3nrjh2I5Ddlg5GzgVOpH+BOvjgRDngBRdGez94 0LV8nAsGA5jwpG7wJqxMTSDp0/0/gjPpK/zWBCMxXI4epT5EJ1hTC7XJA/W+s1Zdaw fPFt4wRcCB4GA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 64F7040096; Mon, 31 Jul 2023 18:16:38 -0300 (-03) Date: Mon, 31 Jul 2023 18:16:38 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Kan Liang , Eduard Zingerman , Andrii Nakryiko , Gaosheng Cui , Rob Herring , linux-perf-users , LKML , bpf , llvm@lists.linux.dev Subject: Re: [PATCH v1 4/6] perf build: Disable fewer flex warnings Message-ID: References: <20230728064917.767761-1-irogers@google.com> <20230728064917.767761-5-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Jul 28, 2023 at 12:05:56PM -0700, Ian Rogers escreveu: > On Fri, Jul 28, 2023, 11:43 AM Arnaldo Carvalho de Melo > > > I haven't checked, lemme do it now. > > It comes directly from flex's m4 files: > > https://github.com/westes/flex/blob/master/src/c99-flex.skl#L2044 > > So I'll keep the -Wno-misleading-indentation, ok? > Makes sense, yes. continuing, changed the version check to: commit f4da4419574536691c6b7843b6c48a3f97240404 Author: Ian Rogers Date: Thu Jul 27 23:49:15 2023 -0700 perf build: Disable fewer flex warnings If flex is version 2.6.4, reduce the number of flex C warnings disabled. Earlier flex versions have all C warnings disabled. Committer notes: Added this to the list of ignored warnings to get it building on a Fedora 36 machine with flex 2.6.4: -Wno-misleading-indentation Noticed when building with: $ make LLVM=1 -C tools/perf NO_BPF_SKEL=1 DEBUG=1 Take two: We can't just try to canonicalize flex versions by just removing the dots, as we end up with: 2.6.4 >= 2.5.37 becoming: 264 >= 2537 Failing the build on flex 2.5.37, so instead use the back to the past added $(call version_ge3,2.6.4,$(FLEX_VERSION)) variant to check for that. Making sure $(FLEX_VERSION) keeps the dots as we may want to use 'sort -V' or something nicer when available everywhere. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andrii Nakryiko Cc: Eduard Zingerman Cc: Gaosheng Cui Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Rob Herring Cc: Tom Rix Cc: bpf@vger.kernel.org Cc: llvm@lists.linux.dev Link: https://lore.kernel.org/r/20230728064917.767761-5-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo diff --git a/tools/perf/util/Build b/tools/perf/util/Build index bb08149179e405ac..ae91e2786f1a4f55 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -1,3 +1,5 @@ +include $(srctree)/tools/scripts/utilities.mak + perf-y += arm64-frame-pointer-unwind-support.o perf-y += addr_location.o perf-y += annotate.o @@ -279,13 +281,11 @@ $(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filt $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \ -o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_ -FLEX_GE_26 := $(shell expr $(shell $(FLEX) --version | sed -e 's/flex \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 26) -ifeq ($(FLEX_GE_26),1) - flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls -Wno-sign-compare -Wno-unused-parameter -Wno-missing-prototypes -Wno-missing-declarations - CC_HASNT_MISLEADING_INDENTATION := $(shell echo "int main(void) { return 0 }" | $(CC) -Werror -Wno-misleading-indentation -o /dev/null -xc - 2>&1 | grep -q -- -Wno-misleading-indentation ; echo $$?) - ifeq ($(CC_HASNT_MISLEADING_INDENTATION), 1) - flex_flags += -Wno-misleading-indentation - endif +FLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2) + +FLEX_GE_264 := $(call version_ge3,2.6.4,$(FLEX_VERSION)) +ifeq ($(FLEX_GE_264),1) + flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation else flex_flags := -w endif -------------------------------------------------------------------------- with version_ge3 being: commit aa9e655a4d755c3c75eb3d200d87a3b695f602cf Author: Arnaldo Carvalho de Melo Date: Mon Jul 31 16:19:21 2023 -0300 tools build: Add a 3-component greater or equal version comparator The next cset needs to compare if a flex version is greater or equal than another, but since there is no canonical, generally available way to compare versions in the command line (sort -V, yeah, but...), just use awk to canonicalize the versions like is also done in scripts/rust_is_available.sh. Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo diff --git a/tools/scripts/utilities.mak b/tools/scripts/utilities.mak index 172e47273b5d995a..568a6541ecf98075 100644 --- a/tools/scripts/utilities.mak +++ b/tools/scripts/utilities.mak @@ -177,3 +177,13 @@ $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) endef _ge_attempt = $(or $(get-executable),$(call _gea_err,$(2))) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) + +# version-ge3 +# +# Usage $(call version_ge3,2.6.4,$(FLEX_VERSION)) +# +# To compare if a 3 component version is greater or equal to anoter, first use +# was to check the flex version to see if we can use compiler warnings as +# errors for one of the cases flex generates code C compilers complains about. +# +version_ge3 = $(shell awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }' <<< "$(1).$(2)")