uVision5.31 Armcc V5.06 update 6
I am trying to use #pragma statements to suppress not referenced warnings for a function.
From the manual I think I need:
#pragma push #pragma diag_suppress 177 void UnReferencedFunction(void) { ..... } #pragma pop
But this doesn't work, I still get "#177-D declared but never referenced" warnings; I have tried different versions of the #pragma diag_suppress 177 statement: including the hash, including the '-D', leading zero; but I just cannot get it to work.Has anyone got this working?
Is it really the compiler that issues this warning for a C file? As it cannot know it is not referenced by another file.
That's a fair point, it will be the linker; however; the linker and compiler are part of the same tool chain and the same version. And it doesn't alter the problem that the manual says #pragma diag_suppress 177 should suppress the warning.
The manual says a pragma in the the C file will suppress a linker warning?
I cannot even find an option to the linker to warn about this.
I was looking at: https://www.keil.com/support/man/docs/ARMCC/armcc_chr1359124986491.htmBut I see what you are saying; the C files aren't going to be passed by the linker, so unless the compiler copies the pragma instruction into the assembled code files somehow, it's not going to work.
I didn't think of that.
The linker has it's own parameters. So for example I pass
# Empty region warningLDFLAGS+= --diag_suppress=6312
to the linker.