Hi Greg, Thanks for the prompt response. I haven't try the latest patch yet. I feel it is the problem of my setup rather than the patch itself. The previous point I made was incorrect. The hard_preempt_disable macro is a statement-embedded expression supported by GNU so there is no problem at all (I was not aware of this). That said, I still cannot figure out why my compiler report errors on codes that seems absolutely fine. I attached my errors and my patch here in case you would bother to take a look at it.
Regards, Yunjie On Tue, 19 Apr 2022 at 00:25, Greg Gallagher <g...@embeddedgreg.com> wrote: > > > On Mon, Apr 18, 2022 at 7:21 PM Yunjie Gu via Xenomai <xenomai@xenomai.org> > wrote: > >> Hi All, >> >> I'm trying to use xenomai on linux 5.4. I previously used xenomai 3.0 on >> linux 4.9 and xenomai 3.1 on linux 4.19 and both were fine. However when I >> use xenomai 3.2.1 on linux 5.4 there are errors in compile. One of the >> errors says >> expected expression before ')' token (__flags) = hard_preempt_disable(); >> for the macro below in fpsimd.c: >> #define get_cpu_fpsimd_context(__flags) \ do { \ (__flags) = >> hard_preempt_disable(); \ __get_cpu_fpsimd_context(); \ } while (0) >> >> hard_preempt_disable is also a macro defined in preempt.h: >> #define hard_preempt_disable() \ ({ \ unsigned long __flags__; \ __flags__ >> = hard_local_irq_save(); \ if (__ipipe_root_p) \ preempt_disable(); \ >> __flags__; \ }) >> >> It is clear that hard_preempt_disable() should be a function-like macro >> but >> is actually not. It seems to me that there are inconsistencies in the >> ipipe >> patch I used. I used ipipe-core-5.4.72-arm64-0.patch. Anyone has a >> suggestion on I can I resolve this issue? >> >> Best Regards, >> Yunjie > > > Have you tried the latest patch? The mainline release doesn’t have this > issue. I’m about to release the next patch. > > -Greg > >> >> -------------- next part -------------- CALL scripts/atomic/check-atomics.sh CALL scripts/checksyscalls.sh CHK include/generated/compile.h make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop. make[1]: *** Waiting for unfinished jobs.... Makefile:1652: recipe for target 'certs' failed make: *** [certs] Error 2 make: *** Waiting for unfinished jobs.... CC arch/arm64/kernel/fpsimd.o CC arch/arm64/kernel/sys.o arch/arm64/kernel/fpsimd.c: In function 'fpsimd_restore_current_state': arch/arm64/kernel/fpsimd.c:174:11: error: expected expression before ')' token 174 | (__flags) = hard_preempt_disable(); \ | ^ arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 'get_cpu_fpsimd_context' 1212 | get_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ./include/linux/bottom_half.h:5, from arch/arm64/kernel/fpsimd.c:11: ./include/linux/preempt.h:259:3: error: '__flags__' undeclared (first use in this function); did you mean 'vm_flags_t'? 259 | __flags__ = hard_local_irq_save(); \ | ^~~~~~~~~ arch/arm64/kernel/fpsimd.c:174:15: note: in expansion of macro 'hard_preempt_disable' 174 | (__flags) = hard_preempt_disable(); \ | ^~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 'get_cpu_fpsimd_context' 1212 | get_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ ./include/linux/preempt.h:259:3: note: each undeclared identifier is reported only once for each function it appears in 259 | __flags__ = hard_local_irq_save(); \ | ^~~~~~~~~ arch/arm64/kernel/fpsimd.c:174:15: note: in expansion of macro 'hard_preempt_disable' 174 | (__flags) = hard_preempt_disable(); \ | ^~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 'get_cpu_fpsimd_context' 1212 | get_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ./arch/arm64/include/asm/irqflags.h:12, from ./include/linux/irqflags.h:16, from ./include/linux/spinlock.h:54, from ./include/linux/seqlock.h:36, from ./include/linux/time.h:6, from ./include/linux/compat.h:10, from arch/arm64/kernel/fpsimd.c:14: ./arch/arm64/include/asm/ipipe_hwirq.h:36:10: error: expected expression before ')' token 36 | : "r" (x) \ | ^ ./arch/arm64/include/asm/ipipe_hwirq.h:134:35: note: in expansion of macro 'hard_local_irq_restore_notrace' 134 | #define hard_local_irq_restore hard_local_irq_restore_notrace | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/preempt.h:269:4: note: in expansion of macro 'hard_local_irq_restore' 269 | hard_local_irq_restore(__flags__); \ | ^~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:181:3: note: in expansion of macro 'hard_preempt_enable' 181 | hard_preempt_enable(__flags); \ | ^~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:1219:2: note: in expansion of macro 'put_cpu_fpsimd_context' 1219 | put_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ./arch/arm64/include/asm/irqflags.h:12, from ./include/linux/irqflags.h:16, from ./include/linux/spinlock.h:54, from ./include/linux/seqlock.h:36, from ./include/linux/time.h:6, from ./include/linux/compat.h:10, from arch/arm64/kernel/fpsimd.c:14: ./arch/arm64/include/asm/ipipe_hwirq.h:85:41: error: too few arguments to function 'arch_irqs_disabled_flags' 85 | #define hard_irqs_disabled_flags(flags) arch_irqs_disabled_flags(flags) | ^~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/preempt.h:270:9: note: in expansion of macro 'hard_irqs_disabled_flags' 270 | if (!hard_irqs_disabled_flags(__flags__)) \ | ^~~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:181:3: note: in expansion of macro 'hard_preempt_enable' 181 | hard_preempt_enable(__flags); \ | ^~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:1219:2: note: in expansion of macro 'put_cpu_fpsimd_context' 1219 | put_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ ./arch/arm64/include/asm/ipipe_hwirq.h:71:19: note: declared here 71 | static inline int arch_irqs_disabled_flags(unsigned long flags) | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from ./arch/arm64/include/asm/irqflags.h:12, from ./include/linux/irqflags.h:16, from ./include/linux/spinlock.h:54, from ./include/linux/seqlock.h:36, from ./include/linux/time.h:6, from ./include/linux/compat.h:10, from arch/arm64/kernel/fpsimd.c:14: ./arch/arm64/include/asm/ipipe_hwirq.h:36:10: error: expected expression before ')' token 36 | : "r" (x) \ | ^ ./arch/arm64/include/asm/ipipe_hwirq.h:134:35: note: in expansion of macro 'hard_local_irq_restore_notrace' 134 | #define hard_local_irq_restore hard_local_irq_restore_notrace | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/preempt.h:273:4: note: in expansion of macro 'hard_local_irq_restore' 273 | hard_local_irq_restore(__flags__); \ | ^~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:181:3: note: in expansion of macro 'hard_preempt_enable' 181 | hard_preempt_enable(__flags); \ | ^~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/fpsimd.c:1219:2: note: in expansion of macro 'put_cpu_fpsimd_context' 1219 | put_cpu_fpsimd_context(); | ^~~~~~~~~~~~~~~~~~~~~~ scripts/Makefile.build:265: recipe for target 'arch/arm64/kernel/fpsimd.o' failed make[2]: *** [arch/arm64/kernel/fpsimd.o] Error 1 make[2]: *** Waiting for unfinished jobs.... scripts/Makefile.build:509: recipe for target 'arch/arm64/kernel' failed make[1]: *** [arch/arm64/kernel] Error 2 Makefile:1652: recipe for target 'arch/arm64' failed make: *** [arch/arm64] Error 2 GEN kernel/xenomai/posix/syscall_entries.h CC kernel/xenomai/posix/syscall.o AR kernel/xenomai/posix/built-in.a AR kernel/xenomai/built-in.a AR kernel/built-in.a make: *** wait: No child processes. Stop. -------------- next part -------------- A non-text attachment was scrubbed... Name: ipipe-core-5.4.72-arm64-0_.pat Type: image/x-gimp-pat Size: 515416 bytes Desc: not available URL: <http://xenomai.org/pipermail/xenomai/attachments/20220419/25e09d66/attachment.bin>