This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Java PATCH] Generate declarations in jvgenmain.c
- From: Marek Polacek <polacek at redhat dot com>
- To: java-patches at gcc dot gnu dot org, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 7 Oct 2014 10:31:29 +0200
- Subject: [Java PATCH] Generate declarations in jvgenmain.c
- Authentication-results: sourceware.org; auth=none
[CCing java-patches now]
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 following patch generates such a declaration
depending on whether -findirect-dispatch is given.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2014-10-07 Marek Polacek <polacek@redhat.com>
* jvgenmain.c (main): Provide declaration for JvRunMain{,Name}.
diff --git gcc/java/jvgenmain.c gcc/java/jvgenmain.c
index 5b14258..82e468d 100644
--- gcc/java/jvgenmain.c
+++ gcc/java/jvgenmain.c
@@ -127,6 +127,10 @@ 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");
+ if (indirect)
+ fprintf (stream, "extern void JvRunMainName ();\n");
+ else
+ fprintf (stream, "extern void JvRunMain ();\n");
fprintf (stream, "static const char *props[] =\n{\n");
for (i = 1; i < last_arg; ++i)
{
Marek