mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 06:51:51 +08:00
d7b891ddd0
Some SDK/host GCC configurations, when meson invokes cc.preprocess() to expand fcobjshash.gperf.h, produce output that includes predefined macro dumps (e.g. #define __STDC__ 1) alongside linemarker lines. The upstream cutout.py script, which strips CUT_OUT_BEGIN/END-delimited sections from the preprocessed output before feeding it to gperf, passes these lines through verbatim into fcobjshash.gperf. gperf then copies them into the declarations section of fcobjshash.h. When fcobjs.c includes fcobjshash.h, the compiler encounters #define redefinitions and stray # tokens, causing a build failure. Fix cutout.py to skip any line starting with # (C preprocessor linemarkers and predefined macro definitions) before writing to the output gperf file. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
12 lines
411 B
Diff
12 lines
411 B
Diff
--- a/src/cutout.py
|
|
+++ b/src/cutout.py
|
|
@@ -19,6 +19,8 @@ if __name__== '__main__':
|
|
|
|
if write and l:
|
|
stripped = re.sub(r'^\s+', '', l)
|
|
+ if stripped.startswith('#'):
|
|
+ continue
|
|
stripped = re.sub(r'\s*,\s*', ',', stripped)
|
|
if not stripped.isspace() and stripped:
|
|
out.write('%s\n' % stripped)
|