This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gcc warnings disappearing  on second compile or minimal change

Hi All

i have a problem that with our test code we have always produced a #warning for all test code that the engineers put in the production code.

if you compile the code and then compile again the #warnings are not reproduced along with other warnings

so the issue is that some times a clean or build all does not produce the warnings in you compilation either

we are using the GCC for arm compiler for the kinetis m0 processor

is there a compiler directive that i can put in .... i have looked and looked but i think that i may be missing the right word to search for

Dan

  • If your build system only recompiles files that have changed, then it is not surprising that second compiles or minimal changes mean that warnings disappear. You will only get the warnings if they happen to present in a file in the change set (or a file one of the change set includes); i.e. if the compiler doesn't scan the file then you won't get any warnings for it.

    Also note that #warning and #error only work if they are on the active codepath - code in an inactive #if or #else block won't trigger because the preprocessor doesn't evaluate those blocks - it just skips over them.

    A clean build should always produce all warnings on the active code path. If it doesn't I would think something in your build system is buggy (e.g. failing to delete an output intermediate in a "clean" build), GCC is a very mature compiler so I would be surprised if the issue is there.

    If you still have issues, please could you post a cut down example of the problem? It is always easier to help with a concrete example to try.

    HTH,
    Pete