diff options
author | rmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-30 18:19:37 +0000 |
---|---|---|
committer | rmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-30 18:19:37 +0000 |
commit | a3c3aab007ba6dddb680d449a882af4ab0366551 (patch) | |
tree | 6b89dbbf7c15425987ef61a507b3be356eb69537 /libjava/testsuite/libjava.jni | |
parent | 1d90d99505f8443c807bbc24e44dffacdb6c7ce5 (diff) | |
download | gcc-a3c3aab007ba6dddb680d449a882af4ab0366551.tar.gz |
* testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Use
additional option "-Wmissing-prototypes" for compiling C sources.
Print actual filename for pass/fail rather than $name.c.
* testsuite/libjava.jni/PR15133.java: New testcase file.
* testsuite/libjava.jni/PR15133.c: Likewise.
* testsuite/libjava.jni/PR15133.out: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81358 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/testsuite/libjava.jni')
-rw-r--r-- | libjava/testsuite/libjava.jni/PR15133.c | 9 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/PR15133.java | 14 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/PR15133.out | 1 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/jni.exp | 15 |
4 files changed, 36 insertions, 3 deletions
diff --git a/libjava/testsuite/libjava.jni/PR15133.c b/libjava/testsuite/libjava.jni/PR15133.c new file mode 100644 index 00000000000..be5a48efa3b --- /dev/null +++ b/libjava/testsuite/libjava.jni/PR15133.c @@ -0,0 +1,9 @@ +#include <stdio.h> +#include <jni.h> +#include "PR15133.h" + +JNIEXPORT void JNICALL +Java_PR15133_printIt (JNIEnv *env, jobject x, jint y) +{ + printf ("%d\n", y); +} diff --git a/libjava/testsuite/libjava.jni/PR15133.java b/libjava/testsuite/libjava.jni/PR15133.java new file mode 100644 index 00000000000..90435765b3d --- /dev/null +++ b/libjava/testsuite/libjava.jni/PR15133.java @@ -0,0 +1,14 @@ +/* Test case for PR java/15133 */ +public class PR15133 +{ + public void printIt (String dummy) { } + + public native void printIt (int num); + + public static void main (String[] args) + { + System.loadLibrary ("PR15133"); + + new PR15133( ).printIt( 1729); + } +} diff --git a/libjava/testsuite/libjava.jni/PR15133.out b/libjava/testsuite/libjava.jni/PR15133.out new file mode 100644 index 00000000000..32bb421c624 --- /dev/null +++ b/libjava/testsuite/libjava.jni/PR15133.out @@ -0,0 +1 @@ +1729 diff --git a/libjava/testsuite/libjava.jni/jni.exp b/libjava/testsuite/libjava.jni/jni.exp index 7dad519d415..a4bf4b80ee1 100644 --- a/libjava/testsuite/libjava.jni/jni.exp +++ b/libjava/testsuite/libjava.jni/jni.exp @@ -21,12 +21,21 @@ proc gcj_jni_compile_c_to_so {file {options {}}} { set so_extension "so" set so_flag "-shared" } - set name [file rootname [file tail $file]] + set filename [file tail $file] + set name [file rootname $filename] set soname lib${name}.${so_extension} lappend options "additional_flags=${so_flag} -fPIC" # Find the generated header. lappend options "additional_flags=-I. -I.." + + # Ensure that the generated header has correct prototypes. + set cfile [file rootname $file].c + if { [file exists $cfile]} { + # This option is only valid for C sources. + lappend options "additional_flags=-Wmissing-prototypes" + } + # Find jni.h. lappend options "additional_flags=-I$srcdir/../include" @@ -34,11 +43,11 @@ proc gcj_jni_compile_c_to_so {file {options {}}} { [target_compile $file $soname executable $options]] if {$x != ""} { verbose "target_compile failed: $x" 2 - fail "$name.c compilation" + fail "$filename compilation" return 0 } - pass "$name.c compilation" + pass "$filename compilation" return 1 } |