summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-29 22:48:46 +0800
committerruki <[email protected]>2024-11-29 22:48:46 +0800
commit780e73424b778b7fa5b7ac7f170459dcc49c6f7c (patch)
tree23bf4cf1218e1e4a735ce3ce91f886fbc7b18f84
parentaedfd1c46c942392fbfefb1750f2cd3bde6d1e6c (diff)
get more warnings output
-rw-r--r--xmake/modules/core/tools/gcc.lua17
1 files changed, 15 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 08f898c8e..9e1a658a7 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -755,6 +755,15 @@ function _preprocess(program, argv, opt)
if linemarkers == false then
table.insert(cppflags, "-P")
end
+ -- if we want to support pch for gcc, we need to enable this flag
+ -- and clang need not this flag, it will use '-include-pch' to include and preprocess header files
+ -- but it will be slower than non-ccache mode.
+ --
+ -- @see https://github.com/xmake-io/xmake/issues/5858
+ -- https://musescore.org/en/node/182331
+ if is_gcc then
+ table.insert(cppflags, "-fpch-preprocess")
+ end
table.insert(cppflags, "-o")
table.insert(cppflags, cppfile)
table.insert(cppflags, sourcefile)
@@ -801,8 +810,12 @@ function _compile_preprocessed_file(program, cppinfo, opt)
end
local outdata, errdata = os.iorunv(program, argv, opt)
-- we need to get warning information from output
- cppinfo.outdata = outdata
- cppinfo.errdata = errdata
+ if outdata then
+ cppinfo.outdata = (cppinfo.outdata or "") .. outdata
+ end
+ if errdata then
+ cppinfo.errdata = (cppinfo.errdata or "") .. errdata
+ end
end
-- do compile