From f673dd84648e2ef84e86347afb65680233dd9aa5 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 21 Jun 2024 11:18:22 -0700 Subject: [PATCH] Cleanup warnings and tests (#666) --- src/tcompiler.cpp | 2 -- src/tcwrapper.cpp | 3 --- tests/class.t | 3 +-- tests/class3.t | 7 ++----- tests/class4.t | 2 +- tests/class5.t | 3 +-- tests/lib/javalike.t | 12 ++++++++---- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 6c1d24ef1..df93db3d7 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -2870,7 +2870,6 @@ struct FunctionEmitter { Value *v = emitAddressOf(&obj); Obj entryType; Value *result = emitStructSelect(&typ, v, offset, &entryType); - Type *ttype = getType(&typ)->type; if (!exp->boolean("lvalue")) result = B->CreateLoad(getType(&entryType)->type, result); return result; @@ -3011,7 +3010,6 @@ struct FunctionEmitter { Value *a_result = B->CreateExtractValue(a, ArrayRef(0)); Value *a_success = B->CreateExtractValue(a, ArrayRef(1)); Value *a_success_i8 = B->CreateZExt(a_success, B->getInt8Ty()); - Type *elt_types[2] = {a_result->getType(), B->getInt8Ty()}; Type *result_type = typeOfValue(exp)->type; Value *result = UndefValue::get(result_type); result = B->CreateInsertValue(result, a_result, ArrayRef(0)); diff --git a/src/tcwrapper.cpp b/src/tcwrapper.cpp index 6fd5b0aa5..afaad2d3d 100644 --- a/src/tcwrapper.cpp +++ b/src/tcwrapper.cpp @@ -802,9 +802,6 @@ void InitHeaderSearchFlagsAndArgs(std::string const &TripleStr, HeaderSearchOpti } clang::driver::ToolChain const &TC = C->getDefaultToolChain(); - std::string path = TC.GetLinkerPath(); - const char *link = path.c_str(); - for (auto &i : TC.getProgramPaths()) link = i.c_str(); llvm::opt::ArgStringList IncludeArgs; TC.AddClangSystemIncludeArgs(C->getArgs(), IncludeArgs); diff --git a/tests/class.t b/tests/class.t index 0a90e1838..8a97b19bb 100644 --- a/tests/class.t +++ b/tests/class.t @@ -1,5 +1,5 @@ -IO = terralib.includec("stdio.h") local Class = require("lib/javalike") +local IO = Class.C struct A(Class()) { a : int @@ -104,7 +104,6 @@ end assert(12 == foobar2()) -local IO = terralib.includec("stdio.h") struct Animal(Class()) { data : int } diff --git a/tests/class3.t b/tests/class3.t index 5f0edd0e2..3669eb880 100644 --- a/tests/class3.t +++ b/tests/class3.t @@ -1,8 +1,5 @@ - -C = terralib.includec("stdio.h") - local Class = require("lib/javalike") - +local C = Class.C local Prints = Class.Interface("Prints",{ print = {} -> {} }) @@ -32,4 +29,4 @@ terra test() p:print() end -test() \ No newline at end of file +test() diff --git a/tests/class4.t b/tests/class4.t index a50db7a3e..051ed55fe 100644 --- a/tests/class4.t +++ b/tests/class4.t @@ -21,4 +21,4 @@ terra bar() a:draw() end -bar() \ No newline at end of file +bar() diff --git a/tests/class5.t b/tests/class5.t index 432ad5185..17c0c226a 100644 --- a/tests/class5.t +++ b/tests/class5.t @@ -1,6 +1,5 @@ - -IO = terralib.includec("stdio.h") local Class = require("lib/javalike") +local IO = Class.C struct A(Class()) { a : int; diff --git a/tests/lib/javalike.t b/tests/lib/javalike.t index 331a429fe..228f2f922 100644 --- a/tests/lib/javalike.t +++ b/tests/lib/javalike.t @@ -1,7 +1,11 @@ local List = terralib.newlist -local malloc = terralib.externfunction("malloc", uint64 -> &opaque) -local free = terralib.externfunction("free", &opaque -> {}) -local printf = terralib.externfunction("printf", terralib.types.funcpointer({rawstring},int,true)) +local C = terralib.includecstring [[ +#include "stdio.h" +#include "stdlib.h" +]] +local malloc = C.malloc +local free = C.free +local printf = C.printf local function createvtable(T) return end @@ -157,4 +161,4 @@ local function Interface(name,methodlist_) return iface end -return setmetatable({ Interface = Interface }, { __call = Class }) \ No newline at end of file +return setmetatable({ Interface = Interface, C = C }, { __call = Class })