mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-14 02:29:28 +00:00
Prevent tags from shadowing variable names within static initializers.
This occurred due to looking for the symbol in all namespaces rather than only variable space. Here is an example affected by this: int X; int main(void) { struct X {int i;}; static int *i = &X; }
This commit is contained in:
parent
1f6bc44b48
commit
645b210e7f
|
@ -2011,7 +2011,7 @@ var
|
||||||
end; {else}
|
end; {else}
|
||||||
end {else if}
|
end {else if}
|
||||||
else if tree^.token.kind = ident then begin
|
else if tree^.token.kind = ident then begin
|
||||||
ip := FindSymbol(tree^.token, allSpaces, false, true);
|
ip := FindSymbol(tree^.token, variableSpace, false, true);
|
||||||
if ip = nil then begin
|
if ip = nil then begin
|
||||||
Error(31);
|
Error(31);
|
||||||
errorFound := true;
|
errorFound := true;
|
||||||
|
@ -2231,7 +2231,7 @@ var
|
||||||
if kind = ident then begin
|
if kind = ident then begin
|
||||||
|
|
||||||
{handle names of functions or static arrays}
|
{handle names of functions or static arrays}
|
||||||
ip := FindSymbol(tree^.token, allSpaces, false, true);
|
ip := FindSymbol(tree^.token, variableSpace, false, true);
|
||||||
if ip = nil then begin
|
if ip = nil then begin
|
||||||
Error(31);
|
Error(31);
|
||||||
errorFound := true;
|
errorFound := true;
|
||||||
|
@ -2267,7 +2267,7 @@ var
|
||||||
iPtr^.pPlus := true;
|
iPtr^.pPlus := true;
|
||||||
iPtr^.isName := true;
|
iPtr^.isName := true;
|
||||||
if tree^.token.kind = ident then begin
|
if tree^.token.kind = ident then begin
|
||||||
ip := FindSymbol(tree^.token, allSpaces, false, true);
|
ip := FindSymbol(tree^.token, variableSpace, false, true);
|
||||||
if ip = nil then begin
|
if ip = nil then begin
|
||||||
Error(31);
|
Error(31);
|
||||||
errorFound := true;
|
errorFound := true;
|
||||||
|
|
2
cc.notes
2
cc.notes
|
@ -2144,6 +2144,8 @@ int foo(int[42]);
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
237. If the same identifier was used for both a variable or function name and a struct/union/enum tag, it might not be possible to take the address of the variable or function within the initializer for a static variable.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
1. In some situations, fread() reread the first 1K or so of the file.
|
1. In some situations, fread() reread the first 1K or so of the file.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user