diff options
| author | Arthur LAURENT <[email protected]> | 2024-01-30 18:08:17 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-01-30 19:42:42 +0100 |
| commit | 8e10652f4f08566ee5c1099d928e75cdefb040d0 (patch) | |
| tree | dff66a0cc98b6098fdc5945514d20823d84b82c6 /xmake/rules/c++/modules/modules_support | |
| parent | a2ccc580a274200d889d199094e7201076594f0d (diff) | |
revert last commit
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
5 files changed, 20 insertions, 11 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang/builder.lua b/xmake/rules/c++/modules/modules_support/clang/builder.lua index 184ebbdf5..1b414215f 100644 --- a/xmake/rules/c++/modules/modules_support/clang/builder.lua +++ b/xmake/rules/c++/modules/modules_support/clang/builder.lua @@ -89,9 +89,11 @@ function _compile(target, flags, cppfile) if not dryrun then -- do compile if msvc then - try{function() return os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()}) end} + local _, err = os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()}) + assert(err, err) else - try{function() return os.iorunv(compinst:program(), flags) end} + local _, err = os.iorunv(compinst:program(), flags) + assert(err, err) end end end diff --git a/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua index c64d05dac..1a79a7147 100644 --- a/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua @@ -49,9 +49,10 @@ function generate_dependencies(target, sourcebatch, opt) local clangscandeps = compiler_support.get_clang_scan_deps(target) local compflags = compinst:compflags({sourcefile = sourcefile, target = target}) local flags = table.join({"--format=p1689", "--", - clang_path, "-x", "c++", runtime_flag, "-c", sourcefile, "-o", target:objectfile(sourcefile)}, compflags or {}) + clang_path, "-x", "c++", "-c", sourcefile, "-o", target:objectfile(sourcefile)}, compflags or {}) vprint(table.concat(table.join(clangscandeps, flags), " ")) - local outdata = try{function() return os.iorunv(clangscandeps, flags) end} + local outdata, err = os.iorunv(clangscandeps, flags) + assert(err, err) io.writefile(jsonfile, outdata) else @@ -65,7 +66,8 @@ function generate_dependencies(target, sourcebatch, opt) end) local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) local flags = table.join(compflags or {}, keepsystemincludesflag or {}, {"-E", "-x", "c++", file, "-o", ifile}) - try{function() os.iorunv(compinst:program(), flags) end} + local _, err = os.iorunv(compinst:program(), flags) + assert(err, err) local content = io.readfile(ifile) os.rm(ifile) return content diff --git a/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua index 72e8b475f..372bb5560 100644 --- a/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua @@ -49,7 +49,8 @@ function generate_dependencies(target, sourcebatch, opt) local dfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".d")) local compflags = compinst:compflags({sourcefile = sourcefile, target = target}) local flags = table.join(compflags or {}, baselineflags, {sourcefile, "-MT", jsonfile, "-MD", "-MF", dfile, depsformatflag, depsfileflag .. jsonfile, depstargetflag .. target:objectfile(sourcefile), "-o", ifile}) - try{function() return os.iorunv(path.translate(compinst:program()), flags) end} + local _, err = os.iorunv(path.translate(compinst:program()), flags) + assert(err, err) os.rm(ifile) os.rm(dfile) else @@ -59,7 +60,8 @@ function generate_dependencies(target, sourcebatch, opt) table.remove_if(compflags, function(_, flag) return flag:startswith("-fmodule") end) local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) local flags = table.join(baselineflags, compflags or {}, {file, "-o", ifile}) - try{function() return os.iorunv(compinst:program(), flags) end} + local _, err = os.iorunv(compinst:program(), flags) + assert(err, err) local content = io.readfile(ifile) os.rm(ifile) return content diff --git a/xmake/rules/c++/modules/modules_support/msvc/builder.lua b/xmake/rules/c++/modules/modules_support/msvc/builder.lua index 929b0cd5d..8a77a7612 100644 --- a/xmake/rules/c++/modules/modules_support/msvc/builder.lua +++ b/xmake/rules/c++/modules/modules_support/msvc/builder.lua @@ -86,7 +86,8 @@ function _compile(target, flags, sourcefile) if not dryrun then -- do compile - try{function() return os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()}) end} + local _, err = os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()}) + assert(err, err) end end diff --git a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua index 6cf095a01..f84a69633 100644 --- a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua @@ -48,14 +48,16 @@ function generate_dependencies(target, sourcebatch, opt) local compinst = target:compiler("cxx") local msvc = target:toolchain("msvc") local compflags = table.join(compinst:compflags({sourcefile = sourcefile, target = target}) or {}, common_flags, flags) - try{function() return os.iorunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()}) end} + local _, err = os.iorunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()}) + assert(err, err) else fallback_generate_dependencies(target, jsonfile, sourcefile, function(file) local compinst = target:compiler("cxx") local compflags = compinst:compflags({sourcefile = file, target = target}) local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) - try{function() return os.vrunv(compinst:program(), table.join(compflags, - {"/P", "-TP", file, "/Fi" .. ifile}), {envs = msvc:runenvs()}) end} + local _, err = os.iorunv(compinst:program(), table.join(compflags, + {"/P", "-TP", file, "/Fi" .. ifile}), {envs = msvc:runenvs()}) + assert(err, err) local content = io.readfile(ifile) os.rm(ifile) return content |
