make: have preprocess2file fail on error

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 7bf1c79cb5f62c4ce5c9fff8211e434bfa09e994
Author: Aidan MacDonald <[email protected]>
Date:   Thu Mar 5 15:05:58 2026 +0000

    make: have preprocess2file fail on error
    
    The preprocess2file helper is mainly used to preprocess
    linker scripts, but piping the preprocessor output to
    'grep' masks the exit code of gcc, so if it fails (eg.
    due to an #error directive) then it does not cause the
    build to fail like it should.
    
    In this particular case the grep commands don't seem to
    be doing anything, since the "-P" option suppresses line
    markers, which "grep -v ^$(_hash)" is probably meant to
    filter out. The intent behind "grep -v ^$$" is unclear
    since the preprocessor doesn't seem to output any line
    beginning with '$', but in any event it seems unnecessary.
    
    Change-Id: Ie23f5de1fe1bfb5890c7b2f3c7fa05401931d89f

diff --git a/tools/functions.make b/tools/functions.make
index ccb23102fc..d3fad449bb 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -24,8 +24,7 @@ preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) |
 		grep -v "^$(_hash_)" | grep -v "^ *$$" | \
 		sed -e 's:^..*:$(dir $(1))&:')
 
-preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
-		grep -v '^$(_hash_)' | grep -v "^$$" > $(2))
+preprocess2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) -o $(2)
 
 asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \
 	perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $(2)
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.