26.2 Warnings
Symbols
‘/*’ within comment
A comment mark was found within a comment.
‘$’ character(s) in identifier or number
Dollar signs in identifier names are an extension to the standard.
#‘directive’ is a GCC extension
#warning, #include_next, #ident, #import, #assert and #unassert directives are GCC extensions and are not of ISO C89.
#import is obsolete, use an #ifndef wrapper in the header file
The #import directive is obsolete. #import was used to include a file if it hadn’t already been included. Use the #ifndef directive instead.
#include_next in primary source file
#include_next
starts searching the list of header file
directories after the directory in which the current file was found. In this case, there
were no previous header files so it is starting in the primary source file.
#pragma pack (pop) encountered without matching #pragma pack (push, <n>)
The pack(pop) pragma must be paired with a pack(push) pragma, which must precede it in the source file.
#pragma pack (pop, identifier) encountered without matching #pragma pack (push, identifier, <n>)
The pack(pop) pragma must be paired with a pack(push) pragma, which must precede it in the source file.
#warning: message
The directive #warning causes the preprocessor to issue a warning and continue preprocessing. The tokens following #warning are used as the warning message.
A
absolute address specification ignored
Ignoring the absolute address specification for the code section in the
#pragma statement because it is not supported in the compiler. Addresses must be specified
in the linker script and code sections can be defined with the keyword
__attribute__
.
address of register variable ‘name’ requested
The register specifier prevents taking the address of a variable.
alignment must be a small power of two, not n
The alignment parameter of the pack pragma must be a small power of two.
anonymous enum declared inside parameter list
An anonymous enum is declared inside a function parameter list. It is usually better programming practice to declare enums outside parameter lists, since they can never become complete types when defined inside parameter lists.
anonymous struct declared inside parameter list
An anonymous struct is declared inside a function parameter list. It is usually better programming practice to declare structs outside parameter lists, since they can never become complete types when defined inside parameter lists.
anonymous union declared inside parameter list
An anonymous union is declared inside a function parameter list. It is usually better programming practice to declare unions outside parameter lists, since they can never become complete types when defined inside parameter lists.
anonymous variadic macros were introduced in C99
Macros which accept a variable number of arguments is a C99 feature.
argument ‘identifier’ might be clobbered by ‘longjmp’ or ‘vfork’
An argument might be changed by a call to longjmp. These warnings are possible only in optimizing compilation.
array ‘identifier’ assumed to have one element
The length of the specified array was not explicitly stated. In the absence of information to the contrary, the compiler assumes that it has one element.
array subscript has type ‘char’
An array subscript has type ‘char’.
array type has incomplete element type
Array types should not have incomplete element types.
asm operand n probably doesn’t match constraints
The specified extended asm operand probably doesn’t match its constraints.
assignment of read-only member ‘name’
The member ‘name’ was declared as const and cannot be modified by assignment.
assignment of read-only variable ‘name’
‘name’ was declared as const and cannot be modified by assignment.
‘identifier’ attribute directive ignored
The named attribute is not a known or supported attribute, and is therefore ignored.
‘identifier’ attribute does not apply to types
The named attribute may not be used with types. It is ignored.
‘identifier’ attribute ignored
The named attribute is not meaningful in the given context, and is therefore ignored.
‘attribute’ attribute only applies to function types
The specified attribute can only be applied to the return types of functions and not to other declarations.
B
backslash and newline separated by space
While processing for escape sequences, a backslash and newline were found separated by a space.
backslash-newline at end of file
While processing for escape sequences, a backslash and newline were found at the end of the file.
bit-field ‘identifier’ type invalid in ISO C
The type used on the specified identifier is not valid in ISO C.
braces around scalar initializer
A redundant set of braces around an initializer is supplied.
built-in function ‘identifier’ declared as non-function
The specified function has the same name as a built-in function, yet is declared as something other than a function.
C
C++ style comments are not allowed in ISO C89
Use C style comments ‘/*’ and ‘*/’ instead of C++ style comments ‘//’.
call-clobbered register used for global register variable
Choose a register that is normally saved and restored by function calls (W8-W13), so that library routines will not clobber it.
cannot inline function ‘main’
The function ‘main’ is declared with the inline attribute. This is not supported, since main must be called from the C start-up code, which is compiled separately.
can’t inline call to ‘identifier’ called from here
The compiler was unable to inline the call to the specified function.
case value ‘n’ not in enumerated type
The controlling expression of a switch statement is an enumeration type, yet a case expression has the value n, which does not correspond to any of the enumeration values.
case value ‘value’ not in enumerated type ‘name’
‘value’ is an extra switch case that is not an element of the enumerated type ‘name’.
cast does not match function type
The return type of a function is cast to a type that does not match the function’s type.
cast from pointer to integer of different size
A pointer is cast to an integer that is not 16 bits wide.
cast increases required alignment of target type
When compiling with the -Wcast-align
command-line option,
the compiler verifies that casts do not increase the required alignment of the target type.
For example, this warning message will be given if a pointer to char is cast as a pointer
to int, since the aligned for char (byte alignment) is less than the alignment requirement
for int (word alignment).
character constant too long
Character constants must not be too long.
comma at end of enumerator list
Unnecessary comma at the end of the enumerator list.
comma operator in operand of #if
Not expecting a comma operator in the #if directive.
comparing floating point with == or != is unsafe
Floating-point values can be approximations to infinitely precise real numbers. Instead of testing for equality, use relational operators to see whether the two values have ranges that overlap.
comparison between pointer and integer
A pointer type is being compared to an integer type.
comparison between signed and unsigned
One of the operands of a comparison is signed, while the other is unsigned. The signed operand will be treated as an unsigned value, which may not be correct.
comparison is always n
A comparison involves only constant expressions, so the compiler can evaluate the run time result of the comparison. The result is always n.
comparison is always n due to width of bit-field
A comparison involving a bit-field always evaluates to n because of the width of the bit-field.
comparison is always false due to limited range of data type
A comparison will always evaluate to false at run time, due to the range of the data types.
comparison is always true due to limited range of data type
A comparison will always evaluate to true at run time, due to the range of the data types.
comparison of promoted ~unsigned with constant
One of the operands of a comparison is a promoted ~unsigned, while the other is a constant.
comparison of promoted ~unsigned with unsigned
One of the operands of a comparison is a promoted ~unsigned, while the other is unsigned.
comparison of unsigned expression >= 0 is always true
A comparison expression compares an unsigned value with zero. Since unsigned values cannot be less than zero, the comparison will always evaluate to true at run time.
comparison of unsigned expression < 0 is always false
A comparison expression compares an unsigned value with zero. Since unsigned values cannot be less than zero, the comparison will always evaluate to false at run time.
comparisons like X<=Y<=Z do not have their mathematical meaning
A C expression does not necessarily mean the same thing as the corresponding mathematical expression. In particular, the C expression X<=Y<=Z is not equivalent to the mathematical expression X ≤ Y ≤ Z.
conflicting types for built-in function ‘identifier’
The specified function has the same name as a built-in function but is declared with conflicting types.
const declaration for ‘identifier’ follows non-const
The specified identifier was declared const after it was previously declared as non-const.
control reaches end of non-void function
All exit paths from non-void function should return an appropriate value. The compiler detected a case where a non-void function terminates, without an explicit return value. Therefore, the return value might be unpredictable.
conversion lacks type at end of format
When checking the argument list of a call to printf, scanf, etc., the compiler found that a format field in the format string lacked a type specifier.
concatenation of string literals with __FUNCTION__ is deprecated
__FUNCTION__
will be handled the same way as
__func__
(which is defined by the ISO standard C99).
__func__
is a variable, not a string literal, so it does not catenate
with other string literals.
conflicting types for ‘identifier’
The specified identifier has multiple, inconsistent declarations.
D
data definition has no type or storage class
A data definition was detected that lacked a type and storage class.
data qualifier ‘qualifier’ ignored
Data qualifiers, which include ‘access’, ‘shared’ and ‘overlay’, are not used in the compiler, but are there for compatibility with the MPLAB C Compiler for PIC18 MCUs.
declaration of ‘identifier’ has ‘extern’ and is initialized
Externs should not be initialized.
declaration of ‘identifier’ shadows a parameter
The specified identifier declaration shadows a parameter, making the parameter inaccessible.
declaration of ‘identifier’ shadows a symbol from the parameter list
The specified identifier declaration shadows a symbol from the parameter list, making the symbol inaccessible.
declaration of ‘identifier’ shadows global declaration
The specified identifier declaration shadows a global declaration, making the global inaccessible.
‘identifier’ declared inline after being called
The specified function was declared inline after it was called.
‘identifier’ declared inline after its definition
The specified function was declared inline after it was defined.
‘identifier’ declared ‘static’ but never defined
The specified function was declared static, but was never defined.
decrement of read-only member ‘name’
The member ‘name’ was declared as const and cannot be modified by decrementing.
decrement of read-only variable ‘name’
‘name’ was declared as const and cannot be modified by decrementing.
‘identifier’ defined but not used
The specified function was defined, but was never used.
deprecated use of label at end of compound statement
A label should not be at the end of a statement. It should be followed by a statement.
dereferencing ‘void *’ pointer
It is not correct to dereference a ‘void *’ pointer. Cast it to a pointer of the appropriate type before dereferencing the pointer.
division by zero
Compile-time division by zero has been detected.
duplicate ‘const’
The ‘const’ qualifier should be applied to a declaration only once.
duplicate ‘restrict’
The ‘restrict’ qualifier should be applied to a declaration only once.
duplicate ‘volatile’
The ‘volatile’ qualifier should be applied to a declaration only once.
E
embedded ‘\0’ in format
When checking the argument list of a call to printf, scanf, etc., the compiler found that the format string contains an embedded ‘\0’ (zero), which can cause early termination of format string processing.
empty body in an else-statement
An else statement is empty.
empty body in an if-statement
An if statement is empty.
empty declaration
The declaration contains no names to declare.
empty range specified
The range of values in a case range is empty, that is, the value of the
low expression is greater than the value of the high expression. Recall that the syntax for
case ranges is case low ... high:
.
‘enum identifier’ declared inside parameter list
The specified enum is declared inside a function parameter list. It is usually better programming practice to declare enums outside parameter lists, since they can never become complete types when defined inside parameter lists.
enum defined inside parms
An enum is defined inside a function parameter list.
enumeration value ‘identifier’ not handled in switch
The controlling expression of a switch statement is an enumeration type, yet not all enumeration values have case expressions.
enumeration values exceed range of largest integer
Enumeration values are represented as integers. The compiler detected that an enumeration range cannot be represented in any of the compiler integer formats, including the largest such format.
excess elements in array initializer
There are more elements in the initializer list than the array was declared with.
excess elements in scalar initializer“);
There should be only one initializer for a scalar variable.
excess elements in struct initializer
There are more elements in the initializer list than the structure was declared with.
excess elements in union initializer
There are more elements in the initializer list than the union was declared with.
extra semicolon in struct or union specified
The structure type or union type contains an extra semicolon.
extra tokens at end of #‘directive’ directive
The compiler detected extra text on the source line containing the #‘directive’ directive.
F
-ffunction-sections may affect debugging on some targets
You may have problems with debugging if you specify both the
-g
option and the -ffunction-sections
option.
first argument of ‘identifier’ should be ‘int’
Expecting declaration of first argument of specified identifier to be of type int.
floating constant exceeds range of ‘double’
A floating-point constant is too large or too small (in magnitude) to be represented as a ‘double’.
floating constant exceeds range of ‘float’
A floating-point constant is too large or too small (in magnitude) to be represented as a ‘float’.
floating constant exceeds range of ‘long double’
A floating-point constant is too large or too small (in magnitude) to be represented as a ‘long double’.
floating point overflow in expression
When folding a floating-point constant expression, the compiler found that the expression overflowed, that is, it could not be represented as float.
‘type1’ format, ‘type2’ arg (arg ‘num’)
The format is of type ‘type1’, but the argument being passed is of type ‘type2’. The argument in question is the ‘num’ argument.
format argument is not a pointer (arg n)
When checking the argument list of a call to printf, scanf, etc., the compiler found that the specified argument number n was not a pointer, san the format specifier indicated it should be.
format argument is not a pointer to a pointer (arg n)
When checking the argument list of a call to printf, scanf, etc., the compiler found that the specified argument number n was not a pointer san the format specifier indicated it should be.
fprefetch-loop-arrays not supported for this target
The option to generate instructions to prefetch memory is not supported for this target.
function call has aggregate value
The return value of a function is an aggregate.
function declaration isn’t a prototype
When compiling with the -Wstrict-prototypes
command-line
option, the compiler ensures that function prototypes are specified for all functions. In
this case, a function definition was encountered without a preceding function
prototype.
function declared ‘noreturn’ has a ‘return’ statement
A function was declared with the noreturn attribute-indicating that the function does not return-yet the function contains a return statement. This is inconsistent.
function might be possible candidate for attribute ‘noreturn’
The compiler detected that the function does not return. If the function had been declared with the ‘noreturn’ attribute, then the compiler might have been able to generate better code.
function returns address of local variable
Functions should not return the addresses of local variables, since, when the function returns, the local variables are de-allocated.
function returns an aggregate
The return value of a function is an aggregate.
function ‘name’ redeclared as inline
previous declaration of function ‘name’ with attribute noinline
Function ‘name’ was declared a second time with the keyword ‘inline’, which now allows the function to be considered for inlining.
function ‘name’ redeclared with attribute noinline
previous declaration of function ‘name’ was inline
Function ‘name’ was declared a second time with the noinline attribute, which now causes it to be ineligible for inlining.
function ‘identifier’ was previously declared within a block
The specified function has a previous explicit declaration within a block, yet it has an implicit declaration on the current line.
G
GCC does not yet properly implement ‘[*]’ array declarators
Variable length arrays are not currently supported by the compiler.
H
hex escape sequence out of range
The hex sequence must be less than 100 in hex (256 in decimal).
I
ignoring asm-specifier for non-static local variable ‘identifier’
The asm-specifier is ignored when it is used with an ordinary, non-register local variable.
ignoring invalid multibyte character
When parsing a multibyte character, the compiler determined that it was invalid. The invalid character is ignored.
ignoring option ‘option’ due to invalid debug level specification
A debug option was used with a debug level that is not a valid debug level.
ignoring #pragma identifier
The specified pragma is not supported by the compiler, and is ignored.
imaginary constants are a GCC extention
ISO C does not allow imaginary numeric constants.
implicit declaration of function ‘identifier’
The specified function has no previous explicit declaration (definition or function prototype), so the compiler makes assumptions about its return type and parameters.
increment of read-only member ‘name’
The member ‘name’ was declared as const and cannot be modified by incrementing.
increment of read-only variable ‘name’
‘name’ was declared as const and cannot be modified by incrementing.
initialization of a flexible array member
A flexible array member is intended to be dynamically allocated not statically.
‘identifier’ initialized and declared ‘extern’
Externs should not be initialized.
initializer element is not constant
Initializer elements should be constant.
inline function ‘name’ given attribute noinline
The function ‘name’ has been declared as inline, but the noinline attribute prevents the function from being considered for inlining.
inlining failed in call to ‘identifier’ called from here
The compiler was unable to inline the call to the specified function.
integer constant is so large that it is unsigned
An integer constant value appears in the source code without an explicit unsigned modifier, yet the number cannot be represented as a signed int; therefore, the compiler automatically treats it as an unsigned int.
integer constant is too large for ‘type’ type
An integer constant should not exceed 2^32 - 1 for an unsigned long int, 2^63 - 1 for a long long int or 2^64 - 1 for an unsigned long long int.
integer overflow in expression
When folding an integer constant expression, the compiler found that the expression overflowed; that is, it could not be represented as an int.
invalid application of ‘sizeof’ to a function type
It is not recommended to apply the sizeof operator to a function type.
invalid application of ‘sizeof’ to a void type
The sizeof operator should not be applied to a void type.
invalid digit ‘digit’ in octal constant
All digits must be within the radix being used. For instance, only the digits 0 thru 7 may be used for the octal radix.
invalid second arg to __builtin_prefetch; using zero
Second argument must be 0
or 1
.
invalid storage class for function ‘name’
‘auto’ storage class should not be used on a function defined at the top level. ‘static’ storage class should not be used if the function is not defined at the top level.
invalid third arg to __builtin_prefetch; using zero
Third argument must be 0
, 1
,
2
, or 3
.
‘identifier’ is an unrecognized format function type
The specified identifier, used with the format attribute, is not one of the recognized format function types printf, scanf, or strftime.
‘identifier’ is narrower than values of its type
A bit-field member of a structure has for its type an enumeration, but the width of the field is insufficient to represent all enumeration values.
‘storage class’ is not at beginning of declaration
The specified storage class is not at the beginning of the declaration. Storage classes are required to come first in declarations.
ISO C does not allow extra ‘;’ outside of a function
An extra ‘;’ was found outside a function. This is not allowed by ISO C.
ISO C does not support ‘++’ and ‘--’ on complex types
The increment operator and the decrement operator are not supported on complex types in ISO C.
ISO C does not support ‘~’ for complex conjugation
The bitwise negation operator cannot be use for complex conjugation in ISO C.
ISO C does not support complex integer types
Complex integer types, such as __complex__
short int, are
not supported in ISO C.
ISO C does not support plain ‘complex’ meaning ‘double complex’
Using __complex__
without another modifier is equivalent
to ‘complex double’ which is not supported in ISO C.
ISO C does not support the ‘char’ ‘kind of format’ format
ISO C does not support the specification character ‘char’ for the specified ‘kind of format’.
ISO C doesn’t support unnamed structs/unions
All structures and/or unions must be named in ISO C.
ISO C forbids an empty source file
The file contains no functions or data. This is not allowed in ISO C.
ISO C forbids empty initializer braces
ISO C expects initializer values inside the braces.
ISO C forbids nested functions
A function has been defined inside another function.
ISO C forbids omitting the middle term of a ?: expression
The conditional expression requires the middle term or expression between the ‘?’ and the ‘:’.
ISO C forbids qualified void function return type
A qualifier may not be used with a void function return type.
ISO C forbids range expressions in switch statements
Specifying a range of consecutive values in a single case label is not allowed in ISO C.
ISO C forbids subscripting ‘register’ array
Subscripting a ‘register’ array is not allowed in ISO C.
ISO C forbids taking the address of a label
Taking the address of a label is not allowed in ISO C.
ISO C forbids zero-size array ‘name’
The array size of ‘name’ must be larger than zero.
ISO C restricts enumerator values to range of ‘int’
The range of enumerator values must not exceed the range of the int type.
ISO C89 forbids compound literals
Compound literals are not valid in ISO C89.
ISO C89 forbids mixed declarations and code
Declarations should be done first before any code is written. It should not be mixed in with the code.
ISO C90 does not support ‘[*]’ array declarators
Variable length arrays are not supported in ISO C90.
ISO C90 does not support complex types
Complex types, such as __complex__ float x
, are not
supported in ISO C90.
ISO C90 does not support flexible array members
A flexible array member is a new feature in C99. ISO C90 does not support it.
ISO C90 does not support ‘long long’
The long long
type is not supported in ISO C90.
ISO C90 does not support ‘static’ or type qualifiers in parameter array declarators
When using an array as a parameter to a function, ISO C90 does not allow the array declarator to use ‘static’ or type qualifiers.
ISO C90 does not support the ‘char’ ‘function’ format
ISO C does not support the specification character ‘char’ for the specified function format.
ISO C90 does not support the ‘modifier’ ‘function’ length modifier
The specified modifier is not supported as a length modifier for the given function.
ISO C90 forbids variable-size array ‘name’
In ISO C90, the number of elements in the array must be specified by an integer constant expression.
L
label ‘identifier’ defined but not used
The specified label was defined, but not referenced.
large integer implicitly truncated to unsigned type
An integer constant value appears in the source code without an explicit unsigned modifier, yet the number cannot be represented as a signed int; therefore, the compiler automatically treats it as an unsigned int.
left-hand operand of comma expression has no effect
One of the operands of a comparison is a promoted ~unsigned, while the other is unsigned.
left shift count >= width of type
Shift counts should be less than the number of bits in the type being shifted. Otherwise, the shift is meaningless, and the result is undefined.
left shift count is negative
Shift counts should be positive. A negative left shift count does not mean shift right; it is meaningless.
library function ‘identifier’ declared as non-function
The specified function has the same name as a library function, yet is declared as something other than a function.
line number out of range
The limit for the line number for a #line directive in C89 is 32767 and in C99 is 2147483647.
‘identifier’ locally external but globally static
The specified identifier is locally external but globally static. This is suspect.
location qualifier ‘qualifier’ ignored
Location qualifiers, which include ‘grp’ and ‘sfr’, are not used in the compiler, but are there for compatibility with MPLAB C Compiler for PIC18 MCUs.
‘long’ switch expression not converted to ‘int’ in ISO C
ISO C does not convert ‘long’ switch expressions to ‘int’.
M
‘main’ is usually a function
The identifier main is usually used for the name of the main entry point of an application. The compiler detected that it was being used in some other way, for example, as the name of a variable.
‘operation’ makes integer from pointer without a cast
A pointer has been implicitly converted to an integer.
‘operation’ makes pointer from integer without a cast
An integer has been implicitly converted to a pointer.
malformed ‘#pragma pack-ignored’
The syntax of the pack pragma is incorrect.
malformed ‘#pragma pack(pop[,id])-ignored’
The syntax of the pack pragma is incorrect.
malformed ‘#pragma pack(push[,id],<n>)-ignored’
The syntax of the pack pragma is incorrect.
malformed ‘#pragma weak-ignored’
The syntax of the weak pragma is incorrect.
‘identifier’ might be used uninitialized in this function
The compiler detected a control path though a function which might use the specified identifier before it has been initialized.
missing braces around initializer
A required set of braces around an initializer is missing.
missing initializer
An initializer is missing.
modification by ‘asm’ of read-only variable ‘identifier’
A const variable is the left-hand-side of an assignment in an ‘asm’ statement.
multi-character character constant
A character constant contains more than one character.
N
negative integer implicitly converted to unsigned type
A negative integer constant value appears in the source code, but the number cannot be represented as a signed int; therefore, the compiler automatically treats it as an unsigned int.
nested extern declaration of ‘identifier’
There are nested extern definitions of the specified identifier.
no newline at end of file
The last line of the source file is not terminated with a newline character.
no previous declaration for ‘identifier’
When compiling with the -Wmissing-declarations
command-line option, the compiler ensures that functions are declared before they are
defined. In this case, a function definition was encountered without a preceding function
declaration.
no previous prototype for ‘identifier’
When compiling with the -Wmissing-prototypes
command-line
option, the compiler ensures that function prototypes are specified for all functions. In
this case, a function definition was encountered without a preceding function
prototype.
no semicolon at end of struct or union
A semicolon is missing at the end of the structure or union declaration.
non-ISO-standard escape sequence, ‘seq’
‘seq’ is ‘\e’ or ‘\E’ and is an extension to the ISO standard. The sequence can be used in a string or character constant and stands for the ASCII character <ESC>.
non-static declaration for ‘identifier’ follows static
The specified identifier was declared non-static after it was previously declared as static.
‘noreturn’ function does return
A function declared with the noreturn attribute returns. This is inconsistent.
‘noreturn’ function returns non-void value
A function declared with the noreturn attribute returns a non-void value. This is inconsistent.
null format string
When checking the argument list of a call to printf, scanf, etc., the compiler found that the format string was missing.
O
octal escape sequence out of range
The octal sequence must be less than 400 in octal (256 in decimal).
output constraint ‘constraint’ for operand n is not at the beginning
Output constraints in extended asm should be at the beginning.
overflow in constant expression
The constant expression has exceeded the range of representable values for its type.
overflow in implicit constant conversion
An implicit constant conversion resulted in a number that cannot be represented as a signed int; therefore, the compiler automatically treats it as an unsigned int.
P
parameter has incomplete type
A function parameter has an incomplete type.
parameter names (without types) in function declaration
The function declaration lists the names of the parameters but not their types.
parameter points to incomplete type
A function parameter points to an incomplete type.
parameter ‘identifier’ points to incomplete type
The specified function parameter points to an incomplete type.
passing arg ‘number’ of ‘name’ as complex rather than floating due to prototype
The prototype declares argument ‘number’ as a complex, but a float value is used so the compiler converts to a complex to agree with the prototype.
passing arg ‘number’ of ‘namee’ as complex rather than integer due to prototype
The prototype declares argument ‘number’ as a complex, but an integer value is used so the compiler converts to a complex to agree with the prototype.
passing arg ‘number’ of ‘name’ as floating rather than complex due to prototype
The prototype declares argument ‘number’ as a float, but a complex value is used so the compiler converts to a float to agree with the prototype.
passing arg ‘number’ of ‘name’ as ‘float’ rather than ‘double’ due to prototype
The prototype declares argument ‘number’ as a float, but a double value is used so the compiler converts to a float to agree with the prototype.
passing arg ‘number’ of ‘name’ as floating rather than integer due to prototype
The prototype declares argument ‘number’ as a float, but an integer value is used so the compiler converts to a float to agree with the prototype.
passing arg ‘number’ of ‘name’ as integer rather than complex due to prototype
The prototype declares argument ‘number’ as an integer, but a complex value is used so the compiler converts to an integer to agree with the prototype.
passing arg ‘number’ of ‘name’ as integer rather than floating due to prototype
The prototype declares argument ‘number’ as an integer, but a float value is used so the compiler converts to an integer to agree with the prototype.
pointer of type ‘void *’ used in arithmetic
A pointer of type ‘void’ has no size and should not be used in arithmetic.
pointer to a function used in arithmetic
A pointer to a function should not be used in arithmetic.
previous declaration of ‘identifier’
This warning message appears in conjunction with another warning message. The previous message identifies the location of the suspect code. This message identifies the first declaration or definition of the identifier.
previous implicit declaration of ‘identifier’
This warning message appears in conjunction with the warning message “type mismatch with previous implicit declaration”. It locates the implicit declaration of the identifier that conflicts with the explicit declaration.
R
“name” reasserted
The answer for ”name“ has been duplicated.
“name” redefined
“name” was previously defined and is being redefined now.
redefinition of ‘identifier’
The specified identifier has multiple, incompatible definitions.
redundant redeclaration of ‘identifier’ in same scope
The specified identifier was re-declared in the same scope. This is redundant.
register used for two global register variables
Two global register variables have been defined to use the same register.
repeated ‘flag’ flag in format
When checking the argument list of a call to strftime, the compiler found that there was a flag in the format string that is repeated.
When checking the argument list of a call to printf, scanf, etc., the compiler found that one of the flags { ,+,#,0,-} was repeated in the format string.
return-type defaults to ‘int’
In the absence of an explicit function return-type declaration, the compiler assumes that the function returns an int.
return type of ‘name’ is not ‘int’
The compiler is expecting the return type of ‘name’ to be ‘int’.
‘return’ with a value, in function returning void
The function was declared as void but returned a value.
‘return’ with no value, in function returning non-void
A function declared to return a non-void value contains a return statement with no value. This is inconsistent.
right shift count >= width of type
Shift counts should be less than the number of bits in the type being shifted. Otherwise, the shift is meaningless, and the result is undefined.
right shift count is negative
Shift counts should be positive. A negative right shift count does not mean shift left; it is meaningless.
S
second argument of ‘identifier’ should be ‘char **’
Expecting second argument of specified identifier to be of type ‘char **’.
second parameter of ‘va_start’ not last named argument
The second parameter of ‘va_start’ must be the last named argument.
shadowing built-in function ‘identifier’
The specified function has the same name as a built-in function, and consequently shadows the built-in function.
shadowing library function ‘identifier’
The specified function has the same name as a library function, and consequently shadows the library function.
shift count >= width of type
Shift counts should be less than the number of bits in the type being shifted. Otherwise, the shift is meaningless, and the result is undefined.
shift count is negative
Shift counts should be positive. A negative left shift count does not mean shift right, nor does a negative right shift count mean shift left; they are meaningless.
size of ‘name’ is larger than n bytes
Using -Wlarger-than-len
will produce the above warning
when the size of ‘name’ is larger than the len bytes defined.
size of ‘identifier’ is n bytes
The size of the specified identifier (which is n bytes) is larger
than the size specified with the -Wlarger-than-len
command-line
option.
size of return value of ‘name’ is larger than n bytes
Using -Wlarger-than-len
will produce the above warning
when the size of the return value of ‘name’ is larger than the len bytes defined.
size of return value of ‘identifier’ is n bytes
The size of the return value of the specified function is n bytes, which
is larger than the size specified with the -Wlarger-than-len
command-line
option.
spurious trailing ‘%’ in format
When checking the argument list of a call to printf, scanf, etc., the compiler found that there was a spurious trailing ‘%’ character in the format string.
statement with no effect
A statement has no effect.
static declaration for ‘identifier’ follows non-static
The specified identifier was declared static after it was previously declared as non-static.
string length ‘n’ is greater than the length ‘n’ ISO Cn compilers are required to support
The maximum string length for ISO C89 is 509. The maximum string length for ISO C99 is 4095.
‘struct identifier’ declared inside parameter list
The specified struct is declared inside a function parameter list. It is usually better programming practice to declare structs outside parameter lists, since they can never become complete types when defined inside parameter lists.
struct has no members
The structure is empty, it has no members.
structure defined inside parms
A union is defined inside a function parameter list.
style of line directive is a GCC extension
Use the format ‘#line linenum’ for traditional C.
subscript has type ‘char’
An array subscript has type ‘char’.
suggest explicit braces to avoid ambiguous ‘else’
A nested if statement has an ambiguous else clause. It is recommended that braces be used to remove the ambiguity.
suggest hiding #directive from traditional C with an indented #
The specified directive is not traditional C and may be ‘hidden’ by indenting the #. A directive is ignored unless its # is in column 1.
suggest not using #elif in traditional C
#elif should not be used in traditional K&R C.
suggest parentheses around assignment used as truth value
When assignments are used as truth values, they should be surrounded by parentheses, to make the intention clear to readers of the source program.
suggest parentheses around + or - inside shift
suggest parentheses around && within ||
suggest parentheses around arithmetic in operand of |
suggest parentheses around comparison in operand of |
suggest parentheses around arithmetic in operand of ^
suggest parentheses around comparison in operand of ^
suggest parentheses around + or - in operand of &
suggest parentheses around comparison in operand of &
While operator precedence is well defined in C, sometimes a reader of an expression might be required to expend a few additional microseconds in comprehending the evaluation order of operands in an expression if the reader has to rely solely upon the precedence rules, without the aid of explicit parentheses. A case in point is the use of the ‘+’ or ‘-’ operator inside a shift. Many readers will be spared unnecessary effort if parentheses are use to clearly express the intent of the programmer, even though the intent is unambiguous to the programmer and to the compiler.
T
‘identifier’ takes only zero or two arguments
Expecting zero or two arguments only.
the meaning of ‘\a’ is different in traditional C
When the -wtraditiona
l option is used, the escape
sequence ‘\a’ is not recognized as a meta-sequence: its value is just ‘a’. In
non-traditional compilation, ‘\a’ represents the ASCII BEL character.
the meaning of ‘\x’ is different in traditional C
When the -wtraditional
option is used, the escape
sequence ‘\x’ is not recognized as a meta-sequence: its value is just ‘x’. In
non-traditional compilation, ‘\x’ introduces a hexadecimal escape sequence.
third argument of ‘identifier’ should probably be ‘char **’
Expecting third argument of specified identifier to be of type ‘char **’.
this function may return with or without a value
All exit paths from non-void function should return an appropriate value. The compiler detected a case where a non-void function terminates, sometimes with and sometimes without an explicit return value. Therefore, the return value might be unpredictable.
this target machine does not have delayed branches
The -fdelayed-branch
option is not supported.
too few arguments for format
When checking the argument list of a call to printf, scanf, etc., the compiler found that the number of actual arguments was fewer than that required by the format string.
too many arguments for format
When checking the argument list of a call to printf, scanf, etc., the compiler found that the number of actual arguments was more than that required by the format string.
traditional C ignores #‘directive’ with the # indented
Traditionally, a directive is ignored unless its # is in column 1.
traditional C rejects initialization of unions
Unions cannot be initialized in traditional C.
traditional C rejects the ‘ul’ suffix
Suffix ‘u’ is not valid in traditional C.
traditional C rejects the unary plus operator
The unary plus operator is not valid in traditional C.
trigraph ??char converted to char
Trigraphs, which are a three-character sequence, can be used to represent symbols that may be missing from the keyboard. Trigraph sequences convert as follows:
??( = [ | ??) = ] | ??< = { | ??> = } | ??= = # | ??/ = \ | ??' = ^ | ??! = | | ??- = ~ |
trigraph ??char ignored
Trigraph sequence is being ignored. char can be (, ), <, >, =, /, ', !, or -.
type defaults to ‘int’ in declaration of ‘identifier’
In the absence of an explicit type declaration for the specified identifier, the compiler assumes that its type is int.
type mismatch with previous external decl
previous external decl of ‘identifier’
The type of the specified identifier does not match the previous declaration.
type mismatch with previous implicit declaration
An explicit declaration conflicts with a previous implicit declaration.
type of ‘identifier’ defaults to ‘int’
In the absence of an explicit type declaration, the compiler assumes that identifier’s type is int.
type qualifiers ignored on function return type
The type qualifier being used with the function return type is ignored.
U
undefining ‘defined’
‘defined’ cannot be used as a macro name and should not be undefined.
undefining ‘name’
The #undef directive was used on a previously defined macro name ‘name’.
union cannot be made transparent
The transparent_union
attribute was applied to a union,
but the specified variable does not satisfy the requirements of that attribute.
‘union identifier’ declared inside parameter list
The specified union is declared inside a function parameter list. It is usually better programming practice to declare unions outside parameter lists, since they can never become complete types when defined inside parameter lists.
union defined inside parms
A union is defined inside a function parameter list.
union has no members
The union is empty, it has no members.
unknown conversion type character ‘character’ in format
When checking the argument list of a call to printf, scanf, etc., the compiler found that one of the conversion characters in the format string was invalid (unrecognized).
unknown conversion type character 0xnumber in format
When checking the argument list of a call to printf, scanf, etc., the compiler found that one of the conversion characters in the format string was invalid (unrecognized).
unknown escape sequence ‘sequence’
‘sequence’ is not a valid escape code. An escape code must start with a ‘\’ and use one of the following characters: n, t, b, r, f, b, \, ', ”, a, or ?, or it must be a numeric sequence in octal or hex. In octal, the numeric sequence must be less than 400 octal. In hex, the numeric sequence must start with an ‘x’ and be less than 100 hex.
unnamed struct/union that defines no instances
struct/union is empty and has no name.
unreachable code at beginning of identifier
There is unreachable code at beginning of the specified function.
unrecognized gcc debugging option: char
The ‘char’ is not a valid letter for the -dletters debugging option.
unused parameter ‘identifier’
The specified function parameter is not used in the function.
unused variable ‘name’
The specified variable was declared but not used.
use of ‘*’ and ‘flag’ together in format
When checking the argument list of a call to printf, scanf, etc., the compiler found that both the flags ‘*’ and ‘flag’ appear in the format string.
use of C99 long long integer constants
Integer constants are not allowed to be declared long long in ISO C89.
use of ‘length’ length modifier with ‘type’ type character
When checking the argument list of a call to printf, scanf, etc., the compiler found that the specified length was incorrectly used with the specified type.
‘name’ used but never defined
The specified function was used but never defined.
‘name’ used with ‘spec’ ‘function’ format
‘name’ is not valid with the conversion specification ‘spec’ in the format of the specified function.
useless keyword or type name in empty declaration
An empty declaration contains a useless keyword or type name.
V
__VA_ARGS__ can only appear in the expansion of a C99 variadic macro
The predefined macro __VA_ARGS
should be used in the
substitution part of a macro definition using ellipses.
value computed is not used
A value computed is not used.
variable ‘name’ declared ‘inline’
The keyword ‘inline’ should be used with functions only.
variable ‘%s’ might be clobbered by ‘longjmp’ or ‘vfork’
A non-volatile automatic variable might be changed by a call to longjmp. These warnings are possible only in optimizing compilation.
volatile register variables don’t work as you might wish
Passing a variable as an argument could transfer the variable to a different register (w0-w7) than the one specified (if not w0-w7) for argument transmission. The compiler may issue an instruction that is not suitable for the specified register and may need to temporarily move the value to another place. These are only issues if the specified register is modified asynchronously (i.e., though an ISR).
W
-Wformat-extra-args ignored without -Wformat
-Wformat
must be specified to use
-Wformat-extra-args
.
-Wformat-nonliteral ignored without -Wformat
-Wformat
must be specified to use
-Wformat-nonliteral
.
-Wformat-security ignored without -Wformat
-Wformat
must be specified to use
-Wformat-security
.
-Wformat-y2k ignored without -Wformat
-Wformat
must be specified to use.
-Wid-clash-LEN is no longer supported
The option -Wid-clash-LEN
is no longer supported.
-Wuninitialized is not supported without -O
Optimization must be on to use the -Wuninitialized
option.
‘identifier’ was declared ‘extern’ and later ‘static’
The specified identifier was previously declared ‘extern’ and is now being declared as static.
‘identifier’ was declared implicitly ‘extern’ and later ‘static’
The specified identifier was previously declared implicitly ‘extern’ and is now being declared as static.
‘identifier’ was previously implicitly declared to return ‘int’
There is a mismatch against the previous implicit declaration.
‘identifier’ was used with no declaration before its definition
When compiling with the -Wmissing-declarations
command-line option, the compiler ensures that functions are declared before they are
defined. In this case, a function definition was encountered without a preceding function
declaration.
‘identifier’ was used with no prototype before its definition
When compiling with the -Wmissing-prototypes
command-line
option, the compiler ensures that function prototypes are specified for all functions. In
this case, a function call was encountered without a preceding function prototype for the
called function.
writing into constant object (arg n)
When checking the argument list of a call to printf, scanf, etc., the compiler found that the specified argument number n was a const object that the format specifier indicated should be written into.
Z
zero-length identifier format string
When checking the argument list of a call to printf, scanf, etc., the compiler found that the format string was empty (“”).