Skip to content

Commit

Permalink
Add newline at the end of file snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
therloux committed Jan 12, 2025
1 parent 229373a commit 9be0e3d
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/armclang/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function _check_try_running(flags, opt, islinker)
-- make an stub source file
local sourcefile = path.join(os.tmpdir(), "detect", "armclang_has_flags" .. _get_extension(opt))
if not os.isfile(sourcefile) then
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
end

-- check flags for linker
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/cl/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ end
function _check_try_running(flags, opt)

-- make an stub source file
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}\n"
local sourcefile = os.tmpfile("cl_has_flags:" .. snippet) .. _get_extension(opt)
if not os.isfile(sourcefile) then
io.writefile(sourcefile, snippet)
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/clang_cl/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function _check_try_running(flags, opt)
-- make an stub source file
local sourcefile = path.join(os.tmpdir(), "detect", "clang_cl_has_flags" .. extension)
if not os.isfile(sourcefile) then
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
end

-- check flags for compiler
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/cosmocc/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ end
function _check_try_running(flags, opt, islinker)

-- make an stub source file
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}\n"
local sourcefile = os.tmpfile("cosmocc_has_flags:" .. snippet) .. _get_extension(opt)
if not os.isfile(sourcefile) then
io.writefile(sourcefile, snippet)
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/find_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function main(opt)
-- @see https://github.com/xmake-io/xmake/issues/3057
local objectfile = os.tmpfile() .. ".obj"
local sourcefile = os.tmpfile() .. ".c"
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
os.runv(program, {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs})
os.rm(objectfile)
os.rm(sourcefile)
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/find_emar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function main(opt)
local libraryfile = os.tmpfile() .. ".a"
local objectfile = os.tmpfile() .. ".o"
local sourcefile = os.tmpfile() .. ".c"
io.writefile(sourcefile, "int test(void)\n{return 0;}")
io.writefile(sourcefile, "int test(void)\n{return 0;}\n")

-- compile it
os.runv(emcc.program, {"-c", "-o" .. objectfile, sourcefile}, {envs = opt.envs})
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/find_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function main(opt)
local libraryfile = os.tmpfile() .. ".lib"
local objectfile = os.tmpfile() .. ".obj"
local sourcefile = os.tmpfile() .. ".c"
io.writefile(sourcefile, "int test(void)\n{return 0;}")
io.writefile(sourcefile, "int test(void)\n{return 0;}\n")

-- check it
local cl = assert(find_tool("cl", {envs = opt.envs}))
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/find_link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function main(opt)
local sourcefile = os.tmpfile() .. ".c"

-- compile sourcefile first
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
os.runv(cl.program, {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs})

-- do link
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/find_strip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function _check_strip_of_xcode(program)
-- make an stub source file
local objectfile = os.tmpfile() .. ".o"
local sourcefile = os.tmpfile() .. ".c"
io.writefile(sourcefile, "int test(void)\n{return 0;}")
io.writefile(sourcefile, "int test(void)\n{return 0;}\n")

-- compile it
compiler.compile(sourcefile, objectfile)
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/gcc/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end
function _check_try_running(flags, opt, islinker)

-- make an stub source file
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}\n"
local sourcefile = os.tmpfile("gcc_has_flags:" .. snippet) .. _get_extension(opt)
if not os.isfile(sourcefile) then
io.writefile(sourcefile, snippet)
Expand Down
4 changes: 2 additions & 2 deletions xmake/modules/detect/tools/link/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ function _check_try_running(flags, opt)
local sourcefile = path.join(os.tmpdir(), "detect", (winmain and "winmain_" or "") .. "link_has_flags.c")
if not os.isfile(sourcefile) then
if winmain then
io.writefile(sourcefile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}")
io.writefile(sourcefile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}\n")
else
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
end
end

Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/nvcc/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ end
function _check_try_running(flags, opt, islinker)

-- make an stub source file
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}\n"
local sourcefile = os.tmpfile("nvcc_has_flags:" .. snippet) .. ".cu"
if not os.isfile(sourcefile) then
io.writefile(sourcefile, snippet)
Expand Down
2 changes: 1 addition & 1 deletion xmake/modules/detect/tools/sdcc/has_flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function _check_try_running(flags, opt, islinker)
-- make an stub source file
local sourcefile = path.join(os.tmpdir(), "detect", "sdcc_has_flags" .. extension)
if not os.isfile(sourcefile) then
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}\n")
end

-- check flags for linker
Expand Down

0 comments on commit 9be0e3d

Please sign in to comment.