This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Committed: fix java/jcf-parse.c g++ compilation
- From: Joern Rennecke <amylaar at spamcop dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Jan 2010 04:43:50 -0500
- Subject: Committed: fix java/jcf-parse.c g++ compilation
--enable-build-with-cxx bootstrap failed for java:
/user/inria/fsf/bld-gcc-cxx10/./prev-gcc/g++
-B/user/inria/fsf/bld-gcc-cxx10/./prev-gcc/
-B/user/inria/cxx/i686-pc-linux-gnu/bin/ -nostdinc++
-I/user/inria/fsf/bld-gcc-cxx10/prev-i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu -I/user/inria/fsf/bld-gcc-cxx10/prev-i686-pc-linux-gnu/libstdc++-v3/include -I/user/inria/fsf/gcc/libstdc++-v3/libsupc++ -L/user/inria/fsf/bld-gcc-cxx10/prev-i686-pc-linux-gnu/libstdc++-v3/src/.libs -c -g -O2 -fomit-frame-pointer -gtoggle -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -Ijava -I../../gcc/gcc -I../../gcc/gcc/java -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber -DCLOOG_PPL_BACKEND -I/usr/include/libelf ../../gcc/gcc/java/jcf-parse.c -o
java/jcf-parse.o
../../gcc/gcc/java/jcf-parse.c: In function 'void
set_source_filename(JCF*, int)':
../../gcc/gcc/java/jcf-parse.c:336:43: error: invalid conversion from
'const char*' to 'char*'
../../gcc/gcc/java/jcf-parse.c: In function 'void
load_class(tree_node*, int)':
../../gcc/gcc/java/jcf-parse.c:1373:60: error: invalid conversion from
'const char*' to 'char*'
../../gcc/gcc/java/jcf-parse.c:1374:63: error: invalid conversion from
'const char*' to 'char*'
Fixed with the attached patch. Committed as obvious.
2010-01-20 Joern Rennecke <amylaar@spamcop.net>
* jcf-parse.c (set_source_filename): Constify variable "dot".
(load_class): Constify variable "separator".
Use get_identifier_with_length.
Index: jcf-parse.c
===================================================================
--- jcf-parse.c (revision 156055)
+++ jcf-parse.c (working copy)
@@ -333,7 +333,7 @@ set_source_filename (JCF *jcf, int index
{
const char *class_name
= IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
- char *dot = strrchr (class_name, '.');
+ const char *dot = strrchr (class_name, '.');
if (dot != NULL)
{
/* Length of prefix, not counting final dot. */
@@ -1355,7 +1355,7 @@ load_class (tree class_or_name, int verb
{
while (1)
{
- char *separator;
+ const char *separator;
/* We've already loaded it. */
if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE)
@@ -1372,12 +1372,9 @@ load_class (tree class_or_name, int verb
for an inner class. */
if ((separator = strrchr (IDENTIFIER_POINTER (name), '$'))
|| (separator = strrchr (IDENTIFIER_POINTER (name), '.')))
- {
- int c = *separator;
- *separator = '\0';
- name = get_identifier (IDENTIFIER_POINTER (name));
- *separator = c;
- }
+ name = get_identifier_with_length (IDENTIFIER_POINTER (name),
+ (separator
+ - IDENTIFIER_POINTER (name)));
/* Otherwise, we failed, we bail. */
else
break;