浏览代码

tools/generate_native_sdk: add missing -ffreestanding

In some environments, the parse_file function in the
tools/generate_native_sdk/parse_c_decl.py script
does not add the -ffreestanding parameter to the
gcc call, which causes the __STDC_HOSTED__
macro to be incorrectly set to 1.
If we add -ffreestanding, then this compiler
predefined macro will be set to 0

Signed-off-by: HaoranJiang <halfsweet@halfsweet.cn>
HalfSweet 4 月之前
父节点
当前提交
82ae671427
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      tools/generate_native_sdk/parse_c_decl.py

+ 1 - 0
tools/generate_native_sdk/parse_c_decl.py

@@ -265,6 +265,7 @@ def parse_file(filename, filenames, func, internal_sdk_build=False, compiler_fla
     if not os.path.isfile(filename):
         raise Exception("Invalid filename: " + filename)
 
+    args.append("-ffreestanding")
     index = clang.cindex.Index.create()
     tu = index.parse(filename, args=args, options=clang.cindex.TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD)