mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 11:58:30 +01:00
cpp2ffi: guess compiler error
This commit is contained in:
@@ -1267,6 +1267,7 @@ local function printItems(items)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-------------
|
-------------
|
||||||
|
local numerr = 0 --for popen error file
|
||||||
function M.Parser()
|
function M.Parser()
|
||||||
local par = {}
|
local par = {}
|
||||||
local cdefs ={}
|
local cdefs ={}
|
||||||
@@ -1310,7 +1311,9 @@ function M.Parser()
|
|||||||
if self.COMMENTS_GENERATION then
|
if self.COMMENTS_GENERATION then
|
||||||
cmd_line = cmd_line .. (compiler=="cl" and " /C " or " -C ")
|
cmd_line = cmd_line .. (compiler=="cl" and " /C " or " -C ")
|
||||||
end
|
end
|
||||||
local pipe,err = io.popen(cmd_line,"r")
|
numerr = numerr + 1
|
||||||
|
local errfile = "err"..numerr..".txt"
|
||||||
|
local pipe,err = io.popen(cmd_line.." 2>"..errfile,"r")
|
||||||
if not pipe then
|
if not pipe then
|
||||||
error("could not execute COMPILER "..err)
|
error("could not execute COMPILER "..err)
|
||||||
end
|
end
|
||||||
@@ -1320,8 +1323,18 @@ function M.Parser()
|
|||||||
self:insert(line, tostring(loca)..":"..tostring(loca2))
|
self:insert(line, tostring(loca)..":"..tostring(loca2))
|
||||||
table.insert(preprocessed,line)--
|
table.insert(preprocessed,line)--
|
||||||
end
|
end
|
||||||
save_data("preprocesed.h",table.concat(preprocessed,"\n"))
|
|
||||||
pipe:close()
|
pipe:close()
|
||||||
|
--print(#preprocessed, "lines processed")
|
||||||
|
save_data("preprocesed.h",table.concat(preprocessed,"\n"))
|
||||||
|
|
||||||
|
local f = assert(io.open(errfile,"r"))
|
||||||
|
local errstr = f:read"*a"
|
||||||
|
f:close()
|
||||||
|
--print(#errstr,"errstr")
|
||||||
|
print(errstr)
|
||||||
|
--try to guess a compiler error
|
||||||
|
assert(not errstr:match" error")
|
||||||
|
os.remove(errfile)
|
||||||
return defines
|
return defines
|
||||||
end
|
end
|
||||||
function par:do_parse()
|
function par:do_parse()
|
||||||
|
Reference in New Issue
Block a user