glcpp: Rename "errors" to "info_log."
Eventually, we'll want to be be able to print out warnings as well.
This commit is contained in:
@@ -859,11 +859,11 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
glcpp_error (&token->location, parser, "");
|
glcpp_error (&token->location, parser, "");
|
||||||
glcpp_print (parser->errors, "Pasting \"");
|
glcpp_print (parser->info_log, "Pasting \"");
|
||||||
_token_print (&parser->errors, token);
|
_token_print (&parser->info_log, token);
|
||||||
glcpp_print (parser->errors, "\" and \"");
|
glcpp_print (parser->info_log, "\" and \"");
|
||||||
_token_print (&parser->errors, other);
|
_token_print (&parser->info_log, other);
|
||||||
glcpp_print (parser->errors, "\" does not give a valid preprocessing token.\n");
|
glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n");
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
@@ -909,7 +909,7 @@ glcpp_parser_create (void)
|
|||||||
parser->lex_from_node = NULL;
|
parser->lex_from_node = NULL;
|
||||||
|
|
||||||
parser->output = talloc_strdup(parser, "");
|
parser->output = talloc_strdup(parser, "");
|
||||||
parser->errors = talloc_strdup(parser, "");
|
parser->info_log = talloc_strdup(parser, "");
|
||||||
|
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ main (void)
|
|||||||
ret = glcpp_parser_parse (parser);
|
ret = glcpp_parser_parse (parser);
|
||||||
|
|
||||||
printf("%s", parser->output);
|
printf("%s", parser->output);
|
||||||
fprintf(stderr, "%s", parser->errors);
|
fprintf(stderr, "%s", parser->info_log);
|
||||||
|
|
||||||
glcpp_parser_destroy (parser);
|
glcpp_parser_destroy (parser);
|
||||||
|
|
||||||
|
@@ -154,7 +154,7 @@ struct glcpp_parser {
|
|||||||
token_list_t *lex_from_list;
|
token_list_t *lex_from_list;
|
||||||
token_node_t *lex_from_node;
|
token_node_t *lex_from_node;
|
||||||
char *output;
|
char *output;
|
||||||
char *errors;
|
char *info_log;
|
||||||
};
|
};
|
||||||
|
|
||||||
glcpp_parser_t *
|
glcpp_parser_t *
|
||||||
|
24
glcpp/pp.c
24
glcpp/pp.c
@@ -26,15 +26,17 @@
|
|||||||
void
|
void
|
||||||
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
|
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
parser->errors = talloc_asprintf_append(parser->errors, "%u:%u(%u): "
|
parser->info_log = talloc_asprintf_append(parser->info_log,
|
||||||
"preprocessor error: ",
|
"%u:%u(%u): "
|
||||||
locp->source, locp->first_line,
|
"preprocessor error: ",
|
||||||
locp->first_column);
|
locp->source,
|
||||||
va_list ap;
|
locp->first_line,
|
||||||
va_start(ap, fmt);
|
locp->first_column);
|
||||||
parser->errors = talloc_vasprintf_append(parser->errors, fmt, ap);
|
va_list ap;
|
||||||
va_end(ap);
|
va_start(ap, fmt);
|
||||||
parser->errors = talloc_strdup_append(parser->errors, "\n");
|
parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
parser->info_log = talloc_strdup_append(parser->info_log, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
@@ -46,8 +48,8 @@ preprocess(void *talloc_ctx, const char **shader, size_t *shader_len)
|
|||||||
|
|
||||||
glcpp_parser_parse (parser);
|
glcpp_parser_parse (parser);
|
||||||
|
|
||||||
errors = parser->errors[0] != '\0';
|
errors = parser->info_log[0] != '\0';
|
||||||
printf("%s", parser->errors);
|
printf("%s", parser->info_log);
|
||||||
|
|
||||||
talloc_steal(talloc_ctx, parser->output);
|
talloc_steal(talloc_ctx, parser->output);
|
||||||
*shader = parser->output;
|
*shader = parser->output;
|
||||||
|
Reference in New Issue
Block a user