sep_comp: declare method __attribute__((weak)) to allow skip of undead methods
[nit.git] / src / compiler / separate_compiler.nit
index 79cdb2f..b1e08c8 100644 (file)
@@ -2214,7 +2214,12 @@ class SeparateRuntimeFunction
                var mmethoddef = self.mmethoddef
 
                var sig = "{c_ret} {c_name}{c_sig}"
-               compiler.provide_declaration(self.c_name, "{sig};")
+               compiler.provide_declaration(self.c_name, "{sig} __attribute__((weak));")
+
+               var rta = compiler.as(SeparateCompiler).runtime_type_analysis
+               if rta != null and not rta.live_mmodules.has(mmethoddef.mclassdef.mmodule) then
+                       return
+               end
 
                var recv = self.mmethoddef.mclassdef.bound_mtype
                var v = compiler.new_visitor