Commit 7cc66cf8 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1252 from carsonmcdonald/fixfilenames

Fix for issue 1243
parents 17f10b05 87eb57b6
...@@ -25,6 +25,11 @@ MRuby::Build.new do |conf| ...@@ -25,6 +25,11 @@ MRuby::Build.new do |conf|
# cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}" # cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
# end # end
# mrbc settings
# conf.mrbc do |mrbc|
# mrbc.compile_options = "-g -B%{funcname} -o- -" # The -g option is required for line numbers
# end
# Linker settings # Linker settings
# conf.linker do |linker| # conf.linker do |linker|
# linker.command = ENV['LD'] || 'gcc' # linker.command = ENV['LD'] || 'gcc'
......
...@@ -2403,6 +2403,8 @@ scope_finish(codegen_scope *s) ...@@ -2403,6 +2403,8 @@ scope_finish(codegen_scope *s)
{ {
mrb_state *mrb = s->mrb; mrb_state *mrb = s->mrb;
mrb_irep *irep = s->irep; mrb_irep *irep = s->irep;
size_t fname_len;
char *fname;
irep->flags = 0; irep->flags = 0;
if (s->iseq) { if (s->iseq) {
...@@ -2418,7 +2420,11 @@ scope_finish(codegen_scope *s) ...@@ -2418,7 +2420,11 @@ scope_finish(codegen_scope *s)
irep->pool = (mrb_value *)codegen_realloc(s, irep->pool, sizeof(mrb_value)*irep->plen); irep->pool = (mrb_value *)codegen_realloc(s, irep->pool, sizeof(mrb_value)*irep->plen);
irep->syms = (mrb_sym *)codegen_realloc(s, irep->syms, sizeof(mrb_sym)*irep->slen); irep->syms = (mrb_sym *)codegen_realloc(s, irep->syms, sizeof(mrb_sym)*irep->slen);
if (s->filename) { if (s->filename) {
irep->filename = s->filename; fname_len = strlen(s->filename);
fname = codegen_malloc(s, fname_len + 1);
memcpy(fname, s->filename, fname_len);
fname[fname_len] = '\0';
irep->filename = fname;
} }
irep->nlocals = s->nlocals; irep->nlocals = s->nlocals;
......
...@@ -267,9 +267,6 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3 ...@@ -267,9 +267,6 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
mrb->irep[irepno]->lines = lines; mrb->irep[irepno]->lines = lines;
error_exit: error_exit:
if (fname) {
mrb_free(mrb, fname);
}
return ret; return ret;
} }
......
...@@ -101,6 +101,7 @@ mrb_irep_free(mrb_state *mrb, struct mrb_irep *irep) ...@@ -101,6 +101,7 @@ mrb_irep_free(mrb_state *mrb, struct mrb_irep *irep)
mrb_free(mrb, irep->iseq); mrb_free(mrb, irep->iseq);
mrb_free(mrb, irep->pool); mrb_free(mrb, irep->pool);
mrb_free(mrb, irep->syms); mrb_free(mrb, irep->syms);
mrb_free(mrb, (void *)irep->filename);
mrb_free(mrb, irep->lines); mrb_free(mrb, irep->lines);
mrb_free(mrb, irep); mrb_free(mrb, irep);
} }
......
...@@ -236,6 +236,8 @@ module MRuby ...@@ -236,6 +236,8 @@ module MRuby
end end
class Command::Mrbc < Command class Command::Mrbc < Command
attr_accessor :compile_options
def initialize(build) def initialize(build)
super super
@command = nil @command = nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment