Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
5b8bcf23
Commit
5b8bcf23
authored
Jan 11, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
godefs: better handling of enums
Fixes #432. R=r, r2 CC=golang-dev
https://golang.org/cl/3869043
parent
9f178edf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
main.c
src/cmd/godefs/main.c
+2
-0
stabs.c
src/cmd/godefs/stabs.c
+11
-2
No files found.
src/cmd/godefs/main.c
View file @
5b8bcf23
...
...
@@ -373,6 +373,8 @@ Continue:
prefix
=
prefixlen
(
t
);
for
(
j
=
0
;
j
<
t
->
nf
;
j
++
)
{
f
=
&
t
->
f
[
j
];
if
(
f
->
type
->
kind
==
0
)
continue
;
// padding
if
(
t
->
kind
==
Struct
||
lang
==
&
go
)
{
if
(
f
->
offset
%
8
!=
0
||
f
->
size
%
8
!=
0
)
{
...
...
src/cmd/godefs/stabs.c
View file @
5b8bcf23
...
...
@@ -363,13 +363,22 @@ parsedef(char **pp, char *name)
return
nil
;
}
while
(
f
->
type
->
kind
==
Typedef
)
f
->
type
=
f
->
type
->
type
;
if
(
f
->
type
->
kind
==
0
&&
f
->
size
<=
64
&&
(
f
->
size
&
(
f
->
size
-
1
))
==
0
)
{
// unknown type but <= 64 bits and bit size is a power of two.
// could be enum - make Uint64 and then let it reduce
tt
=
emalloc
(
sizeof
*
tt
);
*
tt
=
*
f
->
type
;
f
->
type
=
tt
;
tt
->
kind
=
Uint64
;
}
// rewrite
// uint32 x : 8;
// into
// uint8 x;
// hooray for bitfields.
while
(
f
->
type
->
kind
==
Typedef
)
f
->
type
=
f
->
type
->
type
;
while
(
Int16
<=
f
->
type
->
kind
&&
f
->
type
->
kind
<=
Uint64
&&
kindsize
[
f
->
type
->
kind
]
>
f
->
size
)
{
tt
=
emalloc
(
sizeof
*
tt
);
*
tt
=
*
f
->
type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment