Treat static followed by extern declarations as specifying internal linkage.

See C17 section 6.2.2 p4-5.
This commit is contained in:
Stephen Heumann 2022-11-06 21:19:47 -06:00
parent 82b2944eb8
commit e168a4d6cb
2 changed files with 5 additions and 0 deletions

View File

@ -2049,6 +2049,9 @@ if space <> fieldListSpace then begin {are we defining a function?}
Error(42)
else begin
itype := MakeCompositeType(cs^.itype, itype);
if class = externsy then
if cs^.class = staticsy then
class := staticsy;
p := cs;
needSymbol := false;
end; {else}

View File

@ -1966,6 +1966,8 @@ int foo(int[42]);
218. If a function declared within a block had the same name as a variable in an outer scope, the symbol table entry for that variable could be corrupted, leading to spurious errors or incorrect code generation.
219. If a function is first declared as "static" and then subsequently redeclared or defined as "extern" or with no storage-class specifier, it should be private to the source file, the same as if it was just declared "static".
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
1. In some situations, fread() reread the first 1K or so of the file.