************************************* ERROR AND WARNING MESSAGES FILE ************************************* This c_lint_errors file contains the Sun ANSI C compiler (acomp) and lint program error and warning messages. It does not contain messages issued by the other components of the cc driver, such as the optimizer, code generator, or linker. The format for the messages is: o Message o Description o Example of code that generates the message o Message ID (tag) Not all messages have descriptions or code examples. There are three types of compiler messages: o Warning messages, in which the word "warning:" is displayed after the file name and line number, provide useful information without interrupting compilation. They may diagnose a programming error, or a violation of C syntax or semantics, for which the compiler nevertheless generates valid object code. o Error messages, which lack the "warning:" prefix, cause the comiler command to fail. Errors occur when the compiler has diagnosed a serious problem that makes it unable to understand the program or to continue to generate correct object code. It attempts to examine the rest of your program for other errors, however. The compiler does not link your program if the compiler diagnoses errors. o Fatal errors cause the comiler to stop immediately and return an error indication to the compiler command. A fatal error message is prefixed with the word "fatal:". Such messages typically apply to startup conditions, such as being unable to find a source file. The phrase "internal compiler error," followed by some message, usually does not diagnose a programming error, but rather a problem with the compiler. One of the compiler's internal consistency checks has failed. The problem diagnosed by the message issued is important; you can help SunSoft identify the problem by doing the following: 1. Run the cc command again with the same options as when it failed, plus the -P option. Output will be placed in a file with a .i suffix in your current directory. This file will help to identify the compiler problem. 2. Call your authorized service provider. You can find an authorized service provider by contacting your SunSoft reseller. The following table lists the internal operators that the compiler uses in messages, along with their definitions. Operator Definition ======== ========== ,OP The C "comma operator," as distinct from the , that is used to separate function arguments ARG A function argument--a value passed to a function AUTO An automatic variable that has not been allocated to a register CALL A function call with arguments CBRANCH A conditional branch. This can be part of an "if" or "loop" statement CONV A conversion. It may have been explicit, in the form of a cast; or implicit, in the semantics of a C statement FCON A floating-point constant ICON An integer or address constant NAME An object or function with "extern" or "static" storage class PARAM A function parameter--a value that is received by a function. REG An object that has been allocated to a register RETURN The operation that corresponds to a "return" statement STAR The indirection operator *, as in *p STRING A string literal U& The "take address of" operator, as distinct from the bitwise AND operation U- The arithmetic negation operator, as distinct from subtraction UCALL A function call with no arguments UGE An unsigned >= comparison UGT An unsigned > comparison ULE An unsigned <= comparison ULT An unsigned < comparison UPLUS The ANSI C "unary+" operator ************************************* #error A #error directive is encountered in the source file. The other tokens in the directive are printed as part of the message. Example of code that generates the message: #define ONE 2 #if ONE != 1 #error ONE != 1 #endif Message ID: E_ERROR_PRAGMA -------------------------------------------------- cannot recover from previous errors Earlier errors in the compilation have confused the compiler, and it cannot continue to process your program. Correct those errors and try again. Message ID: E_CANNOT_RECOVER -------------------------------------------------- cannot close the output file A file system error has occured when the compiler tries to close stdout. This is not an error from the source program. Message ID: E_FCLOSE_ERR -------------------------------------------------- cannot close .ll file A file system error occured when the compiler was closing the lock lint database (.ll) file. Message ID: E_FCLOSE_LL_ERR -------------------------------------------------- cannot open file. File create as The compiler was unable to create the .ll file. This maybe due to a file system error, or incorrect directory or file permissions. Message ID: E_CANT_CREATE_LL_FILE -------------------------------------------------- Unable to malloc filename space. An internal use of malloc() by the compiler has failed. This is most frequently due to having run out of swap space. Message ID: E_CANT_MALLOC_FILENAME -------------------------------------------------- Out of memory The compiler was unable to acquire sufficient memory to compile this program. This is most frequently due to having run out of swap space. Message ID: E_OUT_OF_MEMORY -------------------------------------------------- Globalizing variable names for dbx fix and continue ignore option -xcrossfile The -xcrossfile flag is ignored when compiling using fix and continue from the debugger. Message ID: E_X_FILES_GLOB_IGNORED -------------------------------------------------- cannot freopen stdout to /dev/null A file system error has occured when the compiler was trying to redirect an output file to /dev/null. Message ID: E_CANT_FREOPEN_STDOUT -------------------------------------------------- floating-point constant folding causes exception The compiler has detected an overflow at compile time when it attempts an operation between two floating-point operands. The operation causes a floating-point exception that causes the compiler to exit. Message ID: E_FP_CONST_CAUSE_EXCEPT -------------------------------------------------- Unable to malloc filename space An internal use of malloc() by the compiler has failed. This is most frequently due to having run out of swap space. Message ID: E_CANT_MALLOC_TMP_FILENAME -------------------------------------------------- cannot create file: A file system error has prevented the compiler from creating a .ll file. Make sure you have permission to write into the current working directory. Message ID: E_CANT_OPEN_LL_FILE -------------------------------------------------- cannot freopen to /dev/null The compiler cannot discard the lock_lint database file. Message ID: E_CANT_FREOPEN_LL_DEV_NULL -------------------------------------------------- #include <... missing ">" In a #include directive for which the header name begins with <, the closing > character is omitted. Example of code that generates the message: #include "1" int i = 1; #endif Message ID: E_TOKEN_ILLEGAL_IN_DIRECTIVE -------------------------------------------------- invalid use of "defined" operator A defined operator in a #if or #elif directive must be followed by an identifier or ( ) that enclose an identifier. The source code does not use it that way. Example of code that generates the message: #if defined int i = 1; #endif Message ID: E_INVALID_USE_OF_DEFINE -------------------------------------------------- argument mismatch The number of arguments passed to a macro is different from the number in the macro definition. Example of code that generates the message: #define twoarg(a,b) a+b int i = twoarg(4); Message ID: E_ARGUEMENT_MISMATCH -------------------------------------------------- token-less macro argument The actual argument to a preprocessor macro consists of no tokens. The ANSI C standard regards this condition as undefined. The C compiler treats the empty list of tokens as an empty argument. It also issues this warning under the -Xc mode. Example of code that generates the message: #define m(x) x+3 int i = m(); Message ID: E_TOKENLESS_MACRO -------------------------------------------------- invalid target filename A compiler internal error. Message ID: E_INVALID_TARGET_FILENAME -------------------------------------------------- #include directive missing file name A #include directive does not specify a file to include. Example of code that generates the message: #include Message ID: E_INCLUDE_MISSING_FILENAME -------------------------------------------------- no file name after expansion You have used the form of the #include directive that permits macro expansion of its argument, but the resulting expansion leaves no tokens to be taken as a file name. Example of code that generates the message: #define EMPTY #include EMPTY Message ID: E_INCLUDE_EXPANSION_NO_FILE -------------------------------------------------- empty file name The file name in a #include directive is null. Example of code that generates the message: #include <> Message ID: E_EMPTY_FILE_NAME -------------------------------------------------- empty header name The file name after a macro substitution is null. Example of code that generates the message: #define NULLNAME <> #include NULLNAME Message ID: E_EMPTY_HEADER_NAME -------------------------------------------------- No closing > The closing > is missing from a #include directive. Example of code that generates the message: #include " expected */ Message ID: E_NO_CLOSING_GREATER_THAN -------------------------------------------------- bad file specification The file specifier in a #include directive was neither a string literal nor a well-formed header name. Example of code that generates the message: #include stdio.h Message ID: E_BAD_FILE_SPEC -------------------------------------------------- 0 is invalid in # < number > directive The line number in a line number information directive (which the compiler uses for internal communication) must be a positive, nonzero value. Example of code that generates the message: # 0 "foo.c" Message ID: E_ZERO_INVALID_IN_POUND_NUMBER -------------------------------------------------- 0 is invalid in #line directive The line number in a #line directive must be a positive, nonzero value. Example of code that generates the message: #line 0 Message ID: E_ZERO_INVALID_IN_POUND_LINE -------------------------------------------------- is invalid in #line directive The line number specified in a #line directive should be less than or equal to 32767. Example of code that generates the message: #line 35767 "string" #line 35768 Message ID: E_OUT_OF_RANGE_POUND_NUMBER -------------------------------------------------- string literal expected after # < number > A # < number > directive may only be followed by a string literal. Example of code that generates the message: #15 notstring Message ID: E_STRING_EXPECTED_POUND_NO -------------------------------------------------- string literal expected after #line < number > Only a string literal may follow the number in a #line directive. Example of code that generates the message: #line 12 int Message ID: E_STRING_EXPECTED_POUND_LINE_NO -------------------------------------------------- identifier or digit sequence expected after "#" An invalid token or non-decimal number follows the # that introduces a preprocessor directive line. Example of code that generates the message: #0x12 Message ID: E_POUND_NUMBER_EXPECTED -------------------------------------------------- digit sequence expected after #line The compiler expects to find the digit sequence that comprises a line number after #line, but the token it finds there is either an inappropriate token or a digit sequence whose value is zero. Example of code that generates the message: #line 09a Message ID: E_POUND_LINE_NO_EXPECTED -------------------------------------------------- #line seen in source file. SunSourceBrowser data is likely to be incorrect. Usage of the #line directive along with the -xsb option to create a source browser database is likely to result in incorrect location information on symbols in the source browser database. This message is frequently seen with code created by code generation tools such as yacc. Message ID: E_SRCBROWSER_POUND_LINE_TOO_BAD -------------------------------------------------- no tokens in #line directive The rest of a #line directive is empty; the line number and optional file name are missing. Example of code that generates the message: #line Message ID: E_NO_TOKENS_IN_POUND_LINE -------------------------------------------------- no tokens after expansion After macro expansion is applied to the expression in a #line directive, there are no tokens left to be interpreted as a line number. Example of code that generates the message: #define EMPTY #line EMPTY Message ID: E_NO_TOKENS_AFTER_EXPANSION -------------------------------------------------- duplicate formal parameter In a function-like macro definition, a name is used more than once as a formal parameter. Example of code that generates the message: #define add3(a,a,c) a + b + c Message ID: E_DUPLICATE_FORMAL_PARAM -------------------------------------------------- macro redefined The source code redefines a macro. Previous releases of K&R C allow such redefinitions if both definitions are 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. Example of code that generates the message: #define TIMES(a,b) a * b #define TIMES(a,b) a - b Message ID: E_MACRO_REDEFINED -------------------------------------------------- more than one character honored in character constant 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 a character constant is different in this release of the C compiler from the one in previous releases, which only honors the first character. The encoding for character constants you use in executable code is unchanged. Example of code that generates the message: #if 'ab' != ('b' * 256 + 'a') #error unknown encoding #endif Message ID: E_MULTI_CHAR_CHAR_CONST -------------------------------------------------- operand treated as unsigned This warning is displayed with the -Xt option. An operand you have used in a #if or #elif directive has a value greater than LONG_MAX (2147483647), but has no unsigned modifier suffix. Previous releases of K&R C treat such constants as signed quantities which, because of their values, actually become 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. Example of code that generates the message: #if 2147483648 > 0 char *mesg = "ANSI C-style"; #endif Message ID: E_OPERAND_TREATED_AS_UNSIGNED -------------------------------------------------- #include of /usr/include/... may be non-portable The source file includes a file with the explicit prefix /usr/include. Such an inclusion is implementation-dependent and nonportable. On some systems, the list of default places to look for a header may not include the /usr/include directory, in which case the wrong file may be included. Example of code that generates the message: #include Message ID: E_INC_USR_INC_MAY_NOT_PORTABLE -------------------------------------------------- directive on line has no matching #endif The compiler has reached the end of the source file without encountering the matching #endif for a previously encountered #if, #elif, #else, #ifdef, or #ifndef directive. Example of code that generates the message: #ifndef STUB TranslationEntry* pageTable = NULL; /* the compiler starts looking for #endif after this point */ #ifdef CHANGED int newfuntion(int a); #endif /* this #endif match with the #ifdef */ /* the compiler is still looking for #endif after this */ /* line but no #endif found after this line */ Message ID: E_NO_MATCHING_ENDIF -------------------------------------------------- #elif has no preceding #if A #elif directive must be part of a preprocessing if-section, which begins with a #if directive. The code in question lacks the #if. Example of code that generates the message: #elif defined(TWO) int i = 2; #endif Message ID: E_ELIF_MISSING_IF -------------------------------------------------- #elif must be followed by a constant expression There is no expression following the #elif directive. Example of code that generates the message: #if defined(ONE) int i = 1; #elif int i = 4; #endif Message ID: E_ELIF_REQUIRES_CONST_EXP -------------------------------------------------- #elif follows #else A preprocessing if-section must be in the order #if, optional #elifs, followed by optional #else and #endif. The code contains a #elif after the #else directive. Example of code that generates the message: #if defined(ONE) int i = 1; #elif defined(TWO) int i = 2; #else int i = 3; #elif defined(FOUR) int i = 4; #endif Message ID: E_ELIF_FOLLOWS_ELSE -------------------------------------------------- #else has no preceding #if A #else directive is encountered that is not part of a preprocessing if-section. Example of code that generates the message: #else int i =7; #endif Message ID: E_ELSE_MISSING_IF -------------------------------------------------- too many #else's The code contains more than one #else directive in a preprocessing if-section. All #else directives after the first are taken to be false. Example of code that generates the message: #ifdef ONE int i = 1; #else int i = 2; #else int i = 3 #endif Message ID: E_TOO_MANY_ELSES -------------------------------------------------- #if-less #endif A #endif directive is encountered that is not part of a preprocessing if-section. Example of code that generates the message: int i = 1; #endif Message ID: E_IFLESS_ENDIF -------------------------------------------------- #if must be followed by a constant expression No expression appears after a #if directive. Example of code that generates the message: #if int i = 4; #endif Message ID: E_IF_REQUIRES_CONST_EXP -------------------------------------------------- #ifdef must be followed by an identifier A #ifdef preprocessing directive must be followed by the name of the macro to check for being defined. The source code has omitted the identifier. The #ifdef is treated as if it is false. Example of code that generates the message: #ifdef int i = 1; #endif Message ID: E_IFDEF_REQUIRES_IDENTIFIER -------------------------------------------------- #ifndef must be followed by an identifier The #ifndef directive must be followed by the identifier that is to be tested for having been defined. Example of code that generates the message: #ifndef int i = 5; #endif Message ID: E_IFNDEF_REQUIRES_IDENTIFIER -------------------------------------------------- preprocessing a .i file A .i file has been supplied when using the -P option. For example: cc -P tst.i Message ID: E_PREPROCESSING_DOT_I_FILE -------------------------------------------------- stdout I/O error A file system error has occured while the compiler was accessing standard output (stdout). Message ID: E_STDOUT_ERROR -------------------------------------------------- stderr I/O error A file system error has occured while the compiler was accessing standard error (stderr). Message ID: E_STDERR_ERROR -------------------------------------------------- empty #assert directive A #assert directive contains no predicate name to assert. Example of code that generates the message: #assert Message ID: E_EMPTY_ASSERT_DIRECTIVE -------------------------------------------------- "#assert identifier" expected In a #assert directive, the token following the directive is not the name of the predicate. Example of code that generates the message: #assert 5 Message ID: E_ASSERT_IDENTIFIER_EXPECTED -------------------------------------------------- "#assert identifier (..." expected In a #assert directive, the token following the predicate is not the ( that is expected. Example of code that generates the message: #assert system unix Message ID: E_ASSERT_ID_DOT_DOT_EXPECTED -------------------------------------------------- no tokens following "#assert name (" A use of the #assert directive is malformed. The assertions and the ) that should follow are missing. Example of code that generates the message: #assert system( Message ID: E_NO_TOKENS_AFTER_ASSERT_NAME -------------------------------------------------- missing tokens between parentheses In a #assert directive, there are no assertions within the parentheses of the predicate. Example of code that generates the message: #assert system() Message ID: E_ASSERT_NO_TKNS_BETWEEN_PARENS -------------------------------------------------- "#assert" missing ")" In a #assert directive, the parenthesized form of the assertion lacks a closing ). Example of code that generates the message: #assert system(unix Message ID: E_ASSERT_MISSING_PAREN -------------------------------------------------- tokens after -A- are ignored In the -A- option to the cc command, there are additional tokens adjacent to the option. They are ignored. Example of code that generates the message: cc -A-extra -c x.c Message ID: E_TOKENS_AFTER_A_IGNORED -------------------------------------------------- identifier or "-" expected after -A 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 is neither of these. Example of code that generates the message: cc -A3b2 -c x.c Message ID: E_IDENTIFIER_EXPECTED_AFTER_A -------------------------------------------------- identifier expected after "#" The compiler expects to find an identifier, a predicate name, after a # in a conditional compilation directive, but none is there. Example of code that generates the message: #if #system(unix) || # char *os = "sys"; #endif Message ID: E_IDENT_EXPECTED_AFTER_POUND -------------------------------------------------- "(" expected after "#identifier" 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. Example of code that generates the message: #assert system(unix) #define system "unix" #if #system char *systype = system; #endif Message ID: E_PAREN_EXPECTED_AFTER_ID_PND -------------------------------------------------- tokens expected after "# identifier (" 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. Example of code that generates the message: #if #system( char *system = "unix"; #endif Message ID: E_TOKENS_EXPECTED_AFTER_ID_PND -------------------------------------------------- tokens expected between parentheses The name of an assertion of a predicate to test is omitted in a #if or #elif directive. Example of code that generates the message: #if #system() char *sysname = "??"; #endif Message ID: E_TKNS_EXPECTED_BETWEEN_PARENS -------------------------------------------------- missing ")" In a test of a predicate that follows a # operator in a #if or #elif directive, the ) that follows the assertion is missing. Example of code that generates the message: #if # system(unix char *system = "unix"; #endif Message ID: E_MISSING_R_PAREN -------------------------------------------------- empty #unassert directive A #unassert directive contains no predicate name to discard. Example of code that generates the message: #unassert Message ID: E_EMPTY_UNASSERT_DIRECTIVE -------------------------------------------------- #unassert requires an identifier token The #unassert directive must name a predicate to "un-assert." Example of code that generates the message: #unassert 5 Message ID: E_UNASSERT_REQUIRES_IDENTIFIER -------------------------------------------------- tokens expected after "(" In a #unassert directive, the assertions and the closing ) after the predicate are missing. Example of code that generates the message: #unassert system( Message ID: E_TOKENS_EXPECTED_AFTER_L_PAREN -------------------------------------------------- ")" expected In a unassert directive, the assertion of a predicate to be dropped must be enclosed in parentheses. Example of code that generates the message: #unassert system(unix Message ID: E_R_PAREN_EXPECTED -------------------------------------------------- empty predicate argument The compiler expects to find tokens between the ( ) that delimit a predicate's assertions in a #unassert directive. None are present. Example of code that generates the message: #unassert machine() Message ID: E_EMPTY_PREDICATE_ARGUMENT -------------------------------------------------- "(" expected after first identifier In an #unassert directive, the assertion of a predicate to be dropped must be enclosed in parentheses. Example of code that generates the message: #unassert system unix Message ID: E_L_PAREN_EXPECTED_AFT_FIRST_ID -------------------------------------------------- ANSI C predefined macro cannot be redefined The source code attempts to define or redefine a macro that is predefined by ANSI C. The predefined macro is unchanged. Example of code that generates the message: #define __FILE__ "xyz.c" #define __LINE__ "10" #define __DATE__ "Jan 21 1993" #define __TIME__ "10:20:04" Message ID: E_CANT_REDEFINE_ANSI_PREDEFINE -------------------------------------------------- cannot define "defined" The predefined preprocessing operator "defined" cannot be defined as a macro name. Example of code that generates the message: #define defined xyz Message ID: E_CANNOT_DEFINE_DEFINED -------------------------------------------------- undefining __STDC__ ANSI C prohibits undefining the predefined symbol __STDC__. You may want to use this feature to test C code that you have 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 C 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 C compiler to do the checking. This diagnostic tells you that you are violating ANSI C constraints. Example of code that generates the message: #undef __STDC__ /*usually -U__STDC__on cc line */ #ifdef _&empty_STDC__ int myfunc(const char *arg1, int arg2) #else /* non-ANSI C case */ int myfunc(arg1,arg2) char *arg1, /* oops */ int arg2; #endif { } Message ID: E_UNDEFINING__STDC__ -------------------------------------------------- ANSI C predefined macro cannot be undefined The source code contains an attempt to undefine a macro that is predefined by ANSI C. Example of code that generates the message: #undef __FILE__ #undef __LINE__ #undef __DATE__ #undef __TIME__ Message ID: E_CANT_UNDEFINE_ANSI_PREDEFINE -------------------------------------------------- cannot undefine "defined" The predefined preprocessing operator "defined" cannot be undefined. Example of code that generates the message: #undef defined Message ID: E_CANT_UNDEFINE_DEFINED -------------------------------------------------- -D option argument not an identifier An identifier must follow the cc -D command-line option. Example of code that generates the message: cc -D3b2 -c x.c Message ID: E_D_OPT_ARG_NOT_AN_IDENTIFIER -------------------------------------------------- -D option argument not followed by "=" If any tokens follow an identifier in a -D command-line option to the cc command, the first such token must be =. Example of code that generates the message: cc -DTWO+2 -c x.c Message ID: E_D_OPT_NOT_FOLLOWED_BY_EQUAL -------------------------------------------------- -U option argument not an identifier An identifier must follow the cc -U command-line option. Example of code that generates the message: cc -U3b2 -c x.c Message ID: E_U_OPT_ARG_NOT_AN_IDENTIFIER -------------------------------------------------- tokens ignored after "-U{identifier}" In the command-line that contains the -U option, there are tokens following the name of the macro to be undefined. Example of code that generates the message: cc -Uunix,u3b2 -c x.c Message ID: E_TOKENS_IGNORED_AFTER_U_OPT -------------------------------------------------- empty #define directive line A #define directive lacks both the name of the macro to define and any other tokens. Example of code that generates the message: #define Message ID: E_EMPTY_POIND_DEFINE_DIRECTIVE -------------------------------------------------- #define requires macro name A #define directive must be followed by the name of the macro to be defined. Example of code that generates the message: #define +3 Message ID: E_PND_DEF_REQUIRES_MACRO_NAME -------------------------------------------------- incomplete #define macro parameter list In the definition of a function-like parameter, the compiler cannot find a ) character on the same (logical) line as the #define directive. Example of code that generates the message: #define mac(a Message ID: E_INCOMPLETE_DEF_MACRO_PARAMS -------------------------------------------------- syntax error in macro parameters The macro parameter list of a function-like macro definition is malformed. The list must be a comma-separated list of identifiers. Example of code that generates the message: #define mac(a,b,) a b Message ID: E_SYNTAX_ERROR_IN_MACRO_PARAMS -------------------------------------------------- bad use of "#" or "##" in macro #define In a macro definition, a # or ## operator is followed by a # or ## operator. Example of code that generates the message: #define bug(s) # # s #define bug2(s) # ## s Message ID: E_BAD_SHARP_OR_SHARPS_IN_MACRO -------------------------------------------------- cannot begin macro replacement with "##" The ## operator is a binary infix operator and cannot be the first token in the macro replacement list of a macro definition. Example of code that generates the message: #define mac(s) ## s Message ID: E_CANT_BEGIN_MACRO_WITH_SHARP -------------------------------------------------- non-formal identifier follows "#" in #define The identifier that follows a # operator in a macro definition must be a formal parameter of a function-like macro. Example of code that generates the message: #define mac(a) "abc" # b Message ID: E_NON_FORMAL_ID_FOLLOWS_SHARP -------------------------------------------------- comment is replaced by "##" This warning is displayed with the -Xt option. The diagnostic indicates 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. Example of code that generates the message: #define PASTE(a,b) a/*GLUE*/b int PASTE(prefix,suffix) = 1; /* creates "prefixsuffix" */ Message ID: E_COMMENT_REPLACED_BY_SHARPS -------------------------------------------------- comment does not concatenate tokens This warning is displayed with the -Xa and -Xc options. In previous releases of K&R C, it is possible to "paste" two tokens together by juxtaposing them in a macro with a comment between them. This behavior is 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. Example of code that generates the message: #define PASTE(a,b) a/*GLUE*/b int PASTE(prefix,suffix) = 1; /* does not create "prefixsuffix" */ Message ID: E_COMMENT_DOSNT_CONCAT_TOKENS -------------------------------------------------- macro replacement within a string literal Previous releases of K&R C allow the value of a formal parameter to be substituted in a string literal that is part of a macro definition. ANSI C does not permit this use. 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) name char *hello_mindy = HELLO("Mindy"); Example of code that generates the message: #define HELLO(name) "name" char *hello_mindy = HELLO(Mindy); Message ID: E_MACRO_REPLACEMENT_IN_STRING -------------------------------------------------- macro replacement within a character constant Previous releases of K&R C allow 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 this use. The proper way to express this construct in ANSI C is: #define CTRL(x) (x &037) /* form control character */ int ctrl_c = CTRL('c'); Example of code that generates the message: #define CTRL(x) ('x'&037) /* form control character */ int ctrl_c = CTRL(c); Message ID: E_MACRO_REPLACEMENT_CHAR_CONST -------------------------------------------------- no macro replacement within a string literal This warning is displayed with the -Xa or -Xc option. It warns you that the macro replacement that is done for -Xt mode is not being done in -Xa or -Xc mode. Message ID: E_NO_REPLACEMENT_IN_STRING -------------------------------------------------- no macro replacement within a character constant This warning is displayed with the -Xa or -Xc option. It warns you that the macro replacement that is done for -Xt mode is not being done in -Xa or -Xt mode. Message ID: E_NO_REPLACEMENT_IN_CHAR_CONST -------------------------------------------------- "#" must be followed by formal identifier in #define The "string-ize" operator # must be followed by the name of a formal parameter in a function-like macro. Example of code that generates the message: #define mac(a) # + a Message ID: E_ID_REQUIRED_FOR_POUND_DEFINE -------------------------------------------------- cannot end macro replacement with "#" or "##" A # or ## operator cannot be the last token in the macro replacement list of a macro definition. Example of code that generates the message: #define mac1(s) abc ## s ## #define mac2(s) s # Message ID: E_CANT_END_MACRO_WITH_SHARP -------------------------------------------------- empty #undef directive, identifier expected A #undef directive lacks the name of a macro to "undefine." Example of code that generates the message: #undef Message ID: E_EMPTY_UNDEF_DIRECTIVE -------------------------------------------------- identifier expected after #undef A #undef must be followed by the name of the macro to be undefined. The token following the directive is not an identifier. Example of code that generates the message: #undef 4 Message ID: E_ID_EXPECTED_AFTER_UNDEF -------------------------------------------------- tokens ignored at end of directive line A directive line contains extra tokens that are not expected as part of the directive. Example of code that generates the message: #undef a b /* can only undefine one */ Message ID: E_TKNS_IGNORED_AT_END_OF_DIR -------------------------------------------------- number expected The compiler cannot find a number where it expects to find one in a #if or #elif directive. Example of code that generates the message: #if 1 + int i = 1; #endif Message ID: E_NUMBER_EXPECTED -------------------------------------------------- missing operator The constant expression of a preprocessing conditional compilation directive is malformed. An operator is expected, but not encountered. Example of code that generates the message: #if 1 4 int i = 1; #endif Message ID: E_MISSING_OPERATOR -------------------------------------------------- unexpected ")" A misplaced ) has been detected in a #if or #elif directive. Example of code that generates the message: #if ) 1 int i = 1; #endif Message ID: E_UNEXPECTED_R_PAREN -------------------------------------------------- unexpected "(" A misplaced ( has been detected in a #if or #elif directive. Example of code that generates the message: #if 1 ( int i = 1; #endif Message ID: E_UNEXPECTED_L_PAREN -------------------------------------------------- missing operand The constant expression of a preprocessing conditional compilation directive is malformed. An expected operand for some operator is missing. Example of code that generates the message: #define EMPTY #if EMPTY / 4 int i = 1; #endif Message ID: E_MISSING_OPERAND -------------------------------------------------- division by 0 An expression contains a division by zero that is 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 if the expression is in a global or static initializer. Example of code that generates the message: f(void) { int i = 1/0; } Message ID: E_DIVISION_BY_ZERO -------------------------------------------------- modulus by 0 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 if the expression is in a global or static initializer. Example of code that generates the message: #if 42 % 0 int i = 1; #endif Message ID: E_MODULUS_BY_ZERO -------------------------------------------------- dubious escape: \c Only certain characters can follow \ in string literals and character constants; c is not one of them. ANSI C ignores the \. Example of code that generates the message: int i = '\c'; Message ID: E_DUBIOUS_ESCAPE_CHAR -------------------------------------------------- dubious escape Only certain non-printing characters can follow \ in string literals and character constants. The value between the angle brackets in the diagnostic is the character's code, printed as a hexadecimal number. Message ID: E_DUBIOUS_ESCAPE_UNPRINTABLE -------------------------------------------------- \a is ANSI C "alert" character This warning is displayed with the -Xt option. In other K&R C compilers, '\a' is equivalent to 'a'. However, ANSI C defines '\a' to be an alert character. In this implementation, the corresponding character code is 07, the BEL character. Example of code that generates the message: int c = '\a'; Message ID: E_ESC_A_IS_ANSI_ALERT -------------------------------------------------- \x is ANSI C hex escape When specifying -Xs or -Xt compilation modes the compiler treats "\x" as the character "x". But with ANSI C modes (-Xa and -Xc) of compilation "\x" specifies a hexadecimal escape sequence. Example of code that generates the message when compiled with -Xs option: char *cp = "This is a hex escape sequence for 254: \xfe"; Message ID: E_ESC_X_IS_ANSI_HEX_ESCAPE -------------------------------------------------- no hex digits follow \x This warning is displayed with the -Xa or -Xc option. The \x escape in character constants and string literals introduces a hexadecimal character escape. \x must be followed by at least one hexadecimal digit. Example of code that generates the message: char *cp = "&\xz"; Message ID: E_NO_HEX_DIGITS_AFTER_ESCAPE_X -------------------------------------------------- overflow in hex escape In a hexadecimal escape (\x) in a character constant or string literal, the accumulated value for the escape has grown too large. Only the low-order 32 bits of value are retained. Example of code that generates the message: int i = '\xabcdefedc'; Message ID: E_OVERFLOW_IN_HEX_ESCAPE -------------------------------------------------- empty character constant A character constant consisting of no characters has been used. Example of code that generates the message: f(void) { char c = ''; /* suggestion: char c = ' '; */ } Message ID: E_EMPTY_CHAR_CONSTANT -------------------------------------------------- character constant too long 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 nonportable. Example of code that generates the message: int i = 'abcde'; Message ID: E_CHAR_CONST_TOO_LONG -------------------------------------------------- invalid multibyte character A multibyte character in a string literal or character constant cannot be converted to a single wide character in the host environment. Or a multibyte character found elsewhere is being ignored. Message ID: E_INVALID_MULTIBYTE_CHAR -------------------------------------------------- character escape does not fit in character 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. Example of code that generates the message: char *p = "\x1ff\400"; Message ID: E_CHAR_ESC_DOES_NO_FIT_IN_CHAR -------------------------------------------------- bad octal digit This warning is displayed with the -Xt option. An integer constant that begins with 0 includes a non-octal digit. An 8 is taken to have value 8, and a 9 is taken to have value 9, even though they are invalid. Example of code that generates the message: int i = 08; Message ID: E_BAD_OCTAL_DIGIT -------------------------------------------------- mismatched parentheses Parentheses are mismatched in a preprocessing conditional compilation directive. Example of code that generates the message: #if ((1) int i = 1; #endif Message ID: E_MISMATCHED_PARENS -------------------------------------------------- mismatched "?" and ":" An expression in a #if or #elif directive contains a malformed ?~: expression. Example of code that generates the message: #if defined(foo) ? 5 int i; #endif Message ID: E_MISMATCHED_TERNARY_OP -------------------------------------------------- empty constant expression after macro expansion A #if or #elif directive contains an expression that, after macro expansion, consists of no tokens. Example of code that generates the message: #define EMPTY #if EMPTY char *mesg = "EMPTY is non-empty"; #endif Message ID: E_EMPTY_CONST_EXP_AFTER_EXPAND -------------------------------------------------- preprocessor: cannot duplicate stdout A file system error has occured while the compiler was accessing standard output (stdout). Message ID: E_CANT_DUP_STDOUT -------------------------------------------------- preprocessor: cannot open alternate stdout A file system error has occured while the compiler was accessing standard output (stdout). Message ID: E_CANT_OPEN_ALT_STDOUT -------------------------------------------------- preprocessor: Can't open /dev/null A file system error has occured while the compiler was accessing /dev/null. Message ID: E_CANT_OPEN_DEV_NULL -------------------------------------------------- temporary file write failed: file system full While writing intermediate files, the compiler runs out of disk space. Verify that the file system on which the temporary files are written has enough free space before starting the compilation. Use the TMPDIR environment variable to specify an alternative location for the compiler to write temporary files. Message ID: E_TMPFILE_FILE_SYSTEM_FULL -------------------------------------------------- undefined or missing type In a function definition, a parameter has been declared with invalid type information. Either the type has not been defined, or an identifier not representing a type has been used as a type. This warning is usually issued after a syntax error message. Example of code that generates the message: int f1(what arg) { } Message ID: E_UNDEFINED_OR_MISSING_TYPE -------------------------------------------------- syntax error before or at: This is an all-purpose diagnostic indicating one of many possible syntactical errors found by the compiler, such as a missing semicolon, a missing closing paren or brace, or juxtaposed language tokens. The token in the diagnostic indicates at what point in the source code, on the indicated line, the compiler recognized the error. Example of code that generates the message: f(void){ int i = 3 /* Missing semicolon here */ } f(int i){ int j; j = (i + 24; /* Missing closing paren here */ } Message ID: E_YACC_GENERIC_ERROR -------------------------------------------------- syntax error before or at: This is an all-purpose diagnostic indicating one of many possible syntactical errors found by the compiler, such as a missing semicolon, a missing closing paren or brace, or juxtaposed language tokens. The token in the diagnostic indicates at what point in the source code, on the indicated line, the compiler recognized the error. Example of code that generates the message: f(void){ int i = 3 /* Missing semicolon here */ } f(int i){ int j; j = (i + 24; /* Missing closing paren here */ } Message ID: E_YACC_ERROR -------------------------------------------------- access through "void" pointer ignored A pointer to void cannot be used to access an object. There is an expression in the source 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. Example of code that generates the message: f(void){ volatile void *vp1, *vp2; *(vp1 = vp2);/* assignment does get done */ } Message ID: E_ACCESS_VIA_VOID_PTR_IGNORED -------------------------------------------------- duplicate case in switch There are two case statements in the current switch statement that have the same constant value. Example of code that generates the message: f(void){ long long i = 5; switch(i) { case 4: case 4: break; } } Message ID: E_DUP_CASE_IN_SWITCH_L -------------------------------------------------- duplicate case in switch There are two case statements in the current switch statement that have the same constant value. Example of code that generates the message: f(void){ int i = 5; switch(i) { case 4: case 4: break; } } Message ID: E_DUP_CASE_IN_SWITCH -------------------------------------------------- asm statement illegal outside function The asm statements may appear only inside a function body, not at the level of an external declaration. Example of code that generates the message: asm(" .align 4 "); /* incorrect */ void f(void) { asm(" nop "); /* correct */ Message ID: E_ASM_ILLEGAL_OUTSIDE_FUNC -------------------------------------------------- asm() argument must be normal string literal The argument to an old-style asm() must be a normal string literal, not a wide one. Example of code that generates the message: asm(L"wide string literal not allowed"); Message ID: E_ASM_ARG_MUST_BE_STRING -------------------------------------------------- embedded NUL not permitted in asm() The string literal that appears in an old-style asm( ) contains an embedded NUL character (character code 0). Example of code that generates the message: asm("this is an old-style asm with embedded NUL: \0"); Message ID: E_EMBEDDED_NUL_ILLEGAL_IN_ASM -------------------------------------------------- asm() statement disables optimization within function This warning is displayed with the -v, -O, and -xO[level] options. Optimization is turned off for a function if asm statements are found within that function. Example of code that generates the message: void foo(void) { asm(".volatile"); asm(" st %g0, [%sp+0x44]"); asm(" ld [%sp+0x44], %fsr"); asm(" nop"); asm(".nonvolatile"); } Message ID: E_ASM_DISABLES_OPTIMIZATION -------------------------------------------------- empty translation unit 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. Example of code that generates the message: #ifdef COMPILE int token; #endif Message ID: E_EMPTY_TRANSLATION_UNIT -------------------------------------------------- ignores a simple pointer to lock Lock_lint cannot tell which lock is being manipulated when a simple pointer to lock is used. Example of code that generates the message: struct G_Mutex { mutex_t* amutex; int global_data; }; struct G_Mutex* global_mutex; int add_data() { mutex_lock(global_mutex->amutex); /* <=== Warning */ global_mutex->global_data++; mutex_unlock(global_mutex->amutex); /* <=== Warning */ return global_mutex->global_data; } ================== /* Change the code to a form lock_lint can cope with */ struct G_Mutex { mutex_t amutex; /* <=== OK */ int global_data; }; int add_data() { mutex_lock(&global_mutex->amutex); /* <=== OK */ global_mutex->global_data++; mutex_unlock(&global_mutex->amutex); /* <=== OK */ return global_mutex->global_data; } Message ID: E_LOCK_FUNC_IGNORES_PTR -------------------------------------------------- ?: operator being used to choose the lock parameter for function The static analysis of your source code by lock_lint cannot determine which parameter is being passed to a function when the ?: operator is used in a function call. The message indicates which value lock_lint will assume is being passed to the function. Example of code that generates the message: mutex_t mutex1; mutex_t mutex2; mutex_lock((1==1)? &mutex1 : &mutex2); Message ID: E_CONDITIONAL_OP_LOCK_CHOICE -------------------------------------------------- will assume this call succeeds in obtaining the lock The static source code analysis by lock_lint will assume the indicated function succeeded in obtaining a lock. Example of code that generates the message: mutex_t mutex1; if (mutex_trylock(&mutex1)) goto getlock; Message ID: E_ASSUME_SUCCESSFUL_LOCK -------------------------------------------------- ?: operator being used to choose the condition variable parameter for func; lock_lint will assume condition variable was chosen The static analysis of your source code by lock_lint cannot determine which parameter is being passed to a function when the ?: operator is used in a function call. The static source code analysis by lock_lint will assume the indicated condition variable is being passed as a parameter to the indicated function. Example of the code that generates this message: int waitWriter; f() { cond_t condt1, condt2; cond_wait((waitWriter == 0) ? condt1 : condt2); } Message ID: E_CONDITIONAL_OP_CONDVAR_CHOICE -------------------------------------------------- lock_lint ignores a simple pointer to condition variable Lock_lint ignores a simple pointer to condition variable since it cannot tell which lock is being manipulated. Example of code that generates the message: cond_t* ptr; int count = 0; /* share variable */ while (count == 0) cond_wait(ptr); /* If rewritten thusly, lock_lint can analyze it */ cond_t p; while (count == 0) cond_wait(&p); Message ID: E_CV_FUNC_IGNORES_SIMPLE_PTR -------------------------------------------------- function requires two arguments The function requires 2 arguments. You didn't specify the second mutex argument. Example of code that generates the message: kcondvar_t cvp; cv_wait(&cvp); /*====================== ** The correct code should be: */ kcondvar_t cvp; kmutex_t mp; cv_wait(&cvp, &mp); Message ID: E_SECOND_MUTEX_MISSING -------------------------------------------------- operand cannot have void type One of the operands has void type. Example of code that generates the message: f(void){ void v(void); int i = v(); } Message ID: E_OPERAND_CANT_BE_VOID_TYPE -------------------------------------------------- whitespace between two character assignment operators The -Xs option allows whitespace in between two character assignment operators. Character assignment operators consists of : +=, -=, *=, /=, &=, |=, ^=, %= However, all other compiler modes do not allow whitespace between these operators. Example of code that generates the message: int i + = 1; /* for operator: += */ int k - = 1; Message ID: E_WHITESPACE_IN_CHAR_ASSIGN_OPS -------------------------------------------------- ANSI C treats constant as unsigned The type promotion rules for ANSI C are slightly different from those of previous versions of K&R C. In the current release, the default behavior is to duplicate the previous rules. You can obtain the ANSI C interpretation by using the -Xa option for the compiler command. Previous K&R C type promotion rules are unsigned preserving. If one of the operands of an expression is of unsigned type, the operands are promoted to a common unsigned type before the operation is performed. ANSI C uses value-preserving type promotion rules. An unsigned type is promoted to a signed type if all its values can be represented in the signed type. ANSI C also has a different rule from previous K&R C versions 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: o The division operators: /, /=, %, %= o The right shift operators: >>, >>= o The relational operators: <, , >= The warning message tells you that your program contains an expression in which the behavior of an operator will change in the future. You can guarantee the behavior you want by inserting an explicit cast in the expression. Example of code that generates the message: f(void){ int i; /* constant is integer in K&R C, unsigned in ANSI C */ i /= 0xf0000000; } Message ID: E_ANSI_CONST_UNSIGNED_OP -------------------------------------------------- semantics of operator change in ANSI C; use explicit cast The type promotion rules for ANSI C are slightly different from those of previous versions of K&R C. In the current release, the default behavior is to duplicate the previous rules. You can obtain the ANSI C interpretation by using the -Xa option for the cc command. Previous K&R C type promotion rules are unsigned preserving. If one of the operands of an expression is of unsigned type, the operands are promoted to a common unsigned type before the operation is performed. ANSI C uses value-preserving type promotion rules. An unsigned type is promoted to a signed type if all its values can be represented in the signed type. The different type promotion rules can lead to different program behavior for the operators that are affected by the "unsigned-ness" of their operands: o The division operators: /, /=, %, %= o The right shift operators: >>, >>= o The relational operators: <, , >= The warning message indicates that your program contains an expression in which the behavior of an operator will change in the future. You can guarantee the behavior you want by inserting an explicit cast in the expression, as follows: f(void){ unsigned char uc; int i; /* is unsigned divide in K&R C, signed in ANSI C */ i /= (unsigned int) uc; } Example of code that generates the message: f(void){ unsigned char uc; int i; /* is unsigned divide in K&R C, signed in ANSI C */ i /= uc; } Message ID: E_SEMANTICS_OF_OP_CHG_IN_ANSI_C -------------------------------------------------- integral constant too large An integral constant is too large to fit in an unsigned long. Example of code that generates the message: int i = 123456789012345678901; Message ID: E_INTEGRAL_CONSTANT_TOO_LARGE -------------------------------------------------- constant promoted to unsigned int The suffixed constant is too large to fit in the type specified by the suffix Hence, it is promoted to an unsigned int. Message ID: E_CONST_PROMOTED_UNSIGNED_INT -------------------------------------------------- constant promoted to unsigned long The suffixed constant is too large to fit in the type specified by the suffix Hence, it is promoted to an unsigned long. Message ID: E_CONST_PROMOTED_UNSIGNED_LONG -------------------------------------------------- constant promoted to unsigned long long This warning is displayed with the -v option. The suffixed constant is too large to fit in the type indicated by the suffix, so it is promoted to either a long long or an unsigned long long. Example of code that generates the message: if (9223372036854775807L > 0) printf("promoted\n"); if (9223372036854775807UL > 0) printf("promoted\n"); Message ID: E_CONST_PROMOTED_UNSIGNED_LL -------------------------------------------------- constant promoted to long The suffixed constant is too large to fit in the type specified by the suffix Hence, it is promoted to long. Message ID: E_CONST_PROMOTED_LONG -------------------------------------------------- constant promoted to long long This warning is displayed with the -v option. The suffixed constant is too large to fit in the type indicated by the suffix, so it is promoted to either a long long or an unsigned long long. Example of code that generates the message: if (9223372036854775807L > 0) printf("promoted\n"); if (9223372036854775807UL > 0) printf("promoted\n"); Message ID: E_CONST_PROMOTED_LONG_LONG -------------------------------------------------- conversion of floating-point constant to float out of range A floating-point constant has too large a value to fit in type float. Example of code that generates the message: float f = 1e300f; Message ID: E_CONV_CONST_FP_FLOAT_OUT_RANGE -------------------------------------------------- conversion of floating-point constant to long double out of range A floating-point constant has too large a value to fit in type long double. Message ID: E_CNV_CNST_FP_LONG_DBL_OUTRANGE -------------------------------------------------- conversion of floating-point constant to double out of range A floating-point constant has too large a value to fit in type double. Message ID: E_CONV_CONST_FP_DBL_OUT_RANGE -------------------------------------------------- syntax error: "&..." invalid This message is displayed when an error occurs with the -Xc option. The program contains &... and is compiled with the -Xc option. &... is an invalid ANSI C syntax. Do not use this notation explicitly. Message ID: E_AND_DOT_DOT_DOT_INVALID -------------------------------------------------- integral constant expression expected The compiler requires an integral constant or an expression that can be evaluated at compile time to yield an integral value. The expression contains either a non-integral value, a reference to an object, or an operator that cannot be evaluated at compile-time. Example of code that generates the message: int ia[5.0]; Message ID: E_INTEGRAL_CONST_EXP_EXPECTED -------------------------------------------------- improper member use Your program contains an expression with a -> or . operator, and the name is not a member of the structure or union that the left side of the operator refers to, but 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. Example of code that generates the message: struct s1 { int x,y; }; struct s2 { int q,r; }; f(void){ struct s1 *ps1; ps1->r = 3; } Message ID: E_IMPROPER_MEMBER_USE -------------------------------------------------- undefined struct/union member The program makes reference to a structure or union member that has not been declared as part of any structure. Example of code that generates the message: struct s { int x; }; f(void){ struct s q; q.y = 1; } Message ID: E_UNDEFINED_STRUCT_UNION_MEMBER -------------------------------------------------- non-unique member requires struct/union pointer The operand on the left side of a -> operator is not a structure, union, or a pointer to one, and the member name is not unique among all structure and union members that you have declared. You should only use -> with structures or unions, and the member should belong to the structure or union corresponding to the left operand. Message ID: E_NON_UNIQUE_REQRS_S_U_PTR -------------------------------------------------- non-unique member requires struct/union object The operand on the left side of a . operator is not a structure, union, or a pointer to one, and the member name is not unique among all structure and union members that you have declared. You should only use . with structures or unions, and the member should belong to the structure or union corresponding to the left operand. Example of code that generates the message: struct s1 { int x,y; }; struct s2 { int y,z; }; f(void){ long *lp; lp.y = 1; } Message ID: E_NON_UNIQUE_REQRS_S_U_OBJ -------------------------------------------------- implicitly declaring function to return int This warning is displayed with the -v option. The program calls a function which has not been previously declared. The compiler warns you that it is assuming that the function returns int. Example of code that generates the message: void v(void){ g(); } Message ID: E_IMPLICIT_DECL_FUNC_RETURN_INT -------------------------------------------------- undefined symbol You have referred to a symbol for which there is no declaration in scope. Example of code that generates the message: f(void){ g(i); } Message ID: E_UNDEFINED_SYMBOL -------------------------------------------------- using out of scope declaration You previously declared an object in a scope that is no longer active. In some ANSI C implementations, referring to such an object yields an error; calling such a function is interpreted as calling a function returning int. The C compiler remembers the previous declaration and uses it. This warning tells you what the compiler has done. Example of code that generates the message: f(void){ extern int i; double sin(double); } g(void){ double d = sin(1.5); i = 1; } Message ID: E_USING_OUT_OF_SCOPE_DECL -------------------------------------------------- cannot take sizeof function The sizeof operator cannot be applied to functions. Example of code that generates the message: int f(void); int i = sizeof(f); Message ID: E_CANT_TAKE_SIZEOF_FUNC -------------------------------------------------- cannot take sizeof function The sizeof operator cannot be applied to functions. Example of code that generates the message: int f(void); int i = sizeof(f); Message ID: E_CANT_TAKE_SIZEOF_FUNC_N -------------------------------------------------- cannot take sizeof void The sizeof operator cannot be applied to type void. Example of code that generates the message: void v(void); int i = sizeof(v()); Message ID: E_CANT_TAKE_SIZEOF_VOID -------------------------------------------------- cannot take sizeof bit-field The sizeof operator cannot be applied to bit-fields. Example of code that generates the message: struct s { int x:3; } st; int i = sizeof(st.x); Message ID: E_CANT_TAKE_SIZEOF_BIT_FIELD -------------------------------------------------- operands have incompatible types The types of the operands for an operand are unsuitable for that kind of operator. Example of code that generates the message: f(void){ char *cp; int *ip; void *vp = ip + cp; } Message ID: E_OPERANDS_INCOMPATIBLE_TYPES -------------------------------------------------- first operand must have scalar type: op "?:" The conditional expression in a ?: expression must have a scalar type: integral, floating-point, or pointer. Example of code that generates the message: struct s { int x; } st; f(void){ int i = st ? 3 : 4; } Message ID: E_FIRST_OPERAND_SCALAR_TYPE -------------------------------------------------- left operand of "." must be struct/union object 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 is allocated to a register; it is a warning otherwise. Example of code that generates the message: f(void){ struct s { short s; }; int i; i.s = 4; } Message ID: E_DOT_L_OPERAND_NOT_STRUCT_U -------------------------------------------------- cannot access member of non-struct/union object The structure or union member must be completely contained within the left operand of the . operator. Example of code that generates the message: f(void){ struct s { int x; }; char c; c.x = 1; } Message ID: E_CANT_ACCESS_MBR_NON_STRUCT_U -------------------------------------------------- left operand of "->" must be pointer to struct/union The operand on the left side of a -> operator must be a pointer to a structure or union, but it is not. The diagnostic is a warning if the operand is a pointer, an error otherwise. Example of code that generates the message: struct s { int x; }; f(void){ long *lp; lp->x = 1; } g(void) : struct s newStr; newS->x = 1; /* newS is a structure, but not ptr to the structure */ } Message ID: E_LEFT_MUST_BE_PTR_TO_STRUCT_U -------------------------------------------------- operands must have integral type An operator has been used with operands that are required to be of integral type (short, int, long, etc.) but are not, for example using a struct. Example of code that generates the message: struct Astr b; int a = 0x345 & b; Message ID: E_OPERAND_MUST_BE_INTEGRAL_TYPE -------------------------------------------------- operands must have arithmetic type Operands of the unary -, + operators have to be of arithmetic type. Example of code that generates the message: struct Astr { int a; int b; } g(void) { struct Astr l; int k = l * 2; /* l is struct Astr, not of arithmetic type */ l = -l; /* l is operand of unary "-" or "+" */ l = +l; /* but l is not arithmetic type */ } Message ID: E_OPERAND_MUST_BE_ARITH_TYPE -------------------------------------------------- operands must have scalar type Operands of the unary "!" operator must have scalar type. Or code using operators "++" or "--" expects scalar type. Example of code that generates the message: struct aStr{ int a; int b; }; g(void) { struct aStr newStr; newStr++; /* operand of the unary ++ must be scalar */ newStr.a++; /* this is correct */ } Message ID: E_OPERAND_MUST_BE_SCALAR_TYPE -------------------------------------------------- cannot do pointer arithmetic on operand of unknown size An expression involves pointer arithmetic for pointers to objects whose size is unknown. Example of code that generates the message: f(void){ struct s *ps; g(ps+1); } Message ID: E_PTR_ARITH_MUST_KNOW_SIZE -------------------------------------------------- improper pointer subtraction The operands of a subtraction are both pointers, but they point at different types. You can only subtract pointers of the same type that point to the same array. The diagnostic is a warning if the pointers point to objects of the same size, and an error otherwise. Example of code that generates the message: f(void){ int *ip; char *cp; int i = ip - cp; } Message ID: E_BAD_POINTER_SUBTRACTION -------------------------------------------------- function designator is not of function type You have used an expression in a function call as if it were the name of a function or a pointer to a function when it is not. Example of code that generates the message: f(void){ char *p; p(); } Message ID: E_FUNC_DESIGNATOR_NOT_FUNC_TYPE -------------------------------------------------- prototype mismatch: n args passed, m expected You have called a function for which there is a function prototype declaration in scope, and the number of arguments in the call does not match the number of parameters in the declaration n. Example of code that generates the message: int f(int); g(void){ f(1,2); } Message ID: E_PROTOTYPE_MISMATCH_ARGS -------------------------------------------------- prototype mismatch: n arg passed, m expected You have called a function for which there is a function prototype declaration in scope, and the number of arguments in the call does not match the number of parameters in the declaration n. Message ID: E_PROTOTYPE_MISMATCH_ARG -------------------------------------------------- argument mismatch: n args passed, m expected This warning is displayed with the -v option. At a function call, the compiler has 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: an old-style (non-prototype) function definition, or 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. Example of code that generates the message: 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 */ } Message ID: E_ARGS_MISMATCH -------------------------------------------------- argument mismatch: n arg passed, m expected This warning is displayed with the -v option. At a function call, the compiler has 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: an old-style (non-prototype) function definition, or 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. Message ID: E_ARG_MISMATCH -------------------------------------------------- cannot return incomplete type 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. Example of code that generates the message: f(void){ struct s g(); g(); } Message ID: E_CANT_RETURN_INCOMPLETE_TYPE -------------------------------------------------- void expressions may not be arguments A function call contains an argument for which the expression type is void. Example of code that generates the message: f(void){ void v(void); g(v()); } Message ID: E_VOID_EXP_MAY_NOT_BE_ARGS -------------------------------------------------- argument cannot have unknown size An argument in a function call must have a completed type. You have passed a struct, union, or enum object whose type is incomplete. Example of code that generates the message: f(void){ struct s *st; g(*st); } Message ID: E_ARG_CANT_BE_UNKNOWN_SIZE -------------------------------------------------- argument is incompatible with prototype You have called a function with an argument whose type cannot be converted to the type in the function prototype declaration for the function. Example of code that generates the message: struct s {int x;} q; f(void){ int g(int,int); g(3,q); } Message ID: E_ARG_INCOMPATIBLE_WITH_ARG -------------------------------------------------- assignment type mismatch 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. Example of code that generates the message: struct s { int x; } st; f(void){ int i; char *cp; const char *ccp; i = st; cp = ccp; } Message ID: E_ASSIGNMENT_TYPE_MISMATCH -------------------------------------------------- invalid cast expression You cannot apply the cast 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 can only be cast to or from an integral type. Example of code that generates the message: f(void){ struct s {int x;} st; int i = (int) st; } Message ID: E_INVALID_CAST_EXPRESSION -------------------------------------------------- return value type mismatch You are attempting to return a value from a function that cannot be converted to the return-type of the function. Example of code that generates the message: f(void){ struct s { int x; } st; return( st ); } Message ID: E_RETURN_VALUE_TYPE_MISMATCH -------------------------------------------------- initialization type mismatch A variable is being initialized with an initializer of incompatible type. For example, initializing a pointer to point to an object of a different type. Example of code that generates the message: struct s { int x; int y; }; const int i = 10; int *j = /* <====== type mismatch */ struct s *foo = j; /* <====== type mismatch */ Message ID: E_INITIALIZATION_TYPE_MISMATCH -------------------------------------------------- invalid switch expression type The controlling expression of a switch statement cannot be converted to int. This message always follows the message switch expression must have integral type. Example of code that generates the message: f(void){ struct s {int x;} sx; switch(sx){ case 4: ; } } Message ID: E_INVALID_SWITCH_EXP_TYPE -------------------------------------------------- argument does not match remembered type This warning is displayed with the -v option. At a function call, the compiler has determined that the type of the argument passed to a function disagrees with other information it has about the function. That other information comes from two sources: an old-style (non-prototype) function definition, or 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. Example of code that generates the message: void f(i) int i; { } void g(void) { f("erroneous"); } Message ID: E_ARG_NOT_MATCH_REMEMBERED_TYPE -------------------------------------------------- cannot take address of bit-field You cannot take the address of a bit-field member of a structure or union. Example of code that generates the message: f(void){ struct s { int x:3, y:4; } st; int *ip = &&st.y; } Message ID: E_CANT_TAKE_ADDRESS_BIT_FIELD -------------------------------------------------- cannot take address of register You have attempted to take the address of an object that is declared with the register storage class. You cannot do so, whether or not 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 is allocated for the object and a warning otherwise. Example of code that generates the message: f(void){ register int i; register int ia[5]; int *ip = & ia[2] = 1; } Message ID: E_CANT_TAKE_ADDRESS_REGISTER -------------------------------------------------- unacceptable operand for unary & You have attempted to take the address of something whose address cannot be taken. Example of code that generates the message: f(void){ int *ip = &g(); } Message ID: E_BAD_OPERAND_FOR_UNARY_AND -------------------------------------------------- cannot dereference non-pointer type The operand of the * (pointer dereference) operator must have pointer type. This diagnostic is also issued for an array reference to a non-array. Example of code that generates the message: f(void){ int i; *i = 4; i[4] = 5; } Message ID: E_CANT_DEREF_NON_POINTER_TYPE -------------------------------------------------- controlling expressions must have scalar type The expression for an if, for, while, or do-while must be an integral, floating-point, or pointer type. Example of code that generates the message: f(void){ struct s {int x;} st; while (st) {} } Message ID: E_CNTRL_EXP_MUST_BE_SCALAR_TYPE -------------------------------------------------- a cast does not yield an lvalue You cannot apply a cast 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. Example of code that generates the message: f(void){ int i; (long) i = 5; (short) i = 4; } Message ID: E_CAST_DOESNT_YIELD_LVALUE -------------------------------------------------- operand must be modifiable lvalue The operand of an operator must be a modifiable lvalue, but it is not. Example of code that generates the message: f(void){ int i = --3; } Message ID: E_OPERAND_NOT_MODIFIABLE_LVALUE -------------------------------------------------- left operand must be modifiable lvalue The operand on the left side of an operator is not a modifiable lvalue; it must be one. Example of code that generates the message: f(void){ int i = 1; +i -= 1; } Message ID: E_L_OPERAND_NOT_MODIFIABLE_LVAL -------------------------------------------------- left operand of "." must be lvalue in this context The operand on the left side of a . operator is an expression that does not yield an lvalue. Usually, this warning results when you try to change the return value of a function that returns a structure. Example of code that generates the message: struct s { int ia[10]; }; struct s sf(void); f(void){ sf().ia[0] = 3; } Message ID: E_L_OPERAND_DOT_NOT_LVALUE_NOW -------------------------------------------------- improper cast of void expression You cannot cast a void expression to something other than void. Example of code that generates the message: f(void){ void v(void); int i = (int) v(); } Message ID: E_BAD_CAST_OF_VOID_EXP -------------------------------------------------- enum type mismatch: arg This warning is displayed with the -v option. 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. Example of code that generates the message: enum e1 { ec11 } ev1; enum e2 { ec21 } ev2; void ef(enum e1); void v(void){ ef(ec21); } Message ID: E_ENUM_TYPE_MISMATCH_ARG -------------------------------------------------- enum type mismatch: op One of the operands of an operator is an enumeration object or constant, and the other is an enumeration object or constant from a different enumerated type. Example of code that generates the message: enum e1 { ec11, ec12 } ev1; enum e2 { ec21, ec22 } ev2; void v(void){ if (ev1 > ec22) ; } Message ID: E_ENUM_TYPE_MISMATCH_OP -------------------------------------------------- void function cannot return value A return statement contains an expression, but the declared type of the function is void. Example of code that generates the message: void v(void){ return 3; } Message ID: E_VOID_CANT_RETURN_VALUE -------------------------------------------------- Unable to malloc ND1 tree space An internal use of malloc() by the compiler has failed. This is most frequently due to having run out of swap space. Message ID: E_CANT_MALLOC_ND1_TREE -------------------------------------------------- unknown operand size You have applied operator ++, --, or = to an operand whose size is unknown. The operand is usually a pointer to a structure or union whose members have not been declared. Example of code that generates the message: f(void){ struct s *sp; sp++; } Message ID: E_UNKNOWN_OPERAND_SIZE -------------------------------------------------- enum constants have different types This warning is displayed with the -v option. You have used a relational operator to compare enumeration constants from two different enumeration types. This may indicate a programming error. The sense of the comparison is known at compile time because the constants' values are known. Example of code that generates the message: enum e1 { ec11, ec12 } ev1; enum e2 { ec21, ec22 } ev2; void v(void){ if (ec11 > ec22) ; } Message ID: E_ENUM_CONSTS_HAVE_DIFF_TYPES -------------------------------------------------- operands have incompatible pointer types You have applied an operator to pointers to different types. Example of code that generates the message: f(void){ char *cp; int *ip; if (ip < cp) ; } Message ID: E_OPERANDS_INCOMPAT_PTR_TYPES -------------------------------------------------- improper pointer/integer combination One of the operands of an operator is a pointer and the other is an integer; this combination is invalid. Example of code that generates the message: f(void){ int i = "abc"; int j = i ? 4 : "def"; } Message ID: E_BAD_PTR_INT_COMBINATION -------------------------------------------------- improper pointer/integer combination 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. Example of code that generates the message: int f(char *); g(void){ f(5); } Message ID: E_BAD_PTR_INT_COMB_ARG -------------------------------------------------- long long not allowed in Xc mode long long int and unsigned long long int are not standard C types, and thus are not available when using the -Xc option. Message ID: E_LONG_LONG_NOT_ALLOWED_XC -------------------------------------------------- invalid type combination You have used an inappropriate combination of type specifiers in a declaration. Example of code that generates the message: short float f; Message ID: E_INVALID_TYPE_COMBINATION -------------------------------------------------- storage class after type is obsolescent This warning is displayed with the -v option. According to the ANSI C standard, writing declarations in which the storage class specifier is not first is obsolescent. Example of code that generates the message: int static i; Message ID: E_TYP_STORAGE_CLASS_OBSOLESCENT -------------------------------------------------- only one storage class allowed You have specified more than one storage class in a declaration. Example of code that generates the message: f(void){ register auto i; } Message ID: E_ONLY_ONE_STORAGE_CLASS_ALLOWD -------------------------------------------------- auto/register inappropriate here A declaration outside any function has storage class auto or register. Example of code that generates the message: auto int i; f(void){ } Message ID: E_AUTO_REG_INAPPROPRIATE_HERE -------------------------------------------------- only "register" valid as formal parameter storage class You can specify a storage class specifier in a function prototype declaration, but only register is permitted. Example of code that generates the message: int f( register int x, auto int y ); Message ID: E_ONLY_REG_VALID_FORMAL_PARAM -------------------------------------------------- modification of typedef ignored In ANSI C, modify a typedef with a type qualifier. Example of code that generates the message: typedef int INT; unsigned INT i Message ID: E_MODIFY_TYPEDEF_IGNORED -------------------------------------------------- typedef already qualified A type specifier includes a typedef and an explicit type qualifier. The typedef already includes the qualifier when it is declared. Example of code that generates the message: typedef volatile int VOL; volatile VOL v; Message ID: E_TYPE_DEF_ALREADY_QUALIFIED -------------------------------------------------- dubious reference to typedef A function prototype declaration refers to a union, struct, or enum typedef with a name. Because the struct, union, or enum has been declared within a function, it cannot be in scope when you define the function whose prototype is being declared. The prototype declaration and function definition thus cannot match. Example of code that generates the message: f(void){ struct s { int x; }; typedef struct s ST; extern int g(ST, struct s); } Message ID: E_DUBIOUS_REF_TYPEDEF -------------------------------------------------- use "double" instead of "long float" You have declared an object or function to be long float, a synonym for double. ANSI C does not permit long float, although the C compiler accepts it as a transition aid. Example of code that generates the message: long float f = 1.0; Message ID: E_USE_DOUBLE_INSTEAD_LONG_FLOAT -------------------------------------------------- only qualifiers allowed after * You can specify only the const or volatile type qualifiers after a * in a declaration. Example of code that generates the message: int * const p; int * unsigned q; Message ID: E_ONLY_QUALS_ALLOWED_AFTER_STAR -------------------------------------------------- zero or negative subscript The size in an array declaration is zero or negative. Example of code that generates the message: int ia[-5]; int ib[0]; Message ID: E_ZERO_OR_NEGATIVE_SUBSCRIPT -------------------------------------------------- array dimension too big An array declaration has a combination of dimensions such that the declared object is too big for the target machine. Example of code that generates the message: int bigarray[2000000000]; Message ID: E_ARRAY_DIMENSION_TOO_BIG -------------------------------------------------- parameter redeclared You have used a name more than once as the name for a parameter in a function definition. Example of code that generates the message: int f(int i, int i) { } int g(i,j) int i; int i; { } Message ID: E_PARAM_REDECLARED -------------------------------------------------- "$" sign used in parameter You have used a "$" in a parameter identifier while using the -Xt option. This will result in a syntax error when using the -Xa or -Xc option. Example of code that generates the messages: int f(int i$j ){ }; Message ID: E_DOLLAR_USED_IN_PARAMETER -------------------------------------------------- "$" used in identifier You have used a "$" in an identifier while using the -Xt option. This will result in a syntax error when using the -Xa or -Xc option. Example of code that generates the message: int a$b; Message ID: E_DOLLAR_USED_IN_IDENTIFIER -------------------------------------------------- ANSI C requires formal parameter before "..." This warning is displayed with the -Xc and -v options. In K&R C, you can define a function with a variable number of arguments and no fixed arguments. ANSI C requires at least one fixed argument. Example of code that generates the message: f(...){} Message ID: E_ANSI_REQS_FRML_PARM_BFORE_DOT -------------------------------------------------- "void" must be sole parameter Only the first parameter in a function prototype declaration can have void type, and it must be the only parameter. Example of code that generates the message: int f(int,void); Message ID: E_VOID_MUST_BE_SOLE_PARAMETER -------------------------------------------------- null dimension 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; an error, otherwise. Example of code that generates the message: int ia[4][]; struct s { int x, y[]; }; int i = sizeof(int []); Message ID: E_NULL_DIMENSION -------------------------------------------------- cannot declare array of functions or void You have attempted to declare an array of functions or an array of void. Example of code that generates the message: int f[5](); Message ID: E_CANT_DECL_ARY_OF_FUNC_VOID -------------------------------------------------- function cannot return function or array You have declared a function whose return type is a function or array, rather than, perhaps, a pointer to one of those. Example of code that generates the message: int f(void)[]; /* function returning array of ints */ Message ID: E_FUNC_CANT_RTN_FUNC_ARY -------------------------------------------------- old style function definition This warning is displayed with the -fd option. An old-style function definition has been found. Example of code that generates the message: int f(a) char a; { } Message ID: E_OLD_STYLE_FUNC_DEF -------------------------------------------------- old style function declaration This warning is displayed with the -fd option. An old-style function declaration has been found. Example of code that generates the message: int f(); Message ID: E_OLD_STYLE_FUNC_DECL -------------------------------------------------- function prototype parameters must have types A function prototype declaration cannot contain an identifier list; it must declare types. The identifier list is ignored. Example of code that generates the message: int f(i); Message ID: E_FUNC_PROTO_REQ_TYPES -------------------------------------------------- inappropriate qualifiers with "void" You cannot qualify void (with const or volatile) when it stands by itself. Example of code that generates the message: int f(const void); Message ID: E_BAD_QUALIFIERS_WITH_VOID -------------------------------------------------- void parameter cannot have name You have declared a parameter name in a function prototype declaration that has void type. Example of code that generates the message: int f(void v); Message ID: E_VOID_PARAM_CANT_HAVE_NAME -------------------------------------------------- parameter not in identifier list A variable appears in an old-style function definition's parameter declarations, but not in the parameter identifier list. Example of code that generates the message: f(a,b) int i; {} Message ID: E_PARAM_NOT_IN_IDENTIFIER_LIST -------------------------------------------------- asm definition cannot have old-style parameters You have an asm function which is defined in old style C Example of code that generates the message: int f(a) int a; { asm(" nop "); } Message ID: E_ASM_CANT_HAVE_OLD_STYLE_PARMS -------------------------------------------------- formal parameter lacks name There is no parameter name in a function prototype definition. Example of code that generates the message: int f(int){ } Message ID: E_FORMAL_PARAM_LACKS_NAME -------------------------------------------------- prototype mismatch in arg n for function name You have provided a function prototype declaration for a function, but used an old-style definition. The type for parameter name in that definition is incompatible with the type used in the prototype declaration. The following example shows an instance of this diagnostic. int f(char); int f(c) char c; { } f has an old-style definition. For compatibility reasons, the f arguments must be promoted according to the default argument promotion. Therefore, the value that must actually be passed to f is an int, although the function only uses 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 causes to be passed. There are two ways to resolve the conflict: o Change the function prototype to read int f(int); o Define f with a function prototype definition: int f(char); int f(char c) {} Example of code that generates the message: int f(char *); int f(p) int *p; {} Message ID: E_PROTOTYPE_MISMATCH_PROMOTE -------------------------------------------------- Prototype mismatch in arg for function You have provided a function prototype declaration for a function, but used an old-style definition. Either the type for parameter name in that definition is incompatible with the type used in the prototype declaration. Or an incorrect number of parameters have been specified. Check the prototype declaration and the function definition. Example of codes that generates the message: int f(char*, int, char*); /* protype declaration */ int f(a, b, c) /* function f definition */ char* a; { int b; } f has an old-style definition. For compatibility reasons, the f arguments must be promoted according to the default argument promotion. Therefore, the value that must actually be passed to f is an int, although the function only uses 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 causes to be passed. There are two ways to resolve the conflict: o Change the function prototype to read int f(int); o Define f with a function prototype definition: Message ID: E_PROTOTYPE_MISMATCH -------------------------------------------------- parameter mismatch: n declared, m defined A function prototype declaration and an old-style definition of the function disagree in the number of parameters. The declaration has n parameters, while the definition has m. Example of code that generates the message: int f(int); int f(i,j) int i,j; {} Message ID: E_PARAM_MISMATCH_DECL_DEFINED -------------------------------------------------- undefined or not a type An identifier has been declared specifying incorrect type information. Either the type has not been defined or an identifier not representing a type has been used as a type. Example of code that generates the message: what id1; int id2; id2 id3; Message ID: E_UNDEFINED_OR_NOT_A_TYPE -------------------------------------------------- ()-less function definition The declarator portion of a function definition must include parentheses. You cannot define a function by writing a typedef name for a function type, followed by an identifier and the braces that define a function. Example of code that generates the message: typedef int F(); F f{ } Message ID: E_PARENLESS_FUNC_DEF -------------------------------------------------- old-style declaration or incorrect type for You have used an old-style declaration for this type or an assignment with an incorrect type. Example of code that generates the message: const int i = 10; struct foo {int x; int y; }; foo = /* bad type for foo */ int f(); /* old style declaration */ Message ID: E_OLD_STYLE_DECL_OR_BAD_TYPE -------------------------------------------------- cannot initialize parameter An old-style function parameter name cannot have an initializer. Example of code that generates the message: int f(i) int i = 4; {} Message ID: E_CANT_INITIALIZE_PARAM -------------------------------------------------- syntax error: empty declaration The code contains a null statement at file scope that looks like an empty declaration statement. K&R C permits this, but ANSI C does not. Example of code that generates the message: int i;; Message ID: E_EMPTY_DECLARATION -------------------------------------------------- dubious static function at block level This warning is displayed with the -Xc option. You have declared a function with storage class static at block scope. The ANSI C standard says that the behavior is undefined if you declare a function at block scope with an explicit storage class other than extern. Although in K&R C you can declare functions this way, you cannot do so in other implementations, or they may attach a different meaning to such a declaration. Example of code that generates the message: void f(void){ static void g(void); } Message ID: E_STATIC_FUNC_AT_BLOCK_LEVEL -------------------------------------------------- "asm" valid only for function definition The key word "asm" is used outside of function definition. Example of code that generates the message: asm(" nop "); asm(int f()); int f() { asm(" ..."); } Message ID: E_ASM_VALID_ONLY_FOR_FUNC_DEF -------------------------------------------------- "typedef" valid only for function declaration A function definition cannot have the typedef storage class. It is ignored here. Example of code that generates the message: typedef int f(void){} Message ID: E_TYPEDEF_VALID_ONLY_FUNC_DEF -------------------------------------------------- storage class for function must be static or extern You have used an inappropriate storage class specifier for a function declaration or definition. Only extern and static can be used, or the storage class can be omitted. The specifier is ignored. Example of code that generates the message: f(void){ auto g(void); } Message ID: E_SC_FUNC_MUST_STATIC_OR_EXTERN -------------------------------------------------- cannot initialize "extern" declaration Within a function, the declaration of an object with extern storage class cannot have an initializer. Example of code that generates the message: f(void){ extern int i = 1; } Message ID: E_CANT_INIT_EXTERN_DECL -------------------------------------------------- fix and continue: cannot reinitialize This warning is displayed when an option is invoked from dbx with fix-and-continue. A static variable cannot be reinitialized to the value it had at the start of the program. This warning is generated when variables are declared inside a nested block. This warning is also issued for var2 of #pragma weak var1 = var2 Example of code that generates the message (variables declared inside a nested block): void main(int argc, char *argv[]) { static int g ; { static int k ; /* can't be reinitialized */ ......... } } Message ID: E_CANT_FIXCONTINUE_REINITIALIZE -------------------------------------------------- cannot initialize typedef A typedef cannot have an initializer. Example of code that generates the message: typedef int INT = 1; Message ID: E_CANT_INIT_TYPEDEF -------------------------------------------------- cannot initialize function A name declared as a function cannot have an initializer. Example of code that generates the message: int f(void) = 3; Message ID: E_CANT_INIT_FUNCTION -------------------------------------------------- const object should have initializer This warning is displayed with the -v option. A const object cannot be modified. If you do not supply an initial value, the object has a value of zero; for automatics, its value is indeterminate. Example of code that generates the message: const int i; Message ID: E_CONST_OBJ_SHOULD_HAVE_INITIZR -------------------------------------------------- identifier redeclared You have declared an identifier in a way that is inconsistent with a previous appearance of the identifier or you have declared an identifier twice in the same scope. In the previous releases of K&&R C, inconsistent redeclarations are allowed if the types are "nearly" the same (such as int and long on SPARC). ANSI C considers the types to be different. int x; long x; int y; double y; Declarations of functions with and without argument information can often lead to confusing diagnostics. See the following example. int f(char); int f(); According to the ANSI C type compatibility rules, a function declaration that lacks type information, that is, 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 is affected by the promotion rules--it is promoted to int. Therefore, the two declarations have incompatible types. Message ID: E_IDENTIFIER_REDECLARED -------------------------------------------------- identifier redefined You have defined an identifier more than once. That is, you have declared an object more than once with an initializer, or you have defined a function more than once. Example of code that generates the message: int i = 1; int i = 1; Message ID: E_IDENTIFIER_REDEFINED -------------------------------------------------- declaration hides parameter You have declared an identifier with the same name as one of the parameters of the function. References to the identifier in this block are to the new declaration. The diagnostic is an error in -Xa or -Xc modes, and a warning in all other modes. Example of code that generates the message: int f(int i,int INT){ int i; typedef int INT; } Message ID: E_DECLARATION_HIDES_PARAMETER -------------------------------------------------- identifier redeclared; ANSI C requires "static" You have declared a name twice at file scope. The first one uses storage class static, but the second one specifies no storage class. The ANSI C rules for storage classes require that all redeclarations of a name after the first must specify static. Example of code that generates the message: static int i; int i; Message ID: E_ID_REDECL_ANSI_REQS_STATIC -------------------------------------------------- out of scope extern and prior uses redeclared as static This warning is displayed with the -Xc or -v options. You have declared a name as extern in a block that has gone out of scope, then the name again, this time as static. The ANSI C 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. Example of code that generates the message: f(void){ extern int i; } static int i; Message ID: E_OUT_SCOPE_EXTERN_REDECL_STAT -------------------------------------------------- extern and prior uses redeclared as static This warning is displayed with the -Xc or -v options. You have declared a name at file scope as an extern, then later declare the same object or function as static. ANSI C rules require that the first declaration of an object or function give its actual storage class. K&R C accepts the declaration and treats the object or function as if the first declaration is static. Example of code that generates the message: extern int i; static int i; Message ID: E_EXTERN_PRIOR_REDECL_STATIC -------------------------------------------------- inconsistent storage class for function ANSI C requires that the first declaration of a function or object at file scope establish its storage class. You have redeclared a function name in an inconsistent way according to these rules. Example of code that generates the message: g(void){ int f(void); static int f(void); } Message ID: E_INCONSISTENT_STOR_CLASS_FUNC -------------------------------------------------- static redeclares external You have reused a name as the name of a static object or function after using it in the same block as the name of an extern object or function. The version of the name that remains visible is the static version. Example of code that generates the message: f(void){ extern int i; static int i; } Message ID: E_STATIC_REDECLARES_EXTERN -------------------------------------------------- automatic redeclares external You have declared an automatic variable name in the same block and with the same name as another symbol that is extern. ANSI C prohibits such declarations, but previous versions of K&R C allow them. For compatibility with previous versions, references to name in this block will be to the automatic. Example of code that generates the message: f(void){ extern int i; int i; } Message ID: E_AUTO_REDECLARES_EXTERNAL -------------------------------------------------- typedef redeclares external You have declared a typedef name, but there is an extern of the same name in the same block. The typedef hides the external. Example of code that generates the message: f(void){ extern int INT; typedef int INT; } Message ID: E_TYPEDEF_REDCLS_EXTERN -------------------------------------------------- typedef redeclared You have declared a typedef name more than once. The latter declaration has an identical type to the first. Example of code that generates the warningr: typedef int i; typedef int i; Message ID: E_TYPEDEF_REDECLARED -------------------------------------------------- inconsistent redeclaration of extern You have redeclared a function or object name with storage class extern for which there is a previous declaration that has since gone out of scope. The second declaration has a type that conflicts with the first. Example of code that generates the message: f(void){ int *p = (int *) malloc(5*sizeof(int)); } g(void){ void *malloc(); } Message ID: E_INCONSISTENT_REDECL_EXTERN -------------------------------------------------- inconsistent redeclaration of static You have redeclared an object or function that is originally declared with storage class static. The second declaration has a type that conflicts with the first. There are two most frequent conditions under which this diagnostic is issued: o A function is 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. o A function or object is 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 is an intervening, unrelated, declaration of the same name. Example of code that generates the message: f(void){ static int myfunc(void); } g(void){ static char *myfunc(void); } static int x; f(void){ int x; /* unrelated */ { extern float x; /* related to first declaration */ } } Message ID: E_INCONSISTENT_REDECL_STATIC -------------------------------------------------- old style declaration hides prototype declaration This warning is displayed with the -v option. You have redeclared a function name in an inner scope. The outer declaration is a function prototype declaration, but the inner one lacks parameter information. By the ANSI C scoping rules, the parameter information is hidden and the automatic conversions of types that the prototype would have provided are suppressed. Example of code that generates the message: extern double sin(double); f(void){ extern double sin(); double d; d = sin(1); /* Note: no conversion to double! */ } Message ID: E_OLD_STYLE_DECL_HIDES_PROTO -------------------------------------------------- base type is really "type tag" This warning is displayed with the -Xt option. A type is declared with a struct, union, or enum type specifier and with "tag" and then used with a different type specifier to declare the type as the type specifier that you have used for the original declaration. For compatibility with previous releases of K&R C, the compiler treats the two types as being the same. In ANSI C (with the -Xa or -Xc options), the types are different. Example of code that generates the message: struct s { int x, y, z; }; f(void){ unions foo; } Message ID: E_BASE_TYPE_IS_REALLY -------------------------------------------------- declaration introduces new type in ANSI C This warning is displayed with the -Xt option. A struct, union, or enum tag has been redeclared in an inner scope. In previous versions of K&R C, this tag is taken to refer to the previous declaration of the tag. In ANSI C, the declaration introduces a new tag. When the -Xt option is selected, the compiler reproduces the earlier behavior. Example of code that generates the message: struct s1 { int x; }; f(void){ struct s1; struct s2 { struct s1 *ps1; }; /* s1 refers to line 1 */ struct s1 { struct s2 *ps2; }; } Message ID: E_DECL_INTRODUCES_NEW_TYPE_ANSI -------------------------------------------------- useless declaration ANSI C requires that every declaration actually declare something, such as: o A declarator o A structure or union tag o Enumeration constants The declaration provides no information to the compiler. Example of code that generates the message: int; /* no identifier */ enum e { e1, e2 }; /* introduces enum e */ enum e; /* no new information */ Message ID: E_USELESS_DECLARATION -------------------------------------------------- forward declaring enum This warning is displayed with the -v, -Xa, or -Xc options. A declaration implying an empty enumeration has been found; a definition for this enumeration must follow later in the code. Example of code that generates the message: enum test *ptr; Message ID: E_FWD_DECLARING_ENUM -------------------------------------------------- typedef declares no type name In a declaration with storage class typedef, no type name is actually declared. This is probably a programming error. Example of code that generates the message: typedef struct s { int x; }; Message ID: E_TYPEDEF_DECLARES_NO_TYPE_NAME -------------------------------------------------- "type" tag redeclared You have redeclared a tag name that is originally a type tag. Example of code that generates the message: struct q { int m1, m2; }; enum q { e1, e2 }; Message ID: E_TAG_REDECLARED -------------------------------------------------- dubious tag in function prototype A function prototype declaration refers to a struct, union, or enum type with a tag. The tag has been declared within a function. Therefore, it cannot be in scope when you define the function whose prototype is being declared. The prototype declaration and function definition thus cannot match. Example of code that generates the message: f(void){ struct s {int x;}; int g(struct s *); } Message ID: E_DUBIOUS_TAG_IN_FUNC_PROTO -------------------------------------------------- dubious "type" declaration; use tag only You have declared a new struct, union, or enum type with a tag 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 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 the ANSI C scope rules. You cannot declare an object of that type outside the function. Instead, declare the struct, union, or enum ahead of the function prototype or function definition and then refer to it just by its tag. The following code: struct s {int x;}; int f(struct s st) {} should be written as: int f(struct s {int x;} st) {} Message ID: E_DUBIOUS_DECL_USE_TAG_ONLY -------------------------------------------------- dubious structure/union/enum type declaration, use tag only A struct, union, or enum type has been declared within function prototype scope. That is, a struct, union, or enum type has been 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 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 the standard C scope rules. There is no way to declare an object of that type outside the function prototype. Instead, declare the struct, union, or enum ahead of the function prototype or function definition and then refer to it by its tag. Example of codes that generates the message: int f(struct {int x; int y; }; ) struct s foo; { } ============ /* Correct code */ struct s {int x; int y; }; int f(struct s foo) { } Message ID: E_DUB_DECL_USE_TAG_ONLY_UNNAMED -------------------------------------------------- dubious tag declaration You have declared a new struct, union, or enum type with a tag within a function prototype declaration or the parameter declaration list of an old-style function definition. Calls to the function always produce a type mismatch, because the tag declaration goes out of scope at the end of the function declaration or definition, according to the ANSI C scope rules. Do not declare an object of that type outside the function. Example of code that generates the message: int f(struct s *); Message ID: E_DUBIOUS_TAG_DECLARATION -------------------------------------------------- dubious tag declaration without name You have declared a new struct, union, or enum within a function prototype declaration or the parameter declaration list of an old-style function definition. Calls to the function always produce a type mismatch, because the tag declaration goes out of scope at the end of the function declaration or definition, according to standard C scope rules. Do not declare an object of that type outside the function. Message ID: E_DUBIOUS_TAG_DECL_UNNAMED -------------------------------------------------- unnamed union member In the union declaration, a member does not have a name. Example of code that generates the message: union s { int i; char c; }; Message ID: E_UNNAMED_UNION_MEMBER -------------------------------------------------- unnamed struct member In the struct declaration, a member does not have a name. Example of code that generates the message: struct s { int i; char c; }; Message ID: E_UNNAMED_STRUCT_MEMBER -------------------------------------------------- bit-field size <= 0 The declaration for a bit-field specifies a zero or negative number of bits. Example of code that generates the message: struct s { int x:-3 }; Message ID: E_BIT_FLD_SIZE_LESS_EQUAL_ZERO -------------------------------------------------- nonportable bit-field type This warning is displayed with the -Xc option. You have used a bit-field type other than signed int or unsigned int, which are the only portable bit-field types. ANSI C supports int, char, short, and long bit-field types that may be signed, unsigned, or plain. It also supports the enum bit-field type. Example of code that generates the message: 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 Message ID: E_NONPORTABLE_BIT_FIELD_TYPE -------------------------------------------------- bit-field too big The declaration for a bit-field specifies more bits than will fit in an object of the declared type. Example of code that generates the message: struct s { char c:20; }; Message ID: E_BIT_FIELD_TOO_BIG -------------------------------------------------- invalid type for bit-field The type you have chosen for a bit-field is not permitted for bit-fields. Bit-fields can only be declared with integral types. Example of code that generates the message: struct s { float f:3; }; Message ID: E_INVALID_TYPE_FOR_BIT_FIELD -------------------------------------------------- member cannot be function A function cannot be a member of a structure or union, although a pointer to a function can be one. You have declared a member name as a function. Example of code that generates the message: struct s { int f(void); }; Message ID: E_MEMBER_CANT_BE_FUNCTION -------------------------------------------------- duplicate member name A struct or union declaration uses the same name for more than one member. Example of code that generates the message: union u { int i; float i; }; Message ID: E_DUPLICATE_MEMBER_NAME -------------------------------------------------- zero-sized struct/union You have declared a structure or union with size of zero. Example of code that generates the message: struct s { int ia[0]; }; Message ID: E_ZERO_SIZED_STRUCT_UNION -------------------------------------------------- struct/union has no named members You have declared a structure or union in which none of the members is named. Example of code that generates the message: struct s { int :4; char :0; }; Message ID: E_STRUCT_UNION_HAS_NO_NAMD_MBRS -------------------------------------------------- syntax requires ";" after last struct/union member The ; that the C syntax requires after the last structure or union member in a structure or union declaration is missing. Example of code that generates the message: struct s { int x }; Message ID: E_SEMI_COLON_REQD_AFT_LAST_MBR -------------------------------------------------- identifier redeclared The identifier has been declared multiple times within the same scope. Example of code that generates the message: f(int i) { int j, i; } Message ID: E_ID_REDECLARED -------------------------------------------------- enumeration constant hides parameter A declaration of an enumerated type within a function includes an enumeration constant with the same name as a parameter name. The enumeration constant hides the parameter. Example of code that generates the message: int f(int i){ enum e { l, k, j, i }; } Message ID: E_ENUM_CONST_HIDES_PARAMETER -------------------------------------------------- enumerator value overflows INT_MAX (2147483647) The value for an enumeration constant overflows the maximum integer value. Example of code that generates the message: enum e { e1=2147483647, e2 }; /* overflow for e2 */ Message ID: E_ENUM_VAL_OVERFLOWS_INT_MAX -------------------------------------------------- enumerator used in its own initializer When setting the value of an enumerator name in an enumeration type declaration, you have used the name in the expression. The ANSI C scope rules take the name in the expression to be whatever symbol is in scope at the time. Example of code that generates the message: int i; f(void){ enum e { i = i+1, j, k }; /* uses global i in i+1 */ } Message ID: E_ENUM_USED_OWN_INITIALIZER -------------------------------------------------- trailing "," prohibited in enum declaration This warning is generated with the -Xc or -v option. You have supplied an extra comma at the end of an enumeration type declaration. The extra comma is prohibited by the syntax. Example of code that generates the message: enum e { e1, e2, }; Message ID: E_TRAILING_COMMA_IN_ENUM -------------------------------------------------- {}-enclosed initializer required When you initialize an aggregate, you must enclose the initializer in { }, except when you initialize a character array with a string literal or an automatic structure with an expression. Example of code that generates the message: int ia[5] = 1; f(void){ struct s { int x,y; } st = 1; } Message ID: E_INIT_REQUIRED -------------------------------------------------- struct/union-valued initializer required In ANSI C, you can initialize an automatic structure or union, but the initializer must have the same type as the object being initialized. Example of code that generates the message: f(void){ int i; struct s { int x; } st = i; } Message ID: E_STRUCT_UNION_INIT_REQUIRED -------------------------------------------------- initializer does not fit or is out of range A value does not fit in the space provided. If it is fetched from that space, it may not reproduce the same value as is put in. In the message, the value is represented as a hexadecimal value if the initializer is unsigned, decimal if it is signed. The hexadecimal values 0x80 through 0xff do not fit into a char; 0x8000 through 0xffff do not fit into a short; 0x80000000 through 0xffffffff do not fit into an int. These values work with their corresponding unsigned types, however. Example of code that generates the message: struct s {signed int m1:3; unsigned int m2:3;} st = {4, 5}; unsigned char uc = 300u; Message ID: E_INIT_DOES_NOT_FIT -------------------------------------------------- string literal must be sole array initializer You cannot initialize a character array with both a string literal and other values in the same initialization. Example of code that generates the message: char ca[] = { "abc", 'd' }; Message ID: E_STR_LIT_ARRAY_INIT -------------------------------------------------- n extra byte(s) in string literal initializer ignored A string literal that initializes a character array contains n more characters than the array can hold. Example of code that generates the message: char ca[3] = "abcd"; Message ID: E_EXTRA_BYTE_IN_STR_IGNORED -------------------------------------------------- non-constant initializer 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. The operator in the diagnostic is the operator whose operands cannot be combined at compile-time. Example of code that generates the message: int j; int k = j+1; Message ID: E_NON_CONST_INIT -------------------------------------------------- too many struct/union initializers You have provided too many initializers for a structure or union. Example of code that generates the message: struct s { int x,y; } st = { 1,2,3 }; Message ID: E_TOO_MANY_STRUCT_UNION_INIT -------------------------------------------------- too many array initializers The code contains more initializers for an array than the array can hold. Example of code that generates the message: int ia[3] = { 1, 2, 3, 4 }; Message ID: E_TOO_MANY_ARRAY_INIT -------------------------------------------------- too many initializers for scalar A { }-bracketed initialization for a scalar contains more than one value. Example of code that generates the message: int i = { 1, 2 }; Message ID: E_TOO_MANY_INIT_SCALAR -------------------------------------------------- initializer will be sign-extended A value used to initialize an object is sign-extended when converted to fit in that object. Example of code that generates the message: unsigned int x = -3; Message ID: E_INIT_SIGN_EXTEND -------------------------------------------------- -xO3 or higher not specified, -crossmodinline flag ignored. The -xO3 option or higher levels of optimization must be used with the -crossfiles flag. Message ID: E_XO3_NOT_SPECIFIED -------------------------------------------------- newline in character constant A character constant that has no closing ' is on the same line as the beginning '. Example of code that generates the message: int i = 'a ; Message ID: E_NEWLINE_IN_CHAR_CONST -------------------------------------------------- invalid source character This message is displayed when an error occurs with the -Xa or -Xc options. The compiler encounters a character in the source program that is not a valid ANSI C token. Example of code that generates the message: int i = 1$; Message ID: E_INVALID_SOURCE_CHARACTER -------------------------------------------------- invalid source character The compiler encounters a character in the source program that is not a valid ANSI C token. The invalid character is not printable. The hex value in the diagnostic is the hexadecimal value of the character code. Message ID: E_INVALID_UNPRINTABLE_SRC_CHR -------------------------------------------------- invalid token: The indicated set of characters does not form a valid C language token. A token is the minimal lexical element of the C language. The categories of tokens are: keywords, identifiers, constants, string literals, operators, and punctuators. Example of code that generates the message: 5d int 1e = 1; /* token should not begin with a digit */ Message ID: E_INVALID_TOKEN_LEX -------------------------------------------------- invalid token: The indicated set of characters does not form a valid C language token. A token is the minimal lexical element of the C language. The categories of tokens are: keywords, identifiers, constants, string literals, operators, and punctuators. Example of code that generates the message: char 2whateveritistoolongmorethan255character... ; /*long string*/ Message ID: E_INVALID_TOKEN_TOO_LONG_LEX -------------------------------------------------- cannot concatenate wide and regular string literals Regular string literals and string literals for wide characters can 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. Example of code that generates the message: #include & wchar_t wa[] = L"abc" "def"; char a[] = "abc" L"def"; Message ID: E_CANT_CONCAT_WIDE_REG_STRINGS -------------------------------------------------- _Restrict is a keyword for -Xa and -Xt When using the -Xa or -Xt options, _Restrict is a C language keyword. Example of code that generates the message: void func(int * _Restrict intptr); Message ID: E_KEYWORD_FOR_XA_AND_XT -------------------------------------------------- __asm is an extension of ANSI C When using the -Xc option, the compiler reports uses of the "__asm" statement. The "__asm" function cannot be used in a strictly conforming ANSI C program. Example of code that generates the message: int f(int a) { __asm(" nop "); } Message ID: E_ASM_IS_AN_EXTENSION_OF_ANSI -------------------------------------------------- character escape does not fit in wide character A hexadecimal or octal escape sequence in a character constant or string literal prefixed by L produces a value that is too big to fit in an unsigned char . The character escape is too large to fit in an object of type wchar_t and is truncated to fit. Message ID: E_CHR_ESC_DOES_NOT_FIT_WCHAR -------------------------------------------------- conversion to double is out of range An expression has too large a value. A conversion of this value is too large to fit in a double. The diagnostic is a waring if the expression is in executable code and an error otherwise. Example of code that generates the message: double f() { return 0xFFFFFFFFFFFFFFFF; } Message ID: E_CONV_TO_DOUBLE_OUT_OF_RANGE -------------------------------------------------- conversion to float is out of range The 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. Example of code that generates the message: float f = 1e300 * 1e300; Message ID: E_CONV_TO_FLOAT_OUT_OF_RANGE -------------------------------------------------- conversion of double to integral is out of range 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. Example of code that generates the message: int i = 1e100; Message ID: E_CONV_DOUBLE_INTEGRAL_OUT_RNGE -------------------------------------------------- shift count negative or too big The compiler has determined that the shift count (the right operand) for the shift operator is either negative or bigger than the size of the operand being shifted. Example of code that generates the message: f(){ short s; s <<= 25; } Message ID: E_SHIFT_CNT_NEG_TOO_BIG_L -------------------------------------------------- shift count negative or too big The compiler has determined that the shift count (the right operand) for the shift operator is either negative or bigger than the size of the operand being shifted. Example of code that generates the message: f(){ short s; s <<= 25; } Message ID: E_SHIFT_CNT_NEG_TOO_BIG -------------------------------------------------- integer overflow detected The compiler attempts to compute the result of an operator expression at compile-time, and determines that the result overflows. The low-order 32 bits of the result are retained, and the compiler issues this diagnostic. Example of code that generates the message: int i = 1000000 * 1000000; Message ID: E_INTEGER_OVERFLOW_DETECTED -------------------------------------------------- floating-point constant calculation out of range The compiler has detected an overflow at compile time when it attempts an operation between two floating-point operands. The diagnostic is a warning if the expression is in executable code, and an error otherwise. Example of code that generates the message: double d1 = 1e300 * 1e300; Message ID: E_FP_CONST_CALC_OUT_OF_RANGE -------------------------------------------------- loop not entered at top 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. Example of code that generates the message: f(void){ int i; goto lab; for (i = 1; i > 0; --i) { lab:; i=5; } } Message ID: E_LOOP_NOT_ENTERED_AT_TOP -------------------------------------------------- statement not reached This statement in your program cannot be reached because of the goto, break, continue, or return statements preceding it. Example of code that generates the message: f(void){ int i; return i; i = 4; } Message ID: E_STATEMENT_NOT_REACHED -------------------------------------------------- function has no return statement This warning is displayed with the -v option. The function should include a return statement. Example of code that generates the message: #include main(void) { (void) printf("Do the hippy-hippy shake.\n"); } Message ID: E_FUNC_HAS_NO_RETURN_STMT -------------------------------------------------- label redefined The same label name has appeared more than once in the current function. A label's scope is an entire function. Example of code that generates the message: f(void){ int i; i = 1; if (i) { L: while (i) g(); goto L; } L: ; } Message ID: E_LABEL_REDEFINED -------------------------------------------------- end-of-loop code not reached You have written a loop such 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 cannot be executed. Example of code that generates the message: f(void){ int i = 1; while (i) { return 4; } } Message ID: E_END_OF_LOOP_CODE_NOT_REACHED -------------------------------------------------- "break" outside loop or switch A function contains a break statement in an inappropriate place, namely, outside any loop or switch statement. Example of code that generates the message: f(void){ break; } Message ID: E_BREAK_OUTSIDE_LOOP_OR_SWITCH -------------------------------------------------- "continue" outside loop Your program contains a continue statement outside the scope of any loop. Example of code that generates the message: f(void){ continue; } Message ID: E_CONTINUE_OUTSIDE_LOOP_SWITCH -------------------------------------------------- function expects to return value This warning is displayed with the -v option. The current function is declared with a type, but you have used a return statement with no return value expression. Example of code that generates the message: f(void){ return; } Message ID: E_FUNC_EXPECTS_TO_RETURN_VALUE -------------------------------------------------- switch expression must have integral type The code contains a switch statement in which the controlling expression does not have an integral type. This message is a warning if the invalid type is a floating-point type; an error, otherwise. A floating-point switch expression is converted to int. Example of code that generates the message: f(void){ float x; switch (x) { case 4: ; } } Message ID: E_SWITCH_EXP_MUST_BE_INTEGRAL -------------------------------------------------- "case" outside switch A case statement occurs outside the scope of any switch statement. Example of code that generates the message: f(void){ case 4: ; } Message ID: E_CASE_OUTSIDE_SWITCH -------------------------------------------------- non-integral case expression The operand of a case statement must be an integral constant. Example of code that generates the message: f(void){ int i = 1; switch (i) { case 5.0: ; } } Message ID: E_NON_INTEGRAL_CASE_EXPRESSION -------------------------------------------------- "default" outside switch A default label appears outside the scope of a switch statement. Example of code that generates the message: f(void){ default: ; } Message ID: E_DEFAULT_OUTSIDE_SWITCH -------------------------------------------------- duplicate "default" in switch There are two default labels in the current switch statement. Example of code that generates the message: f(void){ int i = 5; switch(i) { default: default: break; } } Message ID: E_DUPLICATE_DEFAULT_IN_SWITCH -------------------------------------------------- unreachable case label The expression you have 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, the value is represented as a hexadecimal value if the case expression is unsigned, decimal if it is signed. Example of code that generates the message: f(void){ unsigned char uc; switch( uc ){ case 256: ; } } Message ID: E_UNREACHABLE_CASE_LABEL -------------------------------------------------- case label affected by conversion This warning is displayed with the -v option. The value for the case label cannot be represented by the type of the controlling expression of a switch statement. This warning is generated if the type of the case expression and the type of the controlling expression have the same size, and the actual bit representation of the case expression is unchanged. 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. In the example, 0xffffffffu is not representable as an int. When the case expression is converted to the type of the controlling expression, its effective value is -1. That is, the case is reached if i has the value -1, rather than 0xffffffff. Example of code that generates the message: f(void){ int i; switch( i ){ case 0xffffffffu: ; } } Message ID: E_CASE_LBL_AFFECTED_CONVERSION -------------------------------------------------- cannot have void object You cannot declare an object of type void. Example of code that generates the message: void v; Message ID: E_CANT_HAVE_VOID_OBJECT -------------------------------------------------- incomplete struct/union/enum tag: name You have declared an object name, with struct, union, or enum type and a tag, but the type is incomplete. Example of code that generates the message: struct s st; Message ID: E_INCOMPLETE_STRUCT_UNION_ENUM -------------------------------------------------- st_save() out of memory The compiler has run out of memory. This is most frequently due to having run out of swap space. Message ID: E_ST_SAVE_OUT_OF_MEMORY -------------------------------------------------- st_lookup() out of memory The compiler has run out of memory. This is most frequently due to having run out of swap space. Message ID: E_ST_LOOKUP_OUT_OF_MEMORY -------------------------------------------------- static function called but not defined The program calls a function name, which has been declared static, but no definition of the 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. Example of code that generates the message: static int statfunc(int); void f(){ int i = statfunc(4); } Message ID: E_STATIC_FUNC_CALLD_NOT_DEFINED -------------------------------------------------- undefined label The code contains a goto in the current function, but the target label is not defined within the function. Example of code that generates the message: f(void){ goto L; } Message ID: E_UNDEFINED_LABEL -------------------------------------------------- unrecognized #pragma ignored This warning is displayed with the -v option. Because #pragma directives are implementation-specific, when the -v compilation flag is set, the C compiler warns about any such directives that it is ignoring. The C compiler does not recognize the #pragma shown in the diagnostic. Example of code that generates the message: #pragma list Message ID: E_UNRECOGNIZED_PRAGMA_IGNORED -------------------------------------------------- no tokens follow "#pragma" This warning is displayed with the -v option. The compiler encounters a #pragma directive that contains no other tokens. Example of code that generates the message: #pragma Message ID: E_NO_TOKENS_FOLLOW_PRAGMA -------------------------------------------------- do_pragma: out of memory The compiler has run out of memory. This is most frequently due to having run out of swap space. Message ID: E_DO_PRAGMA_OUT_OF_MEMORY -------------------------------------------------- ignoring malformed #pragma pack(n) The compiler has encountered a #pragma pack that does not have the form shown. The erroneous directive is ignored. Example of code that generates the message: #pragma pack Message ID: E_IGNORE_MALFORMED_PRAGMA_PACK -------------------------------------------------- bad #pragma pack value: The pack pragma controls the layout of structure offsets, and must be of the form: #pragma pack(n) where, n is a power of 2 less than the strictest alignment on the platform (4 on Intel, 8 on sparc v8, 16 on sparc v9). If n is omitted, member alignment reverts to the natural alignment boundaries. The pragma specifies the strictest alignment desired for any structure member. The pragma applies to all structure definitions which follow it, until the next pack directive. If the same structure is defined in different translation units with different packing, your program may fail in unpredictable ways. In particular, you should not use pragma pack prior to including a header defining the interface of a precompiled library. Recommended usage is to place the pragma in your program code immediately before any structure to be packed, with #pragma pack() immediately following the structure. Example of code that generates the message: #pragma pack(-2) #pragma pack(7) #pragma pack(256) Message ID: E_BAD_PRAGMA_PACK_VALUE -------------------------------------------------- ignoring malformed #pragma weak symbol The compiler has encountered a #pragma weak directive that does not have the form shown. The erroneous directive is ignored. Example of code that generates the message: #pragma weak write,_write Message ID: E_IGNORE_MALFORMED_PRAGMA_WEAK -------------------------------------------------- symbol in #pragma unknown_control_flow has not been declared The compiler has encountered a function name in a #pragma unknown_control_flow that has not been declared. The unknown_control_flow pragma has the following syntax: #pragma unknown_control_flow ( name [ , name ... ] ) The function named in the pragma must be declared prior to the #pragma. Example of code that generates the message: #pragma unknown_control_flow(foo, bar) int foo(); int bar(); The code should be specified as: int foo(); int bar(); #pragma unknown_control_flow(foo, bar) Message ID: E_UNKNOWN_CTRL_FLOW_UNDECLARED -------------------------------------------------- symbol in #pragma no_side_effect has not been declared The compiler has encountered a function name in a #pragma no_side_effect that has not been declared. The unknown_control_flow pragma has the following syntax: #pragma no_side_effect (name [, name ...]) Any function named in the id list must be declared prior to the pragma. Example of code that generates the message: /* ABS function is not defined or declared anywhere */ #pragma no_side_effect (abc) ============ The code should be: int abc(); #pragma no_side_effect (abc) Message ID: E_NO_SIDE_EFFECT_UNDECLARED -------------------------------------------------- ignoring malformed #pragma unknown_control_flow ( id [,id ...] ) A #pragma unknown_control_flow has been specified with incorrect syntax. The correct syntax for the pragma is: #pragma unknown_control_flow ( id [,id ...] ) Example of code that generates the message: #pragma unknown_control_flow {a, b c} Message ID: E_IGNORE_MALFORMED_PRAGMA_UCF -------------------------------------------------- ignoring malformed #pragma no_side_effect ( id [,id ...] ) A #pragma unknown_control_flow has been specified with incorrect syntax. The correct syntax for the pragma is: #pragma no_side_effect (id [, id ...]) Example of code that generates the message: #pragma no_side_effect {a b} Message ID: E_IGNORE_MALFORMED_PRAGMA_NSE -------------------------------------------------- ignoring malformed #pragma init/fini Incorrect syntax used for a #pragma init or #pragma fini. The fini and init pragmas must be specified as: #pragma fini (f1 [,f2, ...,fn]) #pragma init (f1 [,f2, ...,fn]) Example of code that generates the message: #define ONE 1 f(); g(); #pragma fini {f, g} Message ID: E_IGNORE_MALFORMED_PRAGMA -------------------------------------------------- must have type "function-returning-unsigned" The name that is a part of a #pragma int_to_unsigned directive must be an identifier whose type is function-returning-unsigned. Example of code that generates the message: extern int f(int); #pragma int_to_unsigned f l Message ID: E_MUST_B_TYPE_FUNC_RTN_UNSIGNED -------------------------------------------------- ignoring malformed #pragma int_to_unsigned symbol The compiler has encountered a #pragma int_to_unsigned directive that does not have the form shown. The erroneous directive is ignored. Example of code that generates the message: #pragma int_to_unsigned strlen(); Message ID: E_IGNORE_MALFORMED_INTTOUNSIGND -------------------------------------------------- bad #pragma align value The value for #pragma align has to be positive a positive power of 2, no greater than 128. The syntax for the align pragma is: #pragma align integer (id [, id...]) Example of code that generates the message: #define ANO 129 #pragma align ANO (astruct) Good examples: #define MAX 128 #pragma align MAX (astruct, aint, aptr) Message ID: E_BAD_PRAGMA_ALIGN_VALUE -------------------------------------------------- ignoring malformed #pragma align int ( ident [,ident ...] ) Incorrect syntax used for #pragma align. The correct syntax is: #pragma align integer (ident [,ident ...]) where integer is a power of 2 between 1 and 128; valid values are: 1, 2, 4, 8, 16, 32, 64, 128. ident must be a global or static variable; it cannot be an automatic variable. Example of code that generates the message: #pragma align 128 {astruct, aunion} Message ID: E_IGNORE_MALFORMED_PRAGMA_ALIGN -------------------------------------------------- Cannot allocate space, out of memory The compiler has run out of memory. This is most frequently due to having run out of swap space. Message ID: E_REALLOC_OUT_OF_MEMORY -------------------------------------------------- string literal expected after #line < number > A #line < number > directive must be followed by a normal string literal. Message ID: E_STRING_EXPECTED_POUND_LINE -------------------------------------------------- precision lost in bit-field assignment A constant is assigned to a bit-field too small to hold the value without truncation. 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. Example of code that generates the message: void v(void) { struct { signed x:3; /* max value allowed is 3 */ unsigned y:3; /* max value allowed is 7 */ int z:3; /* max value allowed is 7 */ } st; st.x = 3; st.x = 4; st.y = 7; st.y = 8; st.z = 7; st.z = 8; } Message ID: E_PRECISION_LOST_IN_BIT_FIELD -------------------------------------------------- enum never defined An enum is incorrectly declared. Format: Simple Example of code that generates the message: 1 enum e {int, two} en; ============ (1) warning: enum never defined: e Message ID: E_ENUM_NEVER_DEF -------------------------------------------------- equality operator == found where assignment = expected An equality operator is found where a side effect is expected. Format: Simple Example of code that generates the message: 1 void 2 main(void) 3 { 4 int i = 0, j = 1; 5 for (i == j; i < 10; i++) 6 i == j; 7 } ============ (5) warning: equality operator "==" found where assignment "=" expected (6) warning: equality operator "==" found where assignment "=" expected Message ID: E_ASSIGNMENT_NOT_EQUALITY -------------------------------------------------- assignment operator = found where == was expected An assignment operator is found where a conditional expression is expected. This 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). This warning is suppressed when lint is invoked with -h. Format: Simple Example of code that generates the message: 1 int 2 main(void) 3 { 4 int y = 0; 5 int z = 0; 6 int j = 0; 7 int x, i; 8 i = (x = y) && (z == j); 9 if (y = x) 10 i = 1; 11 while (z = y) 12 i++; 13 while ((x = z) == y) 14 i--; 15 return (i + x); 16 } ============ (8) warning: assignment operator "=" found where "==" was expected (9) warning: assignment operator "=" found where "==" was expected (11) warning: assignment operator "=" found where "==" was expected Message ID: E_EQUALITY_NOT_ASSIGNMENT -------------------------------------------------- only 0 or 2 parameters allowed: main() The function main() in your program is defined with only one parameter or more than two parameters, in violation of the ANSI C requirement. Format: Simple Example of code that generates the message: 1 void 2 main(int argc, char **argv, char **envp) 3 {} ============ (2) warning: only 0 or 2 parameters allowed: main() Message ID: E_MAIN_PARAM -------------------------------------------------- function must be of type int: main() You have used a main() that does not return int in violation of ANSI C restrictions. Format: Simple Example of code that generates the message: 1 char * 2 main(void) 3 { 4 return "a"; 5 } ============ (2) warning: function must be of type int: main() Message ID: E_MAIN_RET_VAL -------------------------------------------------- nonportable character constant A multicharacter character constant in your program may not be portable. Format: Simple Example of code that generates the message: 1 int c = 'abc'; ============ (1) warning: nonportable character constant Message ID: E_NONPORTABLE_CHAR_CONST -------------------------------------------------- function returns pointer to automatic A function returns a pointer to an automatic variable. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int * 2 f(int x) 3 { 4 int ia[10]; 5 int i; 6 if (x == 1) 7 return ia; 8 else 9 return 10 } ============ (7) warning: function returns pointer to automatic (9) warning: function returns pointer to automatic Message ID: E_FUNC_RET_PTR_TO_AUTO -------------------------------------------------- function returns pointer to parameter A function returns a pointer to a parameter. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int *f(int i) 2 { 3 return 4 } ============ (3) warning: function returns pointer to parameter Message ID: E_FUNC_RET_PTR_TO_PARAM -------------------------------------------------- fallthrough on case statement Execution falls 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 example below), suppresses this message for that statement; invoking lint with -h suppresses it for every statement. Format: Simple Example of code that generates the message: 1 int 2 f(int i) 3 { 4 void error(); 5 switch (i) { 6 case 10: 7 i = 0; 8 case 12: 9 return (i); 10 case 14: 11 break; 12 case 15: 13 case 16: 14 break; 15 case 18: 16 i = 0; 17 /* FALLTHRU */ 18 case 20: 19 error("bad number"); 20 /* NOTREACHED */ 21 case 22: 22 return (i); 23 } 24 return (i); 25 } ============ (8) warning: fallthrough on case statement Message ID: E_CASE_FALLTHRU -------------------------------------------------- directive must be in if/else: /* EMPTY */ The lint directive /* EMPTY */ must occure within the scope of an #if or #else. Example of code the generates the message: int f(void) { /* EMPTY */ }; Message ID: E_IF_ELSE_DIRECTIVE -------------------------------------------------- statement has no consequent: if An if statement has a null if part. Inserting /* EMPTY */ between the controlling expression of the if and semicolon suppresses this message for that statement; invoking lint with -h suppresses it for every statement. Format: Simple Example of code that generates the message: 1 void 2 v(int i) 3 { 4 if (i); 5 if (i == 10) 6 /* EMPTY */ ; 7 else 8 return; 9 } ============ (4) warning: statement has no consequent: if Message ID: E_NOP_IF_STMT -------------------------------------------------- statement has no consequent: else An if statement has a null else part. Inserting /* EMPTY */ between the else and semicolon suppresses this message for that statement; invoking lint with -h suppresses it for every statement. Format: Simple Example of code that generates the message: 1 void 2 v(int i) 3 { 4 if (i) 5 return; 6 else; 7 } ============ (6) warning: statement has no consequent: else Message ID: E_NOP_ELSE_STMT -------------------------------------------------- static unused A variable or function is 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. Example of code that generates the message: 1 static int i; 2 static int f(void); 3 static int j = 1; ============ static unused (1) i (2) f (3) j Message ID: E_STATIC_UNUSED1 -------------------------------------------------- static unused A variable or function is 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. Example of code that generates the message: 1 static int i; 2 static int f(void); 3 static int j = 1; Message ID: E_STATIC_UNUSED -------------------------------------------------- argument unused in function A function argument is not used. Preceding the function definition with /* ARGSUSEDn */ suppresses this message for all but the first n arguments; invoking lint with -v suppresses it for every argument. Example of code that generates the message: 1 static int f(int, int); 2 int 3 main(int argc, char *argv[]) 4 { 5 return (f(argc, 0)); 6 } 7 /* ARGSUSED1 */ 8 9 int 10 f(int x, int y) 11 { 12 return x; 13 } 14 ============ argument unused in function (3) argv in main Message ID: E_FUNC_ARG_UNUSED1 -------------------------------------------------- argument unused in function A function argument is not used. Preceding the function definition with /* ARGSUSEDn */ suppresses this message for all but the first n arguments; invoking lint with -v suppresses it for every argument. Example of code that generates the message: 1 static int f(int, int); 2 int 3 main(int argc, char *argv[]) 4 { 5 return (f(argc, 0)); 6 } 7 /* ARGSUSED1 */ 8 9 int 10 f(int x, int y) 11 { 12 return x; 13 } 14 Message ID: E_FUNC_ARG_UNUSED -------------------------------------------------- variable unused in function A variable is declared, but never used in a function. Example of code that generates the message: 1 void main(void) 2 { 3 int i, j; 4 static k; 5 } 6 7 ============ variable unused in function (3) i in main (3) j in main (4) k in main Message ID: E_FUNC_VAR_UNUSED1 -------------------------------------------------- variable unused in function A variable is declared, but never used in a function. Example of code that generates the message: 1 void main(void) 2 { 3 int i, j; 4 static k; 5 } 6 7 Message ID: E_FUNC_VAR_UNUSED -------------------------------------------------- set but not used in function An automatic variable or a function parameter is declared and set, but not used in a function. Example of code that generates the message: 1 void f(int i) 2 { 3 int j = 1; 4 i = 1; 5 } ============ set but not used in function (1) i in f (3) j in f Message ID: E_FUNC_SET_NOT_USED1 -------------------------------------------------- set but not used in function An automatic variable or a function parameter is declared and set, but not used in a function. Example of code that generates the message: 1 void f(int i) 2 { 3 int j = 1; 4 i = 1; 5 } Message ID: E_FUNC_SET_NOT_USED -------------------------------------------------- pointer casts may be troublesome You have cast a pointer to one object type to a pointer to a different object type. This message is issued only when lint is invoked with -p, and is not issued for the generic pointer void *. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip; 5 char *cp = 0; 6 ip = (int *) cp; 7 } ============ pointer casts may be troublesome (6) Message ID: E_BAD_PTR_CAST -------------------------------------------------- statement not reached A function contains a statement that cannot be reached. Preceding an unreached statement with /* NOTREACHED */ suppresses this message for that statement; invoking lint with -b suppresses it for every unreached break and empty statement. This message is also issued by the compiler, but cannot be suppressed. Example of code that generates the message: 1 void 2 v(int i) 3 { 4 switch (i) { 5 case 1: 6 return; 7 break; 8 case 2: 9 return; 10 /* NOTREACHED */ 11 break; 12 } 13 } ============ statement not reached (7) Message ID: E_STMT_NOT_REACHED -------------------------------------------------- implicitly declared to return int The program calls a function which has not been previously declared. In this case, lint assumes the function returns an int. Example of code that generates the message: 1 void 2 v(void) 3 { 4 f(); 5 } ============ implicitly declared to return int (4) f Message ID: E_RET_INT_IMPLICITLY1 -------------------------------------------------- implicitly declared to return int The program calls a function which has not been previously declared. In this case, lint assumes the function returns an int. Example of code that generates the message: 1 void 2 v(void) 3 { 4 f(); 5 } Message ID: E_RET_INT_IMPLICITLY -------------------------------------------------- pointer cast may result in improper alignment You have cast a pointer to one object type 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. This warning is suppressed when lint is invoked with -h. Example of code that generates the message: 1 void 2 main(void) 3 { 4 short *sp = 0; 5 int *ip; 6 ip = (int *) sp; 7 } 8 ============ pointer cast may result in improper alignment (6) Message ID: E_BAD_PTR_CAST_ALIGN -------------------------------------------------- bitwise operation on signed value possibly nonportable The operand of a bitwise operator is 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. Message ID: E_POSSIBLY_NONPORT_SBITWISE_OP -------------------------------------------------- bitwise operation on signed value nonportable The operand of a bitwise operator is 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. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 signed int j; 6 i = i & 055; 7 j = j | 022; 8 } ============ bitwise operation on signed value nonportable (6) (7) Message ID: E_NONPORT_SBITWISE_OP -------------------------------------------------- conversion to larger integral type may sign-extend incorrectly A variable of type "plain" char is assigned to a variable of a larger integral type. Whether a "plain" char is treated as signed or unsigned is implementation-defined. This message is issued only when lint is invoked with -p, and is suppressed when it is invoked with -a. Example of code that generates the message: 1 int 2 main(void) 3 { 4 char c = 0; 5 long l; 6 l = c; 7 return (l); 8 } ============ conversion to larger integral type may sign-extend incorrectly (6) Message ID: E_BAD_SIGN_EXTEND -------------------------------------------------- assignment causes implicit narrowing conversion An object is assigned to one of a smaller type. Invoking lint with -a suppresses this message. So does an explicit cast to the smaller type. Example of code that generates the message: 1 void 2 main(void) 3 { 4 float f; 5 long long l = 2.5; 6 f = l; 7 } ============ assignment causes implicit narrowing conversion (6) Message ID: E_ASSIGN_NARROW_CONV -------------------------------------------------- function falls off bottom without returning value A non-void function does not return a value to the invoking function. If the closing curly brace is truly not reached, preceding it with /* NOTREACHED */ suppresses this message. Example of code that generates the message: 1 int f(void) {} 2 void v(void) {} 3 h(void) 4 { 5 exit(1); 6 /* NOTREACHED */ 7 } ============ function falls off bottom without returning value (1) f Message ID: E_FUNC_NO_RET_VAL1 -------------------------------------------------- function falls off bottom without returning value A non-void function does not return a value to the invoking function. If the closing curly brace is truly not reached, preceding it with /* NOTREACHED */ suppresses this message. Example of code that generates the message: 1 int f(void) {} 2 void v(void) {} 3 h(void) 4 { 5 exit(1); 6 /* NOTREACHED */ 7 } Message ID: E_FUNC_NO_RET_VAL -------------------------------------------------- declaration unused in block An external variable or function is declared but not used in an inner block. Example of code that generates the message: 1 int 2 main(void) 3 { 4 int f(); 5 int g(); 6 return f(); 7 } ============ declaration unused in block (5) g Message ID: E_BLOCK_DECL_UNUSED1 -------------------------------------------------- declaration unused in block An external variable or function is declared but not used in an inner block. Example of code that generates the message: 1 int 2 main(void) 3 { 4 int f(); 5 int g(); 6 return f(); 7 } Message ID: E_BLOCK_DECL_UNUSED -------------------------------------------------- name used but not defined A nonstatic external variable or function is declared but not defined in any file. This message is suppressed when lint is invoked with -u. Example of code that generates the message: 1 extern int f(void); 2 int 3 main(void) 4 { 5 return f(); 6 } ============ name used but not defined f f.c(5) Message ID: E_NAME_USED_NOT_DEF1 -------------------------------------------------- name used but not defined A nonstatic external variable or function is declared but not defined in any file. This message is suppressed when lintis invoked with -u. Example of code that generates the message: 1 extern int f(void); 2 int 3 main(void) 4 { 5 return f(); 6 } Message ID: E_NAME_USED_NOT_DEF2 -------------------------------------------------- name defined but never used A variable or function is defined but not used in any file. This message is suppressed when lint is invoked with -u. Example of code that generates the message: 1 int i; ============ name defined but never used i f.c(1) Message ID: E_NAME_DEF_NOT_USED1 -------------------------------------------------- name defined but never used A variable or function is defined but not used in any file. This message is suppressed when lint is invoked with -u. Example of code that generates the message: 1 int i; Message ID: E_NAME_DEF_NOT_USED2 -------------------------------------------------- name declared but never used or defined A nonstatic external variable or function is declared but not used or defined in any file. This message is suppressed when lint is invoked with -x. Example of code that generates the message: 1 extern int f(void); 2 static int g(void); ============ name declared but never used or defined f f.c(1) Message ID: E_NAME_DECL_NOT_USED_DEF1 -------------------------------------------------- name declared but never used or defined A nonstatic external variable or function is declared but not used or defined in any file. This message is suppressed when lint is invoked with -x. Example of code that generates the message: 1 extern int f(void); 2 static int g(void); Message ID: E_NAME_DECL_NOT_USED_DEF2 -------------------------------------------------- name multiply defined A variable is defined in more than one source file. Example of code that generates the message: file f.c: 1 char i = 'a'; file f_1.c: 1 long i = 1; ============ name multiply defined i f.c(1) :: f_1.c(1) Message ID: E_NAME_MULTIPLY_DEF1 -------------------------------------------------- name multiply defined A variable is defined in more than one source file. Example of code that generates the message: file f.c: 1 char i = 'a'; file f_1.c: 1 long i = 1; Message ID: E_NAME_MULTIPLY_DEF2 -------------------------------------------------- value type used inconsistently The return type in a function call does not match the return type in the function definition. Example of code that generates the message: file f.c: 1 int * 2 f(int *ip) 3 { 4 return ip; 5 } file f_1.c: 1 void 2 g(void) 3 { 4 int i, *ip = 5 i = f(ip); 6 } ============ value type used inconsistently f f.c(2) int *() :: f_1.c(5) int () Message ID: E_INCONS_VAL_TYPE_USED1 -------------------------------------------------- value type used inconsistently The return type in a function call does not match the return type in the function definition. Example of code that generates the message: file f.c: 1 int * 2 f(int *ip) 3 { 4 return ip; 5 } file f_1.c: 1 void 2 g(void) 3 { 4 int i, *ip = 5 i = f(ip); 6 } Message ID: E_INCONS_VAL_TYPE_USED2 -------------------------------------------------- value type declared inconsistently The return type in a function declaration or definition does not match the return type in another declaration or definition of the function. This message is also issued for inconsistent declarations of variable types. Example of code that generates the message: file f.c: 1 void v(void) {} 2 void g(void); 3 extern int i; file f_1.c: 1 extern int f(void); 2 extern int g(void); 3 extern char i; ============ value type declared inconsistently g f.c(2) void () :: f_1.c(2) int () i f.c(3) int :: f_1.c(3) char Message ID: E_INCONS_VAL_TYPE_DECL1 -------------------------------------------------- value type declared inconsistently The return type in a function declaration or definition does not match the return type in another declaration or definition of the function. This message is also issued for inconsistent declarations of variable types. Example of code that generates the message: file f.c: 1 void v(void) {} 2 void g(void); 3 extern int i; file f_1.c: 1 extern int f(void); 2 extern int g(void); 3 extern char i; Message ID: E_INCONS_VAL_TYPE_DECL2 -------------------------------------------------- function argument ( number ) used inconsistently The argument types in a function call does not match the types of the formal parameters in the function definition. Example of code that generates the message: file f.c: 1 int 2 f(int *x, int *y) 3 { 4 return *x + *y; 5 } file f1.c: 1 int 2 main(void) 3 { 4 int i = 0; 5 extern int f(int, int); 6 return f(1, i); 7 } ============ function argument ( number ) used inconsistently f (arg 2) f.c(3) int * :: f1.c(6) int Message ID: E_INCONS_ARG_USED1 -------------------------------------------------- argument used inconsistently The types of actual and dummy arguments are mismatched for the function call. Format: Simple Example of code that generates the message: 1 static void 2 g(x, y) 3 int x; 4 int *y; 5 { 6 return; 7 } 8 void 9 main(void) 10 { 11 float f = 4.5; 12 g(f, (int *) &f); 13 } ============ "f.c", line 12: warning: argument does not match remembered type: arg #1 argument used inconsistently: g(arg 1) in f.c(5) int and f.c(12) double Message ID: E_INCONS_ARG_USED2 -------------------------------------------------- function called with variable number of arguments A function is called with the wrong number of arguments. Preceding a function definition with /* VARARGSn */ suppresses this message for calls with n or more arguments; defining and declaring a function with the ANSI C notation "..." suppresses it for every argument. Example of code that generates the message: 1 int f(int x, int y, int z) 2 { 3 return x + y + z; 4 } 5 int g(int x, ...) 6 { 7 return x; 8 } 9 /* VARARGS1 */ 10 int h(int x, int y, int z) 11 { 12 return x + y + z; 13 } 14 void main(void) 15 { 16 extern int f(), h(), g(int i, ...); 17 f(); 18 g(1, 2, 3, 4); 19 h(1, 2, 3, 4, 5); 20 } ============ function called with variable number of arguments f f.c(1) :: f.c(17) Message ID: E_FUNC_USED_VAR_ARG1 -------------------------------------------------- function called with variable number of arguments A function is called with the wrong number of arguments. Preceding a function definition with /* VARARGSn */ suppresses this message for calls with n or more arguments; defining and declaring a function with the ANSI C notation "..." suppresses it for every argument. Example of code that generates the message: 1 int f(int x, int y, int z) 2 { 3 return x + y + z; 4 } 5 int g(int x, ...) 6 { 7 return x; 8 } 9 /* VARARGS1 */ 10 int h(int x, int y, int z) 11 { 12 return x + y + z; 13 } 14 void main(void) 15 { 16 extern int f(), h(), g(int i, ...); 17 f(); 18 g(1, 2, 3, 4); 19 h(1, 2, 3, 4, 5); 20 } Message ID: E_FUNC_USED_VAR_ARG2 -------------------------------------------------- function value is used, but none returned A non-void function does not contain a return statement, yet is used for its value in an expression. Example of code that generates the message: file f.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 Message ID: E_FUNC_VAL_USED_NONE_RET1 -------------------------------------------------- function value is used, but none returned A non-void function does not contain a return statement, yet is used for its value in an expression. Example of code that generates the message: file f.c: 1 extern int fun(); 2 main() 3 { 4 return fun(); 5 } file f2.c: 1 int fun() 2 {} Message ID: E_FUNC_VAL_USED_NONE_RET2 -------------------------------------------------- function returns value which is always ignored A function contains a return statement, and every call to the function ignores its return value. Example of code that generates the message: 1 int f(void) 2 { 3 return 1; 4 } 5 extern int f(void); 6 int main(void) 7 { 8 f(); 9 return 1; 10 } ============ function returns value which is always ignored f Message ID: E_FUNC_RET_ALWAYS_IGNOR1 -------------------------------------------------- function returns value which is always ignored A function contains a return statement, and every call to the function ignores its return value. Example of code that generates the message: 1 int f(void) 2 { 3 return 1; 4 } 5 extern int f(void); 6 int main(void) 7 { 8 f(); 9 return 1; 10 } Message ID: E_FUNC_RET_ALWAYS_IGNOR2 -------------------------------------------------- function returns value which is sometimes ignored A function contains a return statement and some, but not all, calls to the function ignored its return value. Example of code that generates the message: 1 int f(void) 2 { 3 return 1; 4 } 5 extern int f(void); 6 int main(void) 7 { 8 if(f()) { 9 return f(); 10 } 11 else { 12 f(); 13 return 1; 14 } 15 } ============ function returns value which is sometimes ignored f Message ID: E_FUNC_RET_MAYBE_IGNORED1 -------------------------------------------------- function returns value which is sometimes ignored A function contains a return statement and some, but not all, calls to the function ignored its return value. Example of code that generates the message: 1 int f(void) 2 { 3 return 1; 4 } 5 extern int f(void); 6 int main(void) 7 { 8 if(f()) { 9 return f(); 10 } 11 else { 12 f(); 13 return 1; 14 } 15 } Message ID: E_FUNC_RET_MAYBE_IGNORED2 -------------------------------------------------- function argument ( number ) declared inconsistently The parameter types in a function prototype declaration or definition differ from their types in another declaration or definition. Example of code that generates the message: file f.c: 1 int f(int); 2 int g(int); file f_1.c: 1 int f(int *ip); 2 int g(int *ip) {return *ip;} 3 ============ function argument ( number ) declared inconsistently g (arg 1) f_1.c(2) int * :: f.c(2) int f (arg 1) f.c(1) int :: f_1.c(1) int * Message ID: E_INCONS_ARG_DECL1 -------------------------------------------------- function declared with variable number of arguments The number of parameters in a function prototype declaration or definition differ from their number in another declaration or definition. Declaring and defining the prototype with the ANSI C notation "..." suppresses this warning if all declarations have the same number of arguments. Example of code that generates the message: file f.c: 1 int 2 f(int x, int y) 3 { 4 return (x + y); 5 } 6 int 7 g(void) 8 { 9 int i, j = 0, k = 0; 10 i = f(j, k); 11 return (i); 12 } file f_1.c: 1 int f(int); 2 int g(int); ============ function declared with variable number of arguments f f.c(2) :: f_1.c(1) g f.c(7) :: f_1.c(2) Message ID: E_FUNC_DECL_VAR_ARG1 -------------------------------------------------- function declared with variable number of args The number of parameters in a function prototype declaration or definition differ from their number in another declaration or definition. Declaring and defining the prototype with the ANSI C notation "..." suppresses this warning if all declarations have the same number of arguments. Example of code that generates the message: file f.c: 1 int 2 f(int x, int y) 3 { 4 return (x + y); 5 } 6 int 7 g(void) 8 { 9 int i, j = 0, k = 0; 10 i = f(j, k); 11 return (i); 12 } file f_1.c: 1 int f(int); 2 int g(int); Message ID: E_FUNC_DECL_VAR_ARG2 -------------------------------------------------- may be indistinguishable due to truncation External names in your program may be indistinguishable when it is ported to another machine because of implementation-defined restrictions as to length or case. 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. Example of code that generates the message: 1 int foobar1; 2 int FooBar12; 3 int foobar2; 4 int FOOBAR12; ============ under -Xc: may be indistinguishable due to truncation FooBar12 in f.c(2) :: foobar1 in f.c(1) foobar2 in f.c(3) :: FooBar12 in f.c(2) FOOBAR12 in f.c(4) :: foobar2 in f.c(3) under -p: may be indistinguishable due to truncation FOOBAR12 (4) in f.c :: FooBar12 (2) in f.c Message ID: E_INDISTING_FROM_TRUNC1 -------------------------------------------------- may be indistinguishable due to truncation External names in your program may be indistinguishable when it is ported to another machine because of implementation-defined restrictions as to length or case. 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. Example of code that generates the message: 1 int foobar1; 2 int FooBar12; 3 int foobar2; 4 int FOOBAR12; Message ID: E_INDISTING_FROM_TRUNC2 -------------------------------------------------- too many arguments for format A control string of a [fs]printf() or [fs]scanf() function call has fewer conversion specifications than there are arguments remaining in the call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 0, j = 1; 6 (void) printf("%d", i, j); 7 } ============ too many arguments for format printf f.c(6) Message ID: E_TOO_MANY_ARG_FOR_FMT1 -------------------------------------------------- too many arguments for format A control string of a [fs]printf() or [fs]scanf() function call has fewer conversion specifications than there are arguments remaining in the call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 0, j = 1; 6 (void) printf("%d", i, j); 7 } Message ID: E_TOO_MANY_ARG_FOR_FMT2 -------------------------------------------------- malformed format string A [fs]printf() or [fs]scanf() control string is formed incorrectly. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 (void) printf("%y"); 6 } ============ malformed format string printf f.c(5) Message ID: E_BAD_FORMAT_STR1 -------------------------------------------------- malformed format string A [fs]printf() or [fs]scanf() control string is formed incorrectly. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 (void) printf("%y"); 6 } Message ID: E_BAD_FORMAT_STR2 -------------------------------------------------- too few arguments for format A control string of a [fs]printf() or [fs]scanf() function call has more conversion specifications than there were arguments remaining in the call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 1; 6 (void) printf("%d%d", i); 7 } ============ too few arguments for format printf f.c(6) Message ID: E_TOO_FEW_ARG_FOR_FORMAT1 -------------------------------------------------- too few arguments for format A control string of a [fs]printf() or [fs]scanf() function call has more conversion specifications than there were arguments remaining in the call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 1; 6 (void) printf("%d%d", i); 7 } Message ID: E_TOO_FEW_ARG_FOR_FORMAT2 -------------------------------------------------- function argument ( number ) type inconsistent with format An argument is inconsistent with the corresponding conversion specification in the control string of a [fs]printf() or [fs]scanf() function call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 0; 6 (void) printf("%s", i); 7 } 8 ============ function argument ( number ) type inconsistent with format printf (arg 2) int :: (format) char * f.c(6) Message ID: E_BAD_FORMAT_ARG_TYPE1 -------------------------------------------------- function argument ( number ) type inconsistent with format An argument is inconsistent with the corresponding conversion specification in the control string of a [fs]printf() or [fs]scanf() function call. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int i = 0; 6 (void) printf("%s", i); 7 } 8 Message ID: E_BAD_FORMAT_ARG_TYPE2 -------------------------------------------------- declared global, could be static An external variable or function is declared global, that is, not declared static, but is referenced only in the file in which it is defined. This message is suppressed when lint is invoked with -m. Example of code that generates the message: 1 int 2 f(void) 3 { 4 return 1; 5 } 6 main(void) 7 { 8 return f(); 9 } ============ declared global, could be static f f.c(2) Message ID: E_GLOBAL_COULD_BE_STATIC1 -------------------------------------------------- declared global, could be static An external variable or function is declared global, that is, not declared static, but is referenced only in the file in which it is defined. This message is suppressed when lint is invoked with -m. Example of code that generates the message: 1 int 2 f(void) 3 { 4 return 1; 5 } 6 main(void) 7 { 8 return f(); 9 } Message ID: E_GLOBAL_COULD_BE_STATIC2 -------------------------------------------------- type has > 16 modifiers, only 16 will be used The number of modifiers used for a name description exceeds the limit of 16. Format: Simple Example of code that generates the message: 1 int ************************ip = 0; ============ (1) warning: type has > 16 modifiers, only 16 will be used Message ID: E_MODIFIER_OVERFLOW -------------------------------------------------- argument number mismatch with directive: /* VARARGS */:effective args() must be no less than those checked by directive(n) If the directive /* VARARGSn */ is applied to a function having less than n parameters, n is decreased to the number of parameters appearing in the function header. Example of code that generates the message: 1 /* VARARGS4 */ 2 int 3 f(int x, int y, int z) 4 { 5 return (x + y + z); 6 } ============ (3) warning: argument number mismatch with directive: /* VARARGS4 */: effective args(3) must be no less than those checked by directive(4) Message ID: E_DIRECTIVE_TOO_MANY_ARG -------------------------------------------------- argument number mismatch with directive: /* VARARGS */:effective args() must be no less than those checked by directive(n) If the directive /* VARARGSn */ is applied to a function having less than n parameters, n is decreased to the number of parameters appearing in the function header. Example of code that generates the message: 1 /* VARARGS4 */ 2 int 3 f(int x, int y, int z) 4 { 5 return (x + y + z); 6 } ============ (3) warning: argument number mismatch with directive: /* VARARGS4 */: effective args(3) must be no less than those checked by directive(4) Message ID: E_DIRECTIVE_TOO_MANY_ARG2 -------------------------------------------------- variable may be used before set The first reference to an automatic, non-array variable occurs at a line number earlier than the first assignment to the variable. Taking the address of a variable implies both a set and a use; the first assignment to any member of a struct or union implies an assignment to the entire struct or union. Format: Simple Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i, j, k; 5 static int x; 6 k = j; 7 i = i + 1; 8 x = x + 1; 9 } ============ (6) warning: variable may be used before set: j (7) warning: variable may be used before set: i Message ID: E_VAR_USED_BEFORE_SET -------------------------------------------------- constant in conditional context The controlling expression of an if, while, or for statement is a constant. Preceding the statement with /* CONSTCOND */ suppresses this message. Format: Simple Example of code that generates the message: 1 void 2 main(void) 3 { 4 if (!1) 5 return; 6 while (1) 7 f(); 8 for (; 1;); 9 for (;;); 10 /* CONSTCOND */ 11 while (1); 12 } ============ (4) warning: constant in conditional context (6) warning: constant in conditional context (8) warning: constant in conditional context Message ID: E_CONSTANT_CONDITION -------------------------------------------------- evaluation order undefined A variable is changed by a side effect and used elsewhere in the same expression. Format: Simple Example of code that generates the message: 1 static int ia[10]; 2 void 3 v(void) 4 { 5 int i = 2; 6 ia[i++] = i; 7 } ============ (6) warning: evaluation order undefined: i Message ID: E_UNDEF_EVAL_ORDER -------------------------------------------------- logical expression always false: op "&&" A logical AND expression checks for equality of the same variable to two different constants, or has the constant 0 as an operand. In the latter case, preceding the expression with /* CONSTCOND */ suppresses this message. Format: Simple Example of code that generates the message: 1 int 2 main(int argc, char *argv[]) 3 { 4 int i = argc; 5 i = (i == 1) && (i == 2); 6 i = (i == 1) && (i == 1); 7 i = (1 == i) && (i == 2); 8 i = (i == 1) && 0; 9 /* CONSTCOND */ 10 i = (0 && (i == 1)); 11 return (i); 12 } ============ (5) warning: logical expression always false: op "&&" (7) warning: logical expression always false: op "&&" (8) warning: logical expression always false: op "&&" Message ID: E_FALSE_LOGICAL_EXPR -------------------------------------------------- logical expression always true: op "|| " A logical OR expression checks for inequality of the same variable to two different constants, or has a nonzero integral constant as an operand. In the latter case, preceding the expression with /* CONSTCOND */ suppresses this message. Format: Simple Example of code that generates the message: 1 int f(int i) 2 { 3 i = (i != 1) || (i != 2); 4 i = (i != 1) || (i != 1); 5 i = (1 != i) || (i != 2); 6 i = (i == 10) || 1; 7 /* CONSTCOND */ 8 i = (1 || (i == 10)); 9 return i; 10 } ============ (3) warning: logical expression always true: op "||" (5) warning: logical expression always true: op "||" (6) warning: logical expression always true: op "||" Message ID: E_TRUE_LOGICAL_EXPR -------------------------------------------------- suspicious comparison of char or unsigned value with a negative constant or 0 A comparison is performed on a variable of type "plain" char or unsigned that implies it may have a negative value or 0. Whether a "plain" char is treated as signed or nonnegative is implementation-defined. Format: Simple Example of code that generates the message: 1 void 2 v(char c, signed char sc) 3 { 4 int i; 5 i = (c == -5); 6 i = (c < 0); 7 i = (sc < 0); 8 } ============ (5) warning: suspicious comparison of char with negative constant: op "==" (6) warning: suspicious comparison of char with 0: op "<" Example of code that generates the message: 1 void 2 v(unsigned int ui) 3 { 4 int i; 5 i = (ui > -2); 6 i = (ui < 0); 7 i = (ui <= 0); 8 i = (ui >= 0); 9 i = (ui > 0); 10 i = (-2 < ui); 11 i = (ui == -1); 12 i = (ui == -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 "==" Message ID: E_SUSPICIOUS_COMPARISON -------------------------------------------------- constant operand to op The operand of the NOT operator is a constant. Preceding the statement with /* CONSTCOND */ suppresses this message for that statement; invoking lint with -h suppresses it for every statement. Format: Simple Example of code that generates the message: 1 void main(void) 2 { 3 if (! 0) return; 4 /* CONSTCOND */ 5 if (! 0) return; 6 } ============ (3) warning: constant operand to op: "!" Message ID: E_CONST_EXPR -------------------------------------------------- assignment of negative constant to unsigned type You have assigned a negative constant to an unsigned integral type. An unsigned integral type can only hold positive values or the value zero. Example of code that generates the message: unsigned char uc = -1; unsigned int b = -13; Message ID: E_ASSIGN_NEG_CONST_TO_UNSIGNED -------------------------------------------------- constant truncated by assignment An integral constant expression is assigned or returned to an object of an integral type that cannot hold the value without truncation. Format: Simple Example of code that generates the message: 1 unsigned char 2 f() 3 { 4 unsigned char uc; 5 uc = 255; 6 uc = 256; 7 return uc; 8 } ============ (6) warning: constant truncated by assignment Message ID: E_CONST_TRUNCATED_BY_ASSIGN -------------------------------------------------- conversion of pointer loses bits A pointer is assigned to an object of an integral type that is smaller than the pointer. Format: Simple Example of code that generates the message: 1 void 2 v(void) 3 { 4 int *ip; 5 char c; 6 c = ip; 7 } ============ (6) warning: conversion of pointer loses bits Message ID: E_PTR_CONV_LOSES_BITS -------------------------------------------------- array subscript cannot be negative The constant expression that represents the subscript of a true array (as opposed to a pointer) had a negative value. Format: Simple Example of code that generates the message: 1 int 2 main(void) 3 { 4 int ia[10]; 5 return ia[5 * 2 / 10 - 2]; 6 } ============ (5) warning: array subscript cannot be negative: -1 Message ID: E_NEG_ARRAY_SUBSCRIPT -------------------------------------------------- array subscript cannot be > value The value of an array element's subscript exceeds the upper array bound. Format: Simple Example of code that generates the message: 1 int 2 f(void) 3 { 4 int ia[10]; 5 int *ip = ia; 6 while (ip != &ia[10]) /* using address is ok */ 7 ip++; 8 return ia[5 + 6]; 9 } ============ (8) warning: array subscript cannot be > 9: 11 Message ID: E_OVERFLOW_ARRAY_SUBSCRIPT -------------------------------------------------- precedence confusion possible; parenthesize You have not parenthesized an expression that mixes a logical and a bitwise operator. This message is suppressed when lint is invoked with -h. Format: Simple Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i = 0, j = 0, x; 5 x = (2 + i == 0); 6 x = (i & j == 0); /* eval'd (i & (j == 0)) */ 7 x = (j == 1 & i); /* eval'd ((j == 1) & i) */ 8 } ============ (6) warning: precedence confusion possible; parenthesize (7) warning: precedence confusion possible; parenthesize Message ID: E_PRECEDENCE_CONFUSION -------------------------------------------------- variables of type long long not allowed by printf and scanf family of routines on hp Printing or reading variables of type long long is not supported by the printf and scanf family of routines on HP-UX. Message ID: E_HPUX_BAD_FORMAT_STR1 -------------------------------------------------- variables of type long long not allowed by printf and scanf family of routines on hp Printing or reading variables of type long long is not supported by the printf and scanf family of routines on HP-UX. Message ID: E_HPUX_BAD_FORMAT_STR2 -------------------------------------------------- name defined but never used: You have defined a variable or function but never accessed it anywhere in the source file. Example of code that generates the message: int f(); int main() { int a = 10; printf("never call function f() " ); return 0; } int f() { return (1+1); } Message ID: E_NAME_DEF_NOT_USED -------------------------------------------------- name declared but never used or defined You have declared a variable or function but never accessed it anywhere in the source file. Example of code that generates the message: int f(); int main() { int a; printf("never call to function f() or use a"); return 0; } Message ID: E_NAME_DECL_NOT_USED_DEF -------------------------------------------------- name multiply defined: You have declared a variable several times in different places. Watch out that the variable you wish to reference is not hidden by a definition of another variable within the current scope. Example of code that generate the message: int x = 10; /* global var: x */ int main() { int x = 1; /* another declaration of x */ return f(x); } int f(int y) { int x = 5; /* declare local x */ return (y + g(x)); /* using x in the current scope */ } int g(int z) { return (x*z); /* using x here */ } Message ID: E_NAME_MULTIPLY_DEF -------------------------------------------------- read error from file A file system error has occured when reading the indicated file. This is not an error from the source program. Message ID: E_F_RD_ERR -------------------------------------------------- write error in file A file system error has occured when reading the indicated file. This is not an error from the source program. Message ID: E_F_WR_ERR -------------------------------------------------- cannot open file A file system error has occured when reading the indicated file. This is not an error from the source program. Message ID: E_OPEN_F -------------------------------------------------- enum member declared inconsistently Different values defined for the enum members with the same name. Example of code that generates the message: file f.c: 1 typedef enum { 2 ONE = 1, TWO = 3 3 } e; file f_1.c: 1 typedef enum { 2 ONE = 1, TWO 3 } e; ============ enum member declared inconsistently TWO 3 f.c(2) :: 2 f_1.c(2) Message ID: E_ENUM -------------------------------------------------- different definitions of macro Two or more source files define the same macro name differently. Example of code that generates the message: file f.c: 1 #define MAX_I 1 file f_1.c: 1 #define MAX_I 2 ============ different definitions of macro MAX_I f.c(1) :: f_1.c(1) Message ID: E_MCR_NODIFF -------------------------------------------------- include file is unnecessary The indicated include file is not used during the compilation of the program. Example of code that generates the message: #include /* no math functions used */ int main () { return 0; } Message ID: E_INCL_NO_US -------------------------------------------------- enum member defined but never used Unused enum member found. Example of code that generates the message: 1 enum { 2 x, 3 y = 3, 4 z 5 } en; 6 main(void) 7 { 8 en = z; 9 return en; 10 } ============ enum member defined but never used x f.c(2) y f.c(3) Message ID: E_ENUM_UNUSE -------------------------------------------------- typedef defined but not used Declared typedef is never used in the program. Example of code that generates the message: 1 typedef long int LONG_INT_t; 2 void 3 main(void) 4 { 5 return; 6 } ============ typedef defined but not used LONG_INT_t f.c(1) Message ID: E_TYPEDEF_UNUSE -------------------------------------------------- typedef declared inconsistently Different definitions exist for the same typedef name. Example of code that generates the message: 1 typedef long int LONG_INT_t; 2 int 3 f(void) 4 { 5 typedef long long int LONG_INT_t; 6 LONG_INT_t li = 1; 7 return li; 8 } ============ typedef declared inconsistently LONG_INT_t long long f.c(1) :: long f.c(5) Message ID: E_TYPEDEF_INCONSIST -------------------------------------------------- .c file has no corresponding .h file There is no .h file with a name equal to the name of the .c file. Format: Simple Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip; 5 ip = (int *) sizeof(int); 6 free(ip); 7 ip = (int *) malloc(sizeof(int) * 10); 8 ip++; 9 free(ip); 10 } ============ .c file has no corresponding .h file /export/ld6/clint/LINT.EXMPLS/f/f.c Message ID: E_H_C_CHECK0 -------------------------------------------------- extern declared in .h file but not defined in corresponding .c file There is an extern name declared in a .h file, but this name isn't defined in the corresponding .c file. Example of code that generates the message: file f.h: 1 extern int i; 2 extern int f(int x, int y); file f.c: 1 #include "f.h" 2 int ia[2]; 3 int i; 4 int 5 f(int x, int y) 6 { 7 ia[0] = x; 8 ia[1] = y; 9 if (ia[i] > ia[1]) 10 ia[0] = ia[1]; 11 return (x + y) / 2; 12 } ============ extern defined in .c file but not declared in corresponding .h file ia f.c(2) Message ID: E_H_C_CHECK1 -------------------------------------------------- extern defined in .c file but not declared in corresponding .h file There is an extern name defined in a .c file, but this name isn't declared in its corresponding .h file. Example of code that generates the message: file f.h: 1 int i; 2 extern int f(int x, int y); file f.c: 1 #include "f.h" 2 extern int i; 3 int 4 f(int x, int y) 5 { 6 int ia[2]; 7 ia[0] = x; 8 ia[1] = y; 9 if (ia[i] > ia[1]) 10 ia[0] = ia[1]; 11 return (x + y) / 2; 12 } 13 int 14 main(void) 15 { 16 i = 5; 17 return f(i, -i); 18 } ============ extern defined in .c file but not declared in corresponding .h file main f.c(14) Message ID: E_H_C_CHECK2 -------------------------------------------------- name defined but not used at runtime A function is defined but not used at runtime, for example, when the function is called from unreachable code. Example of code that generates the message: file f.c: 1 extern int f(void); 2 3 main(void) 4 { 5 int i = 0; 6 if (i > 0) 7 i = f(); 8 return i; 9 } file f_1.c: 1 int 2 f(void) 3 { 4 return 3; 5 } ============ Message ID: E_UNCAL_F -------------------------------------------------- statement not reached You have a statement in your program that is never executed. Example of code that generate the message: int f() { printf("return before reach\n"); return 0; assert(FALSE); /* <==== this statement is not reached */ } Message ID: E_STM_RCH -------------------------------------------------- memory can not be deallocated due to bad argument The argument is not a pointer to allocated memory. Format: Simple Example of code that generates the message: 1 #include 2 int *ip; 3 void 4 main(void) 5 { 6 free(*ip); 7 return; 8 } ============ f.c(6) warning: memory can not be deallocated due to bad argument Message ID: E_A_NOMEM -------------------------------------------------- duplicate deallocation of memory You are deallocating memory that has already been deallocated. Example of code that generates the message: 1 #include 2 static int *ip, *jp; 3 void 4 main(void) 5 { 6 ip = malloc(sizeof(int)); 7 jp = ip; 8 free(ip); 9 free(jp); 10 } ============ duplicate deallocation of memory f.c(9) :: f.c(8) Message ID: E_P_FREE_DEALLOC -------------------------------------------------- possible duplicate deallocation of memory You are deallocating memory that may have already been deallocated. Example of code that generates the message: 1 #include 2 static int *ip, *jp; 3 void 4 main(int argc, char *argv[]) 5 { 6 ip = malloc(sizeof(int)); 7 *ip = 4; 8 jp = ip; 9 if (argc > 2) 10 free(ip); 11 free(jp); 12 } ============ possible duplicate deallocation of memory f.c(11) :: f.c(10) Message ID: E_P_FREE_DEALLOC_PSBL -------------------------------------------------- reference to deallocated memory Reference to deallocated memory. Example of code that generates the message: 1 #include 2 static int *ip; 3 int 4 main(void) 5 { 6 int i; 7 ip = malloc(10); 8 *ip = 2; 9 free(ip); 10 i = *ip; 11 return (i); 12 } ============ reference to deallocated memory f.c(10) :: f.c(9) Message ID: E_P_REF_DEALLOC -------------------------------------------------- possible reference to deallocated memory There may be a reference to deallocated memory. Example of code that generates the message: 1 #include 2 static int *ip; 3 int 4 main(int argc, char *argv[]) 5 { 6 int i; 7 ip = malloc(10); 8 *ip = 2; 9 if (argc > 2) 10 free(ip); 11 i = *ip; 12 return (i); 13 } ============ possible reference to deallocated memory f.c(13) :: f.c(12) Message ID: E_P_REF_DEALLOC_PSBL -------------------------------------------------- use of a pointer to deallocated memory Use of a pointer to deallocated memory. Example of code that generates the message: 1 #include 2 static int *ip; 3 void 4 main(void) 5 { 6 int *jp; 7 ip = malloc(10); 8 free(ip); 9 jp = ip; 10 } ============ use of a pointer to deallocated memory f.c(9) :: f.c(8) Message ID: E_P_USE_DEALLOC -------------------------------------------------- possible use of a pointer to deallocated memory Possible use of a pointer to deallocated memory. Example of code that generates the message: 1 #include 2 void 3 f(char*ip) 4 { free(ip); 5 } 6 7 char 8 main(int argc, char *argv[]) 9 { char *ip, *jp; 10 11 ip = malloc(argc+4); 12 if (argc-- == 0) f(ip); 13 if (argc > 1) 14 { jp = ip; 15 return *jp; } 16 else 17 return '0'; 18 } ============ Message ID: E_P_USE_DEALLOC_PSBL -------------------------------------------------- deallocating a pointer to a variable Deallocating a pointer to a variable is prohibited. Example of code that generates the message: 1 #include 2 int 3 main(void) 4 { 5 int *ip; 6 int i; 7 ip = 8 free(ip); 9 } ============ deallocating a pointer to a variable i defined at f.c(6) :: f.c(8) Message ID: E_P_FREE_VAR -------------------------------------------------- deallocating a pointer that could point to a variable Deallocating a pointer that could point to a variable. Example of code that generates the message: 1 #include 2 static int *ip; 3 int 4 main(int argc, char *argv[]) 5 { 6 int i; 7 if (argc > 2) 8 ip = 9 else 10 ip = malloc(sizeof i); 11 *ip = 99; 12 free(ip); 13 return (++*ip); 14 } ============ deallocating a pointer that could point to a variable i defined at f.c(6) :: f.c(12) Message ID: E_P_FREE_VAR_PSBL -------------------------------------------------- dereference of a pointer that points to a variable that no longer exists Reference using a pointer that points to a variable that no longer exists. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int *ip; 2 f(void) 3 { 4 int i = 0; 5 ip = 6 return (i); 7 } 8 main(void) 9 { 10 int j; 11 j = f(); 12 j += *ip; 13 return (j); 14 } ============ reference using a pointer that points to a variable that no longer exists i defined at f.c(4) :: f.c(12) Message ID: E_P_REF_VAR -------------------------------------------------- possible reference using a pointer to a variable that no longer exists Possible reference using a pointer to a variable that no longer exists. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int *ip, ei; 2 f(int n) 3 { 4 int i = 0; 5 ip = 6 if (n > 0) 7 ip = 8 return (i); 9 } 10 main(int argc, char *argv[]) 11 { 12 int j; 13 j = f(argc); 14 j += *ip; 15 return (ei + j); 16 } ============ possible reference using a pointer to a variable that no longer exists i defined at f.c(4) :: f.c(14) Message ID: E_P_REF_VAR_PSBL -------------------------------------------------- use of a pointer to a variable that no longer exists Use of a pointer to a variable that no longer exists. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int *ip, ei; 2 f(void) 3 { 4 int x = 0; 5 ip = 6 return (x); 7 } 8 main(void) 9 { 10 int i; 11 i = f(); 12 ip++; 13 return (ei + i); 14 } ============ use of a pointer to a variable that no longer exists x defined at f.c(4) :: f.c(12) Message ID: E_P_USE_VAR -------------------------------------------------- use of a pointer to a variable that may no longer exist A pointer is used that could point to a variable that no longer exists. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 int *ip, ei; 2 g(int n) 3 { 4 int x = 0, y = 1; 5 ip = 6 if (n > 0) 7 ip = 8 return (x); 9 } 10 main(int argc, char * argv[]) 11 { 12 int i; 13 i = g(argc); 14 ip++; 15 return (ei + i); 16 } ============ use of a pointer to a variable that may no longer exist x defined at f.c(4) :: f.c(14) Message ID: E_P_USE_VAR_PSBL -------------------------------------------------- return of a pointer to local variable Function returns the address of its automatic local variable or parameter stored in some pointer. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object will be undefined after the end of the block. Example of code that generates the message: 1 int * 2 f(void) 3 { 4 int i; 5 int *ip = 6 return (ip); 7 } 8 void 9 main(void) 10 { 11 int *jp; 12 jp = f(); 13 (*jp)++; 14 } ============ return of a pointer to local variable i defined at f.c(4) :: f.c(6) Message ID: E_P_RET_VAR -------------------------------------------------- possible return of a pointer to local variable A routine may return the address of its automatic local variable. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object will be undefined after the end of the block. Example of code that generates the message: 1 static int * 2 f(int *ip) 3 { 4 int i; 5 int *jp = ip; 6 if (*ip > 5) 7 jp = 8 return jp; 9 } 10 main(void) 11 { 12 int i = 1; 13 i += *f(&i); 14 return i; 15 } ============ possible return of a pointer to local variable i defined at E_P_RET_VAR_PSBL.c(4) :: E_P_RET_VAR_PSBL.c(8) Message ID: E_P_RET_VAR_PSBL -------------------------------------------------- deallocating NULL pointer Argument is equal to NULL. Example of code that generates the message: 1 #include 2 #define ADDR 0 3 static int *ip; 4 main(void) 5 { 6 ip = ADDR * sizeof(int); 7 free(ip); 8 return 0; 9 } ============ deallocating NULL pointer f.c(7) Message ID: E_P_FREE_NULL -------------------------------------------------- deallocating a pointer that could be NULL Deallocating a pointer that could be NULL. Example of code that generates the message: 1 #include 2 static int *ip; 3 main(int argc, char *argv[]) 4 { 5 if (argc == 2) 6 ip = 0; 7 else 8 ip = malloc(sizeof(int)); 9 free(ip); 10 return 0; 11 } ============ deallocating a pointer that could be NULL f.c(9) Message ID: E_P_FREE_NULL_PSBL -------------------------------------------------- reference using a NULL pointer Reference using a NULL pointer. Example of code that generates the message: 1 static int *ip; 2 int 3 main(void) 4 { 5 int i = 0; 6 ip = (int *) 0; 7 i = *ip; 8 i = i + *ip; 9 return (i); 10 } ============ reference using a NULL pointer f.c(7) Message ID: E_P_REF_NULL -------------------------------------------------- possible reference using NULL pointer There may be a reference using a NULL pointer. Example of code that generates the message: 1 static int *ip; 2 static int si = 99; 3 int 4 main(int argc, char *argv[]) 5 { 6 int i = 0; 7 if (argc == 2) 8 ip = (int *) 0; 9 else 10 ip = 11 i = i + *ip; 12 return (i); 13 } ============ possible reference using NULL pointer f.c(11) Message ID: E_P_REF_NULL_PSBL -------------------------------------------------- possible illegal use of NULL pointer A NULL pointer may be used incorrectly. Example of code that generates the message: 1 int 2 main(int argc, char * argv[]) 3 { 4 int *ip, *jp; 5 int i; 6 ip = 0; 7 if (argc > 1) 8 ip = 9 jp = ip; 10 return (*jp)++; 11 } ============ modification using a pointer that could be NULL ip defined at f.c(4) :: f.c(10) Message ID: E_P_USE_NULL_PSBL -------------------------------------------------- deallocating uninitialized pointer Argument is not initialized. Example of code that generates the message: 1 #include 2 void 3 main(void) 4 { 5 int *ip; 6 free(ip); 7 } ============ deallocating uninitialized pointer ip defined at f.c(5) :: f.c(6) Message ID: E_P_FREE_UNINI -------------------------------------------------- deallocating a pointer that could be an uninitialized value Deallocating a pointer that could be an uninitialized value. Example of code that generates the message: 1 #include 2 3 void 4 main(int argc, char *argv[]) 5 { 6 int *ip; 7 if (argc == 0) 8 ip = malloc(sizeof(int)); 9 free(ip); 10 } ============ deallocating a pointer that could be an uninitialized value ip defined at f.c(5) :: f.c(8) Message ID: E_P_FREE_UNINI_PSBL -------------------------------------------------- reference using a pointer that is an uninitialized value Reference using a pointer that is an uninitialized value. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int i; 5 int *ip; 6 7 i = *ip; 8 } ============ reference using a pointer that is an uninitialized value ip defined at f.c(5) :: f.c(7) Message ID: E_P_REF_UNINI -------------------------------------------------- possible reference using an uninitialized pointer There may be a reference using an uninitialized pointer. Example of code that generates the message: 1 #include 2 3 void 4 v(int i, char **p) 5 { 6 *p = (char *) malloc(sizeof(int) * (i + 1)); 7 **p = '0'; 8 } 9 10 char 11 main(int argc, char *argv[]) 12 { 13 char *cp; 14 if (argc) 15 v(argc, &cp); 16 return *cp; 17 } ============ possible reference using an uninitialized pointer cp defined at f.c(13) :: f.c(16) Message ID: E_P_REF_UNINI_PSBL -------------------------------------------------- use of a pointer that is an uninitialized value Use of a pointer that is an uninitialized value. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip; 5 6 ip++; 7 } ============ use of a pointer that is an uninitialized value ip defined at f.c(4) :: f.c(6) Message ID: E_P_USE_UNINI -------------------------------------------------- use of a pointer that could be an uninitialized value Use of a pointer that could be an uninitialized value. Example of code that generates the message: 1 void 2 main(int argc, char *argv[]) 3 { 4 int i; 5 int *ip; 6 if (argc > 1) 7 ip = 8 ip++; 9 } ============ use of a pointer that could be an uninitialized value ip defined at f.c(5) :: f.c(8) Message ID: E_P_USE_UNINI_PSBL -------------------------------------------------- deallocating a pointer produced in a questionable way Deallocating a pointer produced in a questionable way, for example, by conversion of an integral value to a pointer value. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip; 5 ip = (int *) sizeof(int); 6 free(ip); 7 } ============ deallocating a pointer produced in a questionable way f.c(6) Message ID: E_P_FREE_SUSP -------------------------------------------------- deallocating a pointer that could be produced in a questionable way Deallocating a pointer that could be produced in a questionable way. Example of code that generates the message: 1 #include 2 void 3 main(int argc, char *argv[]) 4 { 5 int *ip; 6 ip = (int *) malloc(sizeof(int) * 10); 7 *ip = argc - 1; 8 if (*ip == 0) 9 ip = (int *) sizeof(int); 10 free(ip); 11 } ============ deallocating a pointer that could be produced in a questionable way f.c(10) Message ID: E_P_FREE_SUSP_PSBL -------------------------------------------------- reference using a pointer produced in a questionable way Reference using a pointer produced in a questionable way. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip; 5 int i; 6 ip = (int *) sizeof i; 7 i = *ip; 8 } ============ reference using a pointer produced in a questionable way f.c(7) Message ID: E_P_REF_SUSP -------------------------------------------------- possible reference using a pointer produced in a questionable way Possible reference using a pointer that could be produced in a questionable way. Example of code that generates the message: 1 main(int argc, char *argv[]) 2 { 3 int *ip; 4 int i = argc; 5 ip = (int *) sizeof i; 6 if (argc > 2) 7 ip = 8 return *ip; 9 } ============ possible reference using a pointer produced in a questionable way E_P_REF_SUSP_PSBL.c(8) Message ID: E_P_REF_SUSP_PSBL -------------------------------------------------- use of a pointer produced in a questionable way A pointer is used that was produced in a questionable way. Example of code that generates the message: 1 void 2 main(void) 3 { 4 int *ip, *jp; 5 int i = 0; 6 ip = (int *) sizeof i; 7 jp = ip; 8 } ============ use of a pointer produced in a questionable way f.c(7) Message ID: E_P_USE_SUSP -------------------------------------------------- possible use of a pointer produced in a questionable way A pointer is used that was possibly produced in a questionable way. Example of code that generates the message: 1 void 2 main(int argc, char *argv[]) 3 { 4 int *ip, *jp; 5 int i = 99; 6 ip = (int *) sizeof i; 7 if (argc > 2) 8 ip = 9 jp = ++ip; 10 } ============ possible use of a pointer produced in a questionable way f.c(9) Message ID: E_P_USE_SUSP_PSBL -------------------------------------------------- assigned value never used The variable value is not used in the program. The superfluous assignment can be removed. Example of code that generates the message: 1 static int *ip, i; 2 static void 3 f(void) 4 { 5 int *iq; 6 ip = 7 iq = ip; 8 *ip = 7; 9 } 10 int 11 main(int argc, char *argv[]) 12 { 13 int j = 0xff; 14 f(); 15 j = 0x01; 16 if (argc > 2) 17 ip = 18 else 19 ip = 20 *ip = 1; 21 ip = ip + 1; 22 *ip = 2; 23 return (0); 24 } ============ assigned value never used iq defined at f.c(5) :: set at f.c(7) i defined at f.c(1) :: set at f.c(8) j defined at f.c(13) :: set at f.c(13) j defined at f.c(13) :: set at f.c(15) j defined at f.c(13) :: set at f.c(22) i defined at f.c(1) :: set at f.c(22) assigned value never used j defined at f.c(13) :: set at f.c(20) :: reset at f.c(22) i defined at f.c(1) :: set at f.c(20) :: reset at f.c(22) Message ID: E_ASGN_NEVER_USED -------------------------------------------------- assigned value never used: ; reset at A variable has been assigned a value which is never used prior to resetting the variable to another value. The superfluous assignment can be removed. Example of code that generates the message: 1 static int i; 2 int main (void) 3 { 4 int iq; 5 iq = 8; 6 i = 7; 7 iq = i; 8 return iq; 9 } ========== "t2.c", line 5: warning: assigned value never used: iq defined at t2.c(4); reset at t2.c(7) Message ID: E_ASGN_RESET -------------------------------------------------- modification of constant data A constant data or variable is changed. Example of code that generates the message: 1 static const int ic = 1; 2 static void 3 f(int *ip) 4 { 5 (*ip)++; 6 } 7 main(void) 8 { 9 int *ip = (int *) 10 f(ip); 11 return ic; 12 } ============ modification of constant data ic defined at f.c(1) :: f.c(5) Message ID: E_ASGN_CONST -------------------------------------------------- possible modification of constant data A constant data or value may be changed. Example of code that generates the message: 1 static const int ic = 1; 2 static void 3 f(int *iq) 4 { 5 (*iq)++; 6 } 7 main(int argc , char* argv[]) 8 { 9 int *ip = (int *) 10 int i; 11 if (argc > 2) 12 ip = 13 f(ip); 14 return (*ip); 15 } ============ possible modification of constant data ic defined at f.c(1) :: f.c(5) Message ID: E_ASGN_CONST_PSB -------------------------------------------------- memory not deallocated Allocated memory is not released explicitly in the program. Example of code that generates the message: 1 #include 2 main(void) 3 { 4 int *ip; 5 ip = malloc(sizeof(long)); 6 *ip += 5; 7 return *ip; 8 } ============ memory not deallocated f.c(5) Message ID: E_NEVER_DEALLOC -------------------------------------------------- memory possibly not deallocated Allocated memory may not have been released in the program. Example of code that generates the message: 1 #include 2 void 3 v(int i) 4 { 5 char *cp; 6 cp = (char *) malloc(sizeof(int) * i); 7 *cp = 3; 8 if (i > 1) 9 free(cp); 10 } 11 main(int argc, char *argv[]) 12 { 13 v(argc); 14 } ============ Message ID: E_NEVER_DEALLOC_PSB -------------------------------------------------- use before set A variable or memory is used before set. Example of code that generates the message: 1 static int i; 2 void 3 main(void) 4 { 5 int j; 6 j += i; 7 } ============ use before set j defined at f.c(5) Message ID: E_USE_BEFORE_SET -------------------------------------------------- possible use before set A variable may have been used before set. Example of code that generates the message: 1 int 2 main(int argc, char * argv[]) 3 { 4 int i; 5 if (argc>2) 6 i = 99; 7 i++; 8 return i; 9 } ============ possible use before set i defined at f.c(4) Message ID: E_USE_BEFORE_SET_PSB -------------------------------------------------- inconsistent use of a value type A value of one type stored in a variable or memory is used as a value of another inconsistent type. Example of code that generates the message: 1 main(void) 2 { 3 int i; 4 int *ip = 5 *((char *) ip) = '1'; 6 return (*ip); 7 } ============ inconsistent use of a value type used as int :: i defined at f.c(3) f.c(6) :: f.c(5) set as char Message ID: E_VALUE_TYPE -------------------------------------------------- possible inconsistent use of a value type A value of one type stored in a variable or memory is possibly used as a value of another inconsistent type. Example of code that generates the message: 1 main(int argc, char * argv[]) 2 { 3 int i; 4 int *ip = 5 *ip = 0; 6 if (argc > 2) 7 *((char *) ip) = '1'; 8 return (*ip); 9 } ============ possible inconsistent use of a value type used as int :: i defined at f.c(3) f.c(8) :: f.c(7) set as char Message ID: E_VALUE_TYPE_PSB -------------------------------------------------- unreached function Lint has determined that the program flow will never call the named function. Message ID: E_FUNC_UNREACHED -------------------------------------------------- modification to deallocated memory Modification to deallocated memory. Example of code that generates the message: 1 #include 2 static int *ip; 3 static void f(void) { *ip=1;} 4 static void g(int i) { ip = malloc(i);} 5 static void h(void) { free(ip);} 6 void 7 main(void) 8 { 9 ip = malloc(10); 10 free(ip); 11 *ip = 1; 12 g(10); 13 h(); 14 f(); 15 } ============ modification to deallocated memory f.c(3) :: f.c(5) f.c(11) :: f.c(10) Message ID: E_P_WRT_DEALLOC -------------------------------------------------- possible modification to deallocated memory Possible modification to deallocated memory. Example of code that generates the message: 1 #include 2 static int *ip; 3 int 4 main(int argc, char *argv[]) 5 { 6 ip = malloc(8); 7 if (argc > 1) 8 free(ip); 9 *ip = argc; 10 return (*ip); 11 } ============ possible modification to deallocated memory f.c(9) :: f.c(8) Message ID: E_P_WRT_DEALLOC_PSBL -------------------------------------------------- modification to a variable that no longer exists Modification to a variable that no longer exists. Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 static int *ip; 2 static int si; 3 static int 4 f(void) 5 { 6 int i; 7 ip = 8 i = 0; 9 return (i); 10 } 11 main(void) 12 { 13 int j; 14 j = f(); 15 *ip = 1; 16 j = j + f(); 17 *ip = 1; 18 return (si + j); 19 } ============ modification to a variable that no longer exists i defined at f.c(6) :: f.c(15) i defined at f.c(6) :: f.c(17) Message ID: E_P_WRT_VAR -------------------------------------------------- modification to a variable that may no longer exist Since an object with automatic storage duration is no longer guaranteed to be reserved after the end of the block, the pointer to that object is undefined after the end of the block. Example of code that generates the message: 1 static int *ip; 2 static int si; 3 static int 4 f(void) 5 { 6 int i; 7 ip = 8 i = 0; 9 if (si) 10 ip = 11 return (i); 12 } 13 main(void) 14 { 15 int j; 16 j = f(); 17 *ip = 1; 18 j = j + f(); 19 *ip = 1; 20 return (si + j); 21 } ============ modification to a variable that may no longer exist i defined at f.c(6) :: f.c(17) i defined at f.c(6) :: f.c(19) Message ID: E_P_WRT_VAR_PSBL -------------------------------------------------- modification using a NULL pointer Modification using a NULL pointer. Example of code that generates the message: 1 static int *ip; 2 static void 3 v(void) 4 { 5 *ip = 1; 6 } 7 void 8 main(int argc, char *argv[]) 9 { 10 switch (argc) { 11 case 1: 12 ip = (int *) 0; 13 *ip = 1; 14 break; 15 case 2: 16 ip = (int *) 0; 17 v(); 18 break; 19 default: 20 v(); 21 } 22 } ============ modification using a NULL pointer ip defined at f.c(1) :: f.c(5) ip defined at f.c(1) :: f.c(5) ip defined at f.c(1) :: f.c(13) Message ID: E_P_WRT_NULL -------------------------------------------------- modification using a pointer that could be NULL Modification using a pointer that could be NULL. Example of code that generates the message: 1 #define VALUE 0 2 static int *ip; 3 static int si; 4 int 5 main(void) 6 { 7 ip = (int *) VALUE; 8 if (si) 9 ip = 10 *ip = VALUE + 1; 11 return (si); 12 } ============ modification using a pointer that could be NULL ip defined at f.c(2) :: f.c(10) Message ID: E_P_WRT_NULL_PSBL -------------------------------------------------- modification using a pointer that is an uninitialized value A pointer is dereferenced prior to initializing it to point to an object. Example of code that generates the message: 1 f() { 2 int *p; 3 4 *p = 5; 5 } ========== "t2.c", line 4: warning: modification using a pointer that is an uninitialized value p defined at t2.c(2) :: t2.c(4) Message ID: E_P_WRT_UNINI -------------------------------------------------- modification using a pointer that could be an uninitialized value Modification using a pointer that could be an uninitialized value. Example of code that generates the message: 1 int 2 main(int argc, char *argv[]) 3 { 4 int *ip, i; 5 if (argc > 2) 6 ip = 7 *ip = 1; 8 return i; 9 } ============ modification using a pointer that could be an uninitialized value ip defined at f.c(4) :: f.c(7) Message ID: E_P_WRT_UNINI_PSBL -------------------------------------------------- modification using a pointer produced in a questionable way Modification using a pointer produced in a questionable way. Example of code that generates the message: 1 static int *ip; 2 static void 3 f(void) 4 { 5 *ip = 1; 6 } 7 void 8 main(void) 9 { 10 ip = (int *) 4; 11 *ip = 1; 12 ip = (int *) 5; 13 f(); 14 *ip = 1; 15 } ============ modification using a pointer produced in a questionable way f.c(5) f.c(11) f.c(14) Message ID: E_P_WRT_SUSP -------------------------------------------------- modification using a pointer that could be produced in a questionable way Modification using a pointer that could be produced in a questionable way. Example of code that generates the message: 1 #define VALUE 4 2 static int *ip; 3 static int si; 4 int 5 main(void) 6 { 7 ip = (int *) VALUE; 8 if (si) 9 ip = 10 *ip = VALUE + 1; 11 return (si); 12 } ============ modification using a pointer that could be produced in a questionable way f.c(10) Message ID: E_P_WRT_SUSP_PSBL -------------------------------------------------- content of variable or memory is not used A variable is defined, but its value or occupied memory is not used in a program. Example of code that generates the message: 1 int * 2 f(void) 3 { 4 int i; 5 return (&i + (sizeof(int))); 6 } ============ content of variable or memory is not used i defined at f.c(4) Message ID: E_VRB_NEVER_USED -------------------------------------------------- label unused A label is defined, but not used. Example of code that generates the message: 1 f() 2 { 3 int k =7; 4 switch(k) { 5 case 1: 6 break; 7 defult: /* syntax error undetected */ 8 return (10); 9 } 10 } =============== label unused (7) defult in f Message ID: E_LABEL_NOT_USED -------------------------------------------------- empty loop body Lint detected a loop containing no executable statements. Example of code that generates the message: 1 int i; 2 for (i = 0; i < 5; i++) ; /* empty for loop */ 3 while (i < 7) { } /* empty while loop */ Message ID: E_LOOP_EMPTY -------------------------------------------------- parameter is converted to type An actual parameter is implicitly converted to the type of the matching parameter. Format: Simple Example of code that generates the message: 1 static void f(int x1) 2 { 3 printf("%d\n", x1); 4 } 5 void main () 6 { 7 float x; 8 x = 4.5; 9 f(x); 10 } ============ (9) warning: float is converted to int : arg #1 of function f Message ID: E_ARGUMENT_CONVERT -------------------------------------------------- bad file number The compiler or lint detects invalid file number (greater than free slot in file list). This is an internal error. Message ID: E_BAD_FILE_NUMBER -------------------------------------------------- source line is not accessible lint is not able to print the source line corresponding to the message because the source file is unaccessible, for example, the source file may have been renamed, deleted, or moved. Format: Simple Example of code that generates the message: | |******* source line is not accessible ... | ! line 677, file.c warning: assigned value never used: ReturnVal Message ID: E_SRC_LINE_UNACCESSIBLE -------------------------------------------------- can not find source line because the file contains #line directives Certain #line directives prevent lint from printing the source line corresponding to the message. Format: Simple Example of code that generates the message: file f.c: 1 #line 20 "nofile.c" 2 int i; 3 void 4 main(void) 5 { 6 return 99; 7 } ============ | |******* can not find source line because the file contains #line directives |! line 24, nofile.c | error: void function cannot return value Message ID: E_SRC_LINE_UNACCESSIBLE2 -------------------------------------------------- argument is incompatible with prototype You called a function with an argument whose type cannot be converted to the type in the function prototype declaration for the function Example of code that generates the message: struct s {int x; } q; int g(int, int); f() { g(3, q); } Message ID: E_ARG_INCOMPATIBLE_WITH_ARG_L -------------------------------------------------- expression, or sub-expression, has null effect This code contains an expression or sub-expression that has no effect. Example of code that generates the message: int g() { 1; return 0; } Message ID: E_EXPR_NULL_EFFECT -------------------------------------------------- return type is converted to function return-type You have return from this function a type that is different from its declared return type, and the compiler converts it to the function return type Example of code that generates the message: 1 char f() { 2 return 0xffffffffL; 3 } Message ID: E_IMPL_CONV_RETURN -------------------------------------------------- cast to pointer from n-bit integer An explicit cast of an object of integral type that is smaller than the size of a pointer is being cast to a pointer type. For example, a 32-bit integer being cast to a 64-bit pointer. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 char *ip; 6 ip = (char *) i; 7 } ============ "t.c", line 6: warning: cast to pointer from 32-bit integer Message ID: E_CAST_TO_PTR_FROM_INT -------------------------------------------------- cast from n-bit integer to m-bit integer An explicit cast of an object of an integral type to another integral type that is smaller. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 long l; 6 i = (int) l; 7 } ============ "t.c", line 6: warning: cast from 64-bit integer to 32-bit integer Message ID: E_CAST_INT_TO_SMALL_INT -------------------------------------------------- cast from n-bit integer constant expression to m-bit integer An explicit cast of an integer constant expression to integral type that is smaller than the type of the integer constant expression. Example of code that generates the message: 1 void 2 v(void) 3 { 4 char c; 5 c = (char) 1024; 6 } ============ "t.c", line 5: warning: cast from 32-bit integer constant expression to 8-bit integer Message ID: E_CAST_INT_CONST_TO_SMALL_INT -------------------------------------------------- assignment of n-bit integer to m-bit integer An object of an integral type is assigned to an object of another (smaller) integral type. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 long l; 6 i = l; 7 } ============ "t.c", line 6: warning: assignment of 64-bit integer to 32-bit integer Message ID: E_ASSIGN_INT_TO_SMALL_INT -------------------------------------------------- n-bit constant truncated to m-bit by assignment An integral constant expression is assigned or returned to an object of an integral type that cannot hold the value without truncation. Example of code that generates the message: 1 void 2 v(void) 3 { 4 char c; 5 c = 1024; 6 } ============ "t.c", line 5: warning: 32-bit constant truncated to 8 bits by assignment Message ID: E_ASSIGN_INT_FROM_BIG_CONST -------------------------------------------------- passing n-bit integer, expecting m-bit integer A function call contains an argument of an integral type which is larger than the type of the formal parameter in the function definition. This error message is issued with the -errchk=longptr64 option. Example of code that generates the message: 1 void 2 print_int(int i) 3 { 4 printf("int %d\n", i); 5 } 6 7 void 8 v(void) 9 { 10 long l = 5; 11 print_int(l); 12 } ============ "t.c", line 11: warning: passing 64-bit integer arg, expecting 32-bit integer: print_int(arg 1) Message ID: E_PASS_INT_TO_SMALL_INT -------------------------------------------------- passing n-bit integer constant, expecting m-bit integer A function call contains an argument which is an integral constant expression. The type of the integral constant expression is larger than the type of the formal parameter in the function definition. This error message is issued with the -errchk=longptr64 option. Example of code that generates the message: 1 void 2 print_int(int i) 3 { 4 printf("int %d\n", i); 5 } 6 7 void 8 v(void) 9 { 10 print_int(11111111024L); 11 } ============ "t.c", line 10: warning: passing 64-bit integer constant arg, expecting 32-bit integer: printi(arg 1) Message ID: E_PASS_INT_FROM_BIG_CONST -------------------------------------------------- ?: operator being used to choose the lock parameter When the operator ?: is used in a mutex_lock function call lock_lint cannot determine which lock was used. Lock_lint will assume the indicated lock was used in the function call. Example of the code that generates this message: int waitWriter; f() { mutex_t mutex1, mutex2; mutex_lock((waitWriter == 0) ? &mutex1 : &mutex2); } Message ID: E_CONDITIONAL_OP_LOCKCHOICE -------------------------------------------------- unexpected unary operation An unexpected unary operation has been detected in a #if or #elif directive. Example of code that generates the message: main() { #define x 0 #define y 1 #if x ! y == 0 printf("Hello\n"); #endif } Message ID: E_UNEXPECTED_UNARY -------------------------------------------------- A pointer to any object or function cannot compare equal to a null pointer This warning is displayed with the -p option. A compiler may optimize a pointer to any object or function to always evaluating as true. Example of code that generates the message: extern int foo; #pragma weak foo int main() { if (&foo) return foo; } Message ID: E_POINTER_TO_OBJECT -------------------------------------------------- an address is not allowed in a constant initializer for an integral type whose size is smaller than the size of a pointer An address in a constant initializer must be an arithmetic constant expression. As an extension, an address is allowed in a constant initializer for an integral type whose size is greater than or equal to the size of a pointer. An address in a constant initializer for an integral type whose size is smaller than the size of a pointer is not allowed. Example of code that generates the message: int x; char c = Message ID: E_ADDRESS_IN_CONST_INITIALIZER -------------------------------------------------- comparing n-bit integer with m-bit integer An object of an integral type is compared with an object of another (larger) integral type. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 long l; 6 i = i > l; 7 } ============ "t.c", line 6: warning: comparing 32-bit integer with 64-bit integer Message ID: E_COMP_INT_WITH_LARGE_INT -------------------------------------------------- assignment of n-bit unsigned integer to n-bit signed integer An object of an unsigned integral type is assigned to an object of signed integral type with equal size. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 unsigned int ui; 6 i = ui; 7 } ============ "t.c", line 6: warning: assignment of 32-bit unsigned integer to 32-bit signed integer Message ID: E_ASSIGN_UINT_TO_SIGNED_INT -------------------------------------------------- passing n-bit unsigned integer, expecting n-bit signed integer A function call contains an argument of an unsigned integral type whereas the type of the formal parameter in the function definition is signed integral type with equal size. This error message is issued with the -errchk=longptr64 or -errchk=sizematch option. Example of code that generates the message: 1 void 2 print_int(int i) 3 { 4 printf("int %d\n", i); 5 } 6 7 void 8 v(void) 9 { 10 unsigned int ui = 5; 11 print_int(ui); 12 } ============ "t.c", line 11: warning: passing 32-bit unsigned integer arg, expecting 32-bit signed integer: print_int(arg 1) Message ID: E_PASS_UINT_TO_SIGNED_INT -------------------------------------------------- cast from n-bit unsigned integer to n-bit signed integer An explicit cast of an object of an unsigned integral type to signed integral type with same size. Example of code that generates the message: 1 void 2 v(void) 3 { 4 int i; 5 unsigned int ui; 6 i = (int) ui; 7 } ============ "t.c", line 6: warning: cast from 32-bit unsigned integer to 32-bit signed integer Message ID: E_CAST_UINT_TO_SIGNED_INT -------------------------------------------------- ignoring malformed #pragma error_messages Incorrect syntax used for a #pragma error_messages. The error_messages pragma must be specified as: #pragma error_messages ({on|off|default}, errtag1 [,errtag2, ... ,errtag-n]) Example of code that generates this message: #pragma error_messages {off: E_BAD_PTR_INT_COMBINATION, } Message ID: E_IGNORE_MALFORMED_PRAGMA_EMSG -------------------------------------------------- symbol1 and symbol2 cannot be the same in #pragma weak symbol1 = symbol2 #pragma weak symbol1 = symbol2 defines symbol1 to be a weak symbol, which is an alias for the symbol symbol2. These symbols cannot be the same. Example of code that generates the message: 1 #pragma weak function_name = function_name 2 3 int 4 _function_name(void) { 5 return 1; 6 } ============ "test.c", line 1: symbol1 and symbol2 cannot be the same in #pragma weak symbol1 = symbol2: function_name cc: acomp failed for test.c Message ID: E_SYMBOL_IN_PRAGMA_WEAK -------------------------------------------------- non-constant initializer involving a cast 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. Cast operators in an integral constant expression must only convert arithmetic types to integral types. For example, a cast of a pointer type to an arithmetic type is not a constant expression. And when the type of the variable to be initialized is smaller than a pointer the compiler issues this error message. Example of code that generates the message: extern int myf(); int (* fptr)() = (int (*)())((int)myf + 1); Message ID: E_NON_CONST_INIT_SCONV -------------------------------------------------- undefining __STDC_VERSION__ ISO C prohibits undefining the predefined symbol __STDC_VERSION__. You may want to use this feature to test C code that you have written to work in both an ISO C and non-ISO C environment. For example, suppose you have C code that checks __STDC_VERSION__, declaring function prototype declarations if it is defined, and old-style function declarations or definitions if not. Because the C compiler predefines __STDC_VERSION__, you would ordinarily be unable to check the old-style code, and you would have to run the code through another (non-ISO C) compiler. By undefining __STDC_VERSION__, usually on the command-line, you can use the C compiler to do the checking. This diagnostic tells you that you are violating ISO C constraints. Example of code that generates the message: #undef __STDC_VERSION__ /* usually -U__STDC_VERSION_ */ /* _on cc line */ #ifdef _&empty_STDC_VERSION__ int myfunc(const char *arg1, int arg2) #else /* non-ISO C case */ int myfunc(arg1,arg2) char *arg1, /* oops */ int arg2; #endif { } Message ID: E_UNDEFINING__STDC_VERSION__ -------------------------------------------------- a function in a #pragma ? has not been declared The compiler has encountered a function name that must be prototyped prior to its use in the indicated pragma. Example of code that generates the message: /* abc function is not defined or declared anywhere */ #pragma inline (abc) ============ The function abc should be prototyped prior to the pragma: int abc(); #pragma inline (abc) Message ID: E_PRAGMA_FUNC_UNDECLARED -------------------------------------------------- identifier must specify a function for the #pragma ? The compiler has encountered a identifer that is not a function name where a function name is required for the indicated pragma. Example of code that generates the message: int abc; #pragma inline (abc) Message ID: E_PRAGMA_FUNC_REQUIRED -------------------------------------------------- ignoring malformed #pragma ? The indicated #pragma has been specified with incorrect syntax. The correct syntax for the pragma is: #pragma (funcname [, funcname ...]) Example of code that generates the message: #pragma no_side_effect {a b} Message ID: E_MALFORMED_PRAGMA_W_FUNC -------------------------------------------------- promotion of an unsigned integer type to a larger integer type or to the size of a pointer To calculate the expression with different type operands the compiler promotes the operand of unsigned integer type to a larger integer type or to the size of a pointer. Example of code that generates the message: 1 main() 2 { 3 unsigned int i = 1; 4 unsigned long long ll = 1; 5 char *p = "hello"; 6 char c; 7 8 c = *(p + (-i)); 9 return (ll + (-i)); 10 } ============ (8) warning: promotion of an unsigned integer type to a larger integer type or to the size of a pointer may have unexpected results, there is no sign extension. (9) warning: promotion of an unsigned integer type to a larger integer type or to the size of a pointer may have unexpected results, there is no sign extension. Message ID: E_UNEXPECTED_UINT_PROMOTION -------------------------------------------------- promotion of an unsigned integer to the size of a pointer during subscript evaluation During subscript evaluation the compiler promotes an unsigned integer to the size of a pointer. Example of code that generates the message: 1 void main() 2 { 3 unsigned int i = 1; 4 char *p = "hello"; 5 char c; 6 7 c = p[-i]; 8 } ============ (7) warning: promotion of an unsigned integer to the size of a pointer during subscript evaluation may have unexpected results, there is no sign extension. Message ID: E_UNEXPECTED_UINT_PROMOTION_SUB -------------------------------------------------- sign extension from n-bit to m-bit integer A sign extension occured when the compiler promoted an operand of signed integer type to a larger unsigned integer type. Example of code that generates the message: 1 void main() 2 { 3 int i = -1; 4 unsigned long ul; 5 6 ul = (unsigned long)i; 7 } ============ (6) warning: sign extension from 32-bit to 64-bit integer Message ID: E_SIGN_EXTENSION_PSBL -------------------------------------------------- #pragma opt level reduced to value of -xmaxopt The compiler has encountered a #pragma opt with a level that exceeds the value of the command line -xmaxopt value. The optimization level of the functions encountered with this #pragma opt are lowered to the value specified by the -xmaxopt option to the compiler. Example of code that generates the message: int abc(); /* compiler invoked with -xO5 -xmaxopt=2 */ #pragma opt 4 (abc) Message ID: E_PRAGMA_OPT_REDUCED -------------------------------------------------- ignoring malformed #pragma opt A #pragma opt has been specified with incorrect syntax. The correct syntax for the pragma is: #pragma opt level (funcname [, funcname ...]) Example of code that generates the message: #pragma opt 3 {a b} Message ID: E_IGNORE_MALFORMED_PRAGMA_OPT --------------------------------------------------