diff --git a/Scanner.pas b/Scanner.pas index 4cf05e3..d483c7b 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -4873,13 +4873,6 @@ if tokenList <> nil then begin {get a token put back by a macro} dispose(tPtr); if token.kind = typedef then {allow for typedefs in a macro} token.kind := ident; - if token.kind = ident then begin - CopyString(@workString, token.name); - lExpandMacros := expandMacros; - expandMacros := false; - CheckIdentifier; - expandMacros := lExpandMacros; - end; {if} { dead code if token.kind = ident then if FindSymbol(token,allSpaces,false,false) <> nil then @@ -4926,6 +4919,13 @@ if tokenList <> nil then begin {get a token put back by a macro} goto 4; end; {if} end; {if} + if token.kind = ident then begin + CopyString(@workString, token.name); + lExpandMacros := expandMacros; + expandMacros := false; + CheckIdentifier; + expandMacros := lExpandMacros; + end; {if} goto 2; end; {if} 5: {skip white space} diff --git a/cc.notes b/cc.notes index ac8e3ee..8a0df2f 100644 --- a/cc.notes +++ b/cc.notes @@ -1803,6 +1803,8 @@ int foo(int[42]); 183. The # preprocessor operator would not work correctly on tokens that had been produced by the ## preprocessor operator, tokens that were split over two or more lines using line continuations, or tokens represented using trigraphs. +184. If a macro was declared with the same name as a keyword or a typedef, and that name was also used within another macro, the first macro would not be correctly expanded within invocations of the second macro. (This is a bug that was previously fixed in ORCA/C 2.1.1 B3, but was subsequently reintroduced.) + -- Bugs from C 2.1.0 that have been fixed ----------------------------------- 1. In some situations, fread() reread the first 1K or so of the file.