CERT.TU.UNUSED.GLOBAL.DECL

Global identifier is declared but is not used in this translation unit.

Prevention

Declaring an object with external linkage in a source (non-header) file may not be the intended implementation. If the object is intended to be external it is best practise to declare the object in a header file and include that in appropriate translation units.

Vulnerable code example

<file.c> extern int global_var; void foo();

If either global_var or foo() are not referenced in file.c they might be better declared in a header file