You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function OutputDataToTargetFile in elf2cfetbl.c is prototyped on line 84 with a void argument list but defined on line 2486 with an empty argument list. This causes the compilation to error out if the compiler and its flags are sufficiently strict.
According to the C Standard, subclause 6.7.6.3, paragraph 14 [ISO/IEC 9899:2011],
An identifier list declares only the identifiers of the parameters of the function. An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied.
Subclause 6.11.6 states that
The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature.
Consequently, functions that accept no arguments should explicitly declare a void parameter in their parameter list. This holds true in both the declaration and definition sections (which should match).
This is caught and rejected by sufficiently-strict (with flags) compilers. One example is the current Apple Mac Clang compiler
% cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.4.0
Thread model: posix
with flags including -std=c99 -pedantic -Wall -Wstrict-prototypes.
Admittedly, the Mac is not a cFS supported system, but clang is a pretty standard compiler, and eventually you can expect gcc to complain as well.
System observed on:
MacBook Pro (Intel)
OS: MacOS Ventura 13.3.1
Versions: clang version 14.0.3
The text was updated successfully, but these errors were encountered:
Describe the bug
The function
OutputDataToTargetFile
inelf2cfetbl.c
is prototyped on line 84 with avoid
argument list but defined on line 2486 with an empty argument list. This causes the compilation to error out if the compiler and its flags are sufficiently strict.The fix is to change the line 2486 argument list to
void
To Reproduce
By inspection:
e.g. This description here
This is caught and rejected by sufficiently-strict (with flags) compilers. One example is the current Apple Mac Clang compiler
with flags including
-std=c99 -pedantic -Wall -Wstrict-prototypes
.Admittedly, the Mac is not a cFS supported system, but
clang
is a pretty standard compiler, and eventually you can expectgcc
to complain as well.System observed on:
The text was updated successfully, but these errors were encountered: