diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 11376fd..7c29618 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,8 +17,8 @@ else() endif() if(FLEX_FOUND) - FLEX_TARGET(sfst default-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/default-scanner.cpp) - FLEX_TARGET(sfst utf8-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/utf8-scanner.cpp) + FLEX_TARGET(sfst default-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/default-scanner.cpp COMPILE_FLAGS --nounput) + FLEX_TARGET(sfst utf8-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/utf8-scanner.cpp COMPILE_FLAGS --nounput) else() message(STATUS "Flex not found, so executables won't be generated.") endif() diff --git a/src/compact.cpp b/src/compact.cpp index 94d9543..279835e 100644 --- a/src/compact.cpp +++ b/src/compact.cpp @@ -289,7 +289,7 @@ void CompactTransducer::read_probs(FILE *file) { size_t n, m; - fread(&n, sizeof(n), 1, file); + (void)!fread(&n, sizeof(n), 1, file); if (fread(&m, sizeof(n), 1, file) != 1 || n != node_count() || m != arc_count()) { fprintf(stderr, "Error: incompatible probability file!\n"); @@ -297,7 +297,7 @@ void CompactTransducer::read_probs(FILE *file) } final_logprob = new float[n]; arc_logprob = new float[m]; - fread(final_logprob, sizeof(float), n, file); + (void)!fread(final_logprob, sizeof(float), n, file); if (fread(arc_logprob, sizeof(float), n, file) != n) { fprintf(stderr, "Error: in probability file!\n"); exit(1); diff --git a/src/fst.cpp b/src/fst.cpp index c141586..672ab67 100644 --- a/src/fst.cpp +++ b/src/fst.cpp @@ -863,18 +863,18 @@ void Transducer::store(FILE *file) static void read_node(FILE *file, Node *node, Node **p, Transducer *a) { char c; - fread(&c, sizeof(c), 1, file); + (void)!fread(&c, sizeof(c), 1, file); node->set_final(c); unsigned short n; - fread(&n, sizeof(n), 1, file); + (void)!fread(&n, sizeof(n), 1, file); for (int i = 0; i < n; i++) { Character lc, uc; unsigned int t; - fread(&lc, sizeof(lc), 1, file); - fread(&uc, sizeof(uc), 1, file); - fread(&t, sizeof(t), 1, file); + (void)!fread(&lc, sizeof(lc), 1, file); + (void)!fread(&uc, sizeof(uc), 1, file); + (void)!fread(&t, sizeof(t), 1, file); if (ferror(file)) throw "Error encountered while reading transducer from file"; if (p[t]) @@ -901,7 +901,7 @@ void Transducer::read_transducer_binary(FILE *file) vmark = deterministic = 0; unsigned int n; - fread(&n, sizeof(n), 1, file); // number of nodes + (void)!fread(&n, sizeof(n), 1, file); // number of nodes if (ferror(file)) throw "Error encountered while reading transducer from file"; diff --git a/src/lowmem.h b/src/lowmem.h index 7ff9440..3fed278 100644 --- a/src/lowmem.h +++ b/src/lowmem.h @@ -42,15 +42,15 @@ class LMNode { LMNode(long pos, FILE *lmafile) { fseek(lmafile, pos, SEEK_SET); - fread(&finalp, sizeof(finalp), 1, lmafile); - fread(&number_of_arcs, sizeof(number_of_arcs), 1, lmafile); + (void)!fread(&finalp, sizeof(finalp), 1, lmafile); + (void)!fread(&number_of_arcs, sizeof(number_of_arcs), 1, lmafile); arc = new LMArc[number_of_arcs]; for (int i = 0; i < (int)number_of_arcs; i++) { Character lc, uc; unsigned int tpos; - fread(&lc, sizeof(lc), 1, lmafile); - fread(&uc, sizeof(uc), 1, lmafile); - fread(&tpos, sizeof(tpos), 1, lmafile); + (void)!fread(&lc, sizeof(lc), 1, lmafile); + (void)!fread(&uc, sizeof(uc), 1, lmafile); + (void)!fread(&tpos, sizeof(tpos), 1, lmafile); arc[i].label = Label(lc, uc); arc[i].tnodepos = tpos; } diff --git a/src/utf8-scanner.ll b/src/utf8-scanner.ll index 80d2774..c16c1c4 100644 --- a/src/utf8-scanner.ll +++ b/src/utf8-scanner.ll @@ -23,7 +23,7 @@ using namespace SFST; #define MAX_INCLUDE_DEPTH 10 - + int Include_Stack_Ptr = 0; YY_BUFFER_STATE Include_Stack[MAX_INCLUDE_DEPTH]; char *Name_Stack[MAX_INCLUDE_DEPTH]; @@ -34,9 +34,9 @@ char *FileName=NULL; bool UTF8=true; -static void unmatched( char sym ) { - fprintf(stderr,"Warning: unmatched symbol \"%c\". You might want to quote it.\n", sym); -} +// static void unmatched( char sym ) { +// fprintf(stderr,"Warning: unmatched symbol \"%c\". You might want to quote it.\n", sym); +//} static char *unquote(char *string, bool del_quote=true) { char *s=string, *result=string; @@ -155,13 +155,13 @@ FN [A-Za-z0-9._/\-*+] \<({C5}|\\.)*\> { yylval.name = unquote(yytext,false); return SYMBOL; } -\"<{FN}+>\" { +\"<{FN}+>\" { yylval.value = fst_strdup(yytext+2); yylval.value[strlen(yylval.value)-2] = 0; return STRING2; } -\"{FN}+\" { +\"{FN}+\" { yylval.value = fst_strdup(yytext+1); yylval.value[strlen(yylval.value)-1] = 0; return STRING; @@ -171,7 +171,7 @@ FN [A-Za-z0-9._/\-*+] \\[ \t]*([ \t]\%.*)?\r?\n { print_lineno(); /* ignored */ } \r?\n { print_lineno(); return NEWLINE; } -\\[0-9]+ { long l=atol(yytext+1); +\\[0-9]+ { long l=atol(yytext+1); if (l <= 1114112) { yylval.value=fst_strdup(int2utf8((unsigned)l)); return UTF8CHAR; } yyerror("invalid expression"); }