diff mbox series

[v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled

Message ID 20230427150332.2978867-1-zhanggenjian@kylinos.cn (mailing list archive)
State Superseded
Headers show
Series [v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled | expand

Commit Message

Genjian April 27, 2023, 3:03 p.m. UTC
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 `('

Expands ___SYNC() macros. However, 'if' statement will be wrong
assembly.This Compilers report a lot of errors like the above.
this problem is caused by the #define of if() in
include/linux/compiler.h when CONFIG_PROFILE_ALL_BRANCHES
is set. 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 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

kernel test robot April 28, 2023, 3:20 a.m. UTC | #1
Hi Genjian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3 next-20230427]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
base:   linus/master
patch link:    https://lore.kernel.org/r/20230427150332.2978867-1-zhanggenjian%40kylinos.cn
patch subject: [PATCH v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled
config: mips-randconfig-s053-20230427 (https://download.01.org/0day-ci/archive/20230428/202304281115.mEqaC6GM-lkp@intel.com/config)
compiler: mipsel-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/6eb50851d61ca808629a062e0545704eba5be950
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
        git checkout 6eb50851d61ca808629a062e0545704eba5be950
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/dec/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304281115.mEqaC6GM-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/mips/dec/kn01-berr.c:104:34: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +104 arch/mips/dec/kn01-berr.c

69c75fb458cd81 Maciej W. Rozycki 2005-06-22   59  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   60  static int dec_kn01_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   61  {
a5fc9c0bbee8b9 Maciej W. Rozycki 2005-07-01   62  	volatile u32 *kn01_erraddr = (void *)CKSEG1ADDR(KN01_SLOT_BASE +
a5fc9c0bbee8b9 Maciej W. Rozycki 2005-07-01   63  							KN01_ERRADDR);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   64  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   65  	static const char excstr[] = "exception";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   66  	static const char intstr[] = "interrupt";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   67  	static const char cpustr[] = "CPU";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   68  	static const char mreadstr[] = "memory read";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   69  	static const char readstr[] = "read";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   70  	static const char writestr[] = "write";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   71  	static const char timestr[] = "timeout";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   72  	static const char paritystr[] = "parity error";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   73  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   74  	int data = regs->cp0_cause & 4;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   75  	unsigned int __user *pc = (unsigned int __user *)regs->cp0_epc +
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   76  				  ((regs->cp0_cause & CAUSEF_BD) != 0);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   77  	union mips_instruction insn;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   78  	unsigned long entrylo, offset;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   79  	long asid, entryhi, vaddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   80  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   81  	const char *kind, *agent, *cycle, *event;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   82  	unsigned long address;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   83  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   84  	u32 erraddr = *kn01_erraddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   85  	int action = MIPS_BE_FATAL;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   86  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   87  	/* Ack ASAP, so that any subsequent errors get caught. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   88  	dec_kn01_be_ack();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   89  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   90  	kind = invoker ? intstr : excstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   91  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   92  	agent = cpustr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   93  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   94  	if (invoker)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   95  		address = erraddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   96  	else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   97  		/* Bloody hardware doesn't record the address for reads... */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   98  		if (data) {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22   99  			/* This never faults. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  100  			__get_user(insn.word, pc);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  101  			vaddr = regs->regs[insn.i_format.rs] +
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  102  				insn.i_format.simmediate;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  103  		} else
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 @104  			vaddr = (long)pc;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  105  		if (KSEGX(vaddr) == CKSEG0 || KSEGX(vaddr) == CKSEG1)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  106  			address = CPHYSADDR(vaddr);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  107  		else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  108  			/* Peek at what physical address the CPU used. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  109  			asid = read_c0_entryhi();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  110  			entryhi = asid & (PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  111  			entryhi |= vaddr & ~(PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  112  			write_c0_entryhi(entryhi);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  113  			BARRIER;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  114  			tlb_probe();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  115  			/* No need to check for presence. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  116  			tlb_read();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  117  			entrylo = read_c0_entrylo0();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  118  			write_c0_entryhi(asid);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  119  			offset = vaddr & (PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  120  			address = (entrylo & ~(PAGE_SIZE - 1)) | offset;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  121  		}
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  122  	}
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  123  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  124  	/* Treat low 256MB as memory, high -- as I/O. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  125  	if (address < 0x10000000) {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  126  		cycle = mreadstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  127  		event = paritystr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  128  	} else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  129  		cycle = invoker ? writestr : readstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  130  		event = timestr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  131  	}
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  132  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  133  	if (is_fixup)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  134  		action = MIPS_BE_FIXUP;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  135  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  136  	if (action != MIPS_BE_FIXUP)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  137  		printk(KERN_ALERT "Bus error %s: %s %s %s at %#010lx\n",
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  138  			kind, agent, cycle, event, address);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  139  
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  140  	return action;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  141  }
69c75fb458cd81 Maciej W. Rozycki 2005-06-22  142
Genjian April 28, 2023, 7:13 a.m. UTC | #2
On Thu, Apr 27, 2023 at 11:05 PM Genjian <zhanggenjian123@gmail.com> wrote:
>
> 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 `('
>
> Expands ___SYNC() macros. However, 'if' statement will be wrong
> assembly.This Compilers report a lot of errors like the above.
> this problem is caused by the #define of if() in
> include/linux/compiler.h when CONFIG_PROFILE_ALL_BRANCHES
> is set. 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 | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/include/asm/sync.h b/arch/mips/include/asm/sync.h
> index aabd097933fe..56a4f6f6cdef 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,14 @@
>  /*
>   * Preprocessor magic to expand macros used as arguments before we insert them
>   * into assembly code.
> + * 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
>

This patch does not take into account the situation that CPU_HAS_SYNC
is not set. I will revise it later.

Thanks.
Thomas Bogendoerfer April 28, 2023, 12:06 p.m. UTC | #3
On Fri, Apr 28, 2023 at 03:13:32PM +0800, genjian zhang wrote:
> On Thu, Apr 27, 2023 at 11:05 PM Genjian <zhanggenjian123@gmail.com> wrote:
> >
> > 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 `('
> >
> > Expands ___SYNC() macros. However, 'if' statement will be wrong
> > assembly.This Compilers report a lot of errors like the above.
> > this problem is caused by the #define of if() in
> > include/linux/compiler.h when CONFIG_PROFILE_ALL_BRANCHES
> > is set. 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 | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/mips/include/asm/sync.h b/arch/mips/include/asm/sync.h
> > index aabd097933fe..56a4f6f6cdef 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,14 @@
> >  /*
> >   * Preprocessor magic to expand macros used as arguments before we insert them
> >   * into assembly code.
> > + * 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
> >
> 
> This patch does not take into account the situation that CPU_HAS_SYNC
> is not set. I will revise it later.

please post as a new mail not as a replay to this thread.

Thomas.
kernel test robot May 13, 2023, 8:35 p.m. UTC | #4
Hi Genjian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.4-rc1 next-20230512]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
base:   linus/master
patch link:    https://lore.kernel.org/r/20230427150332.2978867-1-zhanggenjian%40kylinos.cn
patch subject: [PATCH v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled
config: mips-decstation_defconfig (https://download.01.org/0day-ci/archive/20230514/202305140443.2830m30j-lkp@intel.com/config)
compiler: mipsel-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/6eb50851d61ca808629a062e0545704eba5be950
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
        git checkout 6eb50851d61ca808629a062e0545704eba5be950
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/mm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305140443.2830m30j-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/mips/mm/c-r3k.c:28:15: warning: no previous prototype for 'r3k_cache_size' [-Wmissing-prototypes]
      28 | unsigned long r3k_cache_size(unsigned long ca_flags)
         |               ^~~~~~~~~~~~~~
   arch/mips/mm/c-r3k.c:63:15: warning: no previous prototype for 'r3k_cache_lsize' [-Wmissing-prototypes]
      63 | unsigned long r3k_cache_lsize(unsigned long ca_flags)
         |               ^~~~~~~~~~~~~~~
   arch/mips/mm/c-r3k.c:286:6: warning: no previous prototype for 'r3k_cache_init' [-Wmissing-prototypes]
     286 | void r3k_cache_init(void)
         |      ^~~~~~~~~~~~~~
   {standard input}: Assembler messages:
   {standard input}:422: Error: non-constant expression in ".if" statement
   {standard input}: Error: end of file inside conditional
   {standard input}:422: Error: here is the start of the unterminated conditional
>> {standard input}: Warning: missing .end at end of assembly
kernel test robot May 13, 2023, 11:19 p.m. UTC | #5
Hi Genjian,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.4-rc1 next-20230512]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
base:   linus/master
patch link:    https://lore.kernel.org/r/20230427150332.2978867-1-zhanggenjian%40kylinos.cn
patch subject: [PATCH v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled
config: mips-decstation_defconfig (https://download.01.org/0day-ci/archive/20230514/202305140702.w0bg48FH-lkp@intel.com/config)
compiler: mipsel-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/6eb50851d61ca808629a062e0545704eba5be950
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
        git checkout 6eb50851d61ca808629a062e0545704eba5be950
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305140702.w0bg48FH-lkp@intel.com/

All errors (new ones prefixed by >>):

   init/main.c:779:20: warning: no previous prototype for 'arch_post_acpi_subsys_init' [-Wmissing-prototypes]
     779 | void __init __weak arch_post_acpi_subsys_init(void) { }
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
   init/main.c:791:20: warning: no previous prototype for 'mem_encrypt_init' [-Wmissing-prototypes]
     791 | void __init __weak mem_encrypt_init(void) { }
         |                    ^~~~~~~~~~~~~~~~
   init/main.c:793:20: warning: no previous prototype for 'poking_init' [-Wmissing-prototypes]
     793 | void __init __weak poking_init(void) { }
         |                    ^~~~~~~~~~~
   {standard input}: Assembler messages:
   {standard input}:2288: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
>> {standard input}:2288: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:131: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:131: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:245: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:245: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:139: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:898: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:67: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:149: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   arch/mips/kernel/syscall.c:51:16: warning: no previous prototype for 'sysm_pipe' [-Wmissing-prototypes]
      51 | asmlinkage int sysm_pipe(void)
         |                ^~~~~~~~~
   {standard input}: Assembler messages:
   {standard input}:356: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:356: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:178: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:878: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:90: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:169: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:35: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:513: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:100: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:138: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
--
   {standard input}: Assembler messages:
   {standard input}:44: Error: non-constant expression in ".if" statement
>> {standard input}: Error: end of file inside conditional
   {standard input}:332: Error: here is the start of the unterminated conditional
   {standard input}: Warning: missing .end at end of assembly
..
diff mbox series

Patch

diff --git a/arch/mips/include/asm/sync.h b/arch/mips/include/asm/sync.h
index aabd097933fe..56a4f6f6cdef 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,14 @@ 
 /*
  * Preprocessor magic to expand macros used as arguments before we insert them
  * into assembly code.
+ * 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)					\