如何在每次出现“函数的隐式声明”时启用警告?

发布于 2025-01-11 14:08:47 字数 1064 浏览 0 评论 0原文

我在代码中第一次出现时得到“函数的隐式声明”,但其他出现的情况没有突出显示,我想立即查看所有这些情况。如下图所示。

我正在使用:ARM 嵌入式处理器的 GNU 工具 (arm-none-eabi-gcc) 版本:2.4-201503242026

    writeReg(ADDR_IP_TR0,saved_TR0); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR2,saved_TR2); <------ Nothing
    writeReg(ADDR_IP_TR3,saved_TR3); <------ Nothing
    writeReg(ADDR_IP_TR5,saved_TR5); <------ Nothing
    writeReg(ADDR_IP_TR9,saved_TR9); <------ Nothing

我正在寻找能够突出显示所有出现的开关,如下所示:

    writeReg(ADDR_IP_TR0,saved_TR0); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR2,saved_TR2); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR3,saved_TR3); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR5,saved_TR5); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR9,saved_TR9); <------ There is implicit declaration of function

我发现标志 -Werror-隐式函数声明 会将这个特定警告转换为错误。

如果您知道如何执行此操作,请告诉我。

I get "implicit declaration of function" for first occurrence in code but the other occurrences are not highlighted I would like to se all of them at once. As shown below.

I am using: GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc) Version: 2.4-201503242026

    writeReg(ADDR_IP_TR0,saved_TR0); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR2,saved_TR2); <------ Nothing
    writeReg(ADDR_IP_TR3,saved_TR3); <------ Nothing
    writeReg(ADDR_IP_TR5,saved_TR5); <------ Nothing
    writeReg(ADDR_IP_TR9,saved_TR9); <------ Nothing

I am looking for switch that will enable highlighting of all occurrences like this:

    writeReg(ADDR_IP_TR0,saved_TR0); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR2,saved_TR2); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR3,saved_TR3); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR5,saved_TR5); <------ There is implicit declaration of function
    writeReg(ADDR_IP_TR9,saved_TR9); <------ There is implicit declaration of function

I have found that flag -Werror-implicit-function-declaration will turn this specific warning in to an error.

If you know how to do this please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若有似无的小暗淡 2025-01-18 14:08:47

在第一个“隐式声明”之后,现在声明(隐式)已调用的函数。因此,后续调用不会导致该警告,因为该函数已在那时声明。 ——阿德里安·莫尔

After the first "implicit declaration" the function that has been called is now declared (implicitly). So, subsequent calls don't cause that warning because the function is by then declared. – Adrian Mole

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文