-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO_ANL
210 lines (171 loc) · 5.93 KB
/
TODO_ANL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
May 6, 2002
New features and deficiencies are prioritized separately. Each group
listed in order from highest priority to lowest.
New features:
* Control Flow Graph
* Make it possible to pass optional command line arguments to the EDG
frontend.
* It would be nice to use Bugzilla for ROSE. It is already installed and in
use by other CASC projects.
* The variable renaming issue. No provision to do this is ROSE. Our
proposed way of dealing with this: use an attribute to store the new
name. Have the unparser look at the attribute to figure out if the name
should be changed and if so, what is the new name. We don't have to do
this via unparser but it seems to be the easiest way to accomplish this.
But the unparser has no mechanism to do things like this. Currently, we
would have to copy their unparser, modify and use the modified copy.
Maybe Dan has some other ideas how to do this (maybe internally within
ROSE, so we would not have to maintain a modified copy of the unparser)?
What I mean here is some sort of a mechanism by which some hooks could
be put in the unparser so user-defined code could be called from within
the unparser.
Deficiencies:
* Information not available in the Sage parse tree for anonymous
typedefs.
The following typedef is not represented correctly in Sage3:
typedef struct
{
int day;
int month;
int year;
} DATE;
The parser does not crash, however the definition of the struct (i.e.,
names and types of its fields) is not stored anywhere in the Sage tree
(as far as I [BW] can tell).
* EDG to Sage3 conversion fails, it is not possible to continue. "For"
statements with expression lists, parser causes a failed assertion:
The input file looks like this:
int main(void)
{
int i, j;
for(i=0,j=0;i<10; i++)
{
j++;
}
return 0;
}
The error:
~/dan/dec20/compile/src> rose -rose:test 6 ~/roseadic_work/mytest.C
configDefsString = -D__GNUG__=2 -D__EXCEPTIONS -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux
-D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -D__NO_INLINE__
-Di386 -D__i386 -D__i386__ -D__tune_pentium__ -D__builtin_va_list=void*
-U__GNUG__ -U__GNUC__
configIncludeString =
-I/home/winnicka/dan/dec20/compile/g++_HEADERS/hdrs1
-I/home/winnicka/dan/dec20/compile/g++_HEADERS/hdrs2
-I/home/winnicka/dan/dec20/compile/g++_HEADERS/hdrs3
Finished building EDG AST, now build the SAGE AST ...
rose: Cxx_Grammar.C:8793: Sg_File_Info *SgLocatedNode::get_file_info ()
const: Assertion `this != __null' failed.
Abort
Everything works fine if I remove the "j=0" expression from the "for"
statement.
* Variable names are dropped from function prototypes.
int myfunc(int length, int index);
becomes:
int myfunc(int, int);
after unparsing.
We would like to keep the original code unchanged as much as possible
and hence preserve the names. Possibly, a command line argument to the
EDG front end would make this easier to implement.
* Unparser issues. Back in February our plan was to use our own (i.e.,
adic) unparser. We are now going to use Sage3's but it formats the
output in a way that is not going to be readable (weird rules as to
where to insert new lines). (as an exercise, you can try running
Cxx_Grammar.h through rose and look at the unparsed code). And this is
just the beginning, since we will be inserting many new statements and
who knows what line numbers these new statements should have to keep the
unparser happy.
* Pragmas are often saved at incorrect location in the parse tree. The
unparser does not
seem to be able to handle them at all but from looking at the dot files
it seems that often (but not always) pragmas are inserted in the wrong
scope, for example:
#pragma INFO 1
int main()
{
return 1;
}
seems to have a parse tree that corresponds to:
int main()
{
#pragma INFO 1
return 1;
}
* List of args to function pointers incorrect:
int (*a) (double)
after parsing and unparsing becomes:
int (* a)(double , double );
* For constants, it would be nice that values are saved as strings instead
of/in addition to being saved as specific data types, i.e, for
float foobar=3./2.;
right now what is saved is a float with value of 1.5, it would be nice
to have the string "3./2." so that it would look the same as in the original
code when unparsed.
I think this would require digging into EDG code, so it might not be
worth the trouble.
* The code
enum a {PP, QQ};
a gla;
class A
{
enum a {AA, BB};
a thisa;
enum ::a thata;
public:
A(){};
int foobar()
{
thata=PP;
if(thata==QQ)
{
return 1;
}
thisa=AA;
if(thisa==BB)
{
return 1;
}
return 0;
};
};
int main()
{
A mya;
return mya.foobar();
}
unparses to:
enum a {PP,QQ};
enum a gla;
class A {
private: enum a {AA,BB};
enum a thisa;
enum a thata;
public: inline A(){ }
inline int foobar()
{
this -> thata = PP;
if (this -> thata == 1)
{
return 1;
}
this -> thisa = A::AA;
if (this -> thisa == 1)
{
return 1;
}
return 0;
}
};
int main()
{
class A mya;
return mya.foobar();
}
Clearly, the declaration of "thata" is wrong (and g++ indeed complains
about the unparsed code but it is happy with the original).
This obviously will not be a problem in C, but when we move to C++ it
might (hopefully, people do not write code like this too often...)
Also, replacing BB and QQ with 1 is not great. This will be a nuisance
in C as well.