DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Analyzing your code with lint

lint-specific messages

This section lists alphabetically the warning messages issued exclusively by lint or subject exclusively to its options. The code examples illustrate conditions in which the messages are elicited. Note that some of the examples would elicit messages in addition to the one stated. For the remaining lint messages, consult ``Compiler diagnostics''.

argument unused in function

Format: Compound

A function argument was not used. Preceding the function definition with
/* ARGSUSEDn */ suppresses the message for all but the first n arguments; invoking lint with -v suppresses it for every argument.

1   int fun(int x, int y)
2   {
3       return x;
4   }
5   /* ARGSUSED1 */
6   int fun2(int x, int y)
7   {
8       return x;
9   }
============
argument unused in function
    (1) y in fun

array subscript cannot be > value: value

Format: Simple

The value of an array element's subscript exceeded the upper array bound.

1   int fun()
2   {
3       int a[10];
4       int *p = a;
5       while (p != &a[10])  /* using address is ok */
6           p++;
7       return a[5 + 6];
8   }
============
(7)  warning: array subscript cannot be > 9: 11

array subscript cannot be negative: value

Format: Simple

The constant expression that represents the subscript of a true array (as opposed to a pointer) had a negative value.

1   int f()
2   {
3       int a[10];
4       return a[5 * 2 / 10 - 2];
5   }
============
(4)  warning: array subscript cannot be negative: -1

assignment causes implicit narrowing conversion

Format: Compound

An object was assigned to one of a smaller type. Invoking lint with -a suppresses the message. So does an explicit cast to the smaller type.

1   void fun()
2   {
3      short s;
4      long l = 0;
5      s = l;
6   }
============
assignment causes implicit narrowing conversion
    (5) short=long

assignment of negative constant to unsigned type

Format: Simple

A negative constant was assigned to a variable of unsigned type. Use a cast or the U suffix.

1   void fun()
2   {
3      unsigned i;
4      i = -1;
5      i = -1U;
6      i = (unsigned) (-4 + 3);
7   }
============
(4) warning: assignment of negative constant to unsigned type

assignment operator "=" found where "==" was expected

Format: Simple

An assignment operator was found where a conditional expression was expected. The message is not issued when an assignment is made to a variable using the value of a function call or in the case of string copying (see the example below). The warning is suppressed when lint is invoked with -h.

1   void fun()
2   {
3       char *p, *q;
4       int a = 0, b = 0, c = 0, d = 0, i;
5       i = (a = b) && (c == d);
6       i = (c == d) && (a = b);
7       if (a = b)
8          i = 1;
9       while (*p++ = *q++);
10      while (a = b);
11      while ((a = getchar()) == b);
12      if (a = foo()) return;
13  }
============
(5) warning: assignment operator "=" found where "=="
	was expected
(7) warning: assignment operator "=" found where "=="
	was expected
(10) warning: assignment operator "=" found where "=="
	was expected

bitwise operation on signed value nonportable

Format: Compound

The operand of a bitwise operator was a variable of signed integral type, as defined by ANSI C. Because these operators return values that depend on the internal representations of integers, their behavior is implementation-defined for operands of that type. The message is issued only when lint is invoked with -Xc.

1   fun()
2   {
3       int i;
4       signed int j;
5       unsigned int k;
6       i = i & 055;
7       j = j | 022;
8       k = k >> 4;
9   }
============
warning: bitwise operation on signed value nonportable
    (6)       (7)

constant in conditional context

Format: Simple

The controlling expression of an if, while, or for statement was a constant. Preceding the statement with /* CONSTCOND */ suppresses the message.

1   void fun()
2   {
3      if (! 1) return;
4      while (1) foo();
5      for (;1;);
6      for (;;);
7      /* CONSTCOND */
8      while (1);
9   }
============
(3) warning: constant in conditional context
(4) warning: constant in conditional context
(5) warning: constant in conditional context

constant operand to op: "!"

Format: Simple

The operand of the NOT operator was a constant. Preceding the statement with /* CONSTCOND */ suppresses the message for that statement; invoking lint with -h suppresses it for every statement.

1   void fun()
2   {
3      if  (! 0) return;
4      /* CONSTCOND */
5      if  (! 0) return;
6   }
============
(3) warning: constant operand to op: "!"

constant truncated by assignment

Format: Simple

An integral constant expression was assigned or returned to an object of an integral type that cannot hold the value without truncation.

