Yacc:在没有真正原型的情况下调用yyerror()

时间:2018-04-14 17:53:24

标签: flex-lexer yacc

我是yacc的初学者,在编译yacc文件时似乎遇到了一些问题。 警告"在没有真正原型的情况下调用yyerror()是什么"意思? 我该如何解决?

y.tab.c: In function ‘yyparse’:
y.tab.c:287:5: warning: call to function ‘yyerror’ without a real prototype 
[-Wunprototyped-calls]

 ^
morse.y:19:6: note: ‘yyerror’ was declared here
yyerror(s)
  ^
y.tab.c:422:5: warning: call to function ‘yyerror’ without a real prototype 
[-Wunprototyped-calls]
yyoverflow:
 ^
morse.y:19:6: note: ‘yyerror’ was declared here
yyerror(s)

这是yacc文件

%{
#include <stdio.h>
int valid=1;
%}
%token I AM
%%
msg     :       I"\n"{printf("End\n");
char message [20];
printf("Message:");
scanf("%s",message);
printf("Decoded : %s",message);
return;
}
;
%%
main(){
yyparse();
}
yyerror(s)
char *s;
{
fprintf(stderr,"%s\n",s);
}
yywrap ()
{
return 1;
}

0 个答案:

没有答案
相关问题