function location patch
Jean-Yves Lefort <[email protected]> Fri, 1 Feb 2008 23:01:58 +0100
| Newsgroups | gmane.comp.gnome.devtools.gob.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. [email protected] Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Fri__1_Feb_2008_23_01_58_+0100_1._37wELOwu2WGjw" --Signature=_Fri__1_Feb_2008_23_01_58_+0100_1._37wELOwu2WGjw Content-Type: multipart/mixed; boundary="Multipart=_Fri__1_Feb_2008_23_01_58_+0100__t8c.RBcWndpvIfS" --Multipart=_Fri__1_Feb_2008_23_01_58_+0100__t8c.RBcWndpvIfS Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The attached patch: - puts the opening braces of functions in the .gob #line sections, eg: before: #line 1007 "mn-mailbox.gob" void=20 mn_mailbox_check (MNMailbox * self) #line 2064 "mn-mailbox.c" { after: #line 1007 "mn-mailbox.gob" void=20 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). --=20 Jean-Yves Lefort <[email protected]> --Multipart=_Fri__1_Feb_2008_23_01_58_+0100__t8c.RBcWndpvIfS Content-Type: text/x-diff; name="gob2-jylefort-function-locations.diff" Content-Disposition: attachment; filename="gob2-jylefort-function-locations.diff" Content-Transfer-Encoding: quoted-printable Index: src/main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 !=3D PUBLIC_SCOPE) return; =20 + out_addline_infile(outh, m->line_no); print_method(outh, "", "\t", "", "\t", "", ";\n", m, TRUE, FALSE, TRUE, FALSE, FALSE); + out_addline_outfile(outh); } =20 static void @@ -580,15 +582,17 @@ static void put_prot_method(const Method *m) { + FILE *f; + if(m->scope !=3D PROTECTED_SCOPE) return; =20 - 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 =3D 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); } =20 static void @@ -609,8 +613,10 @@ m->cbuf)) { /* add unique ID */ char *s =3D 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 =3D=3D PRIVATE_SCOPE || m->method =3D=3D INIT_METHOD || @@ -618,8 +624,10 @@ m->method =3D=3D CONSTRUCTOR_METHOD || m->method =3D=3D DISPOSE_METHOD || m->method =3D=3D FINALIZE_METHOD) { + out_addline_infile(out, m->line_no); print_method(out, "static ", "", "", " ", "", ";\n", m, FALSE, FALSE, TRUE, FALSE, FALSE); + out_addline_outfile(out); } } =20 @@ -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 =3D " @@ -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); =20 out_printf (out, "{\n"); =20 + 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 =3D %s_GET_CLASS(%s);\n\n" "\tif(klass->%s)\n", --Multipart=_Fri__1_Feb_2008_23_01_58_+0100__t8c.RBcWndpvIfS-- --Signature=_Fri__1_Feb_2008_23_01_58_+0100_1._37wELOwu2WGjw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHo5bWyzD7UaO4AGoRAiHXAJ9hd53coNzmGDxDYPjZPOc7FukRfgCfT/44 XEODNO3HG58sAUgcYrDBK8M= =jCPJ -----END PGP SIGNATURE----- --Signature=_Fri__1_Feb_2008_23_01_58_+0100_1._37wELOwu2WGjw-- [email protected] Content-Type: text/plain; charset=us-ascii; name="footer.txt" Content-Disposition: inline Content-Transfer-Encoding: 8bit -- to unsubscribe: send mail to [email protected] with "unsubscribe gob-list" in the subject [email protected]