Fix Polyspace Compilation Errors About Unknown Function Prototype
Issue
During the compilation phase, the software displays a warning or error message about unknown function prototype.
the prototype for function 'myfunc' is unknown
To determine the data types for such functions, Polyspace follows the C99 Standard (ISO/IEC 9899:1999, Chapter 6.5.2.2: Function calls).
The return type is assumed to be
int
.The number and type of arguments are determined by the first call to the function. For instance, if the function takes one
double
argument in the first call, for subsequent calls, the software assumes that it takes onedouble
argument. If you pass anint
argument in a subsequent call, a conversion fromint
todouble
takes place.
During the linking phase, if a mismatch occurs between the number or type of arguments or the return type in different compilation units, the analysis follows an internal algorithm to resolve this mismatch and determine a common prototype.
Cause
The source code you provided does not contain the function prototype. For instance, the function is declared in an include file that Polyspace cannot find.
If you #include
-d the include file in your
source code but did not add it to your Polyspace project, you
see a previous warning:
Warning: could not find include file "my_include.h"
Solution
Search for the function declaration in your source repository.
If you find the function declaration in an include file, add the folder that contains the include file.
In the user interface of the Polyspace desktop products, add the folder to your project.
For more information, see Add Source Files for Analysis in Polyspace User Interface.
At the command line, use the flag
-I
with thepolyspace-bug-finder
command.For more information, see
-I
.