aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2003-03-12 16:14:01 +0000
committerAndrew Haley <aph@gcc.gnu.org>2003-03-12 16:14:01 +0000
commit68566610afdbfd7f946eea2c4a262586160d9282 (patch)
tree4b6de0a2cf0a76440059fe63a1afe221cdf94a59 /gcc/java
parent0a8e3de3c825de0edac26dc0875e823b1b9d6e9b (diff)
downloadgcc-68566610afdbfd7f946eea2c4a262586160d9282.zip
gcc-68566610afdbfd7f946eea2c4a262586160d9282.tar.gz
gcc-68566610afdbfd7f946eea2c4a262586160d9282.tar.bz2
gjavah.c (is_first_data_member): New global variable.
2003-03-04 Andrew Haley <aph@redhat.com> * gjavah.c (is_first_data_member): New global variable. (print_c_decl): If it's the first data member, align it as the superclass. (process_file): Set is_first_data_member. From-SVN: r64247
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/gjavah.c16
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0c9bc9b..13fa86a 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-04 Andrew Haley <aph@redhat.com>
+
+ * gjavah.c (is_first_data_member): New global variable.
+ (print_c_decl): If it's the first data member, align it as the
+ superclass.
+ (process_file): Set is_first_data_member.
+
2003-03-11 Tom Tromey <tromey@redhat.com>
* parse.y (resolve_field_access): Initialize class if field is
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index 42f3327..23af65a 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -197,6 +197,9 @@ static int method_printed = 0;
static int method_synthetic = 0;
static int method_signature = 0;
+/* Set to 1 while the very first data member of a class is being handled. */
+static int is_first_data_member = 0;
+
#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
{ \
method_synthetic = 0; \
@@ -1383,6 +1386,17 @@ print_c_decl (FILE* stream, JCF* jcf, int name_index, int signature_index,
}
}
+ /* Force the alignment of the first data member. This is
+ because the "new" C++ ABI changed the alignemnt of non-POD
+ classes. gcj, however, still uses the "old" alignment. */
+ if (is_first_data_member && ! (flags & ACC_STATIC) && ! is_method)
+ {
+ is_first_data_member = 0;
+ print_cxx_classname (out, " __attribute__((aligned(__alignof__( ",
+ jcf, jcf->super_class, 1);
+ fputs (" )))) ", stream);
+ }
+
/* Now print the name of the thing. */
if (need_space)
fputs (" ", stream);
@@ -2088,6 +2102,8 @@ process_file (JCF *jcf, FILE *out)
}
/* Now go back for second pass over methods and fields. */
+ is_first_data_member = 1;
+
JCF_SEEK (jcf, method_start);
method_pass = 1;
jcf_parse_methods (jcf);