|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
function location patchThe attached patch:
- puts the opening braces of functions in the .gob #line sections, eg: before: #line 1007 "mn-mailbox.gob" void mn_mailbox_check (MNMailbox * self) #line 2064 "mn-mailbox.c" { after: #line 1007 "mn-mailbox.gob" void mn_mailbox_check (MNMailbox * self) { #line 2064 "mn-mailbox.c" This makes GCC use the .gob location when it has something to say about a function. - encloses function declarations in .gob #line sections. This makes GCC use the .gob location when it has something to say about a function prototype. Note: the patch applies to gob2-jylefort (gob2 2.0.15 + my other patches). -- Jean-Yves Lefort <jylefort@...> [gob2-jylefort-function-locations.diff] Index: src/main.c =================================================================== RCS file: /usr/local/cvsroot/gob2/src/main.c,v retrieving revision 1.3 diff -u -r1.3 main.c --- src/main.c 1 Feb 2008 21:12:03 -0000 1.3 +++ src/main.c 1 Feb 2008 21:33:04 -0000 @@ -447,8 +447,10 @@ if(m->scope != PUBLIC_SCOPE) return; + out_addline_infile(outh, m->line_no); print_method(outh, "", "\t", "", "\t", "", ";\n", m, TRUE, FALSE, TRUE, FALSE, FALSE); + out_addline_outfile(outh); } static void @@ -580,15 +582,17 @@ static void put_prot_method(const Method *m) { + FILE *f; + if(m->scope != PROTECTED_SCOPE) return; - if(outph) - print_method(outph, "", "\t", "", "\t", "", ";\n", - m, FALSE, FALSE, TRUE, FALSE, FALSE); - else - print_method(out, "", "\t", "", "\t", "", ";\n", - m, FALSE, FALSE, TRUE, FALSE, FALSE); + f = outph ? outph : out; + + out_addline_infile(f, m->line_no); + print_method(f, "", "\t", "", "\t", "", ";\n", + m, FALSE, FALSE, TRUE, FALSE, FALSE); + out_addline_outfile(f); } static void @@ -609,8 +613,10 @@ m->cbuf)) { /* add unique ID */ char *s = g_strdup_printf("___%x_", (guint)m->unique_id); + out_addline_infile(out, m->line_no); print_method(out, "static ", s, "", " ", "", ";\n", m, FALSE, FALSE, FALSE, FALSE, FALSE); + out_addline_outfile(out); g_free(s); } else if(m->scope == PRIVATE_SCOPE || m->method == INIT_METHOD || @@ -618,8 +624,10 @@ m->method == CONSTRUCTOR_METHOD || m->method == DISPOSE_METHOD || m->method == FINALIZE_METHOD) { + out_addline_infile(out, m->line_no); print_method(out, "static ", "", "", " ", "", ";\n", m, FALSE, FALSE, TRUE, FALSE, FALSE); + out_addline_outfile(out); } } @@ -2395,10 +2403,10 @@ out_addline_infile(out, m->line_no); print_method(out, "static ", "\n", "", " ", "", "\n", m, FALSE, FALSE, TRUE, TRUE, FALSE); + out_printf(out, "{\n"); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out, "{\n" - "#define __GOB_FUNCTION__ \"%s::init\"\n", + out_printf(out, "#define __GOB_FUNCTION__ \"%s::init\"\n", c->otype); if (privates > 0) { out_printf(out, "\t%s->_priv = " @@ -2444,10 +2452,10 @@ out_addline_infile(out, m->line_no); print_method(out, "static ", "\n", "", " ", "", "\n", m, FALSE, FALSE, TRUE, TRUE, FALSE); + out_printf(out, "{\n"); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out, "{\n" - "#define __GOB_FUNCTION__ \"%s::class_init\"\n", + out_printf(out, "#define __GOB_FUNCTION__ \"%s::class_init\"\n", c->otype); if (set_properties > 0 || get_properties > 0 || @@ -2799,10 +2807,10 @@ static void print_method_body (Method *m, gboolean pre, gboolean unused_self) { + out_printf(out, "{\n"); if (m->line_no > 0) out_addline_outfile(out); - out_printf(out, "{\n" - "#define __GOB_FUNCTION__ \"%s::%s\"\n", + out_printf(out, "#define __GOB_FUNCTION__ \"%s::%s\"\n", ((Class *)class)->otype, m->id); if (pre) @@ -2972,10 +2980,11 @@ else /* PUBLIC, PROTECTED */ print_method2(out, "", "\n", "", " ", "", "\n", m, PRINT_METHOD_NO_ATTR); - out_addline_outfile (out); out_printf (out, "{\n"); + out_addline_outfile (out); + out_printf (out, "\tGValue ___param_values[%d];\n" "\tGValue ___return_val;\n\n" @@ -3103,9 +3112,9 @@ else /* PUBLIC, PROTECTED */ print_method2(out, "", "\n", "", " ", "", "\n", m, PRINT_METHOD_NO_ATTR); + out_printf(out, "{\n"); out_addline_outfile(out); - out_printf(out, "{\n" - "\t%sClass *klass;\n", typebase); + out_printf(out, "\t%sClass *klass;\n", typebase); print_preconditions(m); out_printf(out, "\tklass = %s_GET_CLASS(%s);\n\n" "\tif(klass->%s)\n", -- to unsubscribe: send mail to minimalist@... with "unsubscribe gob-list" in the subject |
| Free embeddable forum powered by Nabble | Forum Help |