public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled
@ 2023-04-26 12:49 Genjian
  2023-04-26 13:02 ` genjian zhang
  0 siblings, 1 reply; 10+ messages in thread
From: Genjian @ 2023-04-26 12:49 UTC (permalink / raw)
  To: tsbogend; +Cc: linux-mips, linux-kernel, zhanggenjian123, Genjian Zhang, k2ci

From: Genjian Zhang <zhanggenjian@kylinos.cn>

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
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.
Compilers report a lot of errors like the above.
Move '.if' into quoted strings to fix it.

Reported-by: k2ci <kernel-bot@kylinos.cn>
Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>
---
 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
+ * 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-13 23:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26 12:49 [PATCH] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled Genjian
2023-04-26 13:02 ` genjian zhang
2023-04-27  3:16   ` Randy Dunlap
2023-04-27  7:18     ` genjian zhang
2023-04-27 15:03       ` [PATCH v2] " Genjian
2023-04-28  3:20         ` kernel test robot
2023-04-28  7:13         ` genjian zhang
2023-04-28 12:06           ` Thomas Bogendoerfer
2023-05-13 20:35         ` kernel test robot
2023-05-13 23:19         ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox