Search code examples
cbuildcompiler-warningsgnu-arm

How to enable warning in each occurrences "implicit declaration of function"?


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.


Solution

  • 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