JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A function or object is declared with file static or narrower scope, but is not used within the scope of the declaration.
See also Unused Variable.
This warning class is derived from a C/C++ parser warning.
| Class Name | Declared but Not Referenced | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | style | |||||||||||||||||||||||||||||||||||||||
| Mnemonic | PARSE.DBNR | |||||||||||||||||||||||||||||||||||||||
| Categories |
|
|||||||||||||||||||||||||||||||||||||||
| Availability | Available for C and C++. |
|||||||||||||||||||||||||||||||||||||||
| Enabling | Checks for this warning class are
disabled by default. To enable them, add the following WARNING_FILTER
rule to the project configuration file.
WARNING_FILTER += allow class="Declared but Not Referenced" |
static int i1 = 1; // 'Declared but Not Referenced' warning issued here int i2 = 2; // unused but has external linkage static int i3 = 3; // used to define f4() static void f1(int i){} // 'Declared but Not Referenced' warning issued here void f2(int i) {} // unused but has external linkage static void f3(int i){ // used to define f4() int a; // 'Declared but Not Referenced' warning issued here // ('Unused Variable' warning also issued) } static void f4(int i){ // 'Declared but Not Referenced' warning issued here f3(i3); } namespace mynamespace { static int mi1 = 1; // 'Declared but Not Referenced' warning issued here int mi2 = 2; // unused but has external linkage static int mi3 = 3; // used to define mns4() static void mns1(int i){} // 'Declared but Not Referenced' warning issued here void mns2(int i){} // unused but has external linkage static void mns3(int i){ // used to define mns4() int a; // 'Declared but Not Referenced' warning issued here // ('Unused Variable' warning also issued) } static void mns4(int i){ // 'Declared but Not Referenced' warning issued here mns3(mi3); } } namespace { static int ai1 = 1; // 'Declared but Not Referenced' warning issued here int ai2 = 2; // 'Declared but Not Referenced' warning issued here static int ai3 = 3; // used to define ans4() static void ans1(int i){} // 'Declared but Not Referenced' warning issued here void ans2(int i){} // 'Declared but Not Referenced' warning issued here static void ans3(int i){ // used to define ans4() int a; // 'Declared but Not Referenced' warning issued here // ('Unused Variable' warning also issued) } static void ans4(int i){ // 'Declared but Not Referenced' warning issued here ans3(ai3); } }
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.