Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp68987rwr; Wed, 26 Apr 2023 20:52:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BGcD45ookh6hMMRwxy2BqbUSFQdb3WwD5KEATKvfESCYz0ixNKFNAB41SoOPXOo2gGHIR X-Received: by 2002:a05:6a21:329f:b0:f0:a282:a343 with SMTP id yt31-20020a056a21329f00b000f0a282a343mr266334pzb.16.1682567521406; Wed, 26 Apr 2023 20:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682567521; cv=none; d=google.com; s=arc-20160816; b=IlzkU3HPN6mU/r+EK2nCTJwyg3qXf2ifux66sumZxBX3xnVPyr/lo6HOEHAqHScxqI Q8Sxnv0cfQJGR1zsZvfYYS86PLZLN8/B1DREjl37ebdZQcyyc09TACUwYzCsADMyZqpt mP/vjxRGp8yYF2LtGD2GI9HyWEbDD8XnjpLUu0tslvVAxU5XPBy3kPmMMq97kSjU6kbN 9gDi81MjovmBF8hznO9zSI4FEIMYR7eZQIOLsvUMh7GNDUc6UQgla1NssTORckaMOHlY F+APhZCPfdFyErCdjBfHPsFOWiNU66xH4cHx7DVeylamw2BSegIeHCJmaOYN0wjQrexu JbxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=f57Zj/04myr3002sVqcVQkqmm+HfOyku1xoDDfbgmL0=; b=atMiZHHD33QbofYCJ+QpnDK97pow4+TnzoK1ef6mwRT+XDPu5IPcLE3fz/GlzTh7PW vkDUqQbi6VLthwmT5nFl1Jm7aBQhtQLGbsyUX1nSdbo3UAg52uWqE9MgtHoyx9EqDrQk uz/RSqZxhEjrafvoX35mwKnEDMx1hK3xpIzwQfgrgyoBgs6LL9MqLeQP8frUDcJ4mB+Q SaQBhnvQaMaH5Cz27F65JFWklTgHsE44DpCOEch1yNeKCiDdIqfwBaY+7FYxPrF6YTX/ Gyn4vZOnWk6s5b+mo6geNYLiiw8mATSdw7a/ta/+LvMIn8nmgnYH5uJvGeXnd4hS64xj KeqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=x7j9Cudl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m184-20020a6326c1000000b004ff6f91fa75si17963255pgm.445.2023.04.26.20.51.45; Wed, 26 Apr 2023 20:52:01 -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=@infradead.org header.s=bombadil.20210309 header.b=x7j9Cudl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242836AbjD0DQl (ORCPT + 99 others); Wed, 26 Apr 2023 23:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbjD0DQk (ORCPT ); Wed, 26 Apr 2023 23:16:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95D635A6; Wed, 26 Apr 2023 20:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=f57Zj/04myr3002sVqcVQkqmm+HfOyku1xoDDfbgmL0=; b=x7j9CudlY7a1euI+PbiS85v+KR BRossHnSmCv4GPvBF5aCAXqSRVM31zSZyHrVcYHC82iVfUGEuyNK9Za2v0Hju1HxWyQEazDPe3bzC 7bvxRd9YHHMDTC85XvT+F494X1E8b9T+6JjOGuFhiYutabbx3TatB9vWgDslKV90qj9+yR+Vc/uJN t6X5TMJYzqKvlwf9K6d2xLi0urE5mxhDXeJ2zNY6Eh2BXdHRvE4oWctbDR6Vz/6O91K75RWEWfCHR eiDW3bM/tv9Bt0GxqEXmBCUHMBuefOJ0SLDjiEBw34U1sk3K4eoNDyn40Sfx/lGwbYJGMOLNGC4Ta MsFj4dpg==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1prs7V-005L2i-0H; Thu, 27 Apr 2023 03:16:33 +0000 Message-ID: <17660b99-d68d-328e-5fe6-c011709fa3e4@infradead.org> Date: Wed, 26 Apr 2023 20:16:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled Content-Language: en-US To: genjian zhang , tsbogend@alpha.franken.de Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Genjian Zhang , k2ci References: <20230426124948.1072216-1-zhanggenjian@kylinos.cn> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 Hi-- > > Maybe the readability of this modification is not very good. Any > comments and suggestions are welcome. Thanks. Some of the patch description could use some cleaning up, then I have a question. On 4/26/23 06:02, genjian zhang wrote: > On Wed, Apr 26, 2023 at 8:51 PM Genjian wrote: >> >> From: Genjian Zhang >> >> compiler error (mips-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110): >> >> {standard input}: Assembler messages: >> {standard input}:171: Error: found '(', expected: ')' >> {standard input}:171: Error: found '(', expected: ')' >> {standard input}:171: Error: non-constant expression in ".if" statement >> {standard input}:171: Error: junk at end of line, first unrecognized >> character is `(' >> >> Preprocessor expand ___SYNC () macros.However,'if' will be wrongly expands ___SYNC() macros. However, 'if' will be wrongly >> replaced by C code when PROFILE_ALL_BRANCHES is enabled and ___SYNC >> is used in inline assembly.This leads to syntax errors in the code. assembly. This >> Compilers report a lot of errors like the above. >> Move '.if' into quoted strings to fix it. >> >> Reported-by: k2ci >> Signed-off-by: Genjian Zhang >> --- >> arch/mips/include/asm/sync.h | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/arch/mips/include/asm/sync.h b/arch/mips/include/asm/sync.h >> index aabd097933fe..d9f5a87424e7 100644 >> --- a/arch/mips/include/asm/sync.h >> +++ b/arch/mips/include/asm/sync.h >> @@ -175,7 +175,7 @@ >> */ >> #ifdef CONFIG_CPU_HAS_SYNC >> # define ____SYNC(_type, _reason, _else) \ >> - .if (( _type ) != -1) && ( _reason ); \ >> + ((_type) != -1) && (_reason); \ >> .set push; \ >> .set MIPS_ISA_LEVEL_RAW; \ >> .rept __SYNC_rpt(_type); \ >> @@ -192,13 +192,15 @@ >> /* >> * Preprocessor magic to expand macros used as arguments before we insert them >> * into assembly code. >> + * In addition,‘if’ can not be substituted when CONFIG_PROFILE_ALL_BRANCHES is * In addition, 'if' cannot be >> + * enabled. >> */ >> #ifdef __ASSEMBLY__ >> # define ___SYNC(type, reason, else) \ >> - ____SYNC(type, reason, else) >> + .if ____SYNC(type, reason, else) >> #else >> # define ___SYNC(type, reason, else) \ >> - __stringify(____SYNC(type, reason, else)) >> + ".if" __stringify(____SYNC(type, reason, else)) >> #endif >> >> #define __SYNC(type, reason) \ >> -- >> 2.25.1 Is this problem that you are fixing being aggravated (caused) by the #define of if() in include/linux/compiler.h when CONFIG_PROFILE_ALL_BRANCHES is set? I suspect that it is. It wouldn't hurt to mention that (if I am correct). Thanks. -- ~Randy