1   unsigned char f()
2   {
3       unsigned char i;
4       i = 255;
5       i = 256;
6       return 256;
7   }
============
(5) warning: constant truncated by assignment
(6) warning: constant truncated by assignment

conversion of pointer loses bits

Format: Simple

A pointer was assigned to an object of an integral type that is smaller than the pointer.

1   void fun()
2   {
3       char c;
4       int *i;
5       c = i;
6   }
============
(5) warning: conversion of pointer loses bits

conversion to larger integral type may sign-extend incorrectly

Format: Compound

A variable of type ``plain'' char was assigned to a variable of a larger
integral type. Whether a ``plain'' char is treated as signed or unsigned is implementation-defined. The message is issued only when lint is invoked with -p, and is suppressed when it is invoked with -a.

1   void fun()
2   {
3       char c = 0;
4       short s = 0;
5       long l;
6       l = c;
7       l = s;
8   }
============
conversion to larger integral type may sign-extend incorrectly
    (6)

declaration unused in block

Format: Compound

An external variable or function was declared but not used in an inner block.

1   int fun()
2   {
3       int foo();
4       int bar();
5       return foo();
6   }
============
declaration unused in block
    (4) bar

declared global, could be static

Format: Compound

An external variable or function was declared global, instead of static, but was referenced only in the file in which it was defined. The message is suppressed when lint is invoked with -m.

file f1.c
1   int i;
2   int foo() {return i;}
3   int fun() {return i;}
4   static int stfun() {return fun();}
file f2.c
1   main()
2   {
3     int a;
4     a = foo();
5   }
============
declared global, could be static
    fun          f1.c(3)
    i            f1.c(1)

equality operator "==" found where "=" was expected

Format: Simple

An equality operator was found where a side effect was expected.

1   void fun(a, b)
2   int a, b;
3   {
4       a == b;
5       for (a == b; a < 10; a++);
6   }
============
(4) warning: equality operator "==" found where "="
	was expected
(5) warning: equality operator "==" found where "="
	was expected

evaluation order undefined: name

Format: Simple

A variable was changed by a side effect and used elsewhere in the same expression.

1   int a[10];
2   main()
3   {
4       int i = 1;
5       a[i++] = i;
6   }
============
(5) warning: evaluation order undefined: i

fallthrough on case statement

Format: Simple

Execution fell through one case to another without a break or return. Preceding a case statement with /* FALLTHRU */, or /* NOTREACHED */ when the case cannot be reached from the preceding case (see below), suppresses the message for that statement; invoking lint with -h suppresses it for every statement.

1   void fun(i)
2   {
3      switch (i) {
4      case 10:
5          i = 0;
6      case 12:
7          return;
8      case 14:
9          break;
10     case 15:
11     case 16:
12         break;
13     case 18:
14         i = 0;
15         /* FALLTHRU */
16     case 20:
17         error("bad number");
18         /* NOTREACHED */
19     case 22:
20         return;
21     }
22  }
============
(6) warning: fallthrough on case statement

function argument ( number ) declared inconsistently

Format: Compound

The parameter types in a function prototype declaration or definition differed from their types in another declaration or definition. The message described after this one is issued for uses (not declarations or definitions) of a prototype with the wrong parameter types.

file i3a.c
1   int fun1(int);
2   int fun2(int);
3   int fun3(int);
file i3b.c
1   int fun1(int *i);
2   int fun2(int *i) {}
3   void foo()
4   {
5       int *i;
6       fun3(i);
7   }
============
function argument ( number ) declared inconsistently
    fun2 (arg 1)           i3b.c(2) int * :: i3a.c(2) int
    fun1 (arg 1)           i3a.c(1) int :: i3b.c(1) int *
function argument ( number ) used inconsistently
    fun3 (arg 1)           i3a.c(3) int :: i3b.c(6) int *

function argument ( number ) used inconsistently

Format: Compound

The argument types in a function call did not match the types of the formal parameters in the function definition. (And see the discussion of the preceding message.)

file f1.c
1   int fun(int x, int y)
2   {
3       return x + y;
4   }
file f2.c
1   int main()
2   {
3       int *x;
4       extern int fun();
5       return fun(1, x);
6   }
============
function argument ( number ) used inconsistently
    fun( arg 2 )        f1.c(2) int :: f2.c(5) int *

function argument type inconsistent with format

Format: Compound

