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
C and C++


PARSE.SCNF : Storage Class Not First

Summary

A declaration contains an auto, extern, static, register, or typedef specifier, but that specifier is not the first one in the declaration.

This warning class is derived from a C/C++ parser warning.

Properties

Class Name Storage Class Not First
Significance style
Mnemonic PARSE.SCNF
Categories
AUTOSARC++14 AUTOSARC++14:A7-1-8 A non-type specifier shall be placed before a type specifier in a declaration.
CWE CWE:1076 Insufficient Adherence to Expected Conventions
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="Storage Class Not First"

Example

typedef const int myint;                                          /* 'typedef' appears first */
int typedef const myotherint;       /* 'Storage Class Not First' warning issued here */

static int si_good;                                               /* 'static' appears first */
int static si_bad;                  /* 'Storage Class Not First' warning issued here */

extern int ei_good;                                               /* 'extern' appears first */
int extern ei_bad;                  /* 'Storage Class Not First' warning issued here */

int static f(void){                 /* 'Storage Class Not First' warning issued here */
    auto int ai_good = 1;                                         /* 'auto' appears first */
    int auto ai_bad = 2;            /* 'Storage Class Not First' warning issued here */
    register int ri_good = 3;                                     /* 'register' appears first
                                                                   * ('Register Keyword' warning issued here )
                                                                   */
    int register ir_bad = 4;        /* 'Storage Class Not First' warning issued here
                                     *  ('Register Keyword' warning also issued)
                                     */
    const register int cri_bad = 5; /* 'Storage Class Not First' warning issued here
                                     *  ('Register Keyword' warning also issued)
                                     */
    return ai_good + ai_bad + ri_good + ir_bad + cri_bad;
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.