var v = self.new_visitor
v.add_decl("#include <signal.h>")
var ost = modelbuilder.toolcontext.opt_stacktrace.value
+ var platform = mainmodule.target_platform
if ost == null then
- var platform = mainmodule.target_platform
if platform != null and not platform.supports_libunwind then
ost = "none"
else
modelbuilder.toolcontext.opt_stacktrace.value = ost
end
+ if platform != null and platform.no_main then modelbuilder.toolcontext.opt_no_main.value = true
+
if ost == "nitstack" or ost == "libunwind" then
v.add_decl("#define UNW_LOCAL_ONLY")
v.add_decl("#include <libunwind.h>")
# Services will be added to this class in other modules.
abstract class Platform
fun supports_libunwind: Bool do return true
+
+ # Does this platform declare its own main function? If so, we won't generate one in Nit.
+ fun no_main: Bool do return false
end
class PnaclPlatform
super Platform
+ redef fun supports_libunwind do return false
+
+ redef fun no_main do return true
+
redef fun toolchain(toolcontext) do return new PnaclToolchain(toolcontext)
end