DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
C compiler diagnostics

Messages


n extra byte(s) in string literal initializer ignored
Type: Warning -- Options: all
A string literal that initializes a character array contains n more characters than the array can hold.
char ca[3] = "abcd";

"file", line 1: warning: 1 extra byte(s) in string literal initializer ignored


0 is invalid in # <number> directive
Type: Error -- Options: all
The line number in a line number information directive (which the compiler uses for internal communication) must be a positive, non-zero value.
# 0 "foo.c"

"file", line 1: 0 is invalid in # <number> directive


0 is invalid in #line directive
Type: Error -- Options: all
This diagnostic is similar to the preceding one, except the invalid line number appeared in a #line directive.
#line 0

"file", line 1: 0 is invalid in #line directive


ANSI C behavior differs; not modifying typedef with modifier
Type: Warning -- Options: -Xa, -Xc
A typedefed type may not be modified with the short, long, signed, or unsigned type modifiers, although earlier releases permitted it. modifier is ignored. A related message is ``modifying typedef with "modifier"; only qualifiers allowed''.

typedef int INT;
unsigned INT ui;

"file", line 2: warning: ANSI C behavior differs; not modifying typedef with "unsigned"


ANSI C predefined macro cannot be redefined
Type: Warning -- Options: all
The source code attempted to define or redefine a macro that is predefined by ANSI C. The predefined macro is unchanged.
#define __FILE__ "xyz.c"

"file", line 1: warning: ANSI C predefined macro cannot be redefined


ANSI C predefined macro cannot be undefined
Type: Warning -- Options: all
The source code contains an attempt to undefine a macro that is predefined by ANSI C.
#undef __FILE__

"file", line 1: warning: ANSI C predefined macro cannot be undefined


ANSI C requires formal parameter before ...
Type: Warning -- Options: -Xc, -w3
The compiler implementation allows you to define a function with a variable number of arguments and no fixed arguments. ANSI C requires at least one fixed argument.
f(...){}

"file", line 1: warning: ANSI C requires formal parameter before "..."


ANSI C treats constant as unsigned: op operator
Type: Warning -- Options: -w3, -w2
The type promotion rules for ANSI C are slightly different from those of previous releases. Obtain the ANSI C interpretation by using the -Xa or -Xc option for the cc command, obtain the old behavior by using -Xt or -Xk.

Previous type promotion rules were ``unsigned-preserving.'' If one of the operands of an expression was of unsigned type, the operands were promoted to a common unsigned type before the operation was performed.

ANSI C uses ``value-preserving'' type promotion rules. An unsigned type is promoted to a signed type if all its values may be represented in the signed type.

ANSI C also has a different rule from previous releases for the type of an integral constant that implicitly sets the sign bit.

The different type promotion rules may lead to different program behavior for the operators that are affected by the unsigned-ness of their operands:

The warning message tells that the program contains an expression in which the behavior of operator will change in the future. To guarantee the desired behavior, insert an explicit cast in the expression.

f(void){
    int i;
    /* constant was integer, unsigned in ANSI C */
    i /= 0xf0000000;
}

"file", line 4: warning: ANSI C treats constant as unsigned: op "/="

To get the same behavior as in previous releases add an explicit cast:
f(void){
    int i;
    /* constant was integer, unsigned in ANSI C */
    i /= (int) 0xf0000000;
}

-D option argument not an identifier
Type: Error -- Options: all
An identifier must follow the -D cc command line option.
cc -D3b2 -c x.c

command line: -D option argument not an identifier


-D option argument not followed by =
Type: Warning -- Options: all
If any tokens follow an identifier in a -D command line option to the cc command, the first such token must be ``=''.
cc -DTWO+2 -c x.c

command line: warning: -D option argument not followed by "="


EOF in argument list of macro: name
Type: Error -- Options: all
The compiler reached end-of-file while reading the arguments for an invocation of function-like macro name.
#define mac(a)
mac( arg1

"file", line 5: EOF in argument list of macro: mac


EOF in asm function definition
Type: Error -- Options: all
The compiler reached end-of-file while reading an enhanced asm function definition.

EOF in character constant
Type: Error -- Options: all
The compiler encountered end-of-file inside a character constant.

EOF in comment
Type: Warning -- Options: all
The compiler encountered end-of-file while reading a comment.

EOF in string literal
Type: Error -- Options: all
The compiler encountered end-of-file inside a string literal.

NUL in asm function definition
Type: Warning -- Options: all
The compiler encountered a NUL (zero) character while reading an enhanced asm function definition. The NUL is ignored.

-U option argument not an identifier
Type: Error -- Options: all
An identifier must follow the -U cc command line option.
cc -U3b2 -c x.c

command line: -U option argument not an identifier


a cast does not yield an lvalue
Type: Warning, Error -- Options: all
A cast may not be applied to the operand that constitutes the object to be changed in an assignment operation. The diagnostic is a warning if the size of the operand type and the size of the type being cast to are the same; otherwise it is an error.
f(void){
    int i;
    (long) i = 5;
    (short) i = 4;
}

"file", line 3: warning: a cast does not yield an lvalue "file", line 4: a cast does not yield an lvalue


\a is ANSI C alert character
Type: Warning -- Options: -Xt
In earlier releases, ``\a'' was equivalent to ``a''. However, ANSI C defines ``\a'' to be an alert character. In the implementation, the corresponding character code is 07, the BEL character.
int c = ''\a'';

"file", line 1: warning: \a is ANSI C "alert" character


access through void pointer ignored
Type: Warning -- Options: all
A pointer to void may not be used to access an object. An expression was written that does an indirection through a (possibly qualified) pointer to void. The indirection is ignored, although the rest of the expression (if any) is honored.
f(){
    volatile void *vp1, *vp2;
    *(vp1 = vp2);		/* assignment does get done */
}

"file", line 3: warning: access through "void" pointer ignored


argument cannot have unknown size: arg #n
Type: Error -- Options: all
An argument in a function call must have a completed type. A struct, union, or enum object was passed whose type is incomplete.
f(){
    struct s *st;
    g(*st);
}

"file", line 3: argument cannot have unknown size: arg #1


argument does not match remembered type: arg #n
Type: Warning -- Options: -w3
At a function call, the compiler determined that the type of the n-th argument passed to a function disagrees with other information it has about the function. That other information comes from two sources:

  1. An old-style (non-prototype) function definition, or

  2. A function prototype declaration that has gone out of scope, but whose type information is still remembered.
The argument in question is promoted according to the default argument promotion rules.

This diagnostic may be incorrect if the old-style function definition case applies and the function takes a variable number of arguments.

void f(i)
int i;
{ }

void g() { f("erroneous"); }

"file", line 7: warning: argument does not match remembered type: arg #1


argument is incompatible with prototype: arg #n
Type: Error -- Options: all
A function was called with an argument whose type cannot be converted to the type in the function prototype declaration for the function.
struct s {int x;} q;
f(void){
    int g(int,int);
    g(3,q);
}

"file", line 4: argument is incompatible with prototype: arg #2


argument mismatch
Type: Warning -- Options: all
The number of arguments passed to a macro was different from the number in the macro definition.
#define twoarg(a,b) a+b
int i = twoarg(4);

"file", line 2: warning: argument mismatch


argument mismatch: n1 arg[s] passed, n2 expected
Type: Warning -- Options: -w3
At a function call, the compiler determined that the number of arguments passed to a function disagrees with other information it has about the function. That other information comes from two sources:

  1. An old-style (non-prototype) function definition, or

  2. A function prototype declaration that has gone out of scope, but whose type information is still remembered.

This diagnostic may be incorrect if the old-style function definition case applies and the function takes a variable number of arguments.

extern int out_of_scope();
int f()
{				/* function takes no args */
    extern int out_of_scope(int);
}

int g() { f(1); /* f takes no args */ out_of_scope(); /* out_of_scope expects one arg */ }

"file", line 9: warning: argument mismatch: 1 arg passed, 0 expected "file", line 10: warning: argument mismatch: 0 args passed, 1 expected


array too big
Type: Error -- Options: all
An array declaration has a combination of dimensions such that the declared object is too big for the target machine.
int bigarray[1000][1000][1000];

"file", line 1: array too big


asm() argument must be normal string literal
Type: Error -- Options: all
The argument to an old-style asm() must be a normal string literal, not a wide one.
asm(L"wide string literal not allowed");

"file", line 1: asm() argument must be normal string literal


asm definition cannot have old-style parameters
Type: Error -- Options: all
The definition of an enhanced asm function may use the ANSI C function prototype notation to declare types for parameters. It may not declare parameters by using the old-style C function definition notation of an identifier list, followed by a declaration list that declares parameter types.

__asm is an extension of ANSI C
Type: Warning -- Options: -Xc
Code declaring an enhanced asm function was compiled with -Xc. This warning tells that the enhanced __asm is a violation of ANSI C syntax, which the compiler is obliged to diagnose, and is not a compatible extension.

asm valid only for function definition
Type: Warning -- Options: all
The asm storage class may only be used for function definitions. It is ignored here.
asm int f(void);

"file", line 1: warning: "asm" valid only for function definition


#assert identifier (... expected
Type: Error -- Options: all
In a #assert directive, the token following the predicate was not the ``('' that was expected.
#assert system unix

"file", line 1: "#assert identifier (..." expected


#assert identifier expected
Type: Error -- Options: all
In a #assert directive, the token following the directive was not the name of the predicate.
#assert 5

"file", line 1: "#assert identifier" expected


#assert missing )
Type: Error -- Options: all
In a #assert directive, the parenthesized form of the assertion lacked a closing ``)''.
#assert system(unix

"file", line 1: "#assert" missing ")"


assignment type mismatch
Type: Warning, Error -- Options: all
The operand types for an assignment operation are incompatible. The message is a warning when the types are pointer types that do not match. Otherwise the message is an error.
struct s { int x; } st;
f(void){
    int i;
    char *cp;
    const char *ccp;
    i = st;
    cp = ccp;
}

"file", line 6: assignment type mismatch "file", line 7: warning: assignment type mismatch


auto/register/asm inappropriate here
Type: Error -- Options: all
A declaration outside any function has storage class auto or register or a declaration within a function has storage class asm.
auto int i;
f(void){
    asm int j;
}

"file", line 1: auto/register/asm inappropriate here "file", line 3: auto/register/asm inappropriate here


automatic redeclares external: name
Type: Warning -- Options: all
An automatic variable was declared name in the same block and with the same name as another symbol that is extern. ANSI C prohibits such declarations, but previous compilation systems of allowed them. For compatibility with previous releases, references to name in this block will be to the automatic.
f(void){
    extern int i;
    int i;
}

"file", line 3: warning: automatic redeclares external: i


bad file specification
Type: Error -- Options: all
The file specifier in a #include directive was neither a string literal nor a well-formed header name.
#include stdio.h

"file", line 1: bad file specification


bad octal digit: ''digit''
Type: Warning -- Options: -Xt
An integer constant that began with ``0'' included the non-octal digit digit. An ``8'' is taken to have value 8, and a ``9'' is taken to have value 9, even though they are invalid.
int i = 08;

"file", line 1: warning: bad octal digit: ''8''


bad #pragma pack value: n
Type: Warning -- Options: all
The value n that was specified in a #pragma pack directive was not one of the acceptable values: 1, 2, or 4. The erroneous value is ignored and the directive has no effect.

bad token in #error directive: token
Type: Error -- Options: all
The tokens in a #error directive must be valid C tokens. The source program contained the invalid token token.
#error "this is an invalid token

"file", line 1: bad token in #error directive: " "file", line 1: #error: "this is an invalid token


bad use of # or ## in macro #define
Type: Warning -- Options: all
In a macro definition, a ``#'' or ``##'' operator was followed by a ``#'' or ``##'' operator.
#define bug(s) # # s
#define bug2(s) # ## s

"file", line 1: warning: bad use of "#" or "##" in macro #define "file", line 2: warning: bad use of "#" or "##" in macro #define


base type is really type tag: name
Type: Warning -- Options: -Xt
A type was declared with a struct, union, or enum type specifier and with tag tag, and then used with a different type specifier to declare name. type is the type specifier used for the original declaration. For compatibility with previous releases, the compiler treats the two types as being the same. In ANSI C (with the -Xa or -Xc options), the types are different.
struct s { int x,y,z; };
f(void){
    union s foo;
}

"file", line 3: warning: base type is really "struct s": foo "file", line 3: warning: declaration introduces new type in ANSI C: union s


bit-field size <= 0: name
Type: Error -- Options: all
The declaration for bit-field name specifies a zero or negative number of bits.
struct s { int x:-3; };

"file", line 1: bit-field size <= 0: x


bit-field too big: name
Type: Error -- Options: all
The declaration for bit-field name specifies more bits than will fit in an object of the declared type.
struct s { char c:20; };

"file", line 1: bit-field too big: c


break outside loop or switch
Type: Error -- Options: all
A function contains a break statement in an inappropriate place, namely outside any loop or switch statement.
f(void){
    break;
}

"file", line 2: "break" outside loop or switch


cannot access member of non-struct/union object
Type: Error -- Options: all
The structure or union member must be completely contained within the left operand of the ``.'' operator.
f(void){
    struct s { int x; };
    char c;
    c.x = 1;
}

"file", line 4: warning: left operand of "." must be struct/ union object "file", line 4: cannot access member of non-struct/union object


cannot begin macro replacement with ##
Type: Warning -- Options: all
The ``##'' operator is a binary infix operator and may not be the first token in the macro replacement list of a macro definition.
#define mac(s) ## s

"file", line 1: warning: cannot begin macro replacement with "##"


cannot concatenate wide and regular string literals
Type: Warning, Error -- Options: all
Regular string literals and string literals for wide characters may be concatenated only if they are both regular or both wide. The compiler issues a warning if a wide string literal is followed by a regular one (and both are treated as wide); it issues an error if a regular string literal is followed by a wide one.
#include <stddef.h>
wchar_t wa[] = L"abc" "def";
char a[] = "abc" L"def";

"file", line 2: warning: cannot concatenate wide and regular string literals "file", line 3: cannot concatenate wide and regular string literals


cannot declare array of functions or void
Type: Error -- Options: all
An array of functions was or an array of void was declared.
int f[5]();

"file", line 1: cannot declare array of functions or void


cannot define defined
Type: Warning -- Options: all
The predefined preprocessing operator defined may not be defined as a macro name.
#define defined xyz

"file", line 1: warning: cannot define "defined"


cannot dereference non-pointer type
Type: Error -- Options: all
The operand of the ``*'' (pointer dereference) operator must have pointer type. This diagnostic is also issued for an array reference to a non-array.
f(){
    int i;
    *i = 4;
    i[4] = 5;
}

"file", line 3: cannot dereference non-pointer type "file", line 4: cannot dereference non-pointer type


cannot do pointer arithmetic on operand of unknown size
Type: Error -- Options: all
An expression involves pointer arithmetic for pointers to objects whose size is unknown.
f(void){
    struct s *ps;
    g(ps+1);
}

"file", line 3: cannot do pointer arithmetic on operand of unknown size


cannot end macro replacement with # or ##
Type: Warning -- Options: all
A ``#'' or ``##'' operator may not be the last token in the macro replacement list of a macro definition.
#define mac1(s) abc ## s ##
#define mac2(s) s #

"file", line 1: warning: cannot end macro replacement with "#" or "##" "file", line 2: warning: cannot end macro replacement with "#" or "##"


cannot find include file: filename
Type: Error -- Options: all
The file filename specified in a #include directive could not be located in any of the directories along the search path.
#include "where_is_it.h"

"file", line 1: cannot find include file: "where_is_it.h"


cannot have ... in asm function
Type: Warning -- Options: all
An enhanced asm definition may not be a function prototype definition with ellipsis notation.

cannot have void object: name
Type: Error -- Options: all
An object may not be declared as having type void.
void v;

"file", line 1: cannot have void object: v


cannot initialize extern declaration: name
Type: Error -- Options: all
Within a function, the declaration of an object with extern storage class may not have an initializer.
f(void){
    extern int i = 1;
}

"file", line 2: cannot initialize "extern" declaration: i


cannot initialize function: name
Type: Error -- Options: all
A name declared as a function may not have an initializer.
int f(void) = 3;

"file", line 1: cannot initialize function: f


cannot initialize parameter: name
Type: Error -- Options: all
Old-style function parameter name may not have an initializer.
int f(i)
int i = 4;
{
}

"file", line 2: cannot initialize parameter: i


cannot initialize typedef: name
Type: Error -- Options: all
A typedef may not have an initializer.
typedef int INT = 1;

"file", line 1: cannot initialize typedef: INT


cannot open file: explanation
Type: Fatal -- Options: all
The compiler was unable to open an input or output file. Usually this means the file name argument passed to the cc command was incorrect. explanation describes why file could not be opened.
cc glorch.c -c x.c

command line: fatal: cannot open glorch.c: No such file or directory


cannot open include file (too many open files): filename
Type: Error -- Options: all
The compiler could not open a new include file, filename, because too many other include files are already open. This scenario could arise if you have file1 that includes file2 that includes file3, and so on. The compiler supports at least eight levels of nesting, up to a maximum defined by the operating system. The most likely reason for the diagnostic is that at some point an include file includes a file that had already been included. For example, this could happen if file1 includes file2, which includes file1 again.

In this example, imagine that the file i1.h contains #include i1.h.

#include "i1.h"

"./i1.h", line 1: cannot open include file (too many open files): "i1.h"


cannot recover from previous errors
Type: Error -- Options: all
Earlier errors in the compilation have confused the compiler, and it cannot continue to process the program. Please correct those errors and try again.

cannot return incomplete type
Type: Error -- Options: all
When a function is called that returns a structure or union, the complete declaration for the structure or union must have been seen already. Otherwise this message results.
f(){
    struct s g();
    g();
}

"file", line 3: cannot return incomplete type


cannot take address of bit-field: name
Type: Error -- Options: all
It is not permitted to take the address of a bit-field member of a structure or union.
f(void){
    struct s { int x:3, y:4; } st;
    int *ip = &st.y ;
}

"file", line 3: cannot take address of bit-field: y


cannot take address of register: name
Type: Warning, Error -- Options: all
When name is declared with register storage class, it is not permissible to take the address of name, even if the compiler actually allocates the object to a register. The attempt to take an object's address may have been implicit, such as when an array is dereferenced. The diagnostic is an error if a register was allocated for the object and a warning otherwise.
f(void){
    register int i;
    register int ia[5];
    int *ip = &i ;
    ia[2] = 1;
}

"file", line 4: cannot take address of register: i "file", line 5: warning: cannot take address of register: ia


cannot take sizeof bit-field: name
Type: Warning -- Options: all
The sizeof operator may not be applied to bit-fields.
struct s { int x:3; } st;
int i = sizeof(st.x);

"file", line 2: warning: cannot take sizeof bit-field: x


cannot take sizeof function: name
Type: Error -- Options: all
The sizeof operator may not be applied to functions.
int f(void);
int i = sizeof(f);

"file", line 2: cannot take sizeof function: f


cannot take sizeof void
Type: Error -- Options: all
The sizeof operator may not be applied to type void.
void v(void);
int i = sizeof(v());

"file", line 2: cannot take sizeof void


cannot undefine defined
Type: Error -- Options: all
The predefined preprocessing operator defined may not be undefined.
#undef defined

"file", line 1: warning: cannot undefine "defined"


case label affected by conversion: value
Type: Warning -- Options: -w3
The value for the case label cannot be represented by the type of the controlling expression of a switch statement. If the type of the case expression and the type of the controlling expression have the same size, the actual bit representation of the case expression is unchanged, but its interpretation is different. For example, the controlling expression may have type int and the case expression may have type unsigned int. In the diagnostic, value is represented as a hexadecimal value if the case expression is unsigned, decimal if it is signed.
f(){
    int i;

switch( i ){ case 0xffffffffu: ; } }

"file", line 5: warning: case label affected by conversion: 0xffffffff

In this example 0xffffffffu is not representable as an int. When the case expression is converted to the type of the controlling expression (int), its effective value is -1, which means that the case will be reached if i has the value -1, rather than 0xffffffff.


case outside switch
Type: Error -- Options: all
A case statement occurred outside the scope of any switch statement.
f(void){
    case 4: ;
}

"file", line 2: "case" outside switch


character constant too long
Type: Warning -- Options: all
The character constant contains too many characters to fit in an integer. Only the first four characters of a regular character constant, and only the first character of a wide character constant, are used. (Character constants that are longer than one character are non-portable.)
int i = 'abcde';

"file", line 1: warning: character constant too long


character escape does not fit in character
Type: Warning -- Options: all
A hexadecimal or octal escape sequence in a character constant or string literal produces a value that is too big to fit in an unsigned char. The value is truncated to fit.
char *p = "\x1ff\400";

"file", line 1: warning: \x is ANSI C hex escape "file", line 1: warning: character escape does not fit in character "file", line 1: warning: character escape does not fit in character


character escape does not fit in wide character
Type: Warning -- Options: all
This message diagnoses a condition similar to the previous one, except the character constant or string literal is prefixed by ``L'' to designate a wide character constant or string literal. The character escape is too large to fit in an object of type wchar_t and is truncated to fit.

comment does not concatenate tokens
Type: Warning -- Options: -Xa, -Xc
In previous releases, it was possible to ``paste'' two tokens together by juxtaposing them in a macro with a comment between them. This behavior was never defined or guaranteed. ANSI C provides a well-defined operator, ``##'', that serves the same purpose and should be used. This diagnostic warns that the old behavior is not being provided.
#define PASTE(a,b) a/*GLUE*/b
int PASTE(prefix,suffix) = 1;   /* does not create */
                                /* prefixsuffix */

"file", line 1: warning: comment does not concatenate tokens "file", line 2: syntax error, probably missing ",", ";" or "=" "file", line 2: syntax error before or at: suffix "file", line 2: warning: declaration missing specifiers: assuming "int"


comment is replaced by ##
Type: Warning -- Options: -Xt
This message is closely related to ``comment does not concatenate tokens''. The diagnostic tells that the compiler is treating an apparent concatenation as if it were the ``##'' operator. The source code should be updated to use the new operator.
#define PASTE(a,b) a/*GLUE*/b
int PASTE(prefix,suffix) = 1;   /* creates prefixsuffix */

"file", line 1: warning: comment is replaced by "##"


const object should have initializer: name
Type: Warning -- Options: -w3
A const object cannot be modified. If an initial value is not supplied, the object will have a value of zero, or for automatics its value will be indeterminate.
const int i;

"file", line 1: warning: const object should have initializer: i


continue outside loop
Type: Error -- Options: all
The program contains a continue statement outside the scope of any loop.
f(void){
    continue;
}

"file", line 2: "continue" outside loop


controlling expressions must have scalar type
Type: Error -- Options: all
The expression for an if, for, while, or do-while must be an integral, floating-point, or pointer type.
f(void){
    struct s {int x;} st;
    while (st) {}
}

"file", line 3: controlling expressions must have scalar type


conversion of double to float is out of range
Type: Warning, Error -- Options: all
A double expression has too large a value to fit in a float. The diagnostic is a warning if the expression is in executable code and an error otherwise.
float f = 1e30 * 1e30;

"file", line 1: conversion of double to float is out of range


conversion of double to integral is out of range
Type: Warning, Error -- Options: all
A double constant has too large a value to fit in an integral type. The diagnostic is a warning if the expression is in executable code and an error otherwise.
int i = 1e100;

"file", line 1: conversion of double to integral is out of range


conversion of floating-point constant to type out of range
Type: Error -- Options: all
A floating-point constant has too large a value to fit in type type (float, double, long double).
float f = 1e300f;

"file", line 1: conversion of floating-point constant to float out of range


declaration hides parameter: name
Type: Warning -- Options: all
An identifier name was declared with the same name as one of the parameters of the function. References to name in this block will be to the new declaration.
int f(int i,int INT){
    int i;
    typedef int INT;
}

"file", line 2: warning: declaration hides parameter: i "file", line 3: warning: declaration hides parameter: INT


declaration introduces new type in ANSI C: type tag
Type: Warning -- Options: -Xt
struct, union, or enum tag has been redeclared in an inner scope. In previous releases, this tag was taken to refer to the previous declaration of tag. In ANSI C, the declaration introduces a new type. When the -Xt option is selected, the earlier behavior is reproduced.
struct s1 { int x; };
f(void){
    struct s1;
    struct s2 { struct s1 *ps1; };  /* s1 refers to line 1 */
    struct s1 { struct s2 *ps2; };
}

"file", line 3: warning: declaration introduces new type in ANSI C: struct s1


declaration missing specifiers; assuming int
Type: Warning -- Options: all
Objects and functions that are declared at file scope must have a storage class or type specifier. If both are omitted the following warning is displayed:
i;
f(void);

"file", line 1: warning: declaration missing specifiers; assuming "int" "file", line 2: warning: declaration missing specifiers; assuming "int"


default outside switch
Type: Error -- Options: all
A default label appears outside the scope of a switch statement.
f(void){
default: ;
}

"file", line 2: "default" outside switch


#define requires macro name
Type: Error -- Options: all
A #define directive must be followed by the name of the macro to be defined.
#define +3

"file", line 1: #define requires macro name


digit sequence expected after #line
Type: Error -- Options: all
The compiler expected to find the digit sequence that comprises a line number after #line, but the token it found there is either an inappropriate token or a digit sequence whose value is zero.
#line 09a

"file", line 1: digit sequence expected after "#line"


directive is an upward-compatible ANSI C extension
Type: Warning -- Options: -Xc
This diagnostic is issued when the C compiler sees a directive that it supports, but that is not part of the ANSI C standard, and -Xc has been selected.
#assert system( unix )

"file", line 1: warning: directive is an upward-compatible ANSI C extension


directive not honored in macro argument list
Type: Warning, Error -- Options: all
A directive has appeared between the ( )'s that delimit the arguments of a function-like macro invocation. The following directives are disallowed in such a context: #ident, #include, #line, #undef. The diagnostic is a warning if it appears within a false group of an if-group, and an error otherwise.
#define flm(a) a+4
int i = flm(
#ifdef flm		/* allowed */
    #undef flm		/* disallowed:  error */
        4
#else		/* allowed */
    #undef flm		/* disallowed:  warn */
        6
#endif		/* allowed */
);

"file", line 4: directive not honored in macro argument list "file", line 7: warning: directive not honored in macro argument list


division by 0
Type: Warning, Error -- Options: all
An expression contains a division by zero that was detected at compile-time. If the division is part of a #if or #elif directive, the result is taken to be zero. The diagnostic is a warning if the division is in executable code, an error otherwise.
f(void) {
    int i = 1/0;
}

"file", line 2: warning: division by 0


dubious type declaration; use tag only: tag
Type: Warning -- Options: all
A new struct, union, or enum type with tag tag was declared within a function prototype declaration or the parameter declaration list of an old-style function definition, and the declaration includes a declarator list for type. Calls to the function would always produce a type mismatch, because the tag declaration goes out of scope at the end of the function prototype declaration or definition, according to ANSI C's scope rules. It is not possible to declare an object of that type outside the function. This can be fixed by declaring the struct, union, or enum ahead of the function prototype or function definition and then referring to it just by its tag.
int f(struct s {int x;} st)
{}

"file", line 1: warning: dubious struct declaration; use tag only: s

Rewrite this as:

struct s {int x;};
int f(struct s st)
{}

dubious escape: \c
Type: Warning -- Options: all
Only certain characters may follow ``\'' in string literals and character constants; c was not one of them. The ``\'' is ignored.
int i = '\q';

"file", line 1: warning: dubious escape: \q


dubious escape: \<hex value>
Type: Warning -- Options: all
This message diagnoses the same condition as the preceding one, but the character that follows ``\'' in the program is a non-printing character. The hex value between the brackets in the diagnostic is the character's code, printed as a hexadecimal number.

dubious reference to type typedef: typedef
Type: Warning -- Options: all
This message is similar to ``dubious tag in function prototype: type tag''. A function prototype declaration refers to a type struct, union, or enum typedef with name typedef. Because the struct, union, or enum has been declared within a function, it could not be in scope when the function whose prototype is being declared was defined. The prototype declaration and function definition thus could never match.
f(){
    struct s { int x; };
    typedef struct s ST;
    extern int g(ST, struct s);
}

"file", line 4: warning: dubious reference to struct typedef: ST "file", line 4: warning: dubious tag in function prototype: struct s


dubious static function at block level
Type: Warning -- Options: -Xc
A function was declared with storage class static at block scope. The ANSI C standard says that the behavior is undefined if a function is declared at block scope with an explicit storage class other than extern. Although functions may be declared this way, other implementations may not recognize them, or may attach a different meaning to such a declaration.
void
f(void){
    static void g(void);
}

"file", line 3: warning: dubious static function at block level


dubious tag declaration: type tag
Type: Warning -- Options: all
A new struct, union, or enum type with tag tag was declared within a function prototype declaration or the parameter declaration list of an old-style function definition. Calls to the function would always produce a type mismatch, because the tag declaration goes out of scope at the end of the function declaration or definition, according to ANSI C's scope rules. It is not possible to declare an object of that type outside the function.
int f(struct s *);

"file", line 1: warning: dubious tag declaration: struct s


dubious tag in function prototype: type tag
Type: Warning -- Options: all
This message is similar to the previous one. A function prototype declaration refers to a struct, union, or enum type with tag tag. The tag has been declared within a function. Therefore it could not be in scope when the function whose prototype is being declared was defined. The prototype declaration and function definition thus could never match.
f(){
    struct s {int x;};
    int g(struct s *);
}

"file", line 3: warning: dubious tag in function prototype: struct s


duplicate case in switch: value
Type: Error -- Options: all
There are two case statements in the current switch statement that have the same constant value value.
f(void){
    int i = 5;
    switch(i) {
    case 4:
    case 4:
        break;
    }
}

"file", line 5: duplicate case in switch: 4


duplicate default in switch
Type: Error -- Options: all
There are two default labels in the current switch statement.
f(void){
    int i = 5;
    switch(i) {
    default:
    default:
        break;
    }
}

"file", line 5: duplicate "default" in switch


duplicate formal parameter: name
Type: Warning -- Options: all
In a function-like macro definition, name was used more than once as a formal parameter.
#define add3(a,a,c) a + b + c

"file", line 1: warning: duplicate formal parameter: a


duplicate member name: member
Type: Error -- Options: all
A struct or union declaration uses the name member for more than one member.
union u {
    int i;
    float i;
};

"file", line 3: duplicate member name: i


duplicate name in % line specification: name
Type: Error -- Options: all
Formal parameter name was mentioned more than once in the ``%'' line of an enhanced asm function.

#elif follows #else
Type: Warning -- Options: all
A preprocessing if-section must be in the order #if, optional #elif's, followed by optional #else and #endif. The code contains a #elif after the #else directive.
#if defined(ONE)
        int i = 1;
#elif defined(TWO)
        int i = 2;
#else
        int i = 3;
#elif defined(FOUR)
        int i = 4;
#endif

"file", line 7: warning: #elif follows #else


#elif has no preceding #if
Type: Error -- Options: all
An #elif directive must be part of a preprocessing if-section, which begins with a #if directive. The code in question lacked the #if.
#elif defined(TWO)
        int i = 2;
#endif

"file", line 1: #elif has no preceding #if "file", line 3: #if-less #endif


#elif must be followed by a constant expression
Type: Error -- Options: all
There was no expression following the #elif directive.
#if defined(ONE)
        int i = 1;
#elif
        int i = 4;
#endif

"file", line 3: warning: #elif must be followed by a constant expression


#else has no preceding #if
Type: Error -- Options: all
An #else directive was encountered that was not part of a preprocessing if-section.
#else
        int i =7;
#endif

"file", line 1: #else has no preceding #if "file", line 3: #if-less #endif


embedded NUL not permitted in asm()
Type: Error -- Options: all
The string literal that appears in an old-style asm() contains an embedded NUL character (character code 0).
asm("this is an old-style asm with embedded NUL:  \0");

"file", line 1: embedded NUL not permitted in asm()


empty #assert directive
Type: Error -- Options: all
A #assert directive contained no predicate name to assert.
#assert

"file", line 1: empty #assert directive


empty character constant
Type: Error -- Options: all
The program has a character constant without any characters in it.
int i = '';

"file", line 1: empty character constant


empty constant expression after macro expansion
Type: Error -- Options: all
A #if or #elif directive contained an expression that, after macro expansion, consisted of no tokens.
#define EMPTY
#if EMPTY
        char *mesg = "EMPTY is non-empty";
#endif

"file", line 2: empty constant expression after macro expansion


empty #define directive line
Type: Error -- Options: all
A #define directive lacked both the name of the macro to define and any other tokens.
#define

"file", line 1: empty #define directive line


empty file name
Type: Error -- Options: all
The file name in a #include directive is null.
#include <>

"file", line 1: empty file name


empty header name
Type: Error -- Options: all
This diagnostic is similar to the preceding one, but the null file name arises after macro substitution.
#define NULLNAME <>
#include NULLNAME

"file", line 2: empty header name


empty predicate argument
Type: Error -- Options: all
The compiler expects to find tokens between the ( )'s that delimit a predicate's assertions in a #unassert directive. None were present.
#unassert machine()

"file", line 1: empty predicate argument


empty translation unit
Type: Warning -- Options: all
The source file has no tokens in it after preprocessing is complete. The ANSI C standard requires the compiler to diagnose a file that has no tokens in it.
#ifdef COMPILE
        int token;
#endif

"file", line 5: warning: empty translation unit


empty #unassert directive
Type: Error -- Options: all
A #unassert contained no predicate name to discard.
#unassert

"file", line 1: empty #unassert directive


empty #undef directive, identifier expected
Type: Error -- Options: all
A #undef directive lacked the name of a macro to ``undefine.''
#undef

"file", line 1: empty #undef directive, identifier expected


{}-enclosed initializer required
Type: Warning -- Options: all
When initializing an aggregate, except in the case of initializing a character array with a string literal or an automatic structure with an expression, the initializes must be enclosed in { }'s.
int ia[5] = 1;
f(void){
    struct s { int x,y; } st = 1;
}

"file", line 1: warning: {}-enclosed initializer required "file", line 3: warning: {}-enclosed initializer required "file", line 3: struct/union-valued initializer required


end-of-loop code not reached
Type: Warning -- Options: all
A loop was written in such a way that the code at the end of the loop that the compiler generates to branch back to the beginning of the loop is not reachable and will never be executed.
f(void){
    int i = 1;
    while (i) {
        return 4;
    }
}

"file", line 5: warning: end-of-loop code not reached


enum constants have different types: op operator
Type: Warning -- Options: -w3
A relational operator operator was used to compare enumeration constants from two different enumeration types. This may indicate a programming error. Note also that the sense of the comparison is known at compile time, because the constants' values are known.
enum e1 { ec11, ec12 } ev1;
enum e2 { ec21, ec22 } ev2;
void v(void){
    if (ec11 > ec22)
        ;
}

"file", line 4: warning: enum constants have different types: op ">"


enum type mismatch: arg #n
Type: Warning -- Options: -w3
The program is passing an enumeration constant or object to a function for which a prototype declaration is in scope. The passed argument is of a different enumerated type from the one in the function prototype, which may indicate a programming error.
enum e1 { ec11 } ev1;
enum e2 { ec21 } ev2;
void ef(enum e1);

void v(void){ ef(ec21); }

"file", line 6: warning: enum type mismatch: arg #1


enum type mismatch: op operator
Type: Warning -- Options: -w3
This message is like the previous one. One of the operands of operator is an enumeration object or constant, and the other is an enumeration object or constant from a different enumerated type.
enum e1 { ec11, ec12 } ev1;
enum e2 { ec21, ec22 } ev2;
void v(void){
    if (ev1 > ec22)
        ;
}

"file", line 4: warning: enum type mismatch: op ">"


enumeration constant hides parameter: name
Type: Warning -- Options: all
A declaration of an enumerated type within a function includes an enumeration constant with the same name as parameter name. The enumeration constant hides the parameter.
int
f(int i){
    enum e { l, k, j, i };
}

"file", line 3: warning: enumeration constant hides parameter: i


enumerator used in its own initializer: name
Type: Warning -- Options: all
When setting the value of enumerator name, name was used in the expression. ANSI C's scope rules take name in the expression to be whatever symbol was in scope at the time.
int i;
f(void){
    enum e { i = i+1, j, k };    /* uses global i in i+1 */
}

"file", line 3: warning: enumerator used in its own initializer: i "file", line 3: integral constant expression expected


enumerator value overflows INT_MAX (2147483647)
Type: Warning -- Options: all
The value for an enumeration constant overflowed the maximum integer value.
enum e { e1=2147483647, e2 };	/* overflow for e2 */

"file", line 1: warning: enumerator value overflows INT_MAX (2147483647)


#error: tokens
Type: Error -- Options: all
A #error directive was encountered in the source file. The other tokens in the directive are printed as part of the message.
#define ONE 2
#if ONE != 1
#error ONE != 1
#endif

"file", line 3: #error: ONE != 1


%error encountered in asm function
Type: Error -- Options: all
A %error specification line was encountered while an enhanced asm was being expanded.

error in asm; expect ; or \n, saw ''c''
Type: Error -- Options: all
In a ``%'' line of an enhanced asm function, the compiler expected to read a semi-colon or new-line and found character c instead.

error writing output file
Type: Error -- Options: all
An output error occurred while the compiler attempted to write its output file or a temporary file. The most likely problem is that a file system is out of space.

) expected
Type: Error -- Options: all
In an #unassert directive, the assertion of a predicate to be dropped must be enclosed in ( ).
#unassert system(unix