An argument was inconsistent with the corresponding conversion specification in the control string of a [fs]printf or [fs]scanf function call. (See also /* PRINTFLIKEn */ and /* SCANFLIKEn */ in the list of directives in the ``Usage'' section above.)

1   #include <stdio.h>
2   main()
3   {
4       int i;
5       printf("%s", i);
6   }
============
function argument type inconsistent with format
    printf(arg 2) int :: (format) char *  test.c(5)

function called with variable number of arguments

Format: Compound

A function was called with the wrong number of arguments. Preceding a function definition with /* VARARGSn */ suppresses the message for calls with n or more arguments; defining and declaring a function with the ANSI C notation ``. . .'' suppresses it for every argument.


NOTE: See "function declared with variable number of arguments" for more information.

file f1.c
1   int fun(int x, int y, int z)
2   {
3       return x + y + z;
4   }
5   int fun2(int x, . . .)
6   {
7       return x;
8   }
10  /* VARARGS1 */
11  int fun3(int x, int y, int z)
12  {
13      return x;
14  }
file f2.c
1   int main()
2   {
3       extern int fun(), fun3(), fun2(int x, . . .);
4       return fun(1, 2);
5       return fun2(1, 2, 3, 4);
6       return fun3(1, 2, 3, 4, 5);
7   }
============
function called with variable number of arguments
    fun         f1.c(2) :: f2.c(4)

function declared with variable number of arguments

Format: Compound

The number of parameters in a function prototype declaration or definition differed from their number in another declaration or definition. Declaring and defining the prototype with the ANSI C notation ``. . .'' suppresses the warning if all declarations have the same number of arguments. The message immediately preceding this one is issued for uses (not declarations or definitions) of a prototype with the wrong number of arguments.

file i3a.c
1   int fun1(int);
2   int fun2(int);
3   int fun3(int);
file i3b.c
1   int fun1(int, int);
2   int fun2(int a, int b) {}
3   void foo()
4   {
5       int i, j, k;
6       i = fun3(j, k);
7   }
============
function declared with variable number of arguments
    fun2           i3a.c(2) :: i3b.c(2)
    fun1           i3a.c(1) :: i3b.c(1)
function called with variable number of arguments
    fun3           i3a.c(3) :: i3b.c(6)

function falls off bottom without returning value

Format: Compound

A nonvoid function did not return a value to the invoking function. If the closing curly brace is truly not reached, preceding it with /* NOTREACHED */ suppresses the message.

1   fun()
2   {}
3   void fun2()
4   {}
5   foo()
6   {
7      exit(1);
8   /* NOTREACHED */
9   }
============
function falls off bottom without returning value
    (2) fun

function must return int: main()

Format: Simple

The program's main function does not return int, in violation of ANSI C restrictions. The message is issued only when lint is invoked with -Xc.

1   void main()
2   {}
============
(2) warning: function must return int: main()

function returns pointer to [automatic/parameter]

Format: Simple

A function returned a pointer to an automatic variable or a parameter. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the value of the pointer to that object will be indeterminate after the end of the block.

1   int *fun(int x)
2   {
3       int a[10];
4       int b;
5       if (x == 1)
6          return a;
7       else if (x == 2)
8          return &b ;
9       else return &x ;
10  }
============
(6) warning: function returns pointer to automatic
(8) warning: function returns pointer to automatic
(9) warning: function returns pointer to parameter

function returns value that is always ignored

Format: Compound

A function contained a return statement and every call to the function ignored its return value.

file f1.c
1   int fun()
2   {
3        return 1;
4    }
file f2.c
1   extern int fun();
2   int main()
3   {
4       fun();
5       return 1;
6   }
============
function returns value that is always ignored
    fun

function returns value that is sometimes ignored

Format: Compound

A function contained a return statement and some, but not all, calls to the function ignored its return value.

file f1.c
1   int fun()
2   {
3       return 1;
4   }
file f2.c
1   extern int fun();
2   int main()
3   {
4       if(1) {
5           return fun();
6       } else {
7           fun();
8           return 1;
9       }
10  }
============
function returns value that is sometimes ignored
    fun

function value is used, but none returned

Format: Compound

A nonvoid function did not contain a return statement, yet was used for its value in an expression.

file f1.c
1   extern int fun();
2   main()
3   {
4       return fun();
5   }
file f2.c
1   int fun()
2   {}
============
function value is used, but none returned
    fun

logical expression always false: op "&&"

Format: Simple

