[previous] 3224 [next] This identifier has previously been declared with internal linkage but is not declared here with the static storage class specifier.
Declarations and Definitions

An object or function which has previously been declared with internal linkage has been redeclared without the static storage class specifier. This is allowed by the C standard but is confusing. If an object or function really is meant to have internal linkage, it is helpful if all declarations explicitly include the keyword static.

For example:


/*PRQA S 2017,3207,3219,3227 ++*/

static int x1 = 0;
static int x2 = 0;
static int foo1(int a);
static int foo2(int b);

extern int x1;                  /* Message 3224 */

int        x2;                  /* Message 0625 - conflicting declaration - undefined */

extern int foo1(int a)
{                               /* Message 3224 */
    return (a+1);
}

int foo2(int b)
{                               /* Message 3224 */
    return (b+1);
}


MISRA C:2012 Rules applicable to message 3224:

Rule-8.8  (Required) The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage


QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents