[Java PATCH] PR 5080, LC_CTYPE problem
Craig Rodrigues
rodrigc@mediaone.net
Sun Jan 27 14:40:00 GMT 2002
Hi,
Is this patch OK? It deals with cases like PR 5080, where
locale.h is not included:
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=5080&database=gcc
2002-01-22 Craig Rodrigues <rodrigc@gcc.gnu.org>
PR java/5080
* jcf-parse.c : Check for HAVE_LOCALE_H before using
setlocale() with LC_CTYPE as a parameter.
* jv-scan.c: Same.
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.102
diff -u -r1.102 jcf-parse.c
--- jcf-parse.c 2002/01/22 20:23:46 1.102
+++ jcf-parse.c 2002/01/23 03:01:03
@@ -911,13 +911,11 @@
/* There's no point in trying to find the current encoding unless we
are going to do something intelligent with it -- hence the test
for iconv. */
-#ifdef HAVE_ICONV
-#ifdef HAVE_NL_LANGINFO
+#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_NL_LANGINFO)
setlocale (LC_CTYPE, "");
if (current_encoding == NULL)
current_encoding = nl_langinfo (CODESET);
-#endif /* HAVE_NL_LANGINFO */
-#endif /* HAVE_ICONV */
+#endif
if (current_encoding == NULL || *current_encoding == '\0')
current_encoding = DEFAULT_ENCODING;
Index: jv-scan.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jv-scan.c,v
retrieving revision 1.27
diff -u -r1.27 jv-scan.c
--- jv-scan.c 2001/12/27 03:35:21 1.27
+++ jv-scan.c 2002/01/23 03:01:03
@@ -199,13 +199,11 @@
/* There's no point in trying to find the current encoding
unless we are going to do something intelligent with it
-- hence the test for iconv. */
-#ifdef HAVE_ICONV
-#ifdef HAVE_NL_LANGINFO
+#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_NL_LANGINFO)
setlocale (LC_CTYPE, "");
if (encoding == NULL)
encoding = nl_langinfo (CODESET);
-#endif /* HAVE_NL_LANGINFO */
-#endif /* HAVE_ICONV */
+#endif
if (encoding == NULL || *encoding == '\0')
encoding = DEFAULT_ENCODING;
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@mediaone.net
More information about the Java-patches
mailing list