A logical AND expression checked for equality of the same variable to two different constants, or had the constant 0 as an operand. In the latter case, preceding the expression with /* CONSTCOND */ suppresses the message.

1   void fun(a)
2   int a;
3   {
4       a = (a == 1) && (a == 2);
5       a = (a == 1) && (a == 1);
6       a = (1 == a) && (a == 2);
7       a = (a == 1) && 0;
8       /* CONSTCOND */
9       a = (0 && (a == 1));
10  }
============
(4) warning: logical expression always false: op "&&"
(6) warning: logical expression always false: op "&&"
(7) warning: logical expression always false: op "&&"

logical expression always true: op "||"

Format: Simple

A logical OR expression checked for inequality of the same variable to two different constants, or had a nonzero integral constant as an operand. In the latter case, preceding the expression with /* CONSTCOND */ suppresses the message.

1   void fun(a)
2   int a;
3   {
4       a = (a != 1) || (a != 2);
5       a = (a != 1) || (a != 1);
6       a = (1 != a) || (a != 2);
7       a = (a == 10) || 1;
8       /* CONSTCOND */
9       a = (1 || (a == 10));
10  }
============
(4) warning: logical expression always true: op "||"
(6) warning: logical expression always true: op "||"
(7) warning: logical expression always true: op "||"

malformed format string

Format: Compound

A [fs]printf or [fs]scanf control string was formed incorrectly. (See also /* PRINTFLIKEn */ and /* SCANFLIKEn */ in the list of directives in the ``Usage'' section above.)

1   #include <stdio.h>
2   main()
3   {
4       printf("%y");
5   }
============
malformed format string
    printf      test.c(4)

may be indistinguishable due to truncation or case

Format: Compound

External names in a program may be indistinguishable when it is ported to another machine due to implementation-defined restrictions as to length or case. The message is issued only when lint is invoked with -Xc or -p. Under -Xc, external names are truncated to the first 6 characters with one case, in accordance with the ANSI C lower bound; under -p, to the first 8 characters with one case.

file f1.c
1   int foobar1;
2   int FooBar12;
file f2.c
1   int foobar2;
2   int FOOBAR12;
============

under -p may be indistinguishable due to truncation or case FooBar12 f1.c(2) :: FOOBAR12 f2.c(2)

under -Xc may be indistinguishable due to truncation or case foobar1 f1.c(1) :: FooBar12 f1.c(2) foobar1 f1.c(1) :: foobar2 f2.c(1) foobar1 f1.c(1) :: FOOBAR12 f2.c(2)

name declared but never used or defined

Format: Compound

A nonstatic external variable or function was declared but not used or defined in any file. The message is suppressed when lint is invoked with -x.

file f.c
1   extern int fun();
2   static int foo();
============
name declared but never used or defined
    fun            f.c(1)

name defined but never used

Format: Compound

A variable or function was defined but not used in any file. The message is suppressed when lint is invoked with -u.

file f.c
1   int i, j, k = 1;
2   main()
3   {
4        j = k;
5   }
============
name defined but never used
    i           f.c(1)

name multiply defined

Format: Compound

A variable was defined in more than one source file.

file f1.c
1   char i = 'a';
file f2.c
1   long i = 1;
============
name multiply defined
    i           f1.c(1) :: f2.c(1)

name used but not defined

Format: Compound

A nonstatic external variable or function was declared but not defined in any file. The message is suppressed when lint is invoked with -u.

file f.c
1   extern int fun();
2   int main()
3   {
4       return fun();
5   }
============
name used but not defined
    fun         f.c(4)

nonportable bit-field type

Format: Simple

A bit-field type other than signed int or unsigned int was used. The message is issued only when lint is invoked with -p. Note that these are the only portable bit-field types. The compilation system supports int, char, short, and long bit-field types that may be unsigned, signed, or ``plain.'' It also supports the enum bit-field type.

1   struct u {
2       unsigned v:1;
3       int      w:1;
4       char     x:8;
5       long     y:8;
6       short    z:8;
7   };
============
(3) warning: nonportable bit-field type
(4) warning: nonportable bit-field type
(5) warning: nonportable bit-field type
(6) warning: nonportable bit-field type

nonportable character constant

Format: Simple

A multi-character character constant in the program may not be portable. The message is issued only when lint is invoked with -Xc.

1   int c = 'abc';
============
(1) warning: nonportable character constant

only 0 or 2 parameters allowed: main()

Format: Simple

