summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-06-17 12:58:54 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-06-21 12:31:03 -0700
commite8e93a45436b06713b83e3d353ab848d85de6758 (patch)
tree0379d730faf884c3812f4a7855b98aa18535f284
parent0774523d1882a087b648e4017e634eb12c12f377 (diff)
glcpp: Remove calls to exit().
Calling exit() would be really bad once integrated into mesa. Even in the standalone binary, we want to print the error log first. Since each case already flags an error, compilation will still fail, but it may go on (with something fudged) and generate more errors.
-rw-r--r--glcpp/glcpp-parse.y12
1 files changed, 6 insertions, 6 deletions
diff --git a/glcpp/glcpp-parse.y b/glcpp/glcpp-parse.y
index 74159c19d8..984a476851 100644
--- a/glcpp/glcpp-parse.y
+++ b/glcpp/glcpp-parse.y
@@ -951,7 +951,10 @@ _glcpp_parser_evaluate_defined (glcpp_parser_t *parser,
next = next->next;
if (next == NULL || next->token->type != IDENTIFIER) {
yyerror (&node->token->location, parser, "operator \"defined\" requires an identifier\n");
- exit (1);
+ /* Already flagged an error; fake it. */
+ node->token->type = INTEGER;
+ node->token->value.ival = 0;
+ return;
}
macro = hash_table_find (parser->defines,
next->token->value.str);
@@ -1098,7 +1101,6 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser,
return NULL;
case FUNCTION_UNBALANCED_PARENTHESES:
glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier);
- exit (1);
return NULL;
}
@@ -1424,11 +1426,9 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
*/
if (strncmp(identifier, "__", 2) == 0) {
glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n");
- exit(1);
}
if (strncmp(identifier, "GL_", 3) == 0) {
glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n");
- exit(1);
}
}
@@ -1611,7 +1611,7 @@ _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
{
if (parser->skip_stack == NULL) {
glcpp_error (loc, parser, "%s without #if\n", type);
- exit (1);
+ return;
}
if (parser->skip_stack->type == SKIP_TO_ELSE) {
@@ -1629,7 +1629,7 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc)
if (parser->skip_stack == NULL) {
glcpp_error (loc, parser, "#endif without #if\n");
- exit (1);
+ return;
}
node = parser->skip_stack;