aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-02-17 04:19:34 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-02-17 04:19:34 +0000
commit33ae9bdf30eeed59f1c4b6ef47c1cdbabc8f5908 (patch)
treede72c2c117e9bee1396bd1c7459447c78d5141c8 /gcc/java
parentb7ba4d8dfa5e7fcb14a920bc26c83e6768e6e05d (diff)
downloadgcc-33ae9bdf30eeed59f1c4b6ef47c1cdbabc8f5908.zip
gcc-33ae9bdf30eeed59f1c4b6ef47c1cdbabc8f5908.tar.gz
gcc-33ae9bdf30eeed59f1c4b6ef47c1cdbabc8f5908.tar.bz2
Makefile.in (PARSE_C, [...]): Move dependencies on lex.c, lex.h, and PARSE_H to...
* Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on lex.c, lex.h, and PARSE_H to... (parse.o, parse-scan.o): ...here, respectively. * lex.c: Split out code that may trigger SIGFPE from yylex() to its own function. * lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value. From-SVN: r32025
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/Makefile.in11
-rw-r--r--gcc/java/lex.c77
-rw-r--r--gcc/java/lex.h1
4 files changed, 67 insertions, 32 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 3a0bf8c..7047b9d 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,13 @@
+2000-02-16 Zack Weinberg <zack@wolery.cumb.org>
+
+ * Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on
+ lex.c, lex.h, and PARSE_H to...
+ (parse.o, parse-scan.o): ...here, respectively.
+
+ * lex.c: Split out code that may trigger SIGFPE from yylex()
+ to its own function.
+ * lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value.
+
2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in (jvspec.o): Depend on $(GCC_H), not gcc.h.
diff --git a/gcc/java/Makefile.in b/gcc/java/Makefile.in
index 07e4f22..633a13f 100644
--- a/gcc/java/Makefile.in
+++ b/gcc/java/Makefile.in
@@ -217,12 +217,11 @@ PARSE_C = $(PARSE_DIR)/parse.c
PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c
PARSE_H = $(srcdir)/parse.h
-$(PARSE_C): $(srcdir)/parse.y $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
+$(PARSE_C): $(srcdir)/parse.y
$(SET_BISON); \
cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
-o parse.c $(PARSE_RELDIR)/parse.y
-$(PARSE_SCAN_C): $(srcdir)/parse-scan.y $(srcdir)/lex.c $(PARSE_H) \
- $(srcdir)/lex.h
+$(PARSE_SCAN_C): $(srcdir)/parse-scan.y
$(SET_BISON); \
cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
$(PARSE_RELDIR)/parse-scan.y
@@ -262,7 +261,8 @@ clean: mostlyclean
force:
parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h \
- $(srcdir)/../function.h $(JAVA_TREE_H)
+ $(srcdir)/../function.h $(JAVA_TREE_H) $(srcdir)/lex.c $(PARSE_H) \
+ $(srcdir)/lex.h
jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
jcf-reader.c jcf.h javaop.h javaop.def $(srcdir)/../version.h
gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
@@ -300,7 +300,8 @@ lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h $(RTL_H) $(EXPR_H)
mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
-parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
+parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
+ $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h
verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
diff --git a/gcc/java/lex.c b/gcc/java/lex.c
index 24ab8ef..58df299 100644
--- a/gcc/java/lex.c
+++ b/gcc/java/lex.c
@@ -517,6 +517,44 @@ java_parse_escape_sequence ()
}
}
+/* Isolate the code which may raise an arithmetic exception in its
+ own function. */
+
+#ifndef JC1_LITE
+struct jpa_args
+{
+ YYSTYPE *java_lval;
+ char *literal_token;
+ int fflag;
+ int number_beginning;
+};
+
+static void java_perform_atof PARAMS ((PTR));
+
+static void
+java_perform_atof (av)
+ PTR av;
+{
+ struct jpa_args *a = (struct jpa_args *)av;
+ YYSTYPE *java_lval = a->java_lval;
+ int number_beginning = a->number_beginning;
+ REAL_VALUE_TYPE value;
+ tree type = (a->fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
+
+ SET_REAL_VALUE_ATOF (value,
+ REAL_VALUE_ATOF (a->literal_token, TYPE_MODE (type)));
+
+ if (REAL_VALUE_ISINF (value)
+ || REAL_VALUE_ISNAN (value))
+ {
+ JAVA_FLOAT_RANGE_ERROR ((a->fflag ? "float" : "double"));
+ value = DCONST0;
+ }
+
+ SET_LVAL_NODE_TYPE (build_real (type, value), type);
+}
+#endif
+
static int yylex PARAMS ((YYSTYPE *));
static int
@@ -762,12 +800,9 @@ java_lex (java_lval)
}
else
{
- jmp_buf handler;
- REAL_VALUE_TYPE value;
#ifndef JC1_LITE
- tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
+ struct jpa_args a;
#endif
-
if (stage != 4) /* Don't push back fF/dD */
java_unget_unicode ();
@@ -778,28 +813,18 @@ java_lex (java_lval)
literal_token [literal_index] = '\0';
JAVA_LEX_LIT (literal_token, radix);
- if (setjmp (handler))
- {
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
- value = DCONST0;
- }
- else
- {
- SET_FLOAT_HANDLER (handler);
- SET_REAL_VALUE_ATOF
- (value, REAL_VALUE_ATOF (literal_token,
- TYPE_MODE (type)));
-
- if (REAL_VALUE_ISINF (value))
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
- if (REAL_VALUE_ISNAN (value))
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
- SET_LVAL_NODE_TYPE (build_real (type, value), type);
- SET_FLOAT_HANDLER (NULL_PTR);
- return FP_LIT_TK;
- }
+#ifndef JC1_LITE
+ a.literal_token = literal_token;
+ a.fflag = fflag;
+ a.java_lval = java_lval;
+ a.number_beginning = number_beginning;
+ if (do_float_handler (java_perform_atof, (PTR) &a))
+ return FP_LIT_TK;
+
+ JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
+#else
+ return FP_LIT_TK;
+#endif
}
}
} /* JAVA_ASCCI_FPCHAR (c) */
diff --git a/gcc/java/lex.h b/gcc/java/lex.h
index 7bb6558..d4754ab 100644
--- a/gcc/java/lex.h
+++ b/gcc/java/lex.h
@@ -180,7 +180,6 @@ extern void set_float_handler PARAMS ((jmp_buf));
sprintf (msg, "Floating pointer literal exceeds range of `%s'", (m)); \
java_lex_error (msg, 0); \
ctxp->c_line->current = i; \
- value = dconst0; \
}
#define JAVA_INTEGRAL_RANGE_ERROR(m) \
{ \