diff --git a/src/llvm/link/lld.c b/src/llvm/link/lld.c index 0afdd34..e1a2175 100644 --- a/src/llvm/link/lld.c +++ b/src/llvm/link/lld.c @@ -35,7 +35,7 @@ const char* get_absolute_link_path(const TargetConfig* config, const char* link_ return NULL; } -TargetLinkConfig* lld_create_link_config(const Target* target, const TargetConfig* target_config, const Module* module) { +TargetLinkConfig* lld_create_link_config(__attribute__((unused)) const Target* target, const TargetConfig* target_config, const Module* module) { DEBUG("generating link configuration"); TargetLinkConfig* config = mem_alloc(MemoryNamespaceLld, sizeof(TargetLinkConfig)); @@ -133,9 +133,6 @@ BackendError lld_link_target(TargetLinkConfig* config) { print_message(Info, "%s", arguments); g_free(arguments); - const char* message = NULL; - int status = 0; - INFO("done linking target..."); g_array_free(argv, TRUE); diff --git a/src/llvm/link/lld.h b/src/llvm/link/lld.h index 61d434b..b7538e0 100644 --- a/src/llvm/link/lld.h +++ b/src/llvm/link/lld.h @@ -8,7 +8,7 @@ #include #include -TargetLinkConfig* lld_create_link_config(const Target * target, const TargetConfig* target_config, const Module* module); +TargetLinkConfig* lld_create_link_config(__attribute__((unused)) const Target * target, const TargetConfig* target_config, const Module* module); BackendError lld_link_target(TargetLinkConfig* config); diff --git a/src/llvm/llvm-ir/expr.c b/src/llvm/llvm-ir/expr.c index 93b09b4..254a969 100644 --- a/src/llvm/llvm-ir/expr.c +++ b/src/llvm/llvm-ir/expr.c @@ -17,7 +17,7 @@ BackendError impl_bitwise_operation(LLVMBackendCompileUnit *unit, LLVMValueRef llvm_rhs = NULL; LLVMValueRef llvm_lhs = NULL; - if (operation->impl.arithmetic == BitwiseNot) { + if (operation->impl.bitwise == BitwiseNot) { // single operand rhs = g_array_index(operation->operands, Expression*, 0); impl_expr(unit, scope, builder, rhs, FALSE, &llvm_rhs); @@ -56,6 +56,7 @@ BackendError impl_bitwise_operation(LLVMBackendCompileUnit *unit, * @param integral * @return */ + [[maybe_unused]] static LLVMValueRef convert_integral_to_boolean( LLVMBuilderRef builder, LLVMValueRef integral) { // type of input @@ -390,7 +391,6 @@ BackendError impl_address_of(LLVMBackendCompileUnit *unit, LLVMLocalScope *scope LLVMBuilderRef builder, AddressOf* addressOf, LLVMValueRef *llvm_result) { - LLVMValueRef llvm_variable = NULL; BackendError err = impl_expr(unit, scope, builder, addressOf->variable, FALSE, llvm_result); if (err.kind != Success) { @@ -434,7 +434,7 @@ BackendError impl_expr(LLVMBackendCompileUnit *unit, LLVMLocalScope *scope, switch (expr->kind) { case ExpressionKindConstant: - err = get_const_type_value(unit, builder, scope->func_scope->global_scope, + err = get_const_type_value(unit, scope->func_scope->global_scope, &expr->impl.constant, llvm_result); break; case ExpressionKindTransmute: diff --git a/src/llvm/llvm-ir/func.c b/src/llvm/llvm-ir/func.c index f0d03cc..384a8df 100644 --- a/src/llvm/llvm-ir/func.c +++ b/src/llvm/llvm-ir/func.c @@ -50,7 +50,7 @@ LLVMValueRef get_variable(const LLVMLocalScope* scope, const char* name) { return param; } - LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, name); + LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, (char*) name); return global_var; } @@ -68,7 +68,7 @@ LLVMBool is_parameter(const LLVMLocalScope* scope, const char* name) { return TRUE; } - LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, name); + LLVMValueRef global_var = get_global_variable(scope->func_scope->global_scope, (char*) name); return global_var != NULL; } @@ -139,7 +139,7 @@ BackendError impl_func_type(LLVMBackendCompileUnit* unit, *llvm_fun = LLVMAddFunction(unit->module, func->name, llvm_fun_type); - g_hash_table_insert(scope->functions, func->name, llvm_fun_type); + g_hash_table_insert(scope->functions, (char*) func->name, llvm_fun_type); g_array_free(llvm_params, FALSE); @@ -217,12 +217,10 @@ BackendError impl_function_types(LLVMBackendCompileUnit* unit, gpointer val = NULL; BackendError err = SUCCESS; - size_t function_count = 0; while (g_hash_table_iter_next(&iterator, &key, &val) != FALSE) { Function* func = (Function*) val; LLVMValueRef llvm_func; err = impl_func_type(unit, scope, func, &llvm_func); - function_count++; } return err; diff --git a/src/llvm/llvm-ir/types.c b/src/llvm/llvm-ir/types.c index e1aba0c..f699e97 100644 --- a/src/llvm/llvm-ir/types.c +++ b/src/llvm/llvm-ir/types.c @@ -40,7 +40,7 @@ static BackendError get_const_composite_value(CompositeType composite, llvm_value); } -BackendError impl_reference_const(LLVMBackendCompileUnit* unit, LLVMBuilderRef builder, TypeValue* value, LLVMValueRef* llvm_value) { +BackendError impl_reference_const(LLVMBackendCompileUnit* unit, TypeValue* value, LLVMValueRef* llvm_value) { BackendError err = SUCCESS; if (value->type->kind == TypeKindReference && compareTypes(value->type, (Type*) &StringLiteralType)) { // is string literal @@ -63,7 +63,6 @@ BackendError impl_reference_const(LLVMBackendCompileUnit* unit, LLVMBuilderRef b } BackendError get_const_type_value(LLVMBackendCompileUnit* unit, - LLVMBuilderRef builder, LLVMGlobalScope* scope, TypeValue* gemstone_value, LLVMValueRef* llvm_value) { @@ -87,7 +86,7 @@ BackendError get_const_type_value(LLVMBackendCompileUnit* unit, llvm_value); break; case TypeKindReference: - err = impl_reference_const(unit, builder, gemstone_value, llvm_value); + err = impl_reference_const(unit, gemstone_value, llvm_value); break; case TypeKindBox: err = @@ -251,8 +250,8 @@ BackendError impl_box_type(LLVMBackendCompileUnit* unit, LLVMGlobalScope* scope, DEBUG("implementing member: %s ", ((BoxMember*)val)->name); - LLVMTypeRef llvm_type = NULL; - err = get_type_impl(unit, scope, member_type, &llvm_type); + LLVMTypeRef llvm_local_type = NULL; + err = get_type_impl(unit, scope, member_type, &llvm_local_type); if (err.kind != Success) { break; diff --git a/src/llvm/llvm-ir/types.h b/src/llvm/llvm-ir/types.h index d094c07..405aa91 100644 --- a/src/llvm/llvm-ir/types.h +++ b/src/llvm/llvm-ir/types.h @@ -19,7 +19,6 @@ BackendError get_type_default_value(LLVMBackendCompileUnit* unit, LLVMValueRef* llvm_value); BackendError get_const_type_value(LLVMBackendCompileUnit* unit, - LLVMBuilderRef builder, LLVMGlobalScope* scope, TypeValue* gemstone_value, LLVMValueRef* llvm_value); diff --git a/src/set/set.c b/src/set/set.c index 47a6bec..1f32c0d 100644 --- a/src/set/set.c +++ b/src/set/set.c @@ -1664,14 +1664,15 @@ int createAssign(Statement *ParentStatement, AST_NODE_PTR currentNode) { assign.destination = mem_alloc(MemoryNamespaceSet, sizeof(StorageExpr)); int status = createStorageExpr(assign.destination, AST_get_node(currentNode, 0)); + if (status == SEMANTIC_ERROR) { + return SEMANTIC_ERROR; + } assign.value = createExpression(AST_get_node(currentNode, 1)); if (assign.value == NULL) { return SEMANTIC_ERROR; } - Type *varType = NULL; - // TODO: check assignment type compatability ParentStatement->impl.assignment = assign;