KhalifaFeng 2018-10-29 04:21 采纳率: 0%
浏览 1293

关于在mac上使用vscode 并用bison flex进行编译原理实验报错

ast.c:46:43: warning: more '%' conversions than data arguments [-Wformat]
case PARAM_DEC: printf("%*c类型:%s, 参数名:%s\n", indent,' ');
~^
ast.c:47:53: warning: expression result unused [-Wunused-value]
T->ptr[0]->type==INT?"int": "float",T->ptr[1]->type_id;
^~~~~
ast.c:47:79: warning: expression result unused [-Wunused-value]
T->ptr[0]->type==INT?"int": "float",T->ptr[1]->type_id;
~~~~~~~~~~~^~~~~~~
ast.c:107:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case INT: printf("%*cINT:%d\n",indent,' ',T->type_int);
^
./parser.tab.h:70:13: note: expanded from macro 'INT'
#define INT 258
^
ast.c:105:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case ID: printf("%*cID: %s\n",indent,' ',T->type_id);
^
./parser.tab.h:71:12: note: expanded from macro 'ID'
#define ID 259
^
ast.c:114:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case RELOP:
^
./parser.tab.h:72:15: note: expanded from macro 'RELOP'
#define RELOP 260
^
ast.c:26:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case TYPE: printf("%*c类型: %s\n",indent,' ',T->type_id);
^
./parser.tab.h:73:14: note: expanded from macro 'TYPE'
#define TYPE 261
^
ast.c:109:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case FLOAT: printf("%*cFLAOT:%f\n",indent,' ',T->type_float);
^
./parser.tab.h:74:15: note: expanded from macro 'FLOAT'
#define FLOAT 262
^
ast.c:115:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case PLUS:
^
./parser.tab.h:81:14: note: expanded from macro 'PLUS'
#define PLUS 269
^
ast.c:116:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case MINUS:
^
./parser.tab.h:82:15: note: expanded from macro 'MINUS'
#define MINUS 270
^
ast.c:117:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case STAR:
^
./parser.tab.h:83:14: note: expanded from macro 'STAR'
#define STAR 271
^
ast.c:118:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case DIV:
^
./parser.tab.h:84:13: note: expanded from macro 'DIV'
#define DIV 272
^
ast.c:111:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case ASSIGNOP:
^
./parser.tab.h:85:18: note: expanded from macro 'ASSIGNOP'
#define ASSIGNOP 273
^
ast.c:112:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case AND:
^
./parser.tab.h:86:13: note: expanded from macro 'AND'
#define AND 274
^
ast.c:113:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case OR:
^
./parser.tab.h:87:12: note: expanded from macro 'OR'
#define OR 275
^
ast.c:123:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case NOT:
^
./parser.tab.h:88:13: note: expanded from macro 'NOT'
#define NOT 276
^
ast.c:64:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case WHILE: printf("%*c循环语句:\n",indent,' ');
^
./parser.tab.h:91:15: note: expanded from macro 'WHILE'
#define WHILE 279
^
ast.c:52:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case RETURN: printf("%*c返回语句:\n",indent,' ');
^
./parser.tab.h:92:16: note: expanded from macro 'RETURN'
#define RETURN 280
^
ast.c:124:7: warning: case value not in enumerated type 'enum node_kind' [-Wswitch]
case UMINUS: printf("%*c%s\n",indent,' ',T->type_id);
^
./parser.tab.h:93:16: note: expanded from macro 'UMINUS'
#define UMINUS 281
^
ast.c:17:10: warning: 12 enumeration values not handled in switch: 'FUNCTION', 'PARAM', 'ARG'... [-Wswitch]
switch (T->kind) {
^
ast.c:17:10: note: add missing switch cases
switch (T->kind) {
^
ast.c:94:49: warning: result of comparison of constant 259 with expression of type 'enum node_kind' is always false
[-Wtautological-constant-out-of-range-compare]
if (T0->ptr[0]->kind==ID)
~~~~~~~~~~~~~~~~^ ~~
ast.c:96:54: warning: result of comparison of constant 273 with expression of type 'enum node_kind' is always false
[-Wtautological-constant-out-of-range-compare]
else if (T0->ptr[0]->kind==ASSIGNOP)
~~~~~~~~~~~~~~~~^ ~~~~~~~~
22 warnings generated.
parser.tab.c:1426:16: warning: implicit declaration of function 'yylex' is invalid in C99 [-Wimplicit-function-declaration]
yychar = YYLEX;
^
parser.tab.c:761:16: note: expanded from macro 'YYLEX'

define YYLEX yylex ()

           ^

parser.y:121:13: error: non-void function 'main' should return a value [-Wreturn-type]
if (!yyin) return;

  • 写回答

1条回答 默认 最新

  • devmiao 2018-10-29 05:05
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥50 Oracle Kubernetes服务器集群主节点无法访问,工作节点可以访问
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架
  • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。
  • ¥15 stm32的can接口不能收发数据
  • ¥15 目标检测算法移植到arm开发板
  • ¥15 利用JD51设计温度报警系统