Skip to content

Commit

Permalink
Merge pull request #208 from elliotchance/0.14.x/sqlite3-linux
Browse files Browse the repository at this point in the history
Adding sqlite3 transpile to all travis jobs
  • Loading branch information
elliotchance authored Aug 8, 2017
2 parents edc50cb + 49b14f7 commit 0e59dee
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ matrix:
os: linux
- env: SCRIPT=lint CLANG=3.9
os: linux
- env: SCRIPT=sqlite3 CLANG=3.9
os: osx

before_install:
- |
Expand Down
16 changes: 9 additions & 7 deletions ast/aligned_attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ package ast
// AlignedAttr is a type of attribute that is optionally attached to a variable
// or struct field definition.
type AlignedAttr struct {
Address string
Position string
Children []Node
Address string
Position string
IsAligned bool
Children []Node
}

func parseAlignedAttr(line string) *AlignedAttr {
groups := groupsFromRegex(
"<(?P<position>.*)> aligned",
"<(?P<position>.*)>(?P<aligned> aligned)?",
line,
)

return &AlignedAttr{
Address: groups["address"],
Position: groups["position"],
Children: []Node{},
Address: groups["address"],
Position: groups["position"],
IsAligned: len(groups["aligned"]) > 0,
Children: []Node{},
}
}

Expand Down
13 changes: 10 additions & 3 deletions ast/aligned_attr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ import (
func TestAlignedAttr(t *testing.T) {
nodes := map[string]Node{
`0x7f8a1d8ccfd0 <col:47, col:57> aligned`: &AlignedAttr{
Address: "0x7f8a1d8ccfd0",
Position: "col:47, col:57",
Children: []Node{},
Address: "0x7f8a1d8ccfd0",
Position: "col:47, col:57",
IsAligned: true,
Children: []Node{},
},
`0x2c8ba10 <col:42>`: &AlignedAttr{
Address: "0x2c8ba10",
Position: "col:42",
IsAligned: false,
Children: []Node{},
},
}

Expand Down
16 changes: 0 additions & 16 deletions travis/sqlite3.sh

This file was deleted.

12 changes: 12 additions & 0 deletions travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ echo "47" | go run prime.go
if [ $($C2GO -v | wc -l) -ne 1 ]; then exit 1; fi
if [ $(cat prime.go | wc -l) -eq 0 ]; then exit 1; fi
if [ $($C2GO ast $C2GO_DIR/examples/prime.c | wc -l) -eq 0 ]; then exit 1; fi

# This will have to be updated every so often to the latest version. You can
# find the latest version here: https://sqlite.org/download.html
export SQLITE3_FILE=sqlite-amalgamation-3190300

# Download Sqlite3 amalgamated source.
curl https://sqlite.org/2017/$SQLITE3_FILE.zip > /tmp/$SQLITE3_FILE.zip
unzip /tmp/$SQLITE3_FILE.zip -d /tmp

# Transpile the SQLite3 files.
./c2go transpile /tmp/sqlite-amalgamation-3190300/shell.c
./c2go transpile /tmp/sqlite-amalgamation-3190300/sqlite3.c
3 changes: 2 additions & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func Atoi(s string) int {
// GetExportedName returns a deterministic and Go safe name for a C type. For
// example, "*__foo[]" will return "FooSlice".
func GetExportedName(field string) string {
if field == "interface{}" {
if strings.Contains(field, "interface{}") ||
strings.Contains(field, "Interface{}") {
return "Interface"
}

Expand Down

0 comments on commit 0e59dee

Please sign in to comment.