HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)
Table Of Contents
- HP Code Advisor Diagnostics Reference Guide
- Contents
- About This Document
- 1 Diagnostics Categorization
- 2 Diagnostics Details
- 2009 nested comment is not allowed
- 2028 expression must have a constant value
- 2042 operand types are incompatible (%t1 and %t2)
- 2047 incompatible redefinition of macro %nod
- 2054 Too few arguments in macro invocation
- 2063 shift count is too large
- 2064 declaration does not declare anything
- 2068 integer conversion resulted in a change of sign
- 2069 integer conversion resulted in truncation
- 2077 this declaration has no storage class or type specifier
- 2082 storage class is not first
- 2102 forward declaration of enum type is nonstandard
- 2108 signed bit field of length 1
- 2111 statement is unreachable
- 2117 non-void %n should return a value
- 2120 return value type does not match the function type
- 2128 loop is not reachable from preceding code
- 2144 a value of type %t1 cannot be used to initialize an entity of type %t2
- 2147 declaration is incompatible with %nfd
- 2152 conversion of nonzero integer to pointer
- 2167 argument of type %t1 is incompatible with parameter of type %t2
- 2170 pointer points outside of underlying object
- 2172 external/internal linkage conflict with previous declaration %nod
- 2174 expression has no effect
- 2175 subscript out of range
- 2177 %n was declared but never referenced
- 2180 argument is incompatible with formal parameter
- 2181 argument is incompatible with corresponding format string conversion
- 2186 pointless comparison of unsigned integer with zero
- 2187 use of "=" where "==" may have been intended
- 2188 enumerated type mixed with another type
- 2191 type qualifier is meaningless on cast type
- 2192 unrecognized character escape sequence
- 2193 zero used for undefined preprocessing identifier
- 2223 function %sq declared implicitly
- 2224 the format string requires additional arguments
- 2225 the format string ends before this argument
- 2226 invalid format string conversion
- 2228 trailing comma is nonstandard
- 2231 declaration is not visible outside of function
- 2236 controlling expression is constant
- 2237 selector expression is constant
- 2245 a nonstatic member reference must be relative to a specific object
- 2248 pointer to reference is not allowed
- 2249 reference to reference is not allowed
- 2250 reference to void is not allowed
- 2251 array of reference is not allowed
- 2252 reference %n requires an initializer
- 2260 explicit type is missing ("int" assumed)
- 2263 duplicate base class name
- 2265 %nd is inaccessible
- 2267 old-style parameter list (anachronism)
- 2269 conversion to inaccessible base class %t is not allowed
- 2276 name followed by :: must be a class or namespace name
- 2278 a constructor or destructor may not return a value
- 2306 default argument not at end of parameter list
- 2314 only nonstatic member functions may be virtual
- 2315 the object has cv-qualifiers that are not compatible with the member function
- 2319 pure specifier ("= 0") allowed only on virtual functions
- 2320 badly-formed pure specifier (only "= 0" is allowed)
- 2321 data member initializer is not allowed
- 2322 object of abstract class type %t is not allowed
- 2323 function returning abstract class %t is not allowed
- 2325 inline specifier allowed on function declarations only
- 2329 local class member %n requires a definition
- 2336 unknown external linkage specification
- 2340 value copied to temporary, reference to temporary used
- 2363 invalid anonymous union -- nonpublic member is not allowed
- 2364 invalid anonymous union -- member function is not allowed
- 2365 anonymous union at global or namespace scope must be declared static
- 2375 declaration requires a typedef name
- 2381 extra ";" ignored
- 2487 inline %n cannot be explicitly instantiated
- 2513 a value of type %t1 cannot be assigned to an entity of type %t2
- 2546 transfer of control bypasses initialization of: "variable"
- 2549 "variable" is used before its value is set
- 2550 %n was set but never used
- 2656 transfer of control into a try block
- 2767 conversion from pointer to smaller integer
- 2815 type qualifier on return type is meaningless
- 2826 %n was never referenced
- 2830 %n has no corresponding operator delete%s (to be called if an exception is thrown during initialization of an allocated object)
- 2836 returning reference to local variable
- 2837 omission of explicit type is nonstandard ("int" assumed)
- 2940 missing return statement at end of non-void function "function"
- 2951 return type of function "main" must be int
- 2991 extra braces are nonstandard
- 3000 a storage class may not be specified here
- 3051 standard requires that %n be given a type by a subsequent declaration (\"int\" assumed)
- 3055 types cannot be declared in anonymous unions
- 3056 returning pointer to local variable
- 3105 #warning directive: %s
- 3138 format argument does not have string type
- 3145 %t1 would have been promoted to %t2 when passed through the ellipsis parameter; use the latter type instead
- 3197 the prototype declaration of %nfd is ignored after this unprototyped redeclaration
- 3290 Passing a non-POD object to a function with variable arguments has undefined behavior. Object will be copied onto the stack instead of using a constructor.
- 3348 declaration hides %nd
- 3353 %n has no corresponding member operator delete%s (to be called if an exception is thrown during initialization of an allocated object)
- 3750 "\" followed by white space is not a line splice
- 4212 mismatch between character pointer types %t1 and %t2
- 4225 suggest parentheses around comparison in operand of %sq
- 4227 padding struct with %s1 bytes to align member %sq2
- 4228 64 bit migration: conversion from %t1 to a more strictly aligned type %t2 may cause misaligned access
- 4229 64 bit migration: conversion from %t1 to %t2 may truncate value
- 4230 64 bit migration: conversion from %t1 to %t2 may cause target of pointers to have a different size.
- 4231 64 bit migration: conversion between types of different sizes has occurred (from %t1 to %t2 )
- 4232 conversion from %t1 to a more strictly aligned type %t2 may cause misaligned access
- 4235 conversion from %t1 to %t2 may lose significant bits
- 4237 type cast from %t1 to %t2 may cause sign extension to a larger size integer.
- 4239 case type mismatch with switch expression type
- 4241 redeclaration, function %nod was previously called without a prototype
- 4242 No prototype or definition in scope for call to %sq
- 4243 function declared with empty parentheses, consider replacing with a prototype
- 4244 extern storage class used with a function definition
- 4245 storage class used with a data definition
- 4247 function called with different argument counts (%s vs. %s2)
- 4248 comparison of unsigned integer with a signed integer
- 4249 64 bit migration: value could be truncated before cast to bigger sized type.
- 4251 the assignment has an excessive size for a bit field
- 4253 unsigned value cannot be less than zero
- 4255 padding size of struct %sq1 with %s2 bytes to alignment boundary
- 4259 suggest parentheses around the operands of %sq
- 4264 padding size of struct anonymous with %s bytes to alignment boundary
- 4272 conversion from %t1 to %t2 may lose sign
- 4273 floating-point equality and inequality comparisons may be inappropriate due to round off common in floating-point computation
- 4274 comparison of pointer with integer zero
- 4275 constant out of range (%s) for the operator
- 4276 relational operator %sq always evaluates to 'false'
- 4277 logical AND with a constant, do you mean to use '&'?
- 4278 the sub expression in logical expression is a constant
- 4279 the expression depends on order of evaluation
- 4281 assignment in control condition
- 4286 return non-const handle to non-public data member may undermine encapsulation
- 4289 endian porting: the definition of the union may be endian dependent
- 4290 endian porting: the initialization of char array may be endian dependent
- 4292 endian porting: the dereference of cast pointer may be endian dependent
- 4295 abstract function type declared with empty parentheses, consider replacing with parameter list or void.
- 4298 64 bit migration: addition result could be truncated before cast to bigger sized type
- 4299 64 bit migration: multiply result could be truncated before cast to bigger sized type
- 4300 Overflow while computing constant in left shift operation
- 4301 expression has no effect
- 4314 if statement without body, did you insert an extra ';'?
- 4315 %s loop without body, did you insert an extra ';'?
- 4354 One of the operands of the %sq operation is a string literal, strcmp() is recommended for such comparison
- 4355 the initializer for %n is greater than %s
- 4356 operand of sizeof is a constant rvalue, this might not be what you intended
- 4357 octal escape sequence "%s" is followed by decimal character '%s2'
- 4360 size of types of consecutive bitfields are different, bitfield packing behavior may be different across compiler
- 4361 64 bit migration: size of types of consecutive bitfields are different, bitfield packing behavior may be different across compilers
- 4363 possible mismatch in parameters passed to %n, previously seen %p
- 4364 endian porting: type cast is endian dependent
- 4365 endian porting: the definition of the union may be endian dependent
- 4370 Control flows into the switch case from the previous case value
- 4372 Potential overflow in arithmetic expression involving time_t/clock_t values
- 4373 non arithmetic integer conversion resulted in a change of sign
- 4377 endian porting: sending data may be endian dependent if not preceded by conversion
- 4378 endian porting: accessing data without conversion may be endian dependent
- 4379
: : - 20035 variable %s is used before its value is set
- 20036 variable %s (field %s) is used before its value is set
- 20037 variable %s may be used before its value is set
- 20048 %s "%s" has incompatible type with previous declaration at line %s in file "%s"
- 20072 variable %s is partially uninitialized when used
- 20073 variable %s may be partially uninitialized when used
- 20074 variable %s (field "%s") may be used before its value is set
- 20200 Potential null pointer dereference %s%s is detected %s
- 20201 Memory leak is detected
- 20202 Allocated memory may potentially be leaked %s
- 20203 Potential out of scope use of local %s %s
- 20206 Out of bound access (%s)
- 20208 Forming out of bound address(%s)
- 20210 Mismatch in allocation and deallocation
- 20213 Potential write to read only memory %s%s is detected
- 20229 variable "%s" is uninitialized if the loop %s is not executed
- 20231 variable "%s" (field "%s") may be used before its value is set if the loop %s is not executed
Action:
#warning directives are usually added to warn against fallthrus in conditionally compiled code.
check if you need to handle a new condition.
Reference:
3138 format argument does not have string type
Cause:
The format argument of a function having same attributes as the printf, scanf family functions must
be of string type.
Example:
int print(char *str,void *fmt, ...)
__attribute__((format(printf,2,3))); // argument 2 must be of
// string type
Action:
Change the type of format argument to string type
Reference:
3145 %t1 would have been promoted to %t2 when passed through the
ellipsis parameter; use the latter type instead
Cause:
Arguments that are passed as variable arguments are subjected to default argument promotion.
The programmer should be aware of such promotions and should ensure that they do not effect
the correctness of the program.
Example:
int print(char *str,void *fmt, ...)
__attribute__((format(printf,2,3))); // argument 2 must be of
// string type
Action:
Where possible use the promoted type instead
Reference:
ANSI/ISO C++ 5.2.2(7)
3197 the prototype declaration of %nfd is ignored after this unprototyped
redeclaration
Cause:
The unprototyped declaration of a function in an inner scope hides an prototyped declaration in
the outer scope. NOTE: In same scope the function prototypes do not hide each other but in nested
scope they do.
Example:
int foo(int x);
int main() {
int foo(); // warning 3197 here
}
Action:
Remove the unprototyped declaration.
Reference:
50 Diagnostics Details