Main Content

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
The message indicates that Polyspace® cannot find a function prototype. Therefore, it cannot identify the data types of the function argument and return value, and has to infer them from the calls to the function.

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 one double argument. If you pass an int argument in a subsequent call, a conversion from int to double 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.