glcpp: Add glcpp_warning for printing warnings to the info log.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 19 Jun 2010 02:54:25 +0000 (19:54 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 21 Jun 2010 19:41:05 +0000 (12:41 -0700)
glcpp/glcpp.h
glcpp/pp.c

index 8167a481d5eb86dd5d3822f50e796750d9050bd9..bb0ac95aedfa0cf8dfd4dafe2c9f648ab13b2641 100644 (file)
@@ -167,9 +167,14 @@ glcpp_parser_parse (glcpp_parser_t *parser);
 void
 glcpp_parser_destroy (glcpp_parser_t *parser);
 
+/* Functions for writing to the info log */
+
 void
 glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...);
 
+void
+glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...);
+
 /* Generated by glcpp-lex.l to glcpp-lex.c */
 
 int
index 846d35506fb510e5f390a66edc64eb900a642d4e..eaca4819ce54c119806a8c62a3e0c80b6979debf 100644 (file)
@@ -40,6 +40,22 @@ glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
        parser->info_log = talloc_strdup_append(parser->info_log, "\n");
 }
 
+void
+glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
+{
+       parser->info_log = talloc_asprintf_append(parser->info_log,
+                                                 "%u:%u(%u): "
+                                                 "preprocessor warning: ",
+                                                 locp->source,
+                                                 locp->first_line,
+                                                 locp->first_column);
+       va_list ap;
+       va_start(ap, fmt);
+       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
 preprocess(void *talloc_ctx, const char **shader, size_t *shader_len)
 {