mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-01 13:29:32 +00:00
Do not require unused static functions to be defined.
This mostly implements the rule in C17 6.9 p3, which requires a definition to be provided only if the function is used in an expression. Per that rule, we should also exclude most sizeof or _Alignof operands, but we don't do that yet.
This commit is contained in:
parent
fe62f70d51
commit
4bc486eade
27
Symbol.pas
27
Symbol.pas
@ -449,20 +449,21 @@ for i := 0 to hashSize do begin
|
||||
while sp <> nil do begin
|
||||
if sp^.storage = private then
|
||||
if sp^.itype^.kind = functionType then
|
||||
if sp^.state <> defined then begin
|
||||
numErrors := numErrors+1;
|
||||
new(msg);
|
||||
msg^ := concat('The static function ', sp^.name^,
|
||||
' was not defined.');
|
||||
writeln('*** ', msg^);
|
||||
if terminalErrors then begin
|
||||
if enterEditor then
|
||||
ExitToEditor(msg, ord4(firstPtr)-ord4(bofPtr))
|
||||
else
|
||||
TermError(0);
|
||||
if sp^.state <> defined then
|
||||
if sp^.used then begin
|
||||
numErrors := numErrors+1;
|
||||
new(msg);
|
||||
msg^ := concat('The static function ', sp^.name^,
|
||||
' was used but never defined.');
|
||||
writeln('*** ', msg^);
|
||||
if terminalErrors then begin
|
||||
if enterEditor then
|
||||
ExitToEditor(msg, ord4(firstPtr)-ord4(bofPtr))
|
||||
else
|
||||
TermError(0);
|
||||
end; {if}
|
||||
liDCBGS.merrf := 16;
|
||||
end; {if}
|
||||
liDCBGS.merrf := 16;
|
||||
end; {if}
|
||||
sp := sp^.next;
|
||||
end; {while}
|
||||
end; {for}
|
||||
|
2
cc.notes
2
cc.notes
@ -2063,6 +2063,8 @@ int foo(int[42]);
|
||||
|
||||
229. Each time a CDev written with ORCA/C was opened and closed, it would leak a user ID. If it was opened and closed many times, the system could run out of user IDs of the appropriate type, potentially causing problems. To avoid this, new cleanup code has been added that runs when a CDev is closed. To ensure this code gets run, CDevs written with ORCA/C should always set the wantClose flag so that they receive CloseCDEV messages, even if they do not otherwise need them.
|
||||
|
||||
230. It should be allowed to declare a static function that is never defined, provided that the function is also never used in an expression.
|
||||
|
||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||
|
||||
1. In some situations, fread() reread the first 1K or so of the file.
|
||||
|
Loading…
Reference in New Issue
Block a user