From 1d0bdb96036cb18a22bcd57e1a7034ef6c26b140 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 12 Sep 2015 21:00:55 +0300 Subject: [PATCH] Fix implicit declaration and default return type build warnings --- cockney.l | 34 ++++++++++++++++++++++------------ jive.l | 15 ++++++++++----- ky00te.dir/ky00te.yacc | 3 +++ newspeak.l | 16 +++++++++++----- nyc.l | 11 +++++++---- 5 files changed, 53 insertions(+), 26 deletions(-) diff --git a/cockney.l b/cockney.l index 4cc1555..180068d 100644 --- a/cockney.l +++ b/cockney.l @@ -17,13 +17,22 @@ EW [ \t.,;!\?$] %option noyywrap -%% - %{ -void eos(); -void plastc(); +#include +void eos(void); +void plastc(void); +char caseify(char); +void I(void); +void bloody(void); +void set_did(short); +void clear_did(void); +void dintI(void); +void pooped(void); +void expletive(void); %} +%% + . { srandom(time(0L)); unput(yytext[0]); BEGIN 0; } {BW}[Tt]he{EW} { ECHO; bloody(); } {BW}[Ss]teal{EW} { printf("%c%cick",yytext[0],yytext[1]-5); @@ -110,7 +119,7 @@ void plastc() unput(yytext[yyleng-1]); } -caseify(c) +char caseify(c) char c; { if (yytext[0] <= 'Z') @@ -120,7 +129,7 @@ char c; } -I() +void I() { /* extern long random(); */ @@ -133,7 +142,7 @@ I() static short b_count = 0; static short b_which = 0; -bloody() +void bloody() { if (b_count++ % 2 == 0) { switch (b_which++ % 4) { @@ -147,17 +156,18 @@ bloody() static short did = 0; -set_did(val) +void set_did(val) +short val; { did = val; } -clear_did() +void clear_did() { did = 0; } -dintI() +void dintI() { /* extern long random(); */ @@ -170,7 +180,7 @@ dintI() clear_did(); } -pooped() +void pooped() { /* extern long random(); */ @@ -187,7 +197,7 @@ pooped() } } -expletive() +void expletive() { /* Blimey diff --git a/jive.l b/jive.l index f8a1386..ff6d21f 100644 --- a/jive.l +++ b/jive.l @@ -18,12 +18,16 @@ BW [ \t\(] EW [ \t.,;!\?$\)] %option noyywrap -%% %{ - void plastc(); + void plastc(void); + char caseify(char); + void expletive(void); + void thing(char); %} +%% + @[Bb]egin(.*) | ".so ".*$ printf("%s", yytext); {BW}send printf("%ct'row",yytext[0]); @@ -207,7 +211,7 @@ void plastc() unput(yytext[yyleng-1]); } -caseify(c) +char caseify(c) char c; { if (yytext[0] <= 'Z') @@ -216,7 +220,7 @@ char c; return (c); } -thing(c) +void thing(c) char c; { static short count = 0; @@ -234,7 +238,8 @@ char c; break; } } -expletive() + +void expletive() { static short count = 0; static short which = 0; diff --git a/ky00te.dir/ky00te.yacc b/ky00te.dir/ky00te.yacc index 4254394..50e2182 100644 --- a/ky00te.dir/ky00te.yacc +++ b/ky00te.dir/ky00te.yacc @@ -1,9 +1,12 @@ %{ #include +#include typedef int INT; #define YYSTYPE INT +extern int yylex (void); +int yyerror(char*); %} diff --git a/newspeak.l b/newspeak.l index 4b2928e..8e7844b 100644 --- a/newspeak.l +++ b/newspeak.l @@ -51,6 +51,12 @@ unsigned int fcounter = 0; #define WCOMP(string1,string2) compstring(Y0,(string1),(string2),1) #define DUMP() printf("%s",yytext) + +void capstring(char, char*, int); +void compstring(char, char*, char*, int); +char _caseify(char, int); +char caseify(char); + %} %e 8000 @@ -643,14 +649,14 @@ robably|ventually|[Oo]bvious|[Bb]asic|{W}[Oo]nly|otally | %} %% -main() +int main() { yylex(); printf("\nHail Big Brother!\n"); } -capstring(firstchar,string,i) +void capstring(firstchar,string,i) char firstchar, *string; int i; { @@ -659,7 +665,7 @@ capstring(firstchar,string,i) printf("%s",string+1); } -compstring(firstchar,string1,string2,i) +void compstring(firstchar,string1,string2,i) char firstchar, *string1, *string2; int i; { @@ -667,7 +673,7 @@ compstring(firstchar,string1,string2,i) capstring(0,string2,i); } -_caseify(c,i) +char _caseify(c,i) char c; int i; { @@ -675,7 +681,7 @@ _caseify(c,i) else return (c); } -caseify(c) +char caseify(c) char c; { return _caseify(c,0); diff --git a/nyc.l b/nyc.l index 509979e..ddc5dbe 100644 --- a/nyc.l +++ b/nyc.l @@ -12,10 +12,13 @@ BW [ \t] SP [ \t] EW [ \t.,;!\?$] -%% %{ - void plastc(); + void plastc(void); + char caseify(char); + void expletive(void); %} + +%% ".so ".*$ printf("%s", yytext); [ao]ther printf("%cdder", yytext[0]=='a'?'a':'u'); [Nn]othing printf("%cuttin'", yytext[0]); @@ -76,7 +79,7 @@ void plastc() yyunput(yytext[yyleng-1], yytext); } -caseify(c) +char caseify(c) char c; { if (yytext[0] <= 'Z') @@ -88,7 +91,7 @@ char c; short count = 0; short which = 0; -expletive() +void expletive() { if (count++ % 4 == 0) { switch (which++ % 5) { -- 2.30.2