Bug 62571 - [Scanner] Unable to macro expand operator ## with "0xxyz" argument
Summary: [Scanner] Unable to macro expand operator ## with "0xxyz" argument
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: John Camelon CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 61972
Blocks:
  Show dependency tree
 
Reported: 2004-05-17 18:03 EDT by Mas Yokota CLA
Modified: 2004-08-10 13:31 EDT (History)
1 user (show)

See Also:


Attachments
test case (668 bytes, text/plain)
2004-05-17 18:04 EDT, Mas Yokota CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mas Yokota CLA 2004-05-17 18:03:47 EDT
There are two problems in the test case:
1. Macro expansion of operator ## with hex literal-like "0xxyz" causes the 
parser to ignore the expansion.
2. Macro expansion where macroname is the same as one of its arguments.
see below,

#define C(X,Y) X##Y

int C(A,1Xxyz)     = 10;
int C(B,1X1X1Xxyz) = 20;	
int C(C,0Xxyz)     = 30; // macro expansion is NOT OK
int C(CC,0Xxyz)     = 30; // OK
int C(D,0xxyz)     = 40; // macro expansion is NOT OK
int C(E,0x0x0xxyz) = 50;
Comment 1 Mas Yokota CLA 2004-05-17 18:04:22 EDT
Created attachment 10756 [details]
test case
Comment 2 Mas Yokota CLA 2004-05-17 18:17:58 EDT
The resultant outline view is as follows:
A1Xxyz : int
B1X1X1Xxyz : int
CC0Xxyz : int
Dxyz : int
E0x0x0xxyz : int

As you can see, C0Xxyz is missing and D0xxyz is coming out as Dxyz.
Comment 3 John Camelon CLA 2004-06-05 23:25:14 EDT
Update: The problem is that when we lookahead for macro pasting, we are 
expecting a valid token.  0xxyz is not a valid identifier format, or a valid 
hexidecimal integer format, and thus it causes an error.  

Mr. Niefer, as the originator of this strategy, do you have any suggestions as 
to how we can get past this?
Comment 4 Kleo Hapitas CLA 2004-07-07 16:34:12 EDT
PR was targeted to the 2.0 release but not resolved, moving target to 2.1
Comment 5 Doug Schaefer CLA 2004-07-07 16:47:09 EDT
This is a 2.0.1 candidate.
Comment 6 John Camelon CLA 2004-08-10 11:13:49 EDT
This defect is fixed in HEAD w/Scanner2 implementation. 
It shall be marked as resolved once it has been fixed in 2.0.1 as well. 
Comment 7 John Camelon CLA 2004-08-10 13:31:04 EDT
The merge from HEAD to 2_0 branch is complete.  
JUnits validating these fixes have been committed to both branches. 
Marking as RESOLVED - FIXED. 
The next available 2.0.1 build shall contain these fixes along with Parser 
performance/scalability improvements.