scws
scws copied to clipboard
编译报错may be used uninitialized in this function
rule.c:190:17: error: ‘rtail may be used uninitialized in this function [-Werror=maybe-uninitialized] rtail->next = a; ~~~~~~~~~~~~^~~
从代码里看 scws/libscws/rule.c@scws_rule_new里 rule_attr_t a, rtail; // 此处rtail未做初始化 ... /* append to the chain list */ if (r->attr == NULL) r->attr = rtail = a; else { rtail->next = a; // 此处使用了未初始化的变量 rtail = a; } 建议改成: rule_attr_t a, rtail = NULL; ... else { if (rtail) rtail->next = a; rtail = a; }
暂时通过增加编译参数-no-undefined绕过