diff options
author | Carl Worth <cworth@cworth.org> | 2010-05-10 13:17:25 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-05-10 13:32:29 -0700 |
commit | a1e32bcff0a04dbff61f28c8e725cf2bf120bf85 (patch) | |
tree | 7ff23bd7662f0894730eb4de675b9e33fdb22247 | |
parent | 38aa83560be3368b4e9784b3ef8f73144171ca45 (diff) |
Add some compiler warnings and corresponding fixes.
Most of the current problems were (mostly) harmless things like
missing declarations, but there was at least one real error, (reversed
argument order for yyerrror).
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | glcpp-lex.l | 1 | ||||
-rw-r--r-- | glcpp-parse.y | 6 | ||||
-rw-r--r-- | glcpp.c | 2 | ||||
-rw-r--r-- | glcpp.h | 45 |
5 files changed, 54 insertions, 2 deletions
@@ -1,3 +1,5 @@ +override CFLAGS += -Wall -Wextra -Wwrite-strings -Wswitch-enum -Wno-unused + glcpp: glcpp.o glcpp-lex.o glcpp-parse.o %.c %.h: %.y diff --git a/glcpp-lex.l b/glcpp-lex.l index 276f50ddfe..747e24056f 100644 --- a/glcpp-lex.l +++ b/glcpp-lex.l @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> +#include "glcpp.h" #include "glcpp-parse.h" %} diff --git a/glcpp-parse.y b/glcpp-parse.y index 9acd549b24..a2d1094253 100644 --- a/glcpp-parse.y +++ b/glcpp-parse.y @@ -25,10 +25,12 @@ #include <stdio.h> #include <stdlib.h> +#include "glcpp.h" + #define YYSTYPE int void -yyerror (const char *error, void *scanner); +yyerror (void *scanner, const char *error); %} @@ -54,7 +56,7 @@ token: TOKEN %% void -yyerror (const char *error, void *scanner) +yyerror (void *scanner, const char *error) { fprintf (stderr, "Parse error: %s\n", error); } @@ -21,6 +21,8 @@ * DEALINGS IN THE SOFTWARE. */ +#include "glcpp.h" + int main (void) { diff --git a/glcpp.h b/glcpp.h new file mode 100644 index 0000000000..485387b8a5 --- /dev/null +++ b/glcpp.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLCPP_H +#define GLCPP_H + +/* Generated by glcpp-lex.l to glcpp-lex.c */ + +#define yyscan_t void* + +int +yylex_init (yyscan_t *scanner); + +int +yylex (yyscan_t scanner); + +int +yylex_destroy (yyscan_t scanner); + +/* Generated by glcpp-parse.y to glcpp-parse.c */ + +int +yyparse (void *scanner); + +#endif |