Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable 'nbufs' set but not used [-Werror,-Wunused-but-set-variable] #246

Closed
zhangxiaolongZ opened this issue Sep 19, 2023 · 4 comments
Closed

Comments

@zhangxiaolongZ
Copy link

When you meet a bug, please open the issue including a title prefixed by '[bug]' and describe it as follows:
(当你碰到一个 bug,请在提出问题时以 '[bug]' 为前缀写明标题,并且像下面的内容一样描述它):

Expected behavior (期望行为)

Actual behavior (实际行为)

OS and Nginx version (操作系统和 Nginx 版本号)

Configuration file (配置文件)

Steps to reproduce the behavior (复现问题步骤)

Error log if any (错误日志)

@zhangxiaolongZ
Copy link
Author

image

@winshining
Copy link
Owner

I have no Mac at hand.
Add the following code after line 656 to test if it works:

(void) nbufs;

@zhangxiaolongZ
Copy link
Author

我也是中国人,找到方法了 在objs的Makefile里 删掉-Werror

@winshining
Copy link
Owner

我也是中国人,找到方法了 在objs的Makefile里 删掉-Werror

不建议这么做,可能有问题的地方不只这一处。
Mac 的编译器检查得更严格些,Linux (gcc-10.2.1) 和 Windows (Visual Studio 2022) 编译都没问题。根本原因是 configure 的时候如果没有添加 --with-debug 选项,ngx_log_debugX 是空的,所以出现 variable 'xxx' set but not used 的错误。
源代码其他文件里有处理方法,就是我上面写的,可以查看 ngx_rtmp_limit_module.c 的第 142 行,ngx_rtmp_mp4_module.c 的第 887 行。在 Linux 和 Windows 上都编译通过,但是我没有 Mac,无法验证。你可以试试,盼复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants