aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2001-05-10 13:39:19 -0400
committerDJ Delorie <dj@gcc.gnu.org>2001-05-10 13:39:19 -0400
commitb0089a92a30ae851e8bad7ca8da8b33dba4a5a95 (patch)
tree8c669d7a707810b2bc18d7b1031872859e3a5a89
parent25d78ace728bb05ef85d359f7c2b123cb7581475 (diff)
downloadgcc-b0089a92a30ae851e8bad7ca8da8b33dba4a5a95.zip
gcc-b0089a92a30ae851e8bad7ca8da8b33dba4a5a95.tar.gz
gcc-b0089a92a30ae851e8bad7ca8da8b33dba4a5a95.tar.bz2
c-common.c (combine_strings): Widen strings in a host-endian-independent way.
* c-common.c (combine_strings): Widen strings in a host-endian-independent way. From-SVN: r41941
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-common.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db35f56..11bf8a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-10 DJ Delorie <dj@redhat.com>
+
+ * c-common.c (combine_strings): Widen strings in a
+ host-endian-independent way.
+
2001-05-10 Joseph S. Myers <jsm28@cam.ac.uk>
* c-parse.in: Remove many shift/reduce conflicts. Update
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 751d67d..a1dc31c 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -583,15 +583,22 @@ combine_strings (strings)
}
else
{
- int i;
+ int i, j;
for (i = 0; i < len; i++)
{
- if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
- ((short *) q)[i] = TREE_STRING_POINTER (t)[i];
+ if (BYTES_BIG_ENDIAN)
+ {
+ for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++)
+ *q++ = 0;
+ *q++ = TREE_STRING_POINTER (t)[i];
+ }
else
- ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
+ {
+ *q++ = TREE_STRING_POINTER (t)[i];
+ for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++)
+ *q++ = 0;
+ }
}
- q += len * wchar_bytes;
}
}
if (wide_flag)