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
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
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
A file system error occured when the compiler was closing the lock lint database (.ll) file.
Message ID: E_FCLOSE_LL_ERR
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
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
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
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
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
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
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
The compiler cannot discard the lock_lint database file.
Message ID: E_CANT_FREOPEN_LL_DEV_NULL
In a #include directive for which the header name begins with <, the closing > character is omitted. Example of code that generates the message:
#include <stdio.h
Message ID: E_INCLUDE_MISSING
This warning is displayed with the -v option. There is a /* inside a comment. Example of code that generates the message:
/* This is comment that has another /* inside of the comment */
Message ID: E_SLASH_STAR_IN_CMNT
The compiler encounters end-of-file while reading a comment.
Message ID: E_EOF_IN_COMMENT
The only white space characters that are permitted in preprocessing directives are space and horizontal tab. The source code includes some other white space character, such as form feed or vertical tab. The compiler treats this character like a space.
Message ID: E_WHITE_SPACE_IN_DIRECTIVE
A string literal has no closing " on the same line as the beginning " . The diagnostic is a warning if the string literal is part of a preprocessing directive (and the compiler provides the missing " ); an error, otherwise. Example of code that generates the message:
char *p = "abc ;
Message ID: E_NEWLINE_IN_STR_LITERAL
This warning is displayed with the -Xc option. A source line is encountered that has a number where the directive name usually goes. Such a line is reserved for the compiler's internal use, but it must be diagnosed in the -Xc (strictly conforming) mode. Example of code that generates the message:
# 9
Message ID: E_INTERPRETED_AS_LINE_DIRECTIVE
The compiler does not recognize the identifier that follows a # in a preprocessing directive line. Example of code that generates the message:
# unknown foo
Message ID: E_INVALID_DIRECTIVE
A .i file, the result of a cc -P command, is assumed to be a reserved communication channel between the preprocessing phase and the compilation phase of the compiler. By examining the .i file, you can detect errors that may otherwise be hard to detect. However, the compiler expects to find only a few directives that are used for internal communication. The source file that is compiled (a .i file) contains a preprocessing directive other than one of the special directives.
Message ID: E_BAD_COMP_CNTRL_LINE
This warning is displayed with the -Xc option. The compiler sees a directive that it supports, which is not part of the ANSI C standard, and -Xc has been selected. Example of code that generates the message:
#assert system( unix )
Message ID: E_UP_COMPATIBLE_DIRECTIVE
A directive has appeared between the ( ) that delimits the arguments of a function-like macro invocation. The following directives are disallowed in such a context: #ident, #include, #line, #undef. The diagnostic is a warning if it is displayed within a false group of an if-group, and an error otherwise. Example of code that generates the message:
#define flm(a) a+4 int i = flm( #ifdef flm /* allowed */ #undef flm /* disallowed: error */ 4 #else /* allowed */ #undef flm/* disallowed: warn */ 6 #endif /* allowed */ );
Message ID: E_DIRECTIVE_IN_MACRO_LIST
The #file directive (which is reserved for the compilation system) is used for internal communication between preprocessing and compilation phases. A string literal operand is expected as the operand.
Message ID: E_FILE_MISSING_LITERAL
A #ident directive must be followed by a normal (not wide-character) string literal. Example of code that generates the message:
#ident no-string
Message ID: E_IDENT_MISSING_LITERAL
The compiler was unable to read an input file, probably due to some kind of file system error. This error was most likely issued for an include file.
Message ID: E_READ_ERROR
The compiler has encountered too many errors to make further processing practicable. Rather than producing more diagnostics, the compiler exits.
Message ID: E_TOO_MANY_ERRS
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_MALLOC_FAILS
An internal use of realloc() by the compiler has failed. This is most frequently due to having run out of swap space.
Message ID: E_REALLOC_FAILS
The compiler is unable to open an input or output file. Usually, this means the file name argument passed to the cc command is incorrect. The explanation in the diagnostic describes why the file cannot be opened. Example of code that generates the message:
cc badname.c -c x.c
Message ID: E_CANNOT_OPEN
This message is displayed when a fatal error occurs with the -Xt option. The source code calls a macro that calls itself, either directly or indirectly. The ANSI C semantics prevent further attempts to rescan the macro. Older C compilers try to rescan the macro, which eventually leads to a fatal error. Because the rescanning rules are different for ANSI C and its predecessor, the ANSI C compiler provides the old behavior in -Xt mode, which includes producing this diagnostic when macro recursion is detected. Example of code that generates the message:
#define a(x) b(x) #define b(x) a(x) a(3)
Message ID: E_MACRO_RECURSION
The compiler encounters a null character--one with a character code of zero.
Message ID: E_NULL_CHAR_INPUT
This warning is displayed with the -Xt option. ANSI C introduces the notion of trigraphs, three-character sequences that stand for a single character. All such sequences begin with ??. Because sequences that are interpreted as trigraphs may appear in existing code, the K&R C compiler produces a transitional diagnostic when such sequences are encountered. Example of code that generates the message:
char *surprise = "this is a trigraph??!";
Message ID: E_TRIGRAPH_REPLACED
Every non-empty source file and header must consist of complete lines. This diagnostic warns that the last line of a file does not end with a newline.
Message ID: E_NEWLINE_NOT_LAST
The compiler reaches end-of-file while reading the arguments for an invocation of a function-like macro. Example of code that generates the message:
#define mac(a) mac( arg1
Message ID: E_EOF_IN_MACRO_ARG
The tokens in a #error directive must be valid C tokens. The source program contains an invalid token. Example of code that generates the message:
#error 038 - this is an invalid token
Message ID: E_BAD_TOKEN_IN_ERROR_DIRECTIVE
The compiler cannot open a new include file, because too many other include files are already open. The compiler supports at least eight levels of "nesting," up to a maximum defined by the operating system. The most likely reason for the diagnostic is that at some point an include file includes a file that has already been included.
Message ID: E_CANT_OPEN_INCLUDE_FILE
A file specified in an #include directive cannot be located in any of the directories along the search path Example of code that generates the message:
#include "where_is_it.h"
Message ID: E_CANT_FIND_INCLUDE_FILE
The compiler encounters a sequence of characters that does not comprise a valid token. An invalid token may result from the preprocessing ## operator. The offending non-token is shown. If non-token is longer than 20 characters, the first 20 are printed, followed by ". . .". The offending invalid token is ignored. Example of code that generates the message:
#define PASTE(l,r) l ## r double d1 = 1e; double d2 = PASTE(1,e); int i = 1veryverylongnontoken;
Message ID: E_INVALID_TOKEN
The compiler has not recognized a sequence of characters as a valid C language token. Example of code that generates the message:
int i = 1$;
Message ID: E_INVALID_INPUT_TOKEN
The compiler encounters an inappropriate token while processing the argument list of a function-like macro definition. Example of code that generates the message:
#define mac(a,4) a b c
Message ID: E_INVALID_TOKEN_IN_DEFINE_MACRO
The compiler finds an invalid token at the end of what would otherwise be a correctly formed directive. Example of code that generates the message:
#line 7 "file.c
Message ID: E_INVALID_TOKEN_IN_DIRECTIVE
You have used a token in a #if or #elif directive that is neither a valid operator for constant expressions, nor a valid integer constant. Example of code that generates the message:
#if 1 > "1" int i = 1; #endif
Message ID: E_TOKEN_ILLEGAL_IN_DIRECTIVE
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
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
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
A compiler internal error.
Message ID: E_INVALID_TARGET_FILENAME
A #include directive does not specify a file to include. Example of code that generates the message:
#include
Message ID: E_INCLUDE_MISSING_FILENAME
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
The file name in a #include directive is null. Example of code that generates the message:
#include <>
Message ID: E_EMPTY_FILE_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
The closing > is missing from a #include directive. Example of code that generates the message:
#include <stdio.h /* closing ">" expected */
Message ID: E_NO_CLOSING_GREATER_THAN
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
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
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
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
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
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
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
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
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
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
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
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
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
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 </usr/include/stdio.h>
Message ID: E_INC_USR_INC_MAY_NOT_PORTABLE
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
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
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
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
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
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
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
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
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
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
A .i file has been supplied when using the -P option. For example: cc -P tst.i
Message ID: E_PREPROCESSING_DOT_I_FILE
A file system error has occured while the compiler was accessing standard output (stdout).
Message ID: E_STDOUT_ERROR
A file system error has occured while the compiler was accessing standard error (stderr).
Message ID: E_STDERR_ERROR
A #assert directive contains no predicate name to assert. Example of code that generates the message:
#assert
Message ID: E_EMPTY_ASSERT_DIRECTIVE
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
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
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
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
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
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
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
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
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
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
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
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
A #unassert directive contains no predicate name to discard. Example of code that generates the message:
#unassert
Message ID: E_EMPTY_UNASSERT_DIRECTIVE
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
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
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
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
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
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
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
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 __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__
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
The predefined preprocessing operator "defined" cannot be undefined. Example of code that generates the message:
#undef defined
Message ID: E_CANT_UNDEFINE_DEFINED
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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) (x037) /* 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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<hexadecimal-digits>"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
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
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
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
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
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
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
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
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
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
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
A file system error has occured while the compiler was accessing standard output (stdout).
Message ID: E_CANT_DUP_STDOUT
A file system error has occured while the compiler was accessing standard output (stdout).
Message ID: E_CANT_OPEN_ALT_STDOUT
A file system error has occured while the compiler was accessing /dev/null.
Message ID: E_CANT_OPEN_DEV_NULL
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
A floating-point constant has too large a value to fit in type long double.
Message ID: E_CNV_CNST_FP_LONG_DBL_OUTRANGE
A floating-point constant has too large a value to fit in type double.
Message ID: E_CONV_CONST_FP_DBL_OUT_RANGE
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 = &i; /* <====== type mismatch */ struct s *foo = j; /* <====== type mismatch */
Message ID: E_INITIALIZATION_TYPE_MISMATCH
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
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
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
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 = &i; ia[2] = 1; }
Message ID: E_CANT_TAKE_ADDRESS_REGISTER
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 = &i; /* bad type for foo */ int f(); /* old style declaration */
Message ID: E_OLD_STYLE_DECL_OR_BAD_TYPE
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
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
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
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
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
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
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
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 It is also issued for extern variable redeclared as static. 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
A typedef cannot have an initializer. Example of code that generates the message:
typedef int INT = 1;
Message ID: E_CANT_INIT_TYPEDEF
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 <TT>enum</TT> 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
The -xO3 option or higher levels of optimization must be used with the -crossfiles flag.
Message ID: E_XO3_NOT_SPECIFIED
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
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
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
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
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
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 <stddef.h> wchar_t wa[] = L"abc" "def"; char a[] = "abc" L"def";
Message ID: E_CANT_CONCAT_WIDE_REG_STRINGS
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
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
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
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
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
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
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
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
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
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
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
This warning is displayed with the -v option. The function should include a return statement. Example of code that generates the message:
#include <stdio.h> main(void) { (void) printf("Do the hippy-hippy shake.\n"); }
Message ID: E_FUNC_HAS_NO_RETURN_STMT
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
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
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
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
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
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
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
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
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
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
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
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
You cannot declare an object of type void. Example of code that generates the message:
void v;
Message ID: E_CANT_HAVE_VOID_OBJECT
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 fl
Message ID: E_MUST_B_TYPE_FUNC_RTN_UNSIGNED
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
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
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
A #line < number > directive must be followed by a normal string literal.
Message ID: E_STRING_EXPECTED_POUND_LINE
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
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
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
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
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
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
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
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 &i; 10 } ============ (7) warning: function returns pointer to automatic (9) warning: function returns pointer to automatic
Message ID: E_FUNC_RET_PTR_TO_AUTO
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 &i; 4 } ============ (3) warning: function returns pointer to parameter
Message ID: E_FUNC_RET_PTR_TO_PARAM
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 = &i; 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
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 = &i; 5 i = f(ip); 6 }
Message ID: E_INCONS_VAL_TYPE_USED2
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 <stdio.h> 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
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 <stdio.h> 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
A [fs]printf() or [fs]scanf() control string is formed incorrectly. Example of code that generates the message:
1 #include <stdio.h> 2 void 3 main(void) 4 { 5 (void) printf("%y"); 6 } ============ malformed format string printf f.c(5)
Message ID: E_BAD_FORMAT_STR1
A [fs]printf() or [fs]scanf() control string is formed incorrectly. Example of code that generates the message:
1 #include <stdio.h> 2 void 3 main(void) 4 { 5 (void) printf("%y"); 6 }
Message ID: E_BAD_FORMAT_STR2
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 <stdio.h> 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
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 <stdio.h> 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
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 <stdio.h> 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
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 <stdio.h> 2 void 3 main(void) 4 { 5 int i = 0; 6 (void) printf("%s", i); 7 } 8
Message ID: E_BAD_FORMAT_ARG_TYPE2
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
The indicated include file is not used during the compilation of the program. Example of code that generates the message:
#include <math.h> /* no math functions used */ int main () { return 0; }
Message ID: E_INCL_NO_US
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
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
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
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
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
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
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
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
The argument is not a pointer to allocated memory. Format: Simple Example of code that generates the message:
1 #include <stdlib.h> 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
You are deallocating memory that has already been deallocated. Example of code that generates the message:
1 #include <malloc.h> 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
You are deallocating memory that may have already been deallocated. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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
There may be a reference to deallocated memory. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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 is prohibited. Example of code that generates the message:
1 #include <malloc.h> 2 int 3 main(void) 4 { 5 int *ip; 6 int i; 7 ip = &i; 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. Example of code that generates the message:
1 #include <malloc.h> 2 static int *ip; 3 int 4 main(int argc, char *argv[]) 5 { 6 int i; 7 if (argc > 2) 8 ip = &i; 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
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 = &i; 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. 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 = &ei; 6 if (n > 0) 7 ip = &i; 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. 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 = &x; 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
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 = &ei; 6 if (n > 0) 7 ip = &x; 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
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 = &i; 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
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 = &i; 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
Argument is equal to NULL. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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. 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
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 = &si; 11 i = i + *ip; 12 return (i); 13 } ============ possible reference using NULL pointer f.c(11)
Message ID: E_P_REF_NULL_PSBL
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 = &i; 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
Argument is not initialized. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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. 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
There may be a reference using an uninitialized pointer. Example of code that generates the message:
1 #include <malloc.h> 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. 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. 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 = &i; 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, 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. Example of code that generates the message:
1 #include <malloc.h> 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. 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 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 = &i; 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
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
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 = &i; 9 jp = ++ip; 10 } ============ possible use of a pointer produced in a questionable way f.c(9)
Message ID: E_P_USE_SUSP_PSBL
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 = &i; 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 = &i; 18 else 19 ip = &j; 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
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
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
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 = &i; 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
Allocated memory is not released explicitly in the program. Example of code that generates the message:
1 #include <stdlib.h> 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
Allocated memory may not have been released in the program. Example of code that generates the message:
1 #include <malloc.h> 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
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
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
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 = &i; 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
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 = &i; 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
Lint has determined that the program flow will never call the named function.
Message ID: E_FUNC_UNREACHED
Modification to deallocated memory. Example of code that generates the message:
1 #include <malloc.h> 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. Example of code that generates the message:
1 #include <malloc.h> 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. 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 = &i; 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
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 = &i; 8 i = 0; 9 if (si) 10 ip = &si; 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. 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. 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 = &si; 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
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. 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 = &i; 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. 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. 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 = &si; 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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 = &x;
Message ID: E_ADDRESS_IN_CONST_INITIALIZER
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
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
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
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
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
#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
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
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 __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__
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
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
The indicated #pragma has been specified with incorrect syntax. The correct syntax for the pragma is:
#pragmaExample of code that generates the message:(funcname [, funcname ...])
#pragma no_side_effect {a b}
Message ID: E_MALFORMED_PRAGMA_W_FUNC
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
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
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
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
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
This message will be printed if you redeclare an identifier with a dubious declaration or definition. In this case the type of identifier can not be printed. Example of code that generates the message:
1 #include <stdio.h> 2 void Function( struct IamNotDefined *b); 3 int counter = 0; 4 main() 5 { 6 } 7 8 void Function( struct IamNotDefined *b) ;
Message ID: E_DUBIOUS_ID_REDECLARED
This message will be printed if you redefine an identifier with a dubious definition. In this case the type of identifier can not be printed. Example of code that generates the message:
1 #include <stdio.h> 2 void Function( struct IamNotDefined *b) { } 3 4 int counter = 0; 5 main() 6 { 7 } 8 9 void Function( ) 10 { 11 }
Message ID: E_DUBIOUS_ID_REDEFINED
The compiler has encountered a redefinition of an externally defined object or function. The original external name has been changed through use of #pragma redefine_extname, and the compiler has detected a redefinition of the new external name. Example of code that generates the message:
1 #pragma redefine_extname fold fnew 2 3 fold () 4 { 5 } 6 7 fnew () 8 { 9 } 10 11 main () 12 { 13 }-#
Message ID: E_FUNC_REDEFINED_THROUGH_PRAGMA
Structure declaration has been constructed such that the declared object is too big for the target machine. Example of code that generates the message:
typedef int Not_that_big_array[0x10000000]; struct { Not_that_big_array m1,m2,m3,m4,m5,m6,m7,m8; }
Message ID: E_STRUCT_SIZE_TOO_BIG
Either the tag following a struct or union keyword is missing or the tag following a struct or union keyword does not appear to be referencing a struct or union properly declared prior to to this #pragma Example of code that generates the message:
/* struct bar is not defined yet */ void foo() { #pragma alias_level strict (struct bar) return; }
Message ID: E_ALIAS_NO_TAG
The indicate identifier must be defined as a struct prior to this pragma. Example of code that generates the message:
union bar { int field; }; void foo() { #pragma alias_level strict (struct bar) return;}
Message ID: E_ALIAS_NOT_A_STRUCT
The indicate identifier must be defined as a union prior to this pragma. Example of code that generates the message:
struct bar { int field; }; void foo() { #pragma alias_level strict (union bar) return; }
Message ID: E_ALIAS_NOT_A_UNION
The indicated identifier must be declared as an enum prior to referencing in this pragma. Example of code that generates the message:
/* enum bar is not defined yet */ void foo() { #pragma alias_level strict (enum bar) return; }
Message ID: E_ALIAS_NOT_AN_ENUM
The indicated identifier must be declared as a pointer prior to referencing in this pragma. Example of code that generates the message:
int bar; void foo() { #pragma alias_level strict (bar) return; }
Message ID: E_ALIAS_EXPECTING_POINTER
The identifier noted in this message is not declared as a struct prior to its usage as a struct in this pragma. Example of code that generates the message:
enum abc {one, two}; #pragma alias_level strict (struct abc)
Message ID: E_ALIAS_STRUCT_LIE
The identifier noted in this message is not declared as a union prior to its usage as a union in this pragma Example of code that generates the message:
enum abc {one, two}; #pragma alias_level strict (union abc)
Message ID: E_ALIAS_UNION_LIE
The identifier noted in this message is not declared as an enum prior to its usage as an enum in this pragma Example of code that generates the message:
struct abc {int field;}; #pragma alias_level strict (enum abc)
Message ID: E_ALIAS_ENUM_LIE
Something other than a type was given in the indicated pragma. #pragma alias and alias_level expect a list of types. Example of code that generates the message:
int i; #pragma alias_level strict (i)
Message ID: E_ALIAS_EXPECTING_TYPE
The indicated identifier must be declared as a variable prior to referencing in this pragma. Example of code that generates the message:
int myfunc(); #pragma alias (myfunc)
Message ID: E_ALIAS_EXPECTING_VARIABLE
The alias_level pragma has the forms:
#pragma alias_levelExample of code that generates the message:( [, ]... ) #pragma alias_level ( [, ]... )
#pragma alias_level std (
Message ID: E_IGNORE_BAD_ALIAS_LEVEL_PRAGMA
The alias pragma has the forms:
#pragma alias (Example of code that generates the message:[, ]... ) #pragma alias ( , [, ]... )
#pragma alias (
Message ID: E_IGNORE_BAD_ALIAS_PRAGMA
The alias pragma has the forms:
#pragma noalias (Example of code that generates the message:[, ]... ) #pragma noalias ( , [, ]... )
#pragma alias (
Message ID: E_IGNORE_BAD_NOALIAS_PRAGMA
The may_point_to pragma has the form:
pragma may_point_to (Example of code that generates the message:, [, ]... )
#pragma may_point_to (
Message ID: E_IGNORE_BAD_MAYPTTO_PRAGMA
The may_not_point_to pragma has the form:
pragma may_not_point_to (Example of code that generates the message:, [, ]... )
#pragma may_not_point_to (
Message ID: E_IGNORE_BAD_MAYNOTPTTO_PRAGMA
The may_not_point_to and may_point_to pragmas have the form:
pragma may_not_point_to (Example of code that generates the message:, [, ]... ) pragma may_point_to ( , [, ]... )
int i, j; #pragma may_point_to ( i, j);
Message ID: E_POINTTO_NOT_A_POINTER
Only certain characters can follow \ in string literals and character constants: \' \" \? \\ \a \b \f \n \r \t \v \<octal-digit> \x<hexadecimal-digit>. ANSI C ignores the \. Example of code that generates the message:
int i = '\c';
Message ID: E_DUBIOUS_ESCAPE_MBCHAR
Aliasing pragmas may only be used at file or function scope. Example of code that generates the message:
struct s1 {...}; struct s2 {...}; main() { { #pragma alias (struct s1, struct s1) } }
Message ID: E_IGNORE_BAD_SCOPE_FOR_PRAGMA
Use a pointer instead of an incomplete array type as the parameter in a function prototype. Example of code that generates the message:
main() { extern somefunc(void array[]); }
Message ID: E_ARRAY_OF_INCOMPLETE
Use a pointer instead of an incomplete type as the parameter in a function prototype. Example of code that generates the message:
struct xxx; extern lastfunc(struct xxx xs[]);
Message ID: E_ARRAY_OF_INCOMPLETE_NONAME
Automatic variable declaration has been constructed such that the declared object doesnt fit the stack of target machine. Example of code that generates the message:
void foo(void) { int big_array[0x100000000LL]; }
Message ID: E_AUTO_VARIABLE_TOO_BIG
During alias analysis for optimizations allowed under -xalias_level a cast of scalar pointer to struct pointer may result in undefined behavior. Example of code that generates the message:
struct foo { int a; }; struct foo *foop; int *p; void main() { foop = (struct foo *)p; }
Message ID: E_CAST_SCALAR_TO_STRUCT
During alias analysis for optimizations allowed under -xalias_level a cast of void pointer to struct pointer may result in undefined behavior. Example of code that generates the message:
struct foo { int a; }; struct foo *foop; void *p; void main() { foop = (struct foo *)p; }
Message ID: E_CAST_VOID_PTR_TO_STRUCT
During alias analysis for optimizations allowed under -xalias_level a cast of struct field to struct pointer may result in undefined behavior. Example of code that generates the message:
struct foo { int a; }; struct foo *foop; int *p; void main() { p = (int *)&foop.a }
Message ID: E_CAST_SCALAR_STRUCT_TO_SCALAR
During alias analysis for optimizations allowed under -xalias_level=strict, a cast of pointers to two unaliased structures may result in undefined behavior. Example of code that generates the message:
struct fooa { int a; }; struct foob { int b; }; struct fooa *fooaa; struct foob *foobb; void main() { fooaa = (struct fooa *)foobb; }
Message ID: E_CAST_STRUCT_TO_STRUCT
During alias analysis for optimizations allowed under -xalias_level=weak and higher, a cast of a scalar pointer to a scalar may result in undefined behavior. Example of code that generates the message:
int *ip; long *lp; void main() { ip = (int *)lp; }
Message ID: E_CAST_SCALAR_TO_SCALAR
During alias analysis for optimizations allowed under -xalias_level=weak and higher, a cast of a non-scalar pointer to a scalar pointer may result in undefined behavior. Example of code that generates the message:
int *ip; long a[10]; void main() { ip = (int *)a[3]; }
Message ID: E_CAST_NONSCALAR_TO_SCALAR
A threadprivate directive must appear at file scope, outside of any definition or declaration. Example of code that generates the message:
int i; void main() { #pragma omp threadprivate(i) }
Message ID: E_OMP_NONFILE_THREADPRIV
Each variable in the list of a threadprivate directive must have a file-scope declaration. Example of code that generates the message:
void main() { int i; #pragma omp threadprivate(i) }
Message ID: E_OMP_AUTO_THREADPRIV
Threadprivate directive must lexically precede all references to any of the variables in its list. Example of code that generates the message:
int i; void foo() { i = 10; } #pragma omp threadprivate(i)
Message ID: E_OMP_THREADPRIV_REF
Threadprivate, firstprivate, lastprivate and private variable must not have an incomplete type. Example of code that generates the message:
struct S s; #pragma omp threadprivate(s) struct S { int i; } void foo() { #pragma omp parallel private(s) { } }
Message ID: E_OMP_VAR_INCOMPLETE
Threadprivate variables are not permitted in private, firstprivate, lastprivate, shared or reduction clauses. They are not affected by default clause though. Example of code that generates the message:
int i; #pragma omp threadprivate(i) void main() { #pragma omp parallel private(i) i++; }
Message ID: E_OMP_THREADPRIV_WRONG_CLAUSE
No variable may be specified in more than one clause, except that a variable can be specified in both a firstprivate and a lastprivate clause. Example of code that generates the message:
void main() { int i; #pragma omp parallel private(i) copyin(i) i++; }
Message ID: E_OMP_DUP_CLAUSE
Variable specified in private (or lastprivate) clause must not have a const-qualified type. Example of code that generates the message:
void main() { const int ci; #pragma omp parallel private(ci) ; }
Message ID: E_OMP_CONST_PRIVATE
Variables that are private (firstprivate/lastprivate) within a parallel region cannot be specified in a private (firstprivate/lastprivate) clause on an enclosed work-sharing or parallel directive. As a result, variables that are specified private on a work-sharing or parallel directive must be shared in the enclosing parallel region. Example of code that generates the message:
void main() { int i,j; #pragma omp parallel private(j) { #pragma omp for lastprivate(j) for (i=0; i<10; i++) j++; } }=======
Message ID: E_OMP_PRIVATE_PRIVATE
The initializer contains nothing between the braces. Example of code that generates the message:
struct {int i;} = {};
Message ID: E_EMPTY_INITIALIZER
This message is being displayed when difference of two pointers might overflow through ptrdiff_t. In the following example the message will be generated for char pointers difference. Note that it will not be generated for int pointers difference.
#includevoid foo(void){ char *pc1, *pc2; int * pi1, *pi2; ptrdiff_t ptrdiff; ptrdiff = pc1 - pc2; ptrdiff += pi1 - pi2; }
Message ID: E_PTRDIFF_OVERFLOW
This message is displayed when general syntax error is discovered in OpenMP pragma. Example of code that generates the message:
void main() { #pragma omp parallel private { } }
Message ID: E_OMP_SYNTAX_ERROR
Example of code that generates the message:
void inline main() { int i; i = 1; }
Message ID: E_INLINE_MAIN
Example of code that generates the message:
inline void foo(); extern foo(); void main() { foo(); } =======
Message ID: E_EXTERN_INLINE_UNDEFINED
The code contains a null struct member declaration. Example of code that generates the message:
struct { int i;; } s;
Message ID: E_EMPTY_MBR_DECLARATION
This message is displayed when chunksize expression specified in schedule clause of OpenMP for pragma is badly formed. Example of code that generates the message:
void main() { int i; #pragma omp parallel for schedule(static,1.0) for (i=0;i<10;i++) { } }
Message ID: E_OMP_BAD_CHUNKSIZE
Chunksize value has no meaning and is not allowed in runtime schedule of OpenMP for pragma. Example of code that generates the message:
void main() { int i; #pragma omp parallel for schedule(runtime,1) for (i=0;i<10;i++) { } }
Message ID: E_OMP_RUNTIME_CHUNKSIZE
The schedule clause kind must be one of - static, dynamic, guided, runtime. Example of code that generates the message:
void main() { int i; #pragma omp parallel for schedule(normal,1) for (i=0;i<10;i++) { } }
Message ID: E_OMP_BAD_SCHEDULE_KIND
Example of code that generates the message:
void foo() { static int j = 1; i += j; }
Message ID: E_DEF_STATIC_INLINE_EXTERN
ANSI C standard requires labels to be followed by a statement. GNU C extensions allow such constructs yet this warning is being displayed, and it becomes an error when using the -Xs option. Example of code that generates the message:
void main() { some_label: }
Message ID: E_LABEL_NO_STMT
There shall be white-space between the identifier and the replacement list in the definition of an object-like macro Example of code that generates the message:
#define THIS$AND$THAT(a, b) ((a) + (b)) int c = THIS$AND$THAT(1, 7);
Message ID: E_NO_WHITE_SPACE
Expression specified in if clause of OpenMP parallel must have scalar type. Example of code that generates the message:
void main() { struct { int val; } true = {1}; #pragma omp parallel if(true) printf("Hello,worlds!\n"); }
Message ID: E_OMP_BAD_IF_TYPE
Init expression of OpenMP for must have canonical shape of the following form:
Message ID: E_OMP_FOR_BAD_INIT
void main() {
int i=0;
#pragma omp parallel for
for (; i<10; i++) {
}
}
Index variable of OpenMP for must have a signed integer type Example of code that generates the message:
void main() { unsigned char c; #pragma omp parallel for for (c=0; c<10; c++) { } }
Message ID: E_OMP_FOR_BAD_INDEX_TYPE
Control expression of OpenMP for must have canonical shape of the following form:
Message ID: E_OMP_FOR_BAD_CONTROL
void main() {
int i,j=0;
#pragma omp parallel for
for (i=0; j<10; i++) {
}
}
Iteration expression of OpenMP for must have a canonical shape. Example of code that generates the message:
void main() { int i; #pragma omp parallel for for (i=0; i<10; foo(&i)) { } }
Message ID: E_OMP_FOR_BAD_ITER
A variable that is specified in copyin clause must be a threadprivate variable. Example of code that generates the message:
void main() { int i; #pragma omp parallel copyin(i) i++; }
Message ID: E_OMP_COPYIN_NOT_THREADPRIVATE
C99 introduces the following new keywords: inline restrict _Bool _Complex _Imaginary Example of code that generates the message:
int _Bool;
Message ID: E_KEYWORD_IN_C99
Variable length array can be declared with unspecified size (via[*]). Such a declaration can only be used in declarations with function prototype scope. Example of code that generates the message:
int foo (int a[*]) { typedef int A[*]; }
Message ID: E_UNSPEC_VLA_SIZE
Variably modified type can not be declared at file scope. Example of code that generates the message:
int n; typedef int A[n]; int a[n];
Message ID: E_CANT_DECL_FILESCOPE_VM
If an identifier is declared to be an object with static storage duration it shall not have a variable length array type. Example of code that generates the message:
int foo(int n) { static int a[n]; }
Message ID: E_STATIC_VLA
Only an ordinary identifier shall have a variably modified type. Thus structure/union members are not allowed to have such a type. Example of code that generates the message:
void foo() { int n; struct s { int a[n]; }; }
Message ID: E_MEMBER_CANT_BE_VM
Expression which specifies the size of an array shall have an integer type. Example of code that generates the message:
void foo() { int a[1.1]; float f; int b[f]; }
Message ID: E_ARRAY_SIZE_NONINTEGER
Only static keyword allowed to be specified in array size expression. Example of code that generates the message:
int a[extern 3];
Message ID: E_BAD_ARRSIZE_STORAGE_CLASS
Only keyword static and type qualifiers (const, restrict, volatile) are allowed to be specified in array size expression. Example of code that generates the message:
int a[int 3];
Message ID: E_ARRSIZE_TYPE_SPECIFIER
The optional type qualifiers and the keyword static shall appear only in a declaration of a function parameter with an array type, and the only in the outermost array type derivation. Example of code that generates the message:
int a[static 3]; int bar(int[*][restrict]);
Message ID: E_CANT_QUAL_NONPARAM_ARY
Variable length array can be declared with unspecified size (via[*]). Such a declaration can only be used in declarations with function prototype scope. Example of code that generates the message:
int foo () { int i = sizeof(int[*]); }
Message ID: E_UNSPEC_VLA_SIZE_NONAME
OpenMP for and parallel for constructs are require to be followed by a for loop statement. Example of code that generates the message:
int foo() { #pragma omp parallel for while(1) { } }
Message ID: E_OMP_FOR_WITHOUT_FOR
There is an argument of type pointer to void or pointer to function used in expression. Size of void or function assumed to be 1. Example of code that generates the message:
void *mem = (void*)7, *retval; int sz = 4; retval = mem + sz;
Message ID: E_PTR_TO_VOID_IN_ARITHMETIC
The tokens in a #warning directive must be valid C tokens. The source program contains an invalid token. Example of code that generates the message:
#warning 038 - this is an invalid token
Message ID: E_BAD_TOKEN_IN_WARN_DIRECTIVE
A #warning 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 #warning ONE != 1 #endif
Message ID: E_WARNING_PRAGMA
A goto statement shall not jump from outside the scope of an identifier having a variably modified type to inside the scope of that identifier. Example of code that generates the message:
void foo() { int n = 10; { int a[n]; vla_scope: a[n-1] = 0; } goto vla_scope; }
Message ID: E_GOTO_INTO_VLA_SCOPE
OpenMP directives flush and barrier are not statements and thus can not be labeled. Example of code that generates the message:
void foo() { int i; wrong_label: #pragma omp barrier i++; }
Message ID: E_OMP_LABELED_DIRECTIVE
A variable that is specified in reduction clause must be shared in the enclosing context. Example of code that generates the message:
void main() { int i; #pragma omp parallel private(i) #pragma omp sections reduction(+:i) { i++; } }
Message ID: E_OMP_REDUCTION_NOTSHARED
Variable specified in reduction clause must not have a const-qualified type. Example of code that generates the message:
void main() { const int ci; #pragma omp parallel reduction(+:ci) ; }
Message ID: E_OMP_CONST_REDUCTION
Type of the variable specified in reduction clause must be valid for the reduction operator except that pointer types are never permitted. Example of code that generates the message:
void main() { float f; #pragma omp parallel reduction(^:f) ; }
Message ID: E_OMP_REDUCTION_BADTYPE
Example of code that generates the message:
extern int foo(int i) { i++; return i; } inline int foo(int i);
Message ID: E_INLINE_DEFINED_EXTERN
Example of code that generates the message:
inline int foo() { return 5; } extern foo(void);
Message ID: E_INLINE_DEFINED_INLINE
This message is displayed when general syntax error is discovered in OpenMP pragma. Example of code that generates the message:
#pragma STDC L_FENV_ACCESS ON /* "ON" used instead "on" */
Message ID: E_STDC_SYNTAX_ERROR
Restrict qualifier is meaningful only for pointer types. Types other than pointer types shall not be restrict-qualified. Example of code that generates the message:
restrict int a;
Message ID: E_NON_PTR_CANT_RESTRICT_QUAL_2
OpenMP directive ordered must not be in the dynamic extent of a for directive that does not have ordered clause specified. Example of code that generates the message:
void main() { int i, a = 0; #pragma omp for for (i=0; i<10; i++) { #pragma omp ordered a+=i; } }
Message ID: E_OMP_NONORDERED_FOR
OpenMP directive ordered must be within the dynamic extent of a for or parallel-for construct that has an ordered clause. Example of code that generates the message:
void main() { int i, a = 0; for (i=0; i<10; i++) { #pragma omp ordered a+=i; } }
Message ID: E_OMP_ORDERED_NOFOR
OpenMP directive section must appear within the lexical extent of the sections directive Example of code that generates the message:
void main() { int i; #pragma omp parallel { #pragma omp section i++; } }
Message ID: E_OMP_SECTION_NO_SECTIONS
Only none or shared are valid values for default clause. Example of code that generates the message:
void main() { int i; #pragma omp parallel default(private) { i++; } }
Message ID: E_OMP_BAD_DEFAULT
Pragma alias_level is meaningful only at file scope, because the alias level that is set via the pragma applies through the remainder of the translation unit. Example of code that generates the message:
struct s1 {...}; struct s2 {...}; foo() { #pragma alias_level strict (struct s1, struct s2) }
Message ID: E_FILE_SCOPE_ALIAS_LEVEL_PRAGMA
The preprocessing operator _Pragma is allowed to be redefined via macro definition. However such a redefinition completely hides _Pragma operator. Example of code that generates the message.
#define _Pragma printf("Pragma\n")
Message ID: E_PP_PRAGMA_REDEFINED
The preprocessing operator _Pragma takes a single argument that should be a single string literal. Example of code that generates the message.
_Pragma("omp", "parallel") _Pragma("omp" "parallel")
Message ID: E_PP_PRAGMA_ARG_MISMATCH
Critical directives with the same name are not allowed to be nested inside each other. Example of code that generates the message.
void main(void) { #pragma omp critical(foo) #pragma omp critical(foo) ; }
Message ID: E_OMP_BAD_CRITICAL_NESTING
Declarations must precede any statements. Example of code that generates the message.
void main(void) { int i = 1; i++; int j = i; }
Message ID: E_DECLARATION_IN_CODE
The initialization part of a for statement shall only be an expression statement. Example of code that generates the message.
void main(void) { for (int i = 1; i<10; i++); }
Message ID: E_DECLARATION_IN_FOR
The declaration part of a for statement shall only declare variables with storage class auto or register. Example of code that generates the message.
void main(void) { for (static int i = 1; i<10;) i++; }
Message ID: E_BAD_STORAGE_IN_FOR_DECL
When used as qualifier in array declarator keyword static should be followed by array size expression. This expression cant be omitted. Example of code that generates the message.
void foo (int a[static]);
Message ID: E_INVALID_STATIC_VLA_QUAL
No read permissions for the file specified in #include directive. Example of code that generates the message:
#include "noperm.h"
Message ID: E_CANT_ACCESS_INCLUDE_FILE
The file specified in #include directive cannot be open because there are too many files opened already. Example of code that generates the message:
#include __FILE__
Message ID: E_TOO_MANY_FILES
A problem has occured when trying to obtain a license or when trying to obtain information about licenses.
Message ID: E_LICENSE_ERROR
Variable is declared without any explicit type specifier, assuming implicit int. Example of code that generates the message.
static a;
Message ID: E_NO_EXPLICIT_TYPE_GIVEN
Parameter is declared without any explicit type specifier, assuming implicit int. Example of code that generates the message.
void fux(a) { /* body */ }
Message ID: E_NO_TYPE_FOR_OLDSTYLE_PARAM
Implicit function declarations are no longer allowed. Example of code that generates the message.
/* No #includehere */ void main(void) { printf("Hello world!\n"); }
Message ID: E_NO_IMPLICIT_DECL_ALLOWED
struct/union field name was used in a non-struct/union initializer context. Example of an initializer that generates the message:
int a[10] = {.field=1}
Message ID: E_DESIG_INIT_FIELD
designated index for an array initializer is not a constant value. Example of an initializer that generates the message:
int i; int a[10] = {[i]=1}
Message ID: E_DESIG_INIT_INDEX_CONST
designated index for an array initializer was used to initialize non-array variable. Example of an initializer that generates the message:
int a = {[5]=1}
Message ID: E_DESIG_INIT_NON_ARRAY
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; static long x;
Message ID: E_IDENTIFIER_REDECLARED_STATIC
When the & is applied to an operand, the operand cannot be of type void. Example of code that generates the message.
void *p; *p = &*p;
Message ID: E_TAKING_ADDRESS_OF_VOID
You have declared a function parameter with struct, union, or enum type that is incomplete. Example of code that generates the message:
typedef struct foo { void (*function)(struct foo bar); } foobar;
Message ID: E_INCOMPLETE_PARAMETER
The __thread keyword may be applied to extern or static variable. It has no effect on automatic variables. Example of code that generates the message:
int foo() { __thread int i; }
Message ID: E_BAD_STORAGE_THREAD_IGNORED
The expression statement must have one of the following forms: x binop= expr, x++, x--, ++x, --x. where x is an lvalue expression with scalar type. binop is one of the following: +, *, -, /, &, ^, |, << or >>. expr is an expression with scalar type, and it does not reference the object designated by x. Example of code that generates the message:
void main() { int i; #pragma omp atomic i = i+1; }
Message ID: E_OMP_BAD_ATOMIC_EXPR
1999 ISO C standard changes rules for integer constant typing. Compiler issues this message for any integer constant that would have different type set by ANSI standard rules. Example of code that generates the message:
long long a = 2147483648;
Message ID: E_C99_INTEGER_PROMOTION
The compiler has encountered #pragma with too many parameters. Extra parameters are ignored. Example of code that generates the message:
#pragma MP taskloop maxcpus (2) savelast
Message ID: E_IGNORE_EXTRA_PRAGMA_PARAMS
A small struct containing an array of {float|double|long double} has been found either being passed as a parameter or returned as a value from a function on a v9. Small structs consist of 16 bytes as arguments to and 32 bytes as returned values from a function.
typedef struct { double tf[4]; } t_st; t_st myfunc(t_st arg) { t_st rv; return rv; }
Message ID: E_FLTARRSMLSTRUCT
The operand on the left side of a . operator is an expression that does not yield an lvalue. Usually, this warning is issued for programs that 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
Statement was expected in an omp pragma construct. Example of code that causes this error:
{ #pragma omp master }
Message ID: E_OMP_NO_STATEMENT
Variables that are used for loop control in parallel for are implicitly declared private, as a result shared() clause has no effect on such variables. Example of code that generates the message:
void main() { int i,j; #pragma omp parallel for shared(i,j) for (i=0; i<10; i++) j = i; printf("i=%d\tj=%d\n",i,j); }
Message ID: E_OMP_SHARED_CONTROL_VAR
Example of code that generates the message:
main() { float f; f = 0x1.ffffffp0f; }
Message ID: E_CNV_HEX_CONST_EVAL_FMT
Expression specified in num_threads clause of OpenMP parallel must have integer type. Example of code that generates the message:
void main() { struct { int val; } true = {1}; #pragma omp parallel num_threads(true) printf("Hello,worlds!\n"); }
Message ID: E_OMP_BAD_NUM_THREADS_TYPE
Example of code that generates the message
void foo() { int i; #pragma STDC FP_CONTRACT OFF }
Message ID: E_STDC_PRAGMA_WRONG
Expression specified in num_threads clause of OpenMP parallel must be positive integer Example of code that generates the message:
void main() { #pragma omp parallel num_threads(-1) printf("Hello,worlds!\n"); }
Message ID: E_OMP_NEGATIVE_NUM_THREADS
Variables that are private withing a parallel region cannot be specified in the reduction clause on a work-sharing directive that binds to the parallel construct. Example of code that generates the message:
void main() { int i; #pragma omp parallel private(i) #pragma omp sections reduction(+:i) { i++; } }
Message ID: E_OMP_CANT_BE_IN_PRIVATE
Variables that appear in the reduction clause of a parallel directive cannot be specified in the reduction clause on a work-sharing directive that binds to the parallel construct. Example of code that generates the message:
void main() { int i; #pragma omp parallel reduction(+:i) #pragma omp sections reduction(+:i) { i++; } }
Message ID: E_OMP_CANT_BE_IN_REDUCTION
OpenMP sections directive contains a sequence of section directives, each directive being followed by a single statement. First section directive might be omitted though.
void foo() { int i,j; #pragma omp parallel sections private(i, j) { i++; i = i + 1; j++; } }
Message ID: E_OMP_BAD_SECTION_STATEMENT
Threadprivate directive for a file-scope variable must appear at the file scope. Threadprivate directive for a block-scope variable must appear in the scope of this variable and not in a nested scope. Example of code that generates the message:
extern int x; void main() { #pragma omp threadprivate(x) static int i; { #pragma omp threadprivate(i) } }
Message ID: E_OMP_THREADPRIV_WRONG_SCOPE
Each variable in the list of a threadprivate directive must have a file-scope or static block-scope declaration. Example of code that generates the message:
void foo(int i) { #pragma omp threadprivate(i) int j; #pragma omp threadprivate(j) }
Message ID: E_OMP_STATIC_THREADPRIV
Right hand side of atomic expression should not reference object of the left hand side. Example of code that generates the message:
void main() { int i; #pragma omp atomic i += i; }
Message ID: E_OMP_ATOMIC_EXPR_REFERENCE
A file system error has prevented the compiler from opening a .cpch file. Make sure you have permission to read/write into the current working directory.
Message ID: E_CANT_OPEN_PCH_FILE
The end of the initial common source to be used to identify the portion of a program that can be reused via a precompiled header must be marked with either a #pragma hdrstop or a -xpchstop=filename, where filename is the same as the name associated with one of the #include's in the program source.
Message ID: E_NO_PCH_STOP_POINT
Using a #pragma hdrstop or -xpchstop prior to any #include directives disables use of precompiled headers.
Message ID: E_HDRSTOP_BEFORE_INCLUDE
Functions cannot be defined in a header file that is to be used as part of a PCH file. Example of code that generate the error:
int foo() { return 1; }
Message ID: E_CANT_INIT_IN_PCH
Some directives are invalid when using precompiled headers. If they are used, an error will be generated. Examples of code that will cause this error
#line 1 #error "error message" #file "file.h" #warning "warning message" #assert system (unix) #unassert system
Message ID: E_PCH_INVALID_DIRECTIVE
The __DATE__ and __TIME__ predefined macros cannot be used in a header file when creating a precompiled header.
Message ID: E_PCH_INVALID_PREDEFINED
The __LINE__ and __FILE__ predefined macros cannot be used in a precompiled header prefix when collecting or using precompiled headers.
Message ID: E_PCH_PREFIX_PREDEFINED
The PCH file is unusable because the magic number was not recognized.
Message ID: E_PCH_FILE_UNUSABLE_MAGIC
The PCH file is unusable because the PCH version number is incorrect. The PCH file must be regenerated using the current compiler.
Message ID: E_PCH_FILE_UNUSABLE_VERSION
The PCH file is unusable because the -D or -U options did not exactly match those used when the PCH file was created.
Message ID: E_PCH_FILE_UNUSABLE_DEFS
The PCH file is unusable because the command line options did not exactly match those used when the PCH file was created.
Message ID: E_PCH_FILE_UNUSABLE_OPS
The PCH file is unusable with the current source file because the initial sequence of pre-processing directives, including #include directives, did not exactly (excluding any comments) match those used when the PCH file was created.
Message ID: E_PCH_FILE_UNUSABLE_PREFIX
Example of code that generates the message:
void foo() { int i; #pragma omp parallel { #pragma omp single copyprivate(i) ; } }
Message ID: E_OMP_COPYPRIV_MUST_BE_PRIVATE
Example of code that generates the message:
int main() { int i = 42; #pragma omp single nowait copyprivate(i) { i++; } }
Message ID: E_OMP_COPYPRIV_WITH_NOWAIT
The inline keyword is valid only when applied to a function identifier. Examples of code that would cause this error are:
inline int i; main() { inline float f[10]; }
Message ID: E_INLINE_NEEDS_FUNC
Function declaration is inconsistent with a previous inline function definition. Example of code that will cause this error:
inline int func(int i) { return ++i } static int func();
Message ID: E_INLINE_FUNC_REDECL_STATIC
Example of code that generates the message:
void main(void) { int a=1, b=0, c=0; (a ? b : c) = 5; }
Message ID: E_ASSIGNMENT_TO_COND_EXPR
Example of code that generates the message:
int *a = &(int[]){10, 20};
Message ID: E_NONC99_COMPOUND_LITERAL
An array member of a function of type struct is being assigned to a pointer. The result of this assignment is undefined beyond the next sequence point. Example of code that generates the message:
main() { int *i; i = foo().bar; printf("i is %d\n", *i); }
Message ID: E_ASG_ARY_TO_PTR
invalid use of inline keyword Example of code that generates the message.
int foo(inline int);
Message ID: E_INLINE_INVALID_USE
Operand of the ++ and -- operators must be of integer, real or pointer type. Example of code that generates the message:
double _Complex dc = 1.0 + 2.0 * _Imaginary_I; dc++; // error here double _Imaginary di = 2.0 * _Imaginary_I; --di; // error here
Message ID: E_OPERAND_MUST_BE_REAL_OR_PTR
Example of code that generates the message:
static int bar(); inline int foo() { static int i; return i + bar(); } The references to variable 'i' and function 'bar' are both invalid.
Message ID: E_REF_STATIC_EXTERN_INLINE
Complex/Imaginary type specifier incomplete Example of code that generates the message:
_Complex c = 1.1 + 2.2 * _Imaginary_I; _Imaginary i;
Message ID: E_INCOMPLETE_COMPLEX_IMAGINARY
invalid floating point operation
Message ID: E_FP_INVALID
floating point operation causes overflow
Message ID: E_FP_OVERFLOW
floating point operation causes underflow
Message ID: E_FP_UNDERFLOW
division by zero
Message ID: E_FP_DIVISION_BY_ZERO
real types converted to _Imaginary types result in a 0.0 of _Imaginary type Example of code that generates the message:
double d = 1.0; double _Imaginary di = d; // warning here: di gets 0
Message ID: E_REAL_CONV_TO_ZERO
_Imaginary types converted to real types result in a 0.0 of real type Example of code that generates the message:
double _Imaginary di = _Imaginary_I; double d = di; // warning here: d gets 0
Message ID: E_IMAGINARY_CONV_TO_ZERO
Iteration expression of OpenMP for must be consistent with control expression. If logical operator in the for loop is <=, then the loop variable should be incremented and vice versa. Example of code that generates the message:
void main() { int i; #pragma omp parallel for for (i=0; i<10; i--) { } }
Message ID: E_OMP_FOR_INCONSIST_ITER
Sixteen-bit string literals can only be concatenated with other sixteen-bit string literals. Example of code that generates the message:
unsigned short *s = U"abc" "def";
Message ID: E_CANT_CONCAT_MIXED_UTF_STRINGS
Example of code that generates the warning:
unsigned short bar[] = U"é";
Message ID: E_ASCII_UTF16_USHORT_CHAR_ERR
The -xcrossfile flag is ignored when compiling using fix and continue from the debugger.
Message ID: E_X_CROSSFILE_IGNORED
Example of code that generates the error:
static __symbolic int i;
Message ID: E_LDSCOPE_FOR_EXTERN_ONLY
Example of code that generates the error:
__symbolic void rescopedcl(); __global void rescopedcl();
Message ID: E_NEW_LDSCOPE_MUST_BE_HIGHER
Example of code that generates the error:
__symbolic void rescopedef() { } __hidden void rescopedef();
Message ID: E_NO_LDSCOPE_AFTER_DEFN
Example of code that generates error:
int i; #include "file.h" #pragma hdrstop main() { }
Message ID: E_PCH_BAD_VIABLE_PREFIX
The declaration for a bit-field specifies negative number of bits. Example of code that generates the message:
struct s { int x:-3 };
Message ID: E_BIT_FLD_SIZE_LESS_ZERO
The declaration for a bit-field specifies zero size. Example of code that generates the message:
struct s { int x:1; int y:0; };
Message ID: E_BIT_FLD_SIZE_EQUAL_ZERO
OpenMP parallel and worksharing constructs are required to be followed by structured block. A structured block is a statement that has a single entry and a single exit. No statement that causes a jump into or out of the block is allowed. Example of code that generates the message:
int foo() { goto label_1; #pragma omp parallel { label_1: ; } }
Message ID: E_OMP_STRUCTBLK_BREAKING_IN
OpenMP parallel and worksharing constructs are required to be followed by structured block. A structured block is a statement that has a single entry and a single exit. No statement that causes a jump into or out of the block is allowed. A structured block cannot contain a return, goto, break or continue statement that causes control to flow out of the block. Example of code that generates the message:
int foo() { #pragma omp parallel { return; } }
Message ID: E_OMP_STRUCTBLK_BREAKING_OUT
TLS variables are not permitted in OpenMP data scope clauses. They are not affected by default clause too. Example of code that generates the message:
__thread int i; void main() { #pragma omp parallel private(i) i++; }
Message ID: E_OMP_TLS_WRONG_CLAUSE
designated index for an array initializer was used to initialize non-array variable. Example of an initializer that generates the message:
int a = {[5]=1};
Message ID: E_DESIG_INIT_NONARRAY
designated index for an array initializer is not a constant value, or not of integer type. Example of an initializer that generates the message:
int i; int a[10] = {[i]=1};
Message ID: E_DESIG_INIT_INDEX_NONCONST
designated index for an array initializer is out of array bounds. Example of an initializer that generates the message:
int a[10] = {[20]=1};
Message ID: E_DESIG_INIT_INDEX_BOUND
struct/union field name was used in a non-struct/union initializer context. Example of an initializer that generates the message:
int a[10] = {.field=1};
Message ID: E_DESIG_INIT_NONSTRUCT
You used C99 ISO designated initializer syntax in a non-C99 mode. Example of an initializer that generates the message:
int a[10] = {.field=1};
Message ID: E_DESIG_INIT_DISABLED
When user defined data (e.g., derived from input or command-line options) is passed as the format argument of printf-like functions, you should make sure that there are no unintended %n specifiers in the format string. %n-expansion is a well-known source for security exploits. Example of code that generates the error:
(void) fprintf(stderr, fmt, i1, i2, i3);
Message ID: E_SEC_PRINTF_VAR_FMT
Unbounded %s specifiers in the format can cause buffer overflows if the argument that is formatted is larger than the buffer. Example of code that generates the error:
(void) sprintf(buf, "%s", string);
Message ID: E_SEC_SPRINTF_UNBOUNDED_COPY
When user defined data (e.g., derived from input or command-line options) is passed as the format argument of scanf-like functions, you should make sure that there are no unintended %n specifiers in the format string. %n-expansion is a well-known source for security exploits. Example of code that generates the error:
(void) fscanf(stdin, fmt, &i1, &i2, &i3);
Message ID: E_SEC_SCANF_VAR_FMT
Unbounded %s specifiers in the format can cause buffer overflows if the argument that is formatted is larger than the buffer. Example of code that generates the error:
(void) scanf("%s", string);
Message ID: E_SEC_SCANF_UNBOUNDED_COPY
Copying strings with strcpy() can result in an overflow of the destination buffer if that buffer is too small to hold the contents of the source buffer. Make sure that the destination buffer is large enough, or use strlcpy(). Example of code that generates the error:
(void) strcpy(dst, src);
Message ID: E_SEC_STRCPY_WARN
The library function strncpy() is sometimes difficult to use since it does not NUL-terminate the destination string if there is insufficient space. strlcpy() does not have this limitation and is usually a better choice of function. There is one exception: when you are updating structures that reside on disk, you might depend on the fact that strncpy() will NUL-fill any unused space in the destination buffer. Example of code that generates the error:
(void) strncpy(dst, src, size);
Message ID: E_SEC_STRNCPY_WARN
The use of strncat() is discouraged since it requires you to calculate the space remaining before calling this function. strlcat() is much easier to use safely. Example of code that generates the error:
(void) strncat(dst, src, size);
Message ID: E_SEC_STRNCAT_WARN
There is no situation where you can use gets() safely. It is always prone to buffer overflows since it doesn't have information on the size of the buffer it is supplied with. Use fgets(). Example of code that generates the error:
(void) gets(buf);
Message ID: E_SEC_FORBIDDEN_WARN_GETS
cftime() relies on a large enough buffer to hold the result. Since it imports information from the environment (CFTIME) you can't be sure that the result will fit in the buffer you supplied. Use strftime() instead. Example of code that generates the error:
(void) cftime(buf, fmt, clock);
Message ID: E_SEC_FORBIDDEN_WARN_CFTIME
ascftime() relies on a large enough buffer to hold the result. Since it imports information from the environment (CFTIME) you can't be sure that the result will fit in the buffer you supplied. Use strftime() instead. Example of code that generates the error:
(void) ascftime(buf, fmt, time);
Message ID: E_SEC_FORBIDDEN_WARN_ASCFTIME
creat() is vulnerable to a symlink attack; that is, if the file name to be created already exists as a symbolic link, creat() will follow the symbolic link and create the file at the location pointed to by the symlink. Because of this implementation artifact, you can't create files securely. Example of code that generates the error:
fd = creat(fname, mode);
Message ID: E_SEC_FORBIDDEN_WARN_CREAT
Using bcopy() or memcpy() to copy strings is error prone since it requires that the programmer has calculated the correct sizes. Therefore we suggest to use strlcpy() instead. Example of code that generates the error:
char *src, dst; ... (void) bcopy(dst, src, len);
Message ID: E_SEC_BCOPY_WARN
The rand()-family of functions implement a rather weak random number generator. If you rely on strong random numbers, use the /dev/random or /dev/urandom interface. Example of code that generates the error:
i = rand();
Message ID: E_SEC_RAND_WARN
Using this function in combination with another function that deals with the same object (directory) can lead to pathname-based race conditions. Use fchdir() as an alternative. Example of code that generates the error:
(void) chdir(dirname);
Message ID: E_SEC_CHDIR_WARN
Libraries and programs should not call this function on user supplied pathnames. User supplied message catalogues can be leveraged to break privileged code easily. Example of code that generates the error:
(void) catopen(fname, flag);
Message ID: E_SEC_CATOPEN_WARN
Parameters to this function should only be unqualified pathnames which are then found using the runtime linker's path, or full pathnames which are not in any way derived from user input (including argv[0]). Note that there is no way to safely open a user supplied shared object since the _init() function is executed before dlopen() returns. Example of code that generates the error:
dlopen(fname, dlopen_mode);
Message ID: E_SEC_DLOPEN_WARN
This function opens several files and should only be used with pathnames that are known to be safe.
Message ID: E_SEC_PATH_WARN
chroot-ed environments offer little protection. Make sure you run no privileged programs in a chroot-ed environment and that you chdir() to a point below the new root after chroot().
Message ID: E_SEC_CHROOT_WARN
Treat the values returned by getenv() carefully. They are under
complete control of the user and can be large (up to NCARGS
( Message ID: E_SEC_GETENV_WARN
Avoid using getlogin(); you can't rely on it's output, and it is not multithread-safe (use getlogin_r() instead). In either case, you should not trust the returned login; use uid or provide alternative user authentification method.
Message ID: E_SEC_GETLOGIN_WARN
Check that the path used for mkdir() is safe if it is derived from user input.
Message ID: E_SEC_MKDIR_WARN
There is no guarantee that the generated pathname can be used safely as there is a race condition between the generation of the pathname and its use in open(). Use "fd = mkstemp(template);" instead.
Message ID: E_SEC_MKTEMP_WARN
This function creates a child process that runs the shell (/bin/sh) to perform its job. Spawning a shell involves $PATH, $IFS and other environment variables, which make it difficult to use securely. Also, keep in mind that the shell will interpret special characters present in its argument.
Message ID: E_SEC_SHELL_WARN
If you accept a user specified \"namelist\" argument, make sure you revoke privileges before using it.
Message ID: E_SEC_KVM_WARN
Make sure you handle the case where the contents of the symbolic link are too large for the supplied buffer.
Message ID: E_SEC_READLINK_WARN
Avoid using getpass() in secure applications. getpassphrase() is preferred since it can return up to 256 characters of password.
Message ID: E_SEC_GETPASS_WARN
There is no guarantee that the generated pathname can be used safely as there is a race condition between the generation of the pathname and its use in open(). Use mkstemp() instead.
Message ID: E_SEC_TEMPNAM_WARN
This function calls umask() which is dangerous in multi-threaded applications.
Message ID: E_SEC_TMPFILE_WARN
This function is subject to pathname race conditions since it operates on an object in the file namespace. The object presented to this function might be different than the object in prior or subsequent calls because the file system may have changed between these subsequent calls.
Message ID: E_SEC_TRUNCATE_WARN
Avoid using umask() since it modifies user-defined umask. Consider using file creation modes in open-like functions.
Message ID: E_SEC_UMASK_WARN
Avoid using utmpname() in secure applications; you should use default utmp file names instead.
Message ID: E_SEC_UTMP_WARN
Programming with select() is error-prone because of the difficult API and is known to have caused several security problems. poll() has a much easier interface to use, has less restrictions and is faster.
Message ID: E_SEC_SELECT_WARN
Copying strings with this function can result in an overflow of the destination buffer if that buffer is too small to hold the contents of the source buffer. Make sure that the destination buffer is large enough.
Message ID: E_SEC_EXPAND_WARN
Processes should honor the current real-uid, switch back to the real-uid before opening files if you need to. If you must change the attributes of a file-system object, preferably use open() together with fchown()/fchmod().
Message ID: E_SEC_CHMOD_WARN
execvp() and execlp() rely on $PATH to find the proper binary to run and $PATH is often under the user's control. Instead use one of execl(), execv() or execve().
Message ID: E_SEC_EXEC_PATH
Make sure that the environment is sanitized before you exec() another application, and that you have closed all sensitive file descriptors.
Message ID: E_SEC_EXEC_WARN
This is a security reminder: you should check bounds when appending to a buffer inside a loop. Incorrect or absent bounds calculations may result in buffer overruns; never assume that user input has fixed length, check for bounds signedness, etc.
Message ID: E_SEC_LOOP_WARN
This function can't be used securely since the information it returns is outdated by the time you can act on it. Using access() followed by open() has a race condition that can't be solved. Alternative: open() with permissions of intended user.
Message ID: E_SEC_ACCESS_WARN
If you call open() with O_CREAT, but without O_EXCL, open() will follow a symlink as the last component of the pathname. This could enable users to creat files in a destination that was not intended.
Message ID: E_SEC_CREAT_WITHOUT_EXCL
You should always specify file creation mode, setting permissions as narrow as possible (current user only, usually), extending them later if needed; otherwise users may get undesired access to created files.
Message ID: E_SEC_CREAT_WITHOUT_MODE
This function does not allow to specify permissions for new files. Make sure that the pathname already exists or that the directory is not publicly writable. Alternative: use open()/fdopen() sequence.
Message ID: E_SEC_FOPEN_MODE
Malicious user may modify the filesystem object after the stat-like call has completed, resulting in possible race condition. Use fstat() instead.
Message ID: E_SEC_USE_AFTER_STAT
When user defined data (e.g., derived from input or command-line options) is passed as a mask argument to glob(), you should validate input to make sure that the string is well-formed and would not pose a security threat. Check for extended symbols, '..', '/', '-', spaces, and other special characters.
Message ID: E_SEC_GLOB_WARN
Type name used in compound literal should either an object type or an array of unknown size. Example of code that generates the message
int i = (struct UNKNOWN) { 1 };
Message ID: E_INCOMPLETE_COMPOUND_LITERAL
\u and \U escape sequences designate universal character names in 1999 ISO C. Example of code that generates the message:
char *cp = "This is a ucn: \u0020";
Message ID: E_ESC_U_IS_C99_UCN
1999 ISO C requires that \u must be followed by 4 hexadecimal digits, \U must be followed by 8 hexadecimal digits. Example of code that generates the message:
char *cp = "&\u00fz";
Message ID: E_BAD_NUM_OF_DIGITS_IN_UCN
This universal character name is not valid in identifer according to limits specified in 1999 ISO C. Example of code that generates the message:
int i\uFFFF;
Message ID: E_INVALID_UCN_FOR_ID
This universal character name is not valid. Example of code that generates the message:
int i\u0033;
Message ID: E_INVALID_UCN_VALUE
Non-integral constant expressions are not allowed in array size expression in 1990 ISO C. Note, that in 1999 ISO C this will be a variable length array. Example of code that generates the message:
void foo() { int a[(int)(5.0+1.0)]; }
Message ID: E_C90_NON_INTEGRAL_ARRAY_SIZE
When creating or using PCH files, a viable prefix for a source file must always terminate outside of conditionally compiled code. Example of code that generates the message: cc -xpch=collect:FOO -DFOO
#ifdef FOO #include "foo.h" #pragma hdrstop #else #include "bar.h" #pragma hdrstop #endif main() {}
Message ID: E_PCH_CONDITIONAL_PREFIX
The PCH file is unusable because the compiler used to generate the PCH file is different from the current compiler.
Message ID: E_PCH_FILE_UNUSABLE_COMP_VERS
The PCH file is unusable because the current source file path is different from the source path in effect when the PCH file was created. This affects includes using relative paths and can lead to different header files getting included, which means the contents of the PCH file would not be valid for this compilation.
Message ID: E_PCH_FILE_UNUSABLE_SRC_PATH
The PCH file is unusable because the current worked directory is different from the directory in effect when the PCH file was created. This can lead to different header files being included, which means the contents of the PCH file would not be valid for this compilation.
Message ID: E_PCH_FILE_UNUSABLE_CWD
This warning is displayed when compiler is invoked with either -xcrossfile or -xipo. Variable declared previously as extern variable cannot be redeclared as static. Example of code that generates the message :
extern int local_i; void main(int argc, char *argv[]) { return local_i; } static int local_i=10;
Message ID: E_CANT_XCROSSFILE_GLOBSTATIC
The very first declaration of a thread variable must include the __thread specifier. Example of code that generates the message:
int i; __thread int i;
Message ID: E_NONTHREAD_THREAD_REDECL
The line number specified in a #line directive should be less than or equal to 2147483647 for C99 mode or 32767 for C90 mode. Example of code that generates the message:
#line 2147483647 "string" #line 2147483648
Message ID: E_OUT_OF_RANGE_POUND_NUMBER
The name that is being redefined by redefine_extname pragma should not be already used.
void main(){ foo6(1,1); } #pragma redefine_extname foo6 foo6_1
Message ID: E_REDEF_EXTNAME_INCORRECT
Variable that has variably modified type can not be declared with external linkage. Example of code that generates the message:
void foo() { int n; extern int (*a)[n]; }
Message ID: E_EXTERN_VM
An operator has been used with an operand that is required to be of real floating type (float, double, long double, etc.) but is not, for example using an int. Example of code that generates the message:
#includeint foo() { double _Complex c; return fpclassify(c); }
Message ID: E_OPERAND_MUST_BE_REAL_FLOAT
Structure can contain a flexible array member. Such a structure (and any union containing, possibly recursively, a member that is such a structure) shall not be a member of a structure. Example of code that generate the message:
struct A {int xa; int ya[];}; struct B {int xb; struct A yb;};
Message ID: E_STRUCT_DERIVED_FROM_FLEX_MBR
Structure can contain a flexible array member. Such a structure (and any union containing, possibly recursively, a member that is such a structure) shall not be an element of an array. Example of code that generate the message:
struct A {int xa; int ya[];}; struct A n[10];
Message ID: E_ARY_DERIVED_FROM_FLEX_MBR
No access permissions for the directory specified with a -I file_path option
Message ID: E_CANT_ACCESS_INCLUDE_DIR
Variable lengths arrays are not allowed to be initialized. Example of code that generates the message:
void foo() { int n; int x[n] = { 1 }; }
Message ID: E_CANT_INIT_VLA2
Such operators as <, >, <=, >= are not applicable for complex or imaginary numbers. Example of code that generate the message:
int foo(float _Complex parm1, float _Complex parm2) { return (parm1 > parm2); } int foo(float _Imaginary parm1, float _Imaginary parm2) { return (parm1 < parm2); }
Message ID: E_OPERANDS_INVALID_TO_BIN_RELOP
OpenMP Reduction loops with nowait clause should be used with caution. Reduction variable value will be indeterminate until a synchronization is performed. Example of code that generate the message:
#pragma omp for reduction(+:s) private(i) nowait for (i=0; i<*p;i++) s += a[i];
Message ID: E_NOWAIT_REDUCTION_USE
assignment of floating point to integer may cause implicit narrowing conversion or loss of precision Example of code that generates the message:
int i; double d; d = 2.78; i = d; // Warning here
Message ID: E_ASSIGMENT_CAUSE_LOSS_PREC
A var args builtin function has been explicitly referenced with an incorrect number of arguments.
Message ID: E_VAR_ARG_PARAM_NUM
A var args builtin function has been explicitly referenced with an argument of the incorrect type
Message ID: E_VAR_ARG_PARAM_TYPE
Bad c99 pragma format, must be #pragma c99 (\"key_to_switch\"). Example of code that generate the message:
#pragma c99 (bubble)
Message ID: E_PRAGMA_C99_BAD_FORMAT
Function call is encountered and it has no parameter type information Example of code that generate the message:
#pragma warn_missing_parameter_info int foo(); foo(3.1416); // Warning here
Message ID: E_NO_MISSED_PARAMS_ALLOWED
The compiler will issue this warning when it can determine that the results of a pointer arithmetic expression will overflow the values representable in an object of type ptrdiff_t Example of code that generates the message:
int foo (int *a) { return a[536870912]; } int foo2 (int a) { int *ptr = &a; ptr = ptr + 536870912; return *ptr; }
Message ID: E_ADDR_EXPR_OVERFLOW
U character literals should contain only one character. Example of code that generates the message:
int i = U'AB';
Message ID: E_UTF16_CHAR_LIT_TOO_BIG
An error has occurred while attempting to write a procedure or other information to a SunIR file.
Message ID: E_IR_FILE_WRITE_ERR
An error has occurred while preparing SunIR to be output to a SunIR file.
Message ID: E_IR_PREP_FOR_OUTPUT
An attempt to minimize a SunIR procedure has failed.
Message ID: E_IR_MINIMIZE_ERR
An error has occured while preparing debug information to be output to a SunIR file.
Message ID: E_IR_DBG_PREP_ERR
It means that name used in pragma struct_align wasn't declared before as a name of user defined type. Example of code that generates the message:
int foo() { #pragma struct_align 16 (unknown) /* heres a warning */ struct tagUNKNOWN { int x; int y; } unknown; unknown.x = 12345; unknown.y = 56789; return 0; }
Message ID: E_PRAGMA_STRUCT_ALIGN_UNDECL
It means that name used in pragma struct_align is not struct/union or typedef struct or union Example of code that generates the message:
int foo() { long double err; #pragma struct_align 16 (err); /* heres a warning */ typedef unsigned long myulong; #pragma struct_align 16 (myulong); /* heres a one more */ .... .... return 0; }
Message ID: E_PRAGMA_STRUCT_ALIGN_BAD_TYPE
The value for #pragma align/struct_align be a positive power of 2, no greater than 128. The syntax for the align pragma is: #pragma align integer (id [, id...]) The syntax for the struct_align pragma is: #pragma struct_align integer (struct/union tag) Example of code that generates the message:
#define ANO 129 #pragma align ANO (astruct)
struct q; #pragma struct_align 123 (q)Good examples:
#define MAX 128 #pragma align MAX (astruct, aint, aptr)
Message ID: E_BAD_PRAGMA_ALIGNMENT_VALUE
When -xmodel=medium is specified, if a TLS object meets the same criteria that a non-TLS object for placement into one of the large sections, an error message is to be generated on the TLS object. Example of code that generates the message:
__thread int large_tls_array[16384] = { ... } // Error here __thread int large_tls_array[16384]; // Error here
Message ID: E_TLS_USED_WITH_MODEL_MEDIUM
The name in the openmp data clause is not a variable Example of code that generates the message:
typedef struct{ int x; int y; }st1; #pragma omp parallel private(st1) // error here { .... }
Message ID: E_OMP_DATA_CLAUSE_INVALID_NAME
Loop control variables aren't allowed in threadprivate directive Example of code that generates the message:
static int i = 0; #pragma omp threadprivate (i) #pragma omp parallel for for (i = 0; i < 4; i++) { // heres an error .... }
Message ID: E_OMP_THREADPRIV_CONTROL_VAR
An identifier redefined by pragma redefine_extname has been declared static. Example of code that generates the message:
1 #pragma redefine_extname fold fnew 2 3 static int fold() 4 { 5 return 1; 6 } 7 8 main () 9 { 10 }
Message ID: E_PRAGMA_REDEFINE_STATIC
Only volatile qualifier is allowed for asm statement Example of code that generates the message:
__asm__ unsigned (...) /* fatal error here */
Message ID: E_ASM_INVALID_QUALIFIER
Output parameter must be lvalue Example of code that generates the message:
__asm__ ("..." : "w" (10) : ...)
Message ID: E_ASM_OUTPUT_PARAM_MUST_BE_LVAL
Undefined named parameter in assembler statement Example of code that generates the message:
asm ("addl %2, %[out]" : [out1] "=a" (b) : "0" (b), "Z" (3));
Message ID: E_ASM_UNDEF_NAMED_PARAM
Missing \"]\" in named parameter list Example of code that generates the message:
asm ("addl %2, %[out" : [out1] "=a" (b) : "0" (b), "Z" (3));
Message ID: E_ASM_NAMED_PARAM_LOST_BRACKET
The result of a statement expression with a void type cannot be referenced. It must be explicitly cast to void. Example of code that generates the message:
int f(int i) { int j; j = ({ int t = -1; if (i > 10) { t = 1; } else { t = 0; } }); printf("Statement expression result is %d\n", j); }
Message ID: E_VOID_STMT_EXPR_NOT_IGNORED
Linker scopes for the same symbol was specified more than once, actual scope will be the last one Example of code that generates the message:
void __symbolic foo() __attribute__((visibility("global"))); /* warning here: actual scope will be "global" */
Message ID: E_MULTIPLE_LDSCOPE_SPECIFIED
Attribute has wrong parameter Example of code that generates the message:
void __attribute__((visibility(__hidden__))) foo(); /* attribute "visibility" parameter must be string */ void __attribute__((visibility("blablabla"))) foo(); /* attribute "visibility" parameter must be one of the: hidden, internal, protected or default */
Message ID: E_ATTRIBUTE_BAD_PARAM
Attribute is unknown and will be ignored Example of code that generates the message:
int c __attribute__((visibi("hidden"))); // Warning here
Message ID: E_ATTRIBUTE_UNKNOWN
This attribute may not be applied to function Example of code that generates the message:
int __attribute__((aligned(8))) f(); // Warning here
Message ID: E_ATTRIBUTE_NOT_FUNC
This attribute may not be applied to type Example of code that generates the message:
struct s { int i; } __attribute__((visibility("hidden"))); // Warning here
Message ID: E_ATTRIBUTE_NOT_TYPE
This attribute may not be applied to variable Example of code that generates the message:
int (*f)() __attribute__((noreturn)); // Warning here: pointer is a variable
Message ID: E_ATTRIBUTE_NOT_VAR
Attribute parameter is undefined identifier Example of code that generates the message:
int ddd __attribute__((cleanup(f))); // Warning here: f should be defined before
Message ID: E_ATTRIBUTE_PARAM_UNDEFINED
The typeof operator was applied to a bit-field. Example of code that generates the message:
struct foo { int i:4; int j:4; }; int main() { typeof(bar.i) j = 1; }
Message ID: E_TYPEOF_ON_BITFIELD
A statement expression was used outside a function. Example of code that generates the message:
int i = ({1;});
Message ID: E_STMT_EXPR_OUTSIDE_FUNC
Operand to the 'typeof' operator is undefined Example of code that generates the message:
int a __attribute__((aligned(sizeof(__typeof(a)))));
Message ID: E_TYPEOF_OPERAND_UNDEF
Local label declaration at file scope Example of code that generates the message:
__label__ l; main() {}
Message ID: E_LOC_LAB_FILE_SCOPE
Output constraint cannot contain both + and = constraint modifiers Example of code that generates the message:
int var1; __asm__ ("nop" : "+=r" (var1));
Message ID: E_ASM_PLUS_EQUAL_MODIFIERS_BOTH
Compound literal is not a constant and can not be used as a direct value for static initialization. It is treated like a static initializer list. Example of code that generates the message:
static int i[] = (int[]) { 10, 20 };
Message ID: E_STATIC_INIT_WITH_CMPLIT
Attribute aligned value should be power of 2 Example of code that generates the message:
char * __attribute__((aligned(5))); // error here
Message ID: E_BAD_ATTR_ALIGNED_VALUE
Attribute "aligned" parameter should be integer constant Example of code that generates the message:
int __attribute__((aligned(foo()));
Message ID: E_ALIGNMENT_NOT_ICON
When using the -Xc option, the compiler reports uses of certain keywords that cannot be used in a strictly conforming ANSI C program. Example of code that will generate the message:
int f(int a) { __typeof(a) b; __asm(" nop "); }
Message ID: E_KW_IS_AN_EXTENSION_OF_ANSI
The __alignof__ operator cannot be applied to function types. Example of code that generates the message:
int i = __alignof__(int ());
Message ID: E_CANT_TAKE_ALIGNOF_FUNC
The __alignof__ operator cannot be applied to functions. Example of code that generates the message:
int f(void); int i = __alignof__(f);
Message ID: E_CANT_TAKE_ALIGNOF_FUNC_N
The __alignof__ operator cannot be applied to type void. Example of code that generates the message:
void v(void); int i = __alignof__(v());
Message ID: E_CANT_TAKE_ALIGNOF_VOID
The __alignof__ operator cannot be applied to bit-fields. Example of code that generates the message:
struct s { int x:3; } st; int i = __alignof__(st.x);
Message ID: E_CANT_TAKE_ALIGNOF_BIT_FIELD
"+" or "=" modifiers aren't allowed in input parameters constraint Example of code that generates the message:
asm("nop" : "+r" (param1) : "+r" (param2));
Message ID: E_ASM_WRONG_INPUT_CONSTR_MOD
Constant variables aren't allowed as asm output parameters Example of code that generates the message:
void foo(void) { const int a = 5; asm("nop" : "=r"(a)); }
Message ID: E_ASM_OUTPUT_PARAM_MUST_BE_MVAL
Current symbol was defined before as an alias for another symbol. Example of code that generates the message:
int f() __attribute__((alias("g"))); int f() { // error here. return 0; }
Message ID: E_ALIAS_REDEFINED
Function may not be declared as alias if current declaration is really a definition. Example of code that generates the message:
int __attribute__((alias("g"))) f() { // warning here. return 0; }
Message ID: E_DEF_ALIAS_IGNORED
Case label for switch statement cannot be placed inside nested statement expression. Example of code that generates the message:
int main() { int i=3; switch(i) { case 1: i++; i = ({ int j = i; j++; case 2: j+=({ int k=j; k+=(j+i); } ); } ); default: break; } }
Message ID: E_MISSING_SWITCH_IN_STMT_EXPR
A defined operator in a #if or #elif directive must be immediately followed by an identifier or ( ) that enclose an identifier. If the token defined is generated as a result of macro replacement process the behavior is undefined. Example of code that generates the message:
#define CHECK defined #if CHECK FOO int i = 1; #endif
Message ID: E_NONPORTABLE_USE_OF_DEFINE
When adding or subtracting an integer to a pointer, both the pointer and the result must point to elements of the same array object, or one past the last element of the same array object. Example of code that generates the message:
void foo(int p) { (&p)[1] = 0; }
Message ID: E_BAD_VAR_ADDRESS_ARITH
Operand with one of m, o, v, p constraints must be lvalue expression Example of code that generates the message:
int b; asm ("nop" : "m" (1, b));
Message ID: E_CANNOT_TAKE_ADDRESS_ASM_PARAM
Input or output parameter in inline asm statement is unused Example of code thet generates the message:
asm ("nop" : m(output));
Message ID: E_ASM_UNUSED_PARAM
When multiple alignment value specified in the same declaration, the greatest one is used. Example of code that generates the message:
int __attribute__((aligned(128))) s __attribute__((aligned(64))); // Warning here
Message ID: E_CONFLICT_ALIGN_MODIFICATION
Symbol may not have an alignment less than the alignment of it's type. Example of code that generates the message:
struct S { ... } __attribute__((aligned(128))); struct S s1 __attribute__((aligned(64))); // Warning here.
Message ID: E_OBJECT_ALIGN_LESS_THAN_TYPE
Declaration may not have an alignment less than the alignment of it's type. Example of code that generates the message:
typedef int __attribute__((aligned(64))) ai64; int align = __alignof__(ai64 __attribute__((aligned(32)))); // warning here
Message ID: E_CUR_ALIGN_LESS_THAN_BASE
Explicit alignment before pointer ignored. Example of code that generates the message:
int __attribute__((aligned(64))) * p; // warning here
Message ID: E_USELESS_PTR_TO_ALIGNED
It's not allowed to change the alignment via redeclaration. Example of code that generates the message:
int __attribute__((aligned(64))) a; int __attribute__((aligned(32))) a; // warning here
Message ID: E_CONFLICT_ALIGN_REDECL_CURR
It's not allowed to change the alignment via redeclaration. Example of code that generates the message:
static int __attribute__((aligned(64))) a; int __attribute__((aligned(32))) a; // warning here
Message ID: E_CONFLICT_ALIGN_REDECL_PREV
Can not set non-default alignment for parameter. Example of code that generates the message:
typedef int __attribute__((aligned(128))) i128; void foo(i128 i1); // warning here
Message ID: E_CANT_SET_NONDEF_ALIGN_PARAM
Can not set non-default alignment for function return type. Example of code that generates the message:
typedef int __attribute__((aligned(128))) i128; i128 foo(); // warning here int __attribute__((aligned(64))) foo(); // warning here
Message ID: E_CANT_SET_NONDEF_ALIGN_FUNC
Can not set non-default alignment for automatic variable. Example of code that generates the message:
typedef int __attribute__((aligned(128))) i128; void boo() { i128 i2; // warning here ..... }
Message ID: E_CANT_SET_NONDEF_ALIGN_AUTO