The function main in your program was defined with only one parameter or more than two parameters, in violation of the ANSI C requirement. The message is issued only when lint is invoked with -Xc.

1   main(int argc, char **argv, char **envp)
2   {}
============
(2) warning: only 0 or 2 parameters allowed: main()

pointer cast may result in improper alignment

Format: Compound

A pointer to one object type was cast to a pointer to an object type with stricter alignment requirements. Doing so may result in a value that is invalid for
the second pointer type. The warning is suppressed when lint is invoked with -h.

1   void fun()
2   {
3       short *s;
4       int *i;
5       i = (int *) s;
6   }
============
pointer cast may result in improper alignment
    (5)

pointer casts may be troublesome

Format: Compound

A pointer to one object type was cast to a pointer to a different object type. The message is issued only when lint is invoked with -p, and is not issued for the generic pointer void *.

1   void fun()
2   {
3       int *i;
4       char *c;
5       void *v;
6       i = (int *) c;
7       i = (int *) v;
8   }
============
warning: pointer casts may be troublesome
    (6)

precedence confusion possible; parenthesize

Format: Simple

An expression that mixes a logical and a bitwise operator was not parenthesized. The message is suppressed when lint is invoked with -h.

1   void fun()
2   {
3       int x = 0, m = 0, MASK = 0, i;
4       i = (x + m == 0);
5       i = (x & MASK == 0);   /* eval'd (x & (MASK == 0)) */
6       i = (MASK == 1 & x);  /* eval'd ((MASK == 1) & x) */
7   }
============
(5) warning: precedence confusion possible; parenthesize
(6) warning: precedence confusion possible; parenthesize

precision lost in bit-field assignment

Format: Simple

A constant was assigned to a bit-field too small to hold the value without truncation. Note that in the following example the bit-field z may have values that range from 0 to 7 or -4 to 3, depending on the machine.

1   void fun()
2   {
3       struct {
4           signed x:3;       /* max value allowed is 3 */
5           unsigned y:3;     /* max value allowed is 7 */
6           int z:3;          /* max value allowed is 7 */
7       } s;
8       s.x = 3;
9       s.x = 4;
10      s.y = 7;
11      s.y = 8;
12      s.z = 7;
13      s.z = 8;
14  }
============
(9) warning: precision lost in bit-field assignment: 4
(11) warning: precision lost in bit-field assignment: 0x8
(13) warning: precision lost in bit-field assignment: 8

set but not used in function

Format: Compound

An automatic variable or a function parameter was declared and set but not used in a function.

1   void fun(y)
2   int y;
3   {
4       int x;
5       x = 1;
6       y = 1;
7   }
============
set but not used in function
    (4) x in fun
    (1) y in fun

statement has no consequent: else

Format: Simple

An if statement had a null else part. Inserting /* EMPTY */ between the else and semicolon suppresses the message for that statement; invoking lint with -h suppresses it for every statement.

1   void f(a)
2   int a;
3   {
4       if (a)
5          return;
6       else;
7   }
============
(6) warning: statement has no consequent: else

statement has no consequent: if

Format: Simple

An if statement had a null if part. Inserting /* EMPTY */ between the controlling expression of the if and semicolon suppresses the message for that statement; invoking lint with -h suppresses it for every statement.

1   void f(a)
2   int a;
3   {
4       if (a);
5       if (a == 10)
6          /* EMPTY */;
7       else return;
8   }
============
(4) warning: statement has no consequent: if

statement has null effect

Format: Compound

An expression did not generate a side effect where a side effect was expected. Note that the message is issued for every subsequent sequence point that is reached at which a side effect is not generated.

1   void fun()
2   {
3       int a, b, c, x;
4       a;
5       a == 5;
6       ;
7       while (x++ != 10);
8       (a == b) && (c = a);
9       (a = b) && (c == a);
10      (a, b);
11  }
============
statement has null effect
    (4)           (5)           (9)           (10)

statement not reached

Format: Compound

A function contained a statement that cannot be reached. Preceding an unreached statement with /* NOTREACHED */ suppresses the message for that statement; invoking lint with -b suppresses it for every unreached break and empty statement. Note that this message is also issued by the compiler but cannot be suppressed.

1   void fun(a)
2   {
3       switch (a) {
4           case 1:
5              return;
6              break;
7           case 2:
8              return;
9              /* NOTREACHED */
10             break;
11      }
12  }
============
statement not reached
    (6)

static unused

Format: Compound

