cpp2ffi: add COMPILER argument to location iterator

This commit is contained in:
sonoro1234
2020-01-23 12:15:14 +01:00
parent fa9538889b
commit 677678af07
2 changed files with 13 additions and 3 deletions

View File

@@ -1290,7 +1290,7 @@ M.serializeTableF = function(t)
return M.serializeTable("defs",t).."\nreturn defs"
end
--iterates lines from a gcc/clang -E in a specific location
local function location(file,locpathT,defines)
local function location(file,locpathT,defines,COMPILER)
local define_re = "^#define%s+([^%s]+)%s+([^%s]+)$"
local number_re = "^-?[0-9]+u*$"
local hex_re = "0x[0-9a-fA-F]+u*$"
@@ -1300,6 +1300,7 @@ local function location(file,locpathT,defines)
else --gcc, clang
location_re = '^# (%d+) "([^"]*)"'
end
local path_reT = {}
for i,locpath in ipairs(locpathT) do
table.insert(path_reT,'^.*[\\/]('..locpath..')%.h$')
@@ -1325,6 +1326,7 @@ local function location(file,locpathT,defines)
if #line==0 then --nothing on emptyline
elseif not line:match("%S") then --nothing if only spaces
elseif line:sub(1,1) == "#" then
--elseif line:match"^%s*#" then
-- Is this a location pragma?
local loc_num_t,location_match = line:match(location_re)
if location_match then