Commit 3a82f1fd authored by Alastair Robertson's avatar Alastair Robertson

Show Clang warnings and fix warnings we were causing with missing semicolons

parent 84030219
......@@ -142,16 +142,16 @@ void ClangParser::parse(ast::Program *program, StructMap &structs)
},
};
CXIndex index = clang_createIndex(0, 0);
CXIndex index = clang_createIndex(1, 1);
CXTranslationUnit translation_unit;
const char * const args[] = {
"-I/bpftrace/include"
"-I", "/bpftrace/include",
};
CXErrorCode error = clang_parseTranslationUnit2(
index,
"definitions.h",
args, 1,
unsaved_files, 7,
args, sizeof(args)/sizeof(char*),
unsaved_files, sizeof(unsaved_files)/sizeof(CXUnsavedFile),
CXTranslationUnit_None,
&translation_unit);
if (error)
......
......@@ -119,7 +119,7 @@ program : c_definitions probes { driver.root_ = new ast::Program($1, $2); }
;
c_definitions : CPREPROC c_definitions { $$ = $1 + "\n" + $2; }
| STRUCT c_definitions { $$ = $1 + "\n" + $2; }
| STRUCT c_definitions { $$ = $1 + ";\n" + $2; }
| { $$ = std::string(); }
;
......
......@@ -645,7 +645,7 @@ TEST(Parser, field_access_builtin)
TEST(Parser, cstruct)
{
test("struct Foo { int x, y; char *str; } kprobe:sys_read { 1; }",
"struct Foo { int x, y; char *str; }\n"
"struct Foo { int x, y; char *str; };\n"
"\n"
"Program\n"
" kprobe:sys_read\n"
......@@ -655,7 +655,7 @@ TEST(Parser, cstruct)
TEST(Parser, cstruct_nested)
{
test("struct Foo { struct { int x; } bar; } kprobe:sys_read { 1; }",
"struct Foo { struct { int x; } bar; }\n"
"struct Foo { struct { int x; } bar; };\n"
"\n"
"Program\n"
" kprobe:sys_read\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment