This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: gcc/java/parse.y: Improper DIR_SEPARATOR Usage
- From: Tom Tromey <tromey at redhat dot com>
- To: Ranjit Mathew <rmathew at hotmail dot com>
- Cc: java-patches at gcc dot gnu dot org, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 09 Sep 2002 11:56:00 -0600
- Subject: Re: Patch: gcc/java/parse.y: Improper DIR_SEPARATOR Usage
- References: <aknqkk$daj$1@main.gmane.org>
- Reply-to: tromey at redhat dot com
>>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:
Ranjit> The MinGW specific config file (gcc/config/i386/xm-mingw32.h)
Ranjit> defines '/' as DIR_SEPARATOR and '\\' as DIR_SEPARATOR_2. The
Ranjit> original parse.y code is thus buggy w.r.t. a MinGW host.
Ranjit> The following patch uses the standard GCC macro
Ranjit> IS_DIR_SEPARATOR( ) (defined in gcc/system.h), which
Ranjit> correctly handles this case:
This patch looks fine. I'm checking it in, with a couple minor
refinements. New patch appended.
There are other uses of DIR_SEPARATOR in the gcj source. I wonder if
these also need to be fixed.
Tom
Index: ChangeLog
from Ranjit Mathew <rmathew@hotmail.com>
* parse.y (DIR_SEPARATOR): Don't define.
(check_class_interface_creation): Use IS_DIR_SEPARATOR.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.393
diff -u -r1.393 parse.y
--- parse.y 26 Aug 2002 23:30:02 -0000 1.393
+++ parse.y 9 Sep 2002 17:54:27 -0000
@@ -69,10 +69,6 @@
#include "debug.h"
#include "tree-inline.h"
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
/* Local function prototypes */
static char *java_accstring_lookup PARAMS ((int));
static void classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
@@ -3449,12 +3445,11 @@
{
const char *f;
- /* Contains OS dependent assumption on path separator. FIXME */
for (f = &input_filename [strlen (input_filename)];
- f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
+ f != input_filename && ! IS_DIR_SEPARATOR (f[0]);
f--)
;
- if (f[0] == '/' || f[0] == DIR_SEPARATOR)
+ if (IS_DIR_SEPARATOR (f[0]))
f++;
if (strncmp (IDENTIFIER_POINTER (raw_name),
f , IDENTIFIER_LENGTH (raw_name)) ||
@@ -12916,7 +12911,7 @@
/* Try a narrowing primitive conversion (5.1.3):
- expression is a constant expression of type byte, short, char,
- or int, AND
+ or int, AND
- variable is byte, short or char AND
- The value of the expression is representable in the type of the
variable */