"file", line 1: ")" expected


( expected after # identifier
Type: Error -- Options: all
When the ``#'' operator is used in a #if or #elif directive to select a predicate instead of a like-named macro, the predicate must be followed by a parenthesized list of tokens.
#assert system(unix)
#define system "unix"
#if #system
        char *systype = system;
#endif

"file", line 3: "(" expected after "# identifier"


( expected after first identifier
Type: Error -- Options: all
In an #unassert directive, the assertion of a predicate to be dropped must be enclosed in ( ).
#unassert system unix

"file", line 1: "(" expected after first identifier


extern and prior uses redeclared as static: name
Type: Warning -- Options: -Xc, -w3
name was declared at file scope as an extern, then later the same object or function was declared as static. ANSI C rules require that the first declaration of an object or function give its actual storage class. The compilation system accepts the declaration and treats the object or function as if the first declaration had been static.
extern int i;
static int i;

"file", line 2: warning: extern and prior uses redeclared as static: i


first operand must have scalar type: op ?:
Type: Error -- Options: all
The conditional expression in a ? : expression must have scalar (integral, floating-point, or pointer) type.
struct s { int x; } st;
f(void){
    int i = st ? 3 : 4;
}

"file", line 3: first operand must have scalar type: op "?:"


floating-point constant calculation out of range: op operator
Type: Warning, Error -- Options: all
The compiler detected an overflow at compile time when it attempted the operator operation between two floating-point operands. The diagnostic is a warning if the expression is in executable code and an error otherwise.
double d1 = 1e300 * 1e300;

"file", line 1: floating-point constant calculation out of range: op "*"


floating-point constant folding causes exception
Type: Error -- Options: all
This message is like the previous one, except that the operation caused a floating-point exception that causes the compiler to exit.

formal parameter lacks name: param #n
Type: Error -- Options: all
In a function prototype definition, a name was not provided for the n-th parameter.
int f(int){
}

"file", line 1: formal parameter lacks name: param #1


function actually returns double: name
Type: Warning -- Options: -w3
A function that was declared to return type float actually returns double. This information may be useful to know if you try to write an assembly language version of the called routine, or if you write the routine in C++.
float f();

"file", line 1: warning: function actually returns double: f


function cannot return function or array
Type: Error -- Options: all
A function was declared whose return type would be a function or array, rather than a pointer to one of those.
int f(void)[];	/* function returning array of ints */

"file", line 1: function cannot return function or array


function designator is not of function type
Type: Error -- Options: all
An expression was used in a function call as if it were the name of a function or a pointer to a function when it was not.
f(void){
    char *p;
    p();
}

"file", line 3: function designator is not of function type


function expects to return value: name
Type: Warning -- Options: -w3
The current function was declared with a non void type, but contained a return statement with no return value expression.
f(void){
    return;
}

"file", line 2: warning: function expects to return value: f


function prototype parameters must have types
Type: Warning -- Options: all
A function prototype declaration cannot contain an identifier list; it must declare types. The identifier list is ignored.
int f(i);

"file", line 1: warning: function prototype parameters must have types


identifier expected after #
Type: Error -- Options: all
The compiler expected to find an identifier, a predicate name, after a ``#'' in a conditional compilation directive, and none was there.
#if #system(unix) || #
        char *os = "sys";
#endif

"file", line 1: identifier expected after "#"


identifier expected after #undef
Type: Error -- Options: all
A #undef must be followed by the name of the macro to be undefined. The token following the directive was not an identifier.
#undef 4

"file", line 1: identifier expected after #undef


identifier or - expected after -A
Type: Error -- Options: all
The cc command line argument -A must be followed by the name of a predicate to assert, or by a ``-'', to eliminate all predefined macros and predicates. The token following -A was neither of these.
cc -A3b2 -c x.c

command line: identifier or "-" expected after -A


identifier or digit sequence expected after #
Type: Error -- Options: all
An invalid token or non-decimal number follows the ``#'' that introduces a preprocessor directive line.
# 0x12

"file", line 1: identifier or digit sequence expected after "#"


identifier redeclared: name
Type: Warning, Error -- Options: all
The identifier name was declared in a way that is inconsistent with a previous appearance of name, or name was declared twice in the same scope.

Previous releases were forgiving of inconsistent redeclarations if the types were ``nearly'' the same. ANSI C considers the types to be different. The -Xt option will allow you to retain the previous behavior, although the compiler will issue a warning. When the types are manifestly different, the diagnostic is always an error. The -Xa and -Xc options always produce an error when the types are different.

int x;
long x;
int y;
double y;

"file", line 2: warning: identifier redeclared: x "file", line 4: identifier redeclared: y

Declarations of functions with and without argument information can often lead to confusing diagnostics. The following example illustrates.
int f(char);
int f();

"file", line 2: warning: identifier redeclared: f

According to ANSI C's type compatibility rules, a function declaration that lacks type information (i.e., one that is not a function prototype declaration) is compatible with a function prototype only when each parameter type is unchanged by the default argument promotion rules. In the example, char would be affected by the promotion rules (it would be promoted to int). Therefore the two declarations have incompatible types.


identifier redeclared; ANSI C requires static: name
Type: Warning -- Options: all
name was declared twice at file scope. The first one used storage class static, but the second one specified no storage class. ANSI C's rules for storage classes require that all redeclarations of name after the first must specify static.
static int i;
int i;

"file", line 2: warning: identifier redeclared; ANSI C requires "static": i


identifier redefined: name
Type: Error -- Options: all
name was defined more than once. An object with an initializer was declared more than once, or a function was defined more than once.
int i = 1;
int i = 1;

"file", line 2: identifier redefined: i


#if must be followed by a constant expression
Type: Warning -- Options: all
No expression appeared after a #if directive.
#if
        int i = 4;
#endif

"file", line 1: warning: #if must be followed by a constant expression


#if on line n has no #endif
Type: Error -- Options: all
The compiler reached end of file without finding the #endif that would end the preprocessing if-section that began with the if directive that was on line n. The if directive is one of #if, #ifdef, or #ifndef.
#ifdef NOENDIF
        int i = 1;

"file", line 5: #ifdef on line 1 has no matching #endif "file", line 5: warning: empty translation unit


#if-less #endif
Type: Error -- Options: all
An #endif directive was encountered that was not part of a preprocessing if-section.
        int i = 1;
#endif

"file", line 2: #if-less #endif


#ifdef must be followed by an identifier
Type: Warning -- Options: all
A #ifdef preprocessing directive must be followed by the name of the macro to check for being defined. The source code omitted the identifier. The #ifdef is treated as if it were false.
#ifdef
        int i = 1;
#endif

"file", line 1: warning: #ifdef must be followed by an identifier


#ifndef must be followed by an identifier
Type: Warning -- Options: all
The #ifndef directive must be followed by the identifier that is to be tested for having been defined.
#ifndef
        int i = 5;
#endif

"file", line 1: warning: #ifndef must be followed by an identifier


ignoring malformed #pragma comment (exestr, ``string'')
Type: Warning -- Options: all
The compiler encountered a #pragma comment that did not have the form shown. The erroneous directive is ignored.
#pragma comment (exestr, not a string)

"file", line 1: warning: malformed #pragma comment (exestr, "string")


ignoring malformed #pragma int_to_unsigned symbol
Type: Warning -- Options: all
The compiler encountered a #pragma int_to_unsigned directive that did not have the form shown. The erroneous directive is ignored.
#pragma int_to_unsigned strlen();

"file", line 1: warning: ignoring malformed #pragma int_to_unsigned symbol


ignoring malformed #pragma pack(n)
Type: Warning -- Options: all
The compiler encountered a #pragma pack directive that did not have the form shown. The erroneous directive is ignored.

ignoring malformed #pragma weak symbol [=value]
Type: Warning -- Options: all
The compiler encountered a #pragma weak directive that did not have the form shown. The erroneous directive is ignored.
#pragma weak write,_write

"file", line 1: warning: ignoring malformed #pragma weak symbol [=value]


implicitly declaring function to return int: name()
Type: Warning -- Options: -w3
The program calls function name, which has not been previously declared. The compiler warns that it is assuming that function name returns int.
void v(void){
    g();
}

"file", line 2: warning: implicitly declaring function to return int: g()


improper cast of void expression
Type: Error -- Options: all
A void expression cannot be cast to something other than void.
f(void){
    void v(void);
    int i = (int) v();
}

"file", line 3: improper cast of void expression


improper member use: name
Type: Warning, Error -- Options: all
The program contains an expression with a ``->'' or ``.'' operator, and name is not a member of the structure or union that the left side of the operator refers to, but it is a member of some other structure or union. This diagnostic is an error if the member is not ``unique.'' A unique member is part of one or more structures or unions but has the same type and offset in all of them.
struct s1 { int x,y; };
struct s2 { int q,r; };
f(void){
    struct s1 *ps1;
    ps1->r = 3;
}

"file", line 5: warning: improper member use: r


improper pointer subtraction
Type: Warning, Error -- Options: all
The operands of a subtraction are both pointers, but they point at different types. Only pointers of the same type that point to the same array may be subtracted.

The diagnostic is a warning if the pointers point to objects of the same size, and an error otherwise.

f(void){
    int *ip;
    char *cp;
    int i = ip - cp;
}

"file", line 4: improper pointer subtraction


improper pointer/integer combination: arg #n
Type: Warning -- Options: all
At a function call for which there is a function prototype declaration in scope, the code is passing an integer where a pointer is expected, or vice versa.
int f(char *);
g(void){
    f(5);
}

"file", line 3: warning: improper pointer/integer combination: arg #1


improper pointer/integer combination: op operator
Type: Warning -- Options: all
One of the operands of operator is a pointer and the other is an integer, but this combination is invalid.
f(void){
    int i = "abc";
    int j = i ? 4 : "def";
}

"file", line 2: warning: improper pointer/integer combination: op "=" "file", line 3: warning: improper pointer/integer combination: op ":" "file", line 3: warning: improper pointer/integer combination: op "="


inappropriate qualifiers with void
Type: Warning -- Options: all
When void stands by itself, it may not be qualified with const or volatile.
int f(const void);

"file", line 1: warning: inappropriate qualifiers with "void"


#include <... missing ''>''
Type: Warning -- Options: all
In a #include directive for which the header name began with ``<'', the closing ``>'' character was omitted.
#include <stdio.h

"file", line 1: warning: #include <... missing ''>''


#include directive missing file name
Type: Error -- Options: all
A #include directive did not specify a file to include.
#include

"file", line 1: #include directive missing file name


#include of /usr/include/... may be non-portable
Type: Warning -- Options: all
The source file included a file with the explicit prefix ``/usr/include''. Such an inclusion is implementation-dependent and non-portable. On some systems the list of default places to look for a header might not include the /usr/include directory. In such a case the wrong file might be included.
#include </usr/include/stdio.h>

"file", line 1: warning: #include of /usr/include/... may be non-portable


incomplete #define macro parameter list
Type: Error -- Options: all
In the definition of a function-like parameter, the compiler did not find a ``)'' character on the same (logical) line as the #define directive.
#define mac(a

"file", line 1: incomplete #define macro parameter list


incomplete struct/union/enum tag: name
Type: Error -- Options: all
An object name, with struct, union, or enum type and tag tag, was declared but the type is incomplete.
struct s st;

"file", line 1: incomplete struct/union/enum s: st


inconsistent redeclaration of extern: name
Type: Warning -- Options: all
A function or object was redeclared name with storage class extern for which there was a previous declaration that has since gone out of scope. The second declaration has a type that conflicts with the first.
f(void){
    int *p = (int *) malloc(5*sizeof(int));
}
g(void){
    void *malloc();
}

"file", line 5: warning: inconsistent redeclaration of extern: malloc


inconsistent redeclaration of static: name
Type: Warning -- Options: all
An object or function that was originally declared with storage class static was redeclared. The second declaration has a type that conflicts with the first.

The two most frequent conditions under which this diagnostic may be issued are:

  1. A function was originally declared at other than file scope and with storage class static. The subsequent declaration of the function has a type that conflicts with the first.

  2. A function or object was originally declared at file scope and with storage class static. A subsequent declaration of the same object or function at other than file scope used storage class extern (or possibly no storage class, if a function), and there was an intervening, unrelated, declaration of the same name.
f(void){
    static int myfunc(void);
}
g(void){
    static char *myfunc(void);
}

"file", line 5: warning: inconsistent redeclaration of static: myfunc

static int x;
f(void){
    int x;			/* unrelated */
    {
        extern float x;	/* related to first declaration */
    }
}
"file", line 5: warning: inconsistent redeclaration of static: x

inconsistent storage class for function: name
Type: Warning -- Options: all
ANSI C requires that the first declaration of a function or object at file scope establish its storage class. Function name was redeclared in an inconsistent way according to these rules.
g(void){
    int f(void);
    static int f(void);
}

"file", line 3: warning: inconsistent storage class for function: f


initialization type mismatch
Type: Warning -- Options: all
The type of an initializer value is incompatible with the type of the object being initialized. This specific message usually applies to pointers.
int a;
unsigned int *pa = &a ;

"file", line 2: warning: initialization type mismatch


initializer does not fit: value
Type: Warning -- Options: -w3, -w2
The value value does not fit in the space provided for it. If it were fetched from that space, it would not reproduce the same value as was put in. In the message, value is represented as a hexadecimal value if the initializer is unsigned, decimal if it is signed.
struct s {signed int m1:3; unsigned int m2:3;} st = {4, 5};
unsigned char uc = 300u;

"file", line 1: warning: initializer does not fit: 4 "file", line 2: warning: initializer does not fit: 0x12c


integer overflow detected: op operator
Type: Warning -- Options: all
The compiler attempted to compute the result of an operator expression at compile-time, and determined that the result would overflow. The low-order 32 bits of the result are retained, and the compiler issues this diagnostic.
int i = 1000000 * 1000000;

"file", line 1: warning: integer overflow detected: op "*"


integral constant expression expected
Type: Error -- Options: all
The compiler expected (required) an integral constant or an expression that can be evaluated at compile time to yield an integral value. The expression written contained either a non-integral value, a reference to an object, or an operator that cannot be evaluated at compile time.
int ia[5.0];

"file", line 1: integral constant expression expected


integral constant too large
Type: Warning -- Options: all
An integral constant is too large to fit in an unsigned long.
int i = 1234567890123;

"file", line 1: warning: integral constant too large


internal compiler error: message
Type: Error -- Options: all
This message does not diagnose a user programming error (usually), but rather a problem with the compiler itself. One of the compiler's internal consistency checks has failed.

interpreted as a #line directive
Type: Warning -- Options: -Xc
A source line was encountered that had a number where the directive name usually goes. Such a line is reserved for the compiler's internal use, but it must be diagnosed in the -Xc (strictly conforming) mode.
# 9

"file", line 1: warning: interpreted as a #line directive "file", line 1: warning: directive is an upward-compatible ANSI C extension


invalid cast expression
Type: Error -- Options: all
A cast cannot be applied to the expression because the types are unsuitable for casting. Both the type of the expression being cast and the type of the cast must be scalar types. A pointer may only be cast to or from an integral type.
f(void){
    struct s {int x;} st;
    int i = (int) st;
}

"file", line 3: invalid cast expression


invalid class in asm % line: class
Type: Error -- Options: all
The storage class class that the compiler encountered in an enhanced asm ``%'' line is not one of the acceptable classes.

invalid compiler control line in .i file
Type: Error -- Options: all
A .i file, the result of a cc -P command, is assumed to be a reserved communication channel between the preprocessing phase and the compilation phase of the compiler. The .i file lets you examine that intermediate form to detect errors that may otherwise be hard to detect. However, the compiler expects to find only a few directives that are used for internal communication. The source file that was compiled (a .i file) contained a preprocessing directive other than one of the special directives.

invalid directive
Type: Error -- Options: all
The identifier that follows a ``#'' in a preprocessing directive line was one that the compiler did not recognize.
# unknown

"file", line 1: invalid directive


invalid initializer
Type: Error -- Options: all
The program contains an initializer for an extern or static that attempts to store a pointer in a smaller than pointer-sized object. Such initializations are not supported.
int j;
char c = (char) &j ;

"file", line 2: invalid initializer


invalid multibyte character
Type: Error -- Options: all
A multibyte character in a string literal or character constant could not be converted to a single wide character in the host environment.

invalid source character: ''c''
Type: Error -- Options: all
The compiler encountered a character (c) in the source program that is not a valid ANSI C token.
int i = 1$;

"file", line 1: invalid source character: ''$''


invalid source character: <hex value>
Type: Error -- Options: all
This message diagnoses the same condition as the previous one, but the invalid character is not printable. The hex value between the brackets in the diagnostic is the hexadecimal value of the character code.

invalid switch expression type
Type: Error -- Options: all
The controlling expression of a switch statement could not be converted to int. This message always follows ``switch expression must have integral type''.
f(){
    struct s {int x;} sx;
    switch(sx){
    case 4: ;
    }
}

"file", line 3: switch expression must have integral type "file", line 3: invalid switch expression type


invalid token: non-token
Type: Error -- Options: all
The compiler encountered a sequence of characters that does not comprise a valid token. An invalid token may result from the preprocessing ``##'' operator. The offending non-token is shown in the diagnostic. If the non-token is longer than 20 characters, the first 20 are printed, followed by ``. . .'', and the. offending invalid token is ignored.
#define PASTE(l,r) l ## r
double d1 = 1e;
double d2 = PASTE(1,e);
int i = 1veryverylongnontoken;

"file", line 2: invalid token: 1e "file", line 2: syntax error before or at: ; "file", line 2: warning: syntax error: empty declaration "file", line 3: invalid token: 1e "file", line 3: syntax error before or at: ; "file", line 3: warning: syntax error: empty declaration "file", line 4: invalid token: 1veryverylongnontoke... "file", line 4: syntax error before or at: ; "file", line 4: warning: syntax error: empty declaration


invalid token in #define macro parameters: token
Type: Error -- Options: all
The compiler encountered an inappropriate token while processing the argument list of a function-like macro definition. token is the erroneous token.
#define mac(a,4) a b c

"file", line 1: invalid token in #define macro parameters: 4


invalid token in directive
Type: Error -- Options: all
The compiler found an invalid token at the end of what would otherwise be a correctly formed directive.
#line 7 "file.c

"file", line 1: warning: string literal expected after #line <number> "file", line 1: invalid token in directive: " "file", line 1: warning: tokens ignored at end of directive line


invalid type combination
Type: Error -- Options: all
An inappropriate combination of type specifiers was used in a declaration.
short float f;

"file", line 1: invalid type combination


invalid type for bit-field: name
Type: Error -- Options: all
The type chosen for bit-field name is not permitted for bit-fields. Bit-fields may only be declared with integral types.
struct s { float f:3; };

"file", line 1: invalid type for bit-field: f


invalid use of defined operator
Type: Error -- Options: all
A defined operator in a #if or #elif directive must be followed by an identifier or ( )'s that enclose an identifier. The source code did not use it that way.
#if defined
        int i = 1;
#endif

"file", line 1: invalid use of "defined" operator


invalid white space character in directive
Type: Warning -- Options: all
The only white space characters that are permitted in preprocessing directives are space and horizontal tab. The source code included some other white space character, such as form feed or vertical tab. The compiler treats this character like a space.

label redefined: name
Type: Error -- Options: all
The same label name has appeared more than once in the current function. (A label's scope is an entire function.)
f(void){
    int i;
    i = 1;
    if (i) {
L:
        while (i)
            g();
        goto L;
    }
L: ;
}

"file", line 10: label redefined: L


left operand must be modifiable lvalue: op operator
Type: Error -- Options: all
The operand on the left side of operator must be a modifiable lvalue, but it wasn't.
f(void){
    int i = 1;
    +i -= 1;
}

"file", line 3: left operand must be modifiable lvalue: op "-="


left operand of -> must be pointer to struct/union
Type: Warning, Error -- Options: all
The operand on the left side of a ``->'' operator must be a pointer to a structure or union, but it wasn't. The diagnostic is a warning if the operand is a pointer, an error otherwise.
struct s { int x; };
f(void){
    long *lp;
    lp->x = 1;
}

"file", line 4: warning: left operand of "->" must be pointer to struct/union


left operand of . must be lvalue in this context
Type: Warning -- Options: all
The operand on the left side of a ``.'' operator is an expression that does not yield an lvalue. Usually this results from trying to change the return value of a function that returns a structure.
struct s { int ia[10]; };
struct s sf(void);
f(void){
    sf().ia[0] = 3;
}

"file", line 4: warning: left operand of "." must be lvalue in this context


left operand of . must be struct/union object
Type: Warning, Error -- Options: all
The ``.'' operator is only supposed to be applied to structure or union objects. The diagnostic is an error if the operand to the left of ``.'' is an array, pointer, function call, enumeration constant or variable, or a register value that got allocated to a register; it is a warning otherwise.
f(void){
    struct s { short s; };
    int i;
    i.s = 4;
}

"file", line 4: warning: left operand of "." must be struct/union object


()-less function definition
Type: Error -- Options: all
The declarator portion of a function definition must include parentheses. A function cannot be defined by writing a typedef name for a function type, followed by an identifier and the braces ({ }) that define a function.
typedef int F();
F f{ }

"file", line 2: ()-less function definition


loop not entered at top
Type: Warning -- Options: all
The controlling expression at the beginning of a for or while loop cannot be reached by sequential flow of control from the statement before it.
f(void){
    int i;
    goto lab;
    for (i = 1; i > 0; --i) {
lab:;
        i=5;
    }
}

"file", line 4: warning: loop not entered at top


macro nesting too deep
Type: Fatal -- Options: all
The source code defines a macro that causes the compiler to run out of memory during preprocessing.

macro recursion
Type: Warning -- Options: -Xt
The source code calls a macro that calls itself, either directly or indirectly. ANSI C's semantics prevent further attempts to rescan the macro. Older C compilers would try to rescan the macro.

Because the rescanning rules are different for ANSI C and its predecessor, the compiler provides the old behavior in -Xt and in -Xk modes, which includes producing this diagnostic when macro recursion is detected.

#define a(x) b(x)
#define b(x) a(x)
a(3)

"file", line 3: warning: macro recursion


macro redefined: name
Type: Warning -- Options: all
The source code redefined a macro. Previous releases allowed such redefinitions silently if both definitions were identical except for the order and spelling of formal parameters. ANSI C requires that, when a macro is redefined correctly, the definitions must be identical including the order and spelling of formal parameters. This diagnostic is produced under all options if the new macro definition disagrees with the old one. For strict conformance, it is also produced under the -Xc option when the macro definitions disagree only in the spelling of the formal parameters.
#define TIMES(a,b) a * b
#define TIMES(a,b) a - b

"file", line 2: warning: macro redefined: TIMES


macro replacement within a character constant
Type: Warning -- Options: -Xt
Previous releases allowed the value of a formal parameter to be substituted in a character constant that is part of a macro definition. ANSI C does not permit such a use.
#define	CTRL(x) ('x'&037)	/* form control character */

int ctrl_c = CTRL(c);

"file", line 1: warning: macro replacement within a character constant

The proper way to express this construct in ANSI C is the following:
#define	CTRL(x) (x&037)	/* form control character */

int ctrl_c = CTRL('c');


macro replacement within a string literal
Type: Warning -- Options: -Xt
This message diagnoses a similar condition to the preceding one, except the substitution is being made into a string literal.
#define HELLO(name)	"hello, name"

char *hello_dave = HELLO(Dave);

"file", line 1: warning: macro replacement within a string literal

ANSI C provides a way to accomplish the same thing. The ``#'' ``string-ize'' operator turns the tokens of a macro argument into a string literal, and adjacent string literals are concatenated. The correct form is:
#define HELLO(name)	"hello, " #name

char *hello_dave = HELLO(Dave);


member cannot be function: name
Type: Error -- Options: all
A function may not be a member of a structure or union, although a pointer to a function may. Member name was declared as a function.
struct s { int f(void); };

"file", line 1: member cannot be function: f


mismatched ? and :
Type: Error -- Options: all
An expression in a #if or #elif directive contained a malformed ? : expression.
#if defined(foo) ? 5
        int i;
#endif

"file", line 1: mismatched "?" and ":"


mismatched parentheses
Type: Error -- Options: all
Parentheses were mismatched in a preprocessing conditional compilation directive.
#if ((1)
        int i = 1;
#endif

"file", line 1: mismatched parentheses


missing )
Type: Error -- Options: all
In a test of a predicate that follows a ``#'' operator in a #if or #elif directive, the ``)'' that follows the assertion was missing.
#if # system(unix
        char *system = "unix";
#endif

"file", line 1: missing ")"


missing formal name in % line
Type: Error -- Options: all
In an enhanced asm function, a ``%'' line specified a storage class, but not the formal parameter than has that storage class.

missing operand
Type: Error -- Options: all
The constant expression of a preprocessing conditional compilation directive is malformed. An expected operand for some operator was missing.
#define EMPTY
#if EMPTY / 4
        int i = 1;
#endif

"file", line 2: missing operand


missing operator
Type: Error -- Options: all
The constant expression of a preprocessing conditional compilation directive is malformed. An operator was expected but was not encountered.
#if 1 4
        int i = 1;
#endif

"file", line 1: missing operator


missing tokens between parentheses
Type: Error -- Options: all
In a #assert directive, there are no assertions within the parentheses of the predicate.
#assert system()

"file", line 1: missing tokens between parentheses


modifying typedef with modifier; only qualifiers allowed
Type: Warning -- Options: -Xt
ANSI C prohibits applying a type modifier to a typedef name. ANSI C only permits modifying a typedef with a type qualifier (const, volatile). However, for compatibility, the compiler accepts the declaration and treats it as did previous releases. Future releases will reject this declaration.
typedef int INT;
unsigned INT i;

"file", line 2: warning: modifying typedef with "unsigned"; only qualifiers allowed


modulus by zero
Type: Warning, Error -- Options: all
The second operand of a ``%'' operator is zero. If the modulus operation is part of a #if or #elif directive, the result is taken to be zero. The diagnostic is a warning if the modulus is in executable code, an error otherwise.
#if 42 % 0
        int i = 1;
#endif

"file", line 1: warning: modulus by zero


more than one character honored in character constant: constant
Type: Warning -- Options: all
A character constant has an integral value that derives from the character codes of the characters. If a character constant comprises more than one character, the encoding of the additional characters depends on the implementation. This warning alerts you that the encoding that the preprocessing phase uses for the character constant constant is different in this release of the C compiler from the one in previous releases, which only honored the first character. (The encoding for character constants you use in executable code is unchanged.)
#if 'ab' != ('b' * 256 + 'a')
#error unknown encoding
#endif

"file", line 1: warning: more than one character honored in character constant: ''ab''


# must be followed by formal identifier in #define
Type: Error -- Options: all
The ``string-ize'' operator ``#'' must be followed by the name of a formal parameter in a function-like macro.
#define mac(a) # + a

"file", line 1: "#" must be followed by formal identifier in #define


must have type function-returning-unsigned: name
Type: Warning -- Options: all
The name that is a part of a #pragma int_to_unsigned directive must be an identifier whose type is function-returning-unsigned.
extern int f(int);
#pragma int_to_unsigned f

"file", line 2: warning: must have type "function-returning-unsigned": f


name in asm % line is not a formal: name
Type: Error -- Options: all
The identifier name that followed a storage class specifier in the ``%'' line of an enhanced asm function was not one of the formal parameters of the function.

nested asm calls not now supported
Type: Error -- Options: all
The compiler does not now support calls to enhanced asm functions as part of the argument expression for another enhanced asm function.

newline in character constant
Type: Error -- Options: all
A character constant was written that had no closing ' on the same line as the beginning '.
int i = 'a
;

"file", line 1: newline in character constant


newline in string literal
Type: Warning, Error -- Options: all
A string literal was written that had no closing " on the same line as the beginning ". The diagnostic is a warning if the string literal is part of a preprocessing directive (and the compiler provides the missing ") and an error otherwise.
char *p = "abc
;

"file", line 1: newline in string literal


newline not last character in file
Type: Warning -- Options: all
Every non-empty source file and header must consist of complete lines. This diagnostic warns that the last line of a file did not end with a newline.

no actual for asm formal: name
Type: Error -- Options: all
An enhanced asm function was called with fewer arguments than there were parameters in the definition. Thus there was no actual argument for parameter name.

no closing > in #include <...
Type: Error -- Options: all
A #include directive that used the ``<>'' form of header omitted the closing ``>''.
#include <stdio.h

"file", line 1: warning: #include <... missing ''>''


no file name after expansion
Type: Error -- Options: all
The form of #include directive was used that permits macro expansion of its argument, but the resulting expansion left no tokens to be taken as a file name.
#define EMPTY
#include EMPTY

"file", line 2: no file name after expansion


no hex digits follow \x
Type: Warning -- Options: -Xa, -Xc
The \x escape in character constants and string literals introduces a hexadecimal character escape. The \x must be followed by at least one hexadecimal digit.
char *cp = "\xz";

"file", line 1: warning: no hex digits follow \x


no macro replacement within a character constant
Type: Warning -- Options: -Xa, -Xc
This message is the inverse of ``macro replacement within a character constant''. This informs you that the macro replacement that was done for -Xt or -Xk mode is not being done in -Xa or -Xc mode.

no macro replacement within a string literal
Type: Warning -- Options: -Xa, -Xc
This message is the inverse of ``macro replacement within a string literal''. It informs you that the macro replacement that was done for -Xt mode is not being done in -Xa or -Xt mode.

no tokens after expansion
Type: Error -- Options: all
After macro expansion was applied to the expression in a #line directive, there were no tokens left to be interpreted as a line number.
#define EMPTY
#line EMPTY

"file", line 2: no tokens after expansion


no tokens follow #pragma
Type: Warning -- Options: -w3
The compiler encountered a #pragma directive that contained no other tokens.
#pragma

"file", line 1: warning: no tokens follow "#pragma"


no tokens following #assert name (
Type: Error -- Options: all
A use of the #assert directive is malformed. The assertions and the ``)'' that should follow are missing.
#assert system(

"file", line 1: no tokens following "#assert name ("


no tokens in #line directive
Type: Error -- Options: all
The rest of a #line directive was empty; the line number and optional file name were missing.
#line

"file", line 1: no tokens in #line directive


non-constant initializer: op operator
Type: Error -- Options: all
The initializer for an extern, static, or array object must be a compile-time constant. The initializers for an automatic structure or union object, if enclosed in { }, must also be compile-time constants. operator is the operator whose operands could not be combined at compile time.
int j;
int k = j+1;

"file", line 2: non-constant initializer: op "+"


non-formal identifier follows # in #define
Type: Warning -- Options: all
The identifier that follows a ``#'' operator in a macro definition must be a formal parameter of a function-like macro.
#define mac(a) "abc" # b

"file", line 1: non-formal identifier follows "#" in #define


non-integral case expression
Type: Error -- Options: all
The operand of a case statement must be an integral constant.
f(void){
    int i = 1;
    switch (i) {
    case 5.0: ;
    }
}

"file", line 4: non-integral case expression


non-unique member requires struct/union: name
Type: Error -- Options: all
The operand on the left side of a ``.'' operator was not a structure, union, or a pointer to one, and member name was not unique among all structure and union members that you have declared. Use ``.'' only with structures or unions. The member should belong to the structure or union corresponding to the left operand.
struct s1 { int x,y; };
struct s2 { int y,z; };
f(void){
    long *lp;
    lp.y = 1;
}

"file", line 5: non-unique member requires struct/union object: y "file", line 5: left operand of "." must be struct/union object


non-unique member requires struct/union pointer: name
Type: Error -- Options: all
This message diagnoses the same condition as the preceding one, but for the ``->'' operator.

null character in input
Type: Error -- Options: all
The compiler encountered a null character (a character with a character code of zero).

null dimension: name
Type: Warning, Error -- Options: all
A dimension of an array is null in a context where that is prohibited. The diagnostic is a warning if the offending dimension is outermost and an error otherwise.
int ia[4][];
struct s { int x, y[]; };
int i = sizeof(int []);

"file", line 1: null dimension: ia "file", line 2: warning: null dimension: y "file", line 3: warning: null dimension: sizeof()


number expected
Type: Error -- Options: all
The compiler did not find a number where it expected to find one in a #if or #elif directive.
#if 1 +
        int i = 1;
#endif

"file", line 1: number expected


old-style declaration hides prototype declaration: name
Type: Warning -- Options: -w3
The function name was declared in an inner scope. The outer declaration was a function prototype declaration, but the inner one lacks parameter information. By ANSI C's scoping rules, the parameter information is hidden and the automatic conversions of types that the prototype would have provided are suppressed.
extern double sin(double);
f(void){
    extern double sin();
    double d;
    d = sin(1);	/* Note:  no conversion to double! */
}

"file", line 3: warning: old-style declaration hides prototype declaration: sin "file", line 5: warning: argument does not match remembered type: arg #1


only one storage class allowed
Type: Error -- Options: all
More than one storage class was specified in a declaration.
f(void){
    register auto i;
}

"file", line 2: only one storage class allowed


only qualifiers allowed after *
Type: Error -- Options: all
Only the const or volatile type qualifiers may be specified after a ``*'' in a declaration.
int * const p;
int * unsigned q;

"file", line 2: only qualifiers allowed after *


only register valid as formal parameter storage class
Type: Error -- Options: all
A storage class specifier may be specified in a function prototype declaration, but only register is permitted.
int f(
    register int x,
    auto int y
);

"file", line 3: only "register" valid as formal parameter storage class


operand cannot have void type: op operator
Type: Error -- Options: all
One of the operands of operator has void type.
f(void){
    void v(void);
    int i = v();
}

"file", line 3: operand cannot have void type: op "=" "file", line 3: assignment type mismatch


operand must be modifiable lvalue: op operator
Type: Error -- Options: all
The operand of operator must be a modifiable lvalue, but it wasn't.
f(void){
    int i = --3;
}

"file", line 2: operand must be modifiable lvalue: op "--"


operand treated as unsigned: constant
Type: Warning -- Options: -Xt
An operand used in a #if or #elif directive has a value greater than LONG_MAX (2147483647) but has no unsigned modifier suffix (u or U). Previous releases treated such constants as signed quantities which, because of their values, actually became negative. ANSI C treats such constants as unsigned long integers, which may affect their behavior in expressions. This diagnostic is a transition aid that informs you that the value is being treated differently from before.
#if 2147483648 > 0
        char *mesg = "ANSI C-style";
#endif

"file", line 1: warning: operand treated as unsigned: 2147483648


operands have incompatible pointer types: op operator
Type: Warning -- Options: all
operator was applied to pointers to different types.
f(void){
    char *cp;
    int *ip;
    if (ip < cp)
        ;
}

"file", line 4: warning: operands have incompatible pointer types: op "<"


operands have incompatible types: op operator
Type: Error -- Options: all
The types of the operands for operand are unsuitable for that type of operator.
f(void){
    char *cp;
    int *ip;
    void *vp = ip + cp;
}

"file", line 4: operands have incompatible types: op "+"


operands must have category type: op operator
Type: Error -- Options: all
The operands for operator do not fall into the appropriate category for that operator. category may be arithmetic, integral, or scalar.
f(void){
    int ia[5];
    int *ip = ia/4;
}

"file", line 3: operands must have arithmetic type: op "/"


out of scope extern and prior uses redeclared as static: name
Type: Warning -- Options: -Xc, -w3
name was declared as extern in a block that has gone out of scope. Then name was declared again, this time as static. The compiler treats the object or function as if it were static, and all references, including ones earlier in the source file, apply to the static version.
f(void){
    extern int i;
}
static int i;

"file", line 4: warning: out of scope extern and prior uses redeclared as static: i


overflow in hex escape
Type: Warning -- Options: all
In a hexadecimal escape (\x) in a character constant or string literal, the accumulated value for the escape grew too large. Only the low-order 32 bits of value are retained.
int i = '\xabcdefedc';

"file", line 1: warning: \x is ANSI C hex escape "file", line 1: warning: overflow in hex escape "file", line 1: warning: character escape does not fit in character


parameter mismatch: ndecl declared, ndef defined
Type: Warning -- Options: all" A function prototype declaration and an old-style definition
of the function disagree in the number of parameters. The declaration had ndecl parameters, while the definition had ndef.
int f(int);
int f(i,j)
int i,j;
{}

"file", line 4: warning: parameter mismatch: 1 declared, 2 defined


parameter not in identifier list: name
Type: Error -- Options: all
Variable name appears in an old-style function definition's parameter declarations, but it does not appear in the parameter identifier list.
f(a,b)
int i;
{}

"file", line 2: parameter not in identifier list: i


parameter redeclared: name
Type: Error -- Options: all
name was used more than once as the name for a parameter in a function definition.
int f(int i, int i) { }
int g(i,j)
int i;
int i;
{ }

"file", line 1: parameter redeclared: i "file", line 4: parameter redeclared: i


preprocessing a .i file
Type: Warning -- Options: all
The source file is a .i file, a file that has already been preprocessed, and the -E cc option was selected. The compiler will simply copy the input file to the standard output without further processing.

prototype mismatch: n1 arg[s] passed, n2 expected
Type: Error -- Options: all
A function for which there is a function prototype declaration in scope, and the number of arguments in the call, n2, did not match the number of parameters in the declaration, n1.
int f(int);
g(void){
    f(1,2);
}

"file", line 3: prototype mismatch: 2 args passed, 1 expected


return value type mismatch
Type: Error -- Options: all
A value from a function cannot be returned that cannot be converted to the return-type of the function.
f(void){
    struct s { int x; } st;
    return( st );
}

"file", line 3: return value type mismatch


semantics of operator change in ANSI C; use explicit cast
Type: Warning -- Options: -w3, -w2
The type promotion rules for ANSI C are slightly different from those of previous releases. In the current release the default behavior is to duplicate the previous rules. In future releases the default will be to use ANSI C rules. To obtain the ANSI C interpretation, use the -Xa option for the cc command.

Previous type promotion rules were ``unsigned-preserving.'' If one of the operands of an expression was of unsigned type, the operands were promoted to a common unsigned type before the operation was performed.

ANSI C uses ``value-preserving'' type promotion rules. An unsigned type is promoted to a signed type if all its values may be represented in the signed type.

The different type promotion rules may lead to different program behavior for the operators that are affected by the unsigned-ness of their operands:


The warning message tells that the program contains an expression in which the behavior of operator will change in the future. To guarantee the desired behavior, insert an explicit cast in the expression.

f(void){
    unsigned char uc;
    int i;
    /* was unsigned divide, signed in ANSI C */
    i /= uc;
}

"file", line 5: warning: semantics of "/=" change in ANSI C; use explicit cast

To get the same behavior as in previous releases add an explicit cast:
f(void){
    unsigned char uc;
    int i;
    /* was unsigned divide, signed in ANSI C */
    i /= (unsigned int) uc;
}

shift count negative or too big: op n
Type: Warning -- Options: all
The compiler determined that the shift count (the right operand) for shift operator op is either negative or bigger than the size of the operand being shifted.
f(){
    short s;
    s <<= 25;
}

"file", line 3: warning: shift count negative or too big: <<= 25


statement not reached
Type: Warning -- Options: all
This statement in the program cannot be reached because of goto, break, continue, or return statements preceding it.
f(void){
    int i;
    return i;
    i = 4;
}

"file", line 4: warning: statement not reached


static function called but not defined: name()
Type: Warning -- Options: all
The program calls function name, which has been declared static, but no definition of name appears in the translation unit. (The line number that is displayed in the message is one more than the number of lines in the file, because this condition can be diagnosed only after the entire translation unit has been seen.)
static int statfunc(int);
void
f(){
    int i = statfunc(4);
}

"file", line 7: warning: static function called but not defined: statfunc()


static redeclares external: name
Type: Warning -- Options: all
name was reused as the name of a static object or function after having used it in the same block as the name of an extern object or function. The version of name that remains visible is the static version.
f(void){
    extern int i;
    static int i;
}

"file", line 3: warning: static redeclares external: i


storage class after type is obsolescent
Type: Warning -- Options: -w3
According to the ANSI C standard, writing declarations in which the storage class specifier is not first is ``obsolescent.''
int static i;

"file", line 1: warning: storage class after type is obsolescent


storage class for function must be static or extern
Type: Warning -- Options: all
An inappropriate storage class specifier for a function declaration or definition was used. Only extern and static may be used, or the storage class may be omitted. The specifier is ignored.
f(void){
    auto g(void);
}

"file", line 2: warning: storage class for function must be static or extern


string literal expected after # <number>
Type: Warning -- Options: all
The ``#'' line information directive takes an optional second token, a file name. If present, it must be in the form of a string literal.
# 1 x.c

"file", line 1: warning: string literal expected after # <number> "file", line 1: warning: tokens ignored at end of directive line


string literal expected after #file
Type: Error -- Options: all
The #file directive (which is reserved for the compilation system) is used for internal communication between preprocessing and compilation phases. A string literal operand is expected as the operand.

string literal expected after #ident
Type: Error -- Options: all
A #ident directive must be followed by a normal (not wide character) string literal.
#ident no-string

"file", line 1: string literal expected after #ident


string literal expected after #line <number>
Type: Warning -- Options: all
This diagnostic is similar to ``string literal expected after # <number>'', except that it applies to the standard #line directive.

string literal must be sole array initializer
Type: Warning -- Options: all
It is not permissible to initialize a character array with both a string literal and other values in the same initialization.
char ca[] = { "abc", ''d'' };

"file", line 1: warning: string literal must be sole array initializer


struct/union has no named members
Type: Warning -- Options: all
A structure or union was declared in which none of the members is named.
struct s { int :4; char :0; };

"file", line 1: warning: struct/union has no named members


struct/union-valued initializer required
Type: Error -- Options: all
ANSI C allows you to initialize an automatic structure or union, but the initializer must have the same type as the object being initialized.
f(void){
    int i;
    struct s { int x; } st = i;
}

"file", line 3: warning: {}-enclosed initializer required "file", line 3: struct/union-valued initializer required


switch expression must have integral type
Type: Warning, Error -- Options: all
A switch statement was written in which the controlling expression did not have integral type. The message is a warning if the invalid type is a floating-point type and an error otherwise. A floating-point switch expression is converted to int.
f(void){
    float x;
    switch (x) {
    case 4: ;
    }
}

"file", line 3: warning: switch expression must have integral type


syntax error before or at: token
Type: Error -- Options: all
This is an all-purpose diagnostic that means you have juxtaposed two (or more) language tokens inappropriately. The compiler shows you the token at which the error was detected.
f(void){
    int i = 3+;
}

"file", line 2: syntax error before or at: ;


syntax error in macro parameters
Type: Error -- Options: all
The macro parameter list part of a function-like macro definition is malformed. The list must be a comma-separated list of identifiers and was not.
#define mac(a,b,) a b

"file", line 1: syntax error in macro parameters


syntax error, probably missing , ; or =
Type: Error -- Options: all
A declaration that looked like a function definition was written, except that the type of the symbol declared was not ``function returning.'' A ``;'' or ``='' is needed.
int i
int j;

"file", line 2: syntax error, probably missing ",", ";" or "=" "file", line 2: parameter not in identifier list: j "file", line 4: syntax error before or at: <EOF>


syntax violation: empty declaration
Type: Warning -- Options: all
A null statement was written at file scope. This looks like an empty declaration statement and was previously permitted, but ANSI C does not.
int i;;

"file", line 1: warning: syntax violation: empty declaration


syntax violation: &... invalid
Type: Warning -- Options: -Xc
A &. . . was written in a program that was compiled with the -Xc option. & . . . is invalid ANSI C syntax. Do not use this notation explicitly.

syntax requires ; after last struct/union member
Type: Warning -- Options: all
The ``;'' that C syntax requires after the last structure or union member in a structure or union declaration was omitted.
struct s { int x };

"file", line 1: warning: syntax requires ";" after last struct/union member


(type) tag redeclared: name
Type: Error -- Options: all
The tag name that was originally a type (struct, union, or enum) tag was redeclared.
struct q { int m1, m2; };
enum q { e1, e2 };

"file", line 2: (struct) tag redeclared: q


token not allowed in directive: token
Type: Error -- Options: all
A token was used in a #if or #elif directive that is neither a valid operator for constant expressions, nor a valid integer constant.
#if 1 > "1"
        int i = 1;
#endif

"file", line 1: token not allowed in directive: "1"


token-less macro argument
Type: Warning -- Options: -Xc
The actual argument to a preprocessor macro consisted of no tokens. The ANSI C standard regards this condition as undefined. The compiler treats the empty list of tokens as an empty argument, and, under the -Xc mode, it also issues this warning.
#define	m(x) x+3
int i = m();

"file", line 2: warning: token-less macro argument


tokens after -A- are ignored
Type: Warning -- Options: all
In the -A- option to the cc command, there were additional tokens adjacent to the option. They are ignored.
cc -A-extra -c x.c

command line: warning: tokens after -A- are ignored


tokens expected after # identifier (
Type: Error -- Options: all
When the ``#'' operator is used in a #if or #elif directive to select a predicate instead of a like-named macro, the predicate must be followed by a parenthesized list of tokens.
#if #system(
        char *system = "unix";
#endif

"file", line 1: tokens expected after "# identifier ("


tokens expected after (
Type: Error -- Options: all
In a #unassert directive, the assertion(s) and closing ``)'' after the predicate were missing.
#unassert system(

"file", line 1: tokens expected after "("


tokens expected between parentheses
Type: Error -- Options: all
The name of an assertion of a predicate to test was omitted in an #if or #elif directive.
#if #system()
        char *sysname = "??";
#endif

"file", line 1: tokens expected between parentheses


tokens ignored after -U{identifier}
Type: Warning -- Options: all
In the command line -U option, there were tokens following the name of the macro to be undefined.
cc -Uunix,u3b2 -c x.c

command line: warning: tokens ignored after "-U{identifier}"


tokens ignored at end of directive line
Type: Warning -- Options: all
A directive line contains extra tokens that are not expected as part of the directive.
#undef a b		/* can only undefine one */

"file", line 1: warning: tokens ignored at end of directive line


too many array initializers
Type: Error -- Options: all
More initializers than the array can hold were provided for the array.
int ia[3] = { 1, 2, 3, 4 };

"file", line 1: too many array initializers


too many #else's
Type: Warning -- Options: all
The code contained more that one #else directive in a preprocessing if-section. All #else directives after the first are taken to be false.
#ifdef ONE
        int i = 1;
#else
        int i = 2;
#else
        int i = 3;
#endif

"file", line 5: warning: too many #else''s


too many errors
Type: Fatal -- Options: all
The compiler encountered too many errors to make further processing sensible. Rather than produce further diagnostics, the compiler exits.

too many initializers for scalar
Type: Error -- Options: all
A { }-bracketed initialization for a scalar contains more than one value.
int i = { 1, 2 };

"file", line 1: too many initializers for scalar


too many struct/union initializers
Type: Error -- Options: all
Too many initializers for a structure or union were provided.
struct s { int x,y; } st = { 1,2,3 };

"file", line 1: too many struct/union initializers


trailing , prohibited in enum declaration
Type: Warning -- Options: -Xc, -w3
An extra comma was supplied at the end of an enumeration type declaration. The extra comma is prohibited by the syntax.
enum e { e1, e2, };

"file", line 1: warning: trailing "," prohibited in enum declaration


trigraph sequence replaced
Type: Warning -- Options: -Xt
ANSI C introduces the notion of trigraphs, three-character sequences that stand for a single character. All such sequences begin with ``??''. Because sequences that are interpreted as trigraphs may appear in existing code, the compiler produces a transitional diagnostic when such sequences are encountered.
char *surprise = "this is a trigraph??!";

"file", line 1: warning: trigraph sequence replaced


type does not match prototype: name
Type: Warning -- Options: all
A function prototype declaration for a function was provided, but it used an old-style definition. The type for parameter name in that definition is incompatible with the type you used in the prototype declaration.
int f(char *);
int f(p)
int *p;
{}

"file", line 4: warning: type does not match prototype: p

The following example shows an especially confusing instance of this diagnostic.
int f(char);
int f(c)
char c;
{}

"file", line 3: warning: identifier redeclared: f "file", line 4: warning: type does not match prototype: c

f has an old-style definition. For compatibility reasons, f's arguments must therefore be promoted according to the default argument promotions, which is how they were promoted before the existence of function prototypes. Therefore the value that must actually be passed to f is an int, although the function will only use the char part of the value. The diagnostic, then, identifies the conflict between the int that the function expects and the char that the function prototype would (conceptually) cause to be passed.

There are two ways to fix the conflict:

  1. Change the function prototype to read
    int f(int);
    

  2. Define f with a function prototype definition:
    int f(char);
    int f(char c)
    {}
    

typedef already qualified with qualifier
Type: Warning -- Options: all
A type specifier includes a typedef and an explicit type qualifier, qualifier. The typedef already included qualifier when it was declared.
typedef volatile int VOL;
volatile VOL v;

"file", line 2: warning: typedef already qualified with "volatile"


typedef declares no type name
Type: Warning -- Options: all
In a declaration with storage class typedef, no type name was actually declared. This is probably a programming error.
typedef struct s { int x; };

"file", line 1: warning: typedef declares no type name


typedef redeclared: name
Type: Warning -- Options: all
typedef name was declared more than once. The later declaration has an identical type to the first.
typedef int i;
typedef int i;

"file", line 2: warning: typedef redeclared: i


typedef redeclares external: name
Type: Warning -- Options: all
typedef name was declared, but there is an extern of the same name in the same block. The typedef hides the external.
f(void){
    extern int INT;
    typedef int INT;
}

"file", line 3: warning: typedef redeclares external: INT


typedef valid only for function declaration
Type: Warning -- Options: all
A function definition may not have the typedef storage class. It is ignored here.
typedef int f(void){}

"file", line 1: warning: "typedef" valid only for function declaration


unacceptable operand for unary &
Type: Error -- Options: all
An attempt was made to take the address of something whose address cannot be taken.
f(void){
    int *ip = &g() ;
}

"file", line 2: unacceptable operand for unary &


#unassert requires an identifier token
Type: Error -- Options: all
The #unassert directive must name a predicate to ``un-assert.''
#unassert 5

"file", line 1: #unassert requires an identifier token


undefined label: label
Type: Error -- Options: all
A goto was written in the current function, but the target label was never defined anywhere within the function.
f(void){
    goto L;
}

"file", line 3: undefined label: L


undefined struct/union member: name
Type: Error -- Options: all
The program made reference to a structure or union member, name, that has not been declared as part of any structure.
struct s { int x; };
f(void){
    struct s q;
    q.y = 1;
}

"file", line 4: undefined struct/union member: y


undefined symbol: name
Type: Error -- Options: all
A symbol name was referred to for which there is no declaration in scope.
f(void){
    g(i);
}

"file", line 2: undefined symbol: i


undefining __STDC__
Type: Warning -- Options: -Xt
ANSI C prohibits undefining the predefined symbol __STDC__. However, C issue 5 permits you to do so in transition mode (only). Use this feature to test C code that has been written to work in both an ANSI C and non-ANSI C environment.

For example, suppose you have C code that checks __STDC__, declaring function prototype declarations if it is defined, and old-style function declarations (or definitions) if not. Because the compiler predefines __STDC__, you would ordinarily be unable to check the old-style code, and you would have to run the code through another (non-ANSI C) compiler. By undefining __STDC__ (usually on the command line), you can use the compiler to do the checking.

This diagnostic tells you, as required, that you are violating ANSI C constraints.

#undef __STDC__	/* usually -U__STDC__ on cc line */

#ifdef __STDC__ int myfunc(const char *arg1, int arg2) #else /* non-ANSI C case */ int myfunc(arg1,arg2) char *arg1, /* oops */ int arg2; #endif { }

"file", line 1: warning: undefining __STDC__ "file", line 10: syntax error before or at: int "file", line 12: syntax error before or at: {


unexpected (
Type: Error -- Options: all
A misplaced ``('' was encountered in a #if or #elif directive.
#if 1 (
        int i = 1;
#endif

"file", line 1: unexpected "("


unexpected )
Type: Error -- Options: all
A misplaced ``)'' was encountered in a #if or #elif directive.
#if ) 1
        int i = 1;
#endif

"file", line 1: unexpected ")"


unexpected character in asm % line: ''c''
Type: Error -- Options: all
In the ``%'' specification line of an enhanced asm function, the compiler expected to see an alphabetic character that begins a storage class specifier. Instead it encountered the character c.

unknown comment type: type
Type: Warning -- Options: all
The compiler encountered a #pragma comment directive with an unknown type. The erroneous directive is ignored.
#pragma comment (unknown, "text")

"file", line 1: warning: unknown comment type: unknown


unknown operand size: op operator
Type: Error -- Options: all
operator ``++'', ``--'', or ``='' was applied to an operand whose size is unknown. The operand is usually a pointer to a structure or union whose members have not been declared.
f(void){
    struct s *sp;
    sp++;
}

"file", line 3: unknown operand size: op "++"


unnamed type member
Type: Warning -- Options: all
In the type declaration, you failed to give a member a name.
union s { int; char c; };

"file", line 1: warning: unnamed union member


unreachable case label: value
Type: Warning -- Options: all
The expression specified in a case statement has a value outside the range of the type of the controlling expression of the enclosing switch statement. Therefore the case label can never be reached. In the message, value is represented as a hexadecimal value if the case expression is unsigned, decimal if it is signed.
f(){
    unsigned char uc;

switch( uc ){ case 256: ; } }

"file", line 5: warning: unreachable case label: 256


unrecognized #pragma ignored: pragma
Type: Warning -- Options: -w3
Because #pragma directives are implementation-specific, when the -w3 compilation flag is set, the compiler warns about any such directives that it is ignoring. The compiler does not recognize #pragma pragma.
#pragma list

"file", line 1: warning: unrecognized #pragma ignored: list


unused label: label
Type: Warning -- Options: -w3
When using acomp (a component name for the ANSI C compiler) if the -w3 compilation flag is set, the compiler warns if a label is declared but never used in a function. When removing labels from the symbol table, it checks the SY_REF flag and warns if it is unset.

"file", line 4: warning: unused label: label


use double instead of long float
Type: Warning -- Options: all
An object or function was declared to be long float, which was a synonym for double. ANSI C does not permit long float, although the compiler accepts it as a transition aid.
long float f = 1.0;

"file", line 1: warning: use "double" instead of "long float"


useless declaration
Type: Warning -- Options: all
ANSI C requires that every declaration actually declare something, such as A declaration was written that provided no information to the compiler.
int;   		/* no identifier */
enum e { e1, e2 };	/* introduces enum e */
enum e;		/* no new information */

"file", line 1: warning: useless declaration "file", line 3: warning: useless declaration


using out of scope declaration: name
Type: Warning -- Options: all
name was previously declared in a scope that is no longer active. In some ANSI C implementations, referring to such an object would yield an error; calling such a function would be interpreted as calling a function returning int. The compiler remembers the previous declaration and uses it. This warning tells what the compiler has done.
f(void){
    extern int i;
    double sin(double);
}
g(void){
    double d = sin(1.5);
    i = 1;
}

"file", line 6: warning: using out of scope declaration: sin "file", line 7: warning: using out of scope declaration: i


void expressions may not be arguments: arg #n
Type: Error -- Options: all
A function call contains an argument for which the expression type is void.
f(void){
    void v(void);
    g(v());
}

"file", line 3: void expressions may not be arguments: arg #1


void function cannot return value
Type: Warning -- Options: all
A return was written statement with an expression, but the declared type of the function is void.
void v(void){
    return 3;
}

"file", line 2: void function cannot return value


void must be sole parameter
Type: Error -- Options: all
Only the first parameter in a function prototype declaration may have void type, and it must be the only parameter.
int f(int,void);

"file", line 1: "void" must be sole parameter


void parameter cannot have name: name
Type: Error -- Options: all
The parameter name was declared in a function prototype declaration that has void type.
int f(void v);

"file", line 1: void parameter cannot have name: v


\x is ANSI C hex escape
Type: Warning -- Options: -Xt
In earlier releases, ``\x'' was equivalent to ``x''. However, in ANSI C, ``\x'' introduces a hexadecimal character escape. This diagnostic warns of the new meaning.

If valid hexadecimal characters follow ``\x'', they are interpreted as part of the new escape sequence. Otherwise ``\x'' is treated as it was in previous releases.

int i = '\x';

"file", line 1: warning: \x is ANSI C hex escape


zero or negative subscript
Type: Warning, Error -- Options: all
The size in an array declaration is zero or negative. The diagnostic is a warning if the size is zero and an error otherwise.
int ia[-5];
int ib[0];

"file", line 1: zero or negative subscript "file", line 2: warning: zero or negative subscript


zero-sized struct/union
Type: Error -- Options: all

A structure or union was declared with the size of zero.

struct s { int ia[0]; };

"file", line 1: warning: zero or negative subscript "file", line 1: zero-sized struct/union



Next topic: Operator names
Previous topic: Operator names in messages

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003