diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-13 16:50:20 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-13 16:50:20 -0400 |
commit | 6541135026dc0cc2486bf53fdedd618d32b1b561 (patch) | |
tree | 0be9303e24b7c7df07f2e23f79d789d933cbfd9d | |
parent | a05402678ac7bc8cc8a545212cdf4caede49be1b (diff) | |
download | runes-6541135026dc0cc2486bf53fdedd618d32b1b561.tar.gz runes-6541135026dc0cc2486bf53fdedd618d32b1b561.zip |
fix undeclared warnings in the parser
the ones in yy_fatal_error, yyalloc, yyrealloc, and yyfree are due to a
bug in flex (http://sourceforge.net/p/flex/bugs/115/), but i've just
worked around them for now
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | parser.l | 27 |
2 files changed, 25 insertions, 5 deletions
@@ -11,9 +11,6 @@ build: $(OUT) $(OUT): $(OBJ) $(CC) $(shell pkg-config --libs $(LIBS)) $(LDFLAGS) -o $@ $^ -parser.o: parser.c - $(CC) $(shell pkg-config --cflags $(LIBS)) $(CFLAGS) -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-value -c -o $@ $^ - %.o: %.c $(CC) $(shell pkg-config --cflags $(LIBS)) $(CFLAGS) -c -o $@ $^ @@ -4,9 +4,12 @@ #include "runes.h" #define RUNES_PARSER_CSI_MAX_PARAMS 256 + +#define YY_EXIT_FAILURE (UNUSED(yyscanner), 2) %} -%option reentrant noyywrap nodefault batch +%option reentrant nodefault batch +%option noyywrap nounput noinput noyyalloc noyyrealloc noyyfree %option prefix="runes_parser_yy" %option extra-type="RunesTerm *" @@ -160,6 +163,7 @@ static void runes_parser_handle_text(RunesTerm *t, char *text, size_t len) static void runes_parser_handle_bel(RunesTerm *t) { /* XXX */ + UNUSED(t); } static void runes_parser_handle_bs(RunesTerm *t) @@ -196,7 +200,6 @@ static void runes_parser_extract_csi_params( static void runes_parser_extract_sm_params( char *buf, size_t len, char *modes, int *params, int *nparams) { - char tmp = buf[len]; char *pos = buf; /* this assumes that it will only ever be called on a fully matched CSI @@ -497,3 +500,23 @@ static void runes_parser_handle_osc2(RunesTerm *t, char *buf, size_t len) { runes_window_backend_set_window_title(t, buf + 4, len - 5); } + +/* XXX these are copied from the generated file so that I can add the UNUSED + * declarations, otherwise we get compilation errors */ +void *runes_parser_yyalloc(yy_size_t size, yyscan_t yyscanner) +{ + UNUSED(yyscanner); + return (void *)malloc(size); +} + +void *runes_parser_yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner) +{ + UNUSED(yyscanner); + return (void *)realloc((char *)ptr, size); +} + +void runes_parser_yyfree(void *ptr, yyscan_t yyscanner) +{ + UNUSED(yyscanner); + free((char *) ptr); +} |