../nginx_upload_module-2.2.0/ngx_http_upload_module.c: In function ‘ngx_http_upload_merge_ranges’:../nginx_upload_module-2.2.0/ngx_http_upload_module.c:1681:18: error: variable ‘result’ set but not used [-Werror=unused-but-set-variable]cc1: all warnings being treated as errorsmake[1]: *** [objs/addon/nginx_upload_module-2.2.0/ngx_http_upload_module.o] Error 1make[1]: Leaving directory `/root/build/nginx-1.0.10'make: *** [build] Error 2
解决:
Just replace "int result;" by "__attribute__((__unused__)) int result;".
分析:代码中有类似这样的代码
int main()
{
int result;
if(...)
{result = func();
}
}
编译器检查严格,把所有的警告当做错误来对待。该警告产生的原因是由于 result有可能定义了但是用不到(if不会执行)