summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-29 16:01:44 +0800
committerruki <[email protected]>2022-05-29 16:01:44 +0800
commit53e8d28f6f8f1ebe5bd33b7733aef9c878251f78 (patch)
treeb8b4317c652563767ef52c68d7d9e46a16564c44 /xmake/modules/core/tools/gcc.lua
parentef6baaf4b1d333d330d6c44810fc3544c1e5d8f5 (diff)
add linemarkers policy
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 79bc6a776..f154fb1ee 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -448,6 +448,17 @@ function _preprocess(program, argv, opt)
fdirectives_only = true
end
+ -- disable linemarkers?
+ local linemarkers = _g.linemarkers
+ if linemarkers == nil then
+ if os.isfile(os.projectfile()) and project.policy("preprocessor.linemarkers") == false then
+ linemarkers = false
+ else
+ linemarkers = true
+ end
+ _g.linemarkers = linemarkers
+ end
+
-- do preprocess
local cppfile = path.join(path.directory(objectfile), path.basename(objectfile) .. path.extension(sourcefile))
local cppfiledir = path.directory(cppfile)
@@ -460,6 +471,9 @@ function _preprocess(program, argv, opt)
if fdirectives_only then
table.insert(cppflags, "-fdirectives-only")
end
+ if linemarkers == false then
+ table.insert(cppflags, "-P")
+ end
table.insert(cppflags, "-o")
table.insert(cppflags, cppfile)
table.insert(cppflags, sourcefile)