A variable or function was defined or declared static in a file but not used in that file. Doing so is probably a programming error because the object cannot be used outside the file.

1   static int x;
2   static int main() {}
3   static int foo();
4   static int y = 1;
============
static unused
    (4) y        (3) foo        (2) main        (1) x

suspicious comparison of char with value: op "op"

Format: Simple

A comparison was performed on a variable of type ``plain'' char that implied it may have a negative value (< 0, <= 0, >= 0, > 0). Whether a ``plain'' char is treated as signed or nonnegative is implementation-defined. The message is issued only when lint is invoked with -p.

1   void fun(c, d)
2   char c;
3   signed char d;
4   {
5       int i;
6       i = (c == -5);
7       i = (c < 0);
8       i = (d < 0);
9   }
============
(6) warning: suspicious comparison of char with negative
	constant: op "=="
(7) warning: suspicious comparison of char with 0: op "<"

suspicious comparison of unsigned with value: op "op"

Format: Simple

A comparison was performed on a variable of unsigned type that implied it may have a negative value (< 0, <= 0, >= 0, > 0).

1   void fun(x)
2   unsigned x;
3   {
4       int i;
5       i = (x > -2);
6       i = (x < 0);
7       i = (x <= 0);
8       i = (x >= 0);
9       i = (x > 0);
10      i = (-2 < x);
11      i = (x == -1);
12      i = (x == -1U);
13  }
============
(5) warning: suspicious comparison of unsigned with negative
	constant: op ">"
(6) warning: suspicious comparison of unsigned with 0: op "<"
(7) warning: suspicious comparison of unsigned with 0: op "<="
(8) warning: suspicious comparison of unsigned with 0: op ">="
(9) warning: suspicious comparison of unsigned with 0: op ">"
(10) warning: suspicious comparison of unsigned with negative
	constant: op "<"
(11) warning: suspicious comparison of unsigned with negative
	constant: op "=="

too few arguments for format

Format: Compound

A control string of a [fs]printf or [fs]scanf function call had more conversion specifications than there were arguments remaining in the call. (See also /* PRINTFLIKEn */ and /* SCANFLIKEn */ in the list of directives in the ``Usage'' section above.)

1   #include <stdio.h>
2   main()
3   {
4       int i;
5       printf("%d%d", i);
6   }
============
too few arguments for format
    printf      test.c(5)

too many arguments for format

Format: Compound

A control string of a [fs]printf or [fs]scanf function call had fewer conversion specifications than there were arguments remaining in the call. (See also /* PRINTFLIKEn */ and /* SCANFLIKEn */ in the list of directives in the ``Usage'' section above.)

1   #include <stdio.h>
2   main()
3   {
4       int i, j;
5       printf("%d", i, j);
6   }
============
too many arguments for format
    printf      test.c(5)

value type declared inconsistently

Format: Compound

The return type in a function declaration or definition did not match the return type in another declaration or definition of the function. The message is also issued for inconsistent declarations of variable types.

file f1.c
1   void fun() {}
2   void foo();
3   extern int a;
file f2.c
1   extern int fun();
2   extern int foo();
3   extern char a;
============
value type declared inconsistently
    fun         f1.c(1) void() :: f2.c(1) int()
    foo         f1.c(2) void() :: f2.c(2) int()
    a           f1.c(3) int :: f2.c(3) char

value type used inconsistently

Format: Compound

The return type in a function call did not match the return type in the function definition.

file f1.c
1   int *fun(p)
2   int *p;
3   {
4       return p;
5   }
file f2.c
1   main()
2   {
3       int i, *p;
4       i = fun(p);
5   }
============
value type used inconsistently
    fun        f1.c(3) int *() :: f2.c(4) int()

variable may be used before set: name

Format: Simple

The first reference to an automatic, non-array variable occurred at a line number earlier than the first assignment to the variable. Note that taking the address of a variable implies both a set and a use, and that the first assignment to any member of a struct or union implies an assignment to the entire struct or union.

1   void fun()
2   {
3       int i, j, k;
4       static int x;
5       k = j;
6       i = i + 1;
7       x = x + 1;
8   }
============
(5) warning: variable may be used before set: j
(6) warning: variable may be used before set: i

variable unused in function

Format: Compound

A variable was declared but never used in a function.

1   void fun()
2   {
3       int x, y;
4       static z;
5   }
============
variable unused in function
    (4) z in fun
    (3) y in fun
    (3) x in fun

Previous topic: Options and directives listed

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004