mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-16 20:32:57 +00:00
Fix handling of typedef names immediately after an inner scope where the identifier is redeclared.
If an identifier is used as a typedef in an outer scope but then declared as something else in an inner scope (e.g. a variable name or tag), and that same identifier is the next token after the end of the inner scope, it would not be recognized properly as a typedef name leading to spurious errors.\ Here is an example that triggered this: typedef char Type; void f(int Type); Type t; Here is another one: int main(void) { typedef int S; if (1) (struct S {int a;} *)0; S x; }
This commit is contained in:
parent
85890e0b6b
commit
1f6bc44b48
@ -2522,7 +2522,14 @@ if (lint & lintUnused) <> 0 then
|
||||
CheckUnused(tPtr);
|
||||
if tPtr^.next <> nil then begin
|
||||
table := table^.next;
|
||||
if not tPtr^.isEmpty or (tablePoolSize = tablePoolMaxSize) then
|
||||
if not tPtr^.isEmpty then begin
|
||||
dispose(tPtr);
|
||||
if token.kind = ident then
|
||||
if FindSymbol(token,variableSpace,false,false) <> nil then
|
||||
if token.symbolPtr^.class = typedefsy then
|
||||
token.kind := typedef;
|
||||
end {if}
|
||||
else if (tablePoolSize = tablePoolMaxSize) then
|
||||
dispose(tPtr)
|
||||
else begin
|
||||
tPtr^.next := tablePool;
|
||||
|
2
cc.notes
2
cc.notes
@ -2142,6 +2142,8 @@ int foo(int[42]);
|
||||
|
||||
235. With certain inputs, the qsort() function could cause a stack overflow due to excessive recursion, potentially leading to crashes or other problems. Now its stack usage is limited to less than 600 bytes (usually significantly less), excluding whatever stack space may be used by the comparison function.
|
||||
|
||||
236. If a typedef name was used immediately after the end of an inner scope where the same name was used as a variable name or struct/union/enum tag, it might not be properly recognized as a typedef name, leading to spurious errors.
|
||||
|
||||
-- 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…
x
Reference in New Issue
Block a user