From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/testsuite/libjava.cni/PR9577.h | 29 ++++++ libjava/testsuite/libjava.cni/PR9577.jar | Bin 0 -> 629 bytes libjava/testsuite/libjava.cni/PR9577.java | 14 +++ libjava/testsuite/libjava.cni/PR9577.out | 1 + libjava/testsuite/libjava.cni/cni.exp | 124 +++++++++++++++++++++++++ libjava/testsuite/libjava.cni/longfield.h | 33 +++++++ libjava/testsuite/libjava.cni/longfield.jar | Bin 0 -> 852 bytes libjava/testsuite/libjava.cni/longfield.java | 22 +++++ libjava/testsuite/libjava.cni/longfield.out | 6 ++ libjava/testsuite/libjava.cni/natPR9577.cc | 9 ++ libjava/testsuite/libjava.cni/natlongfield.cc | 15 +++ libjava/testsuite/libjava.cni/natshortfield.cc | 10 ++ libjava/testsuite/libjava.cni/shortfield.h | 33 +++++++ libjava/testsuite/libjava.cni/shortfield.jar | Bin 0 -> 995 bytes libjava/testsuite/libjava.cni/shortfield.java | 21 +++++ libjava/testsuite/libjava.cni/shortfield.out | 1 + libjava/testsuite/libjava.cni/shortfieldbase.h | 25 +++++ 17 files changed, 343 insertions(+) create mode 100644 libjava/testsuite/libjava.cni/PR9577.h create mode 100644 libjava/testsuite/libjava.cni/PR9577.jar create mode 100644 libjava/testsuite/libjava.cni/PR9577.java create mode 100644 libjava/testsuite/libjava.cni/PR9577.out create mode 100644 libjava/testsuite/libjava.cni/cni.exp create mode 100644 libjava/testsuite/libjava.cni/longfield.h create mode 100644 libjava/testsuite/libjava.cni/longfield.jar create mode 100644 libjava/testsuite/libjava.cni/longfield.java create mode 100644 libjava/testsuite/libjava.cni/longfield.out create mode 100644 libjava/testsuite/libjava.cni/natPR9577.cc create mode 100644 libjava/testsuite/libjava.cni/natlongfield.cc create mode 100644 libjava/testsuite/libjava.cni/natshortfield.cc create mode 100644 libjava/testsuite/libjava.cni/shortfield.h create mode 100644 libjava/testsuite/libjava.cni/shortfield.jar create mode 100644 libjava/testsuite/libjava.cni/shortfield.java create mode 100644 libjava/testsuite/libjava.cni/shortfield.out create mode 100644 libjava/testsuite/libjava.cni/shortfieldbase.h (limited to 'libjava/testsuite/libjava.cni') diff --git a/libjava/testsuite/libjava.cni/PR9577.h b/libjava/testsuite/libjava.cni/PR9577.h new file mode 100644 index 000000000..a8d6d19ae --- /dev/null +++ b/libjava/testsuite/libjava.cni/PR9577.h @@ -0,0 +1,29 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __PR9577__ +#define __PR9577__ + +#pragma interface + +#include +#include + +extern "Java" +{ + class PR9577; +} + +class PR9577 : public ::java::lang::Object +{ + +public: + PR9577(); +private: + void sayHello(JArray< ::java::lang::String * > *, ::java::lang::Object *); +public: + static void main(JArray< ::java::lang::String * > *); + static ::java::lang::Class class$; +}; + +#endif // __PR9577__ diff --git a/libjava/testsuite/libjava.cni/PR9577.jar b/libjava/testsuite/libjava.cni/PR9577.jar new file mode 100644 index 000000000..6e9f5cee7 Binary files /dev/null and b/libjava/testsuite/libjava.cni/PR9577.jar differ diff --git a/libjava/testsuite/libjava.cni/PR9577.java b/libjava/testsuite/libjava.cni/PR9577.java new file mode 100644 index 000000000..269739243 --- /dev/null +++ b/libjava/testsuite/libjava.cni/PR9577.java @@ -0,0 +1,14 @@ +// Check if a method name is mangled properly in the presence +// of an array parameter sharing a part of the type name +// with a subsequent parameter. + +public class PR9577 +{ + private native void sayHello (String[] s, Object o); + + public static void main (String[] args) + { + PR9577 x = new PR9577( ); + x.sayHello( null, null); + } +} diff --git a/libjava/testsuite/libjava.cni/PR9577.out b/libjava/testsuite/libjava.cni/PR9577.out new file mode 100644 index 000000000..10ddd6d25 --- /dev/null +++ b/libjava/testsuite/libjava.cni/PR9577.out @@ -0,0 +1 @@ +Hello! diff --git a/libjava/testsuite/libjava.cni/cni.exp b/libjava/testsuite/libjava.cni/cni.exp new file mode 100644 index 000000000..aec16b933 --- /dev/null +++ b/libjava/testsuite/libjava.cni/cni.exp @@ -0,0 +1,124 @@ +# Tests for CNI code. + +# Compile a single C++ file and produce a .o file. OPTIONS is a list +# of options to pass to the compiler. Returns 0 on failure, 1 on +# success. +proc gcj_cni_compile_cxx_to_o {file {options {}}} { + global srcdir subdir + + set name [file rootname [file tail $file]] + set oname ${name}.o + + # Find the generated header. + lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir -fdollars-in-identifiers" + # Find libgcj headers. + lappend options "additional_flags=-I$srcdir/.." + + set x [libjava_prune_warnings \ + [target_compile $file $oname object $options]] + if {$x != ""} { + verbose "target_compile failed: $x" 2 + fail "[file tail $file] compilation" + return 0 + } + + pass "[file tail $file] compilation" + return 1 +} + +# Build header files given name of .java file. Return 0 on failure. +proc gcj_cni_build_headers {file} { + global libgcj_jar + + set gcjh [find_gcjh] + + # Currently we only build a header file for the main class from the + # .java file, and then others on an ad hoc basis. + set list {} + set main [file rootname [file tail $file]] + lappend list $main + # ... for instance, an obvious hack. + if {$main == "shortfield"} { + lappend list shortfieldbase + } + + foreach file $list { + set cmd "$gcjh -cni -force -classpath .:$libgcj_jar $file" + verbose $cmd + set x [string trim [libjava_prune_warnings \ + [lindex [local_exec $cmd "" "" 300] 1]]] + if {$x != ""} { + verbose "local_exec failed: $x" 2 + fail "$main header generation" + return 0 + } + } + + pass "$main header generation" + return 1 +} + +# Do all the work for a single CNI test. Return 0 on failure. +proc gcj_cni_test_one {file} { + global runtests + + # The base name. We use it for several purposes. + set main [file rootname [file tail $file]] + if {! [runtest_file_p $runtests $main]} { + # Simply skip it. + return 1 + } + +# if {! [bytecompile_file $file [pwd]]} { +# fail "bytecompile $file" +# # FIXME - should use `untested' on all remaining tests. +# # But that is hard. +# return 0 +# } +# pass "bytecompile $file" + +# if {! [gcj_cni_build_headers $file]} { +# # FIXME +# return 0 +# } + + set cfile [file join [file dirname $file] nat$main.cc] + if {! [gcj_cni_compile_cxx_to_o $cfile]} { + # FIXME + return 0 + } + + if {! [gcj_link $main $main [list $file nat$main.o]]} { + # FIXME + return 0 + } + + if {! [gcj_invoke $main [file rootname $file].out {}]} { + # FIXME + return 0 + } + + # When we succeed we remove all our clutter. + eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main nat$main.o] + + return 1 +} + +# Run the CNI tests. +proc gcj_cni_run {} { + global srcdir subdir + global build_triplet host_triplet + + # For now we only test CNI on native builds. + if {$build_triplet == $host_triplet} { + catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar] } srcfiles + + foreach x $srcfiles { + gcj_cni_test_one $x + } + } else { + verbose "CNI tests not run in cross-compilation environment" + } +} + +gcj_cni_run diff --git a/libjava/testsuite/libjava.cni/longfield.h b/libjava/testsuite/libjava.cni/longfield.h new file mode 100644 index 000000000..51ea17f44 --- /dev/null +++ b/libjava/testsuite/libjava.cni/longfield.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __longfield__ +#define __longfield__ + +#pragma interface + +#include +#include + +extern "Java" +{ + class longfield; +} + +class longfield : public ::java::lang::Object +{ + +public: + longfield(); + virtual void doitc(); + virtual void doitj(); + static void main(JArray< ::java::lang::String * > *); +public: // actually package-private + jlong __attribute__((aligned(__alignof__( ::java::lang::Object)))) lval; + jboolean bval; + ::java::lang::String * sval; +public: + static ::java::lang::Class class$; +}; + +#endif // __longfield__ diff --git a/libjava/testsuite/libjava.cni/longfield.jar b/libjava/testsuite/libjava.cni/longfield.jar new file mode 100644 index 000000000..aab946776 Binary files /dev/null and b/libjava/testsuite/libjava.cni/longfield.jar differ diff --git a/libjava/testsuite/libjava.cni/longfield.java b/libjava/testsuite/libjava.cni/longfield.java new file mode 100644 index 000000000..917bf953a --- /dev/null +++ b/libjava/testsuite/libjava.cni/longfield.java @@ -0,0 +1,22 @@ +public class longfield +{ + long lval = 232300; + boolean bval = true; + String sval = "maude"; + + public native void doitc (); + + public void doitj() + { + System.out.println(lval); + System.out.println(bval); + System.out.println(sval); + } + + public static void main(String[] args) + { + longfield f = new longfield(); + f.doitc(); + f.doitj(); + } +} diff --git a/libjava/testsuite/libjava.cni/longfield.out b/libjava/testsuite/libjava.cni/longfield.out new file mode 100644 index 000000000..d041bbbf7 --- /dev/null +++ b/libjava/testsuite/libjava.cni/longfield.out @@ -0,0 +1,6 @@ +232300 +true +maude +232300 +true +maude diff --git a/libjava/testsuite/libjava.cni/natPR9577.cc b/libjava/testsuite/libjava.cni/natPR9577.cc new file mode 100644 index 000000000..90fafeea3 --- /dev/null +++ b/libjava/testsuite/libjava.cni/natPR9577.cc @@ -0,0 +1,9 @@ +#include + +#include "PR9577.h" + +void +PR9577::sayHello (JArray< ::java::lang::String *> *x, ::java::lang::Object *y) + { + printf( "Hello!\n"); + } diff --git a/libjava/testsuite/libjava.cni/natlongfield.cc b/libjava/testsuite/libjava.cni/natlongfield.cc new file mode 100644 index 000000000..c16a46c76 --- /dev/null +++ b/libjava/testsuite/libjava.cni/natlongfield.cc @@ -0,0 +1,15 @@ +#include + +#include "longfield.h" +#include +#include + +void +longfield::doitc () +{ + java::io::PrintStream *ps = java::lang::System::out; + + ps->println(lval); + ps->println(bval); + ps->println(sval); +} diff --git a/libjava/testsuite/libjava.cni/natshortfield.cc b/libjava/testsuite/libjava.cni/natshortfield.cc new file mode 100644 index 000000000..08a7d5c05 --- /dev/null +++ b/libjava/testsuite/libjava.cni/natshortfield.cc @@ -0,0 +1,10 @@ +#include +#include "shortfield.h" + +void shortfield::ouch () +{ + printf ("list: %d %d 0x%x\n", + modCount, + size__, + data); +} diff --git a/libjava/testsuite/libjava.cni/shortfield.h b/libjava/testsuite/libjava.cni/shortfield.h new file mode 100644 index 000000000..175a9fd8e --- /dev/null +++ b/libjava/testsuite/libjava.cni/shortfield.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __shortfield__ +#define __shortfield__ + +#pragma interface + +#include +#include + +extern "Java" +{ + class shortfield; +} + +class shortfield : public ::shortfieldbase +{ + +public: + shortfield(); +public: // actually package-private + virtual void ouch(); +public: + static void main(JArray< ::java::lang::String * > *); +public: // actually package-private + jshort __attribute__((aligned(__alignof__( ::shortfieldbase)))) size__; + jint data; +public: + static ::java::lang::Class class$; +}; + +#endif // __shortfield__ diff --git a/libjava/testsuite/libjava.cni/shortfield.jar b/libjava/testsuite/libjava.cni/shortfield.jar new file mode 100644 index 000000000..f7af1afb7 Binary files /dev/null and b/libjava/testsuite/libjava.cni/shortfield.jar differ diff --git a/libjava/testsuite/libjava.cni/shortfield.java b/libjava/testsuite/libjava.cni/shortfield.java new file mode 100644 index 000000000..68b6c5e22 --- /dev/null +++ b/libjava/testsuite/libjava.cni/shortfield.java @@ -0,0 +1,21 @@ +class shortfieldbase +{ + short modCount; +} + +public class shortfield extends shortfieldbase +{ + short size__; + int data; + + native void ouch (); + + public static void main (String[] s) + { + shortfield f = new shortfield(); + f.modCount = 99; + f.size__ = 2; + f.data = 0x12345678; + f.ouch(); + } +} diff --git a/libjava/testsuite/libjava.cni/shortfield.out b/libjava/testsuite/libjava.cni/shortfield.out new file mode 100644 index 000000000..06485dbae --- /dev/null +++ b/libjava/testsuite/libjava.cni/shortfield.out @@ -0,0 +1 @@ +list: 99 2 0x12345678 diff --git a/libjava/testsuite/libjava.cni/shortfieldbase.h b/libjava/testsuite/libjava.cni/shortfieldbase.h new file mode 100644 index 000000000..171ca3d45 --- /dev/null +++ b/libjava/testsuite/libjava.cni/shortfieldbase.h @@ -0,0 +1,25 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __shortfieldbase__ +#define __shortfieldbase__ + +#pragma interface + +#include +extern "Java" +{ + class shortfieldbase; +} + +class shortfieldbase : public ::java::lang::Object +{ + +public: // actually package-private + shortfieldbase(); + jshort __attribute__((aligned(__alignof__( ::java::lang::Object)))) modCount; +public: + static ::java::lang::Class class$; +}; + +#endif // __shortfieldbase__ -- cgit v1.2.3