HP Code Advisor Diagnostics

The return value of the function is the address of a local variable. Unless declared as static, a
local variable has automatic storage duration i.e. the storage for it lasts until the block that defines
it exists. Dereferencing the pointer to a local variable after the function that defines it returns
will lead to undefined runtime behavior.
Example:
int* foo() {
int i = 10;
return
}
Action:
If you need to return the pointer to this variable then make it a static variable.
Reference:
ANSI/ISO C++ 3.7.2
3105 #warning directive: %s
Cause:
The preprocessor has encountered a #warning preprocessor directive.
Example:
#if VERSION_10
#define VERSION 10
#else
#warning "undefined version"
#endif
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:
3105 #warning directive: %s 53