diff mbox

[Java] Generate declarations in jvgenmain.c

Message ID 20141006095400.GP3503@redhat.com
State New
Headers show

Commit Message

Marek Polacek Oct. 6, 2014, 9:54 a.m. UTC
Java testsuite breaks with -std=gnu11 as a default and/or with 
-Wimplicit-function-declaration on, since the jvgenmain.c program
that generates a C file containing 'main' function which calls either
'JvRunMainName' or 'JvRunMain' does not generate forward declarations
for these functions.  The fix is obvious IMHO.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-10-06  Marek Polacek  <polacek@redhat.com>

	* jvgenmain.c: Generate forward declarations for JvRunMain{,Name}.


	Marek

Comments

Mark Wielaard Oct. 6, 2014, 9 p.m. UTC | #1
On Mon, Oct 06, 2014 at 11:54:00AM +0200, Marek Polacek wrote:
> Java testsuite breaks with -std=gnu11 as a default and/or with 
> -Wimplicit-function-declaration on, since the jvgenmain.c program
> that generates a C file containing 'main' function which calls either
> 'JvRunMainName' or 'JvRunMain' does not generate forward declarations
> for these functions.  The fix is obvious IMHO.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

I cannot approve (java) patches, but it does look ok to me.
With one nitpick. JvRunMain is only used when -findirect-dispatch
is given, and otherwise JvRunMainName is used. So you could output
only the actually used forward declaration by checking if (indirect).

If no java maintainer responds, try CCing java-patches@gcc.gnu.org
to draw their attention.

Cheers,

Mark
Andrew Haley Oct. 7, 2014, 8:07 a.m. UTC | #2
On 06/10/14 22:00, Mark Wielaard wrote:
> If no java maintainer responds, try CCing java-patches@gcc.gnu.org
> to draw their attention.

Please.  I can't see the patch here.

Andrew.
Marek Polacek Oct. 7, 2014, 8:32 a.m. UTC | #3
On Mon, Oct 06, 2014 at 11:00:48PM +0200, Mark Wielaard wrote:
> On Mon, Oct 06, 2014 at 11:54:00AM +0200, Marek Polacek wrote:
> > Java testsuite breaks with -std=gnu11 as a default and/or with 
> > -Wimplicit-function-declaration on, since the jvgenmain.c program
> > that generates a C file containing 'main' function which calls either
> > 'JvRunMainName' or 'JvRunMain' does not generate forward declarations
> > for these functions.  The fix is obvious IMHO.
> > 
> > Bootstrapped/regtested on x86_64-linux, ok for trunk?
> 
> I cannot approve (java) patches, but it does look ok to me.
> With one nitpick. JvRunMain is only used when -findirect-dispatch
> is given, and otherwise JvRunMainName is used. So you could output
> only the actually used forward declaration by checking if (indirect).

Yeah, that will be better.
 
> If no java maintainer responds, try CCing java-patches@gcc.gnu.org
> to draw their attention.

Done (separate mail).  Thanks.

	Marek
diff mbox

Patch

diff --git gcc/gcc/java/jvgenmain.c gcc/gcc/java/jvgenmain.c
index 5b14258..a786d31 100644
--- gcc/gcc/java/jvgenmain.c
+++ gcc/gcc/java/jvgenmain.c
@@ -127,6 +127,8 @@  main (int argc, char **argv)
   /* At this point every element of ARGV from 1 to LAST_ARG is a `-D'
      option.  Process them appropriately.  */
   fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n");
+  fprintf (stream, "extern void JvRunMain ();\n");
+  fprintf (stream, "extern void JvRunMainName ();\n");
   fprintf (stream, "static const char *props[] =\n{\n");
   for (i = 1; i < last_arg; ++i)
     {