This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 877ea4f8d81f13634671328cc54369b12e76f9c5
Author: wangjianyu3 <[email protected]>
AuthorDate: Thu Sep 17 02:02:21 2026 +0800

    arch/x86: Add -P to CPP to suppress linemarkers.
    
    The x86 CPP definition used `gcc -E -x c` without `-P`, unlike every
    other arch's Toolchain.defs (arm, risc-v, avr, mips, misoc, or1k, z16,
    z80 all pass `-E -P -x c`). Without `-P`, cpp emits GNU linemarker
    lines (e.g. `# 0 "file"`) into its preprocessed output.
    
    boards/Board.mk's PREPROCESS macro runs RCSRCS init.rc files through
    $(CPP) before feeding them to apps/system/nxinit's parser. The parser
    (apps/system/nxinit/parser.c) matches each line against known section
    keywords ("on", "service", ...) with strncmp(); a leading linemarker
    line does not match any keyword and the parser returns -EINVAL, so
    any board that preprocesses an nxinit init.rc under x86 fails to
    parse it at boot.
    
    Reproduced independently on the host toolchain: `gcc -E -x c` on a
    minimal init.rc emits `# 0 "file"` lines; `gcc -E -P -x c` on the
    same input produces clean `service`/`on` lines only.
    
    Assisted-by: Claude:claude-sonnet-5
    Signed-off-by: wangjianyu3 <[email protected]>
---
 arch/x86/src/common/Toolchain.defs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/src/common/Toolchain.defs 
b/arch/x86/src/common/Toolchain.defs
index 0c6bf27dde6..3ef04adb599 100644
--- a/arch/x86/src/common/Toolchain.defs
+++ b/arch/x86/src/common/Toolchain.defs
@@ -57,7 +57,7 @@ CROSSDEV ?= i686-elf-
 endif
 
 CC = $(CROSSDEV)gcc
-CPP = $(CROSSDEV)gcc -E -x c
+CPP = $(CROSSDEV)gcc -E -P -x c
 LD = $(CROSSDEV)ld
 STRIP = $(CROSSDEV)strip --strip-unneeded
 AR = $(CROSSDEV)ar rcs

Reply via email to