Remove suppressed warning.

This commit is contained in:
Christoffer Lerno
2021-04-29 17:18:50 +02:00
parent 41a07f40a9
commit c4585f9bbd
7 changed files with 20 additions and 20 deletions

View File

@@ -143,7 +143,7 @@ add_executable(c3c
src/compiler/llvm_codegen_c_abi_riscv.c
src/compiler/llvm_codegen_c_abi_wasm.c)
target_compile_options(c3c PRIVATE -Wsign-compare -Wno-unknown-warning-option -Wno-unused-result -Wno-maybe-uninitialized -Wimplicit-int -Werror -Wall -Wno-unknown-pragmas -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter)
target_compile_options(c3c PRIVATE -Wsign-compare -Wno-unknown-warning-option -Wno-maybe-uninitialized -Wimplicit-int -Werror -Wall -Wno-unknown-pragmas -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter)
target_include_directories(c3c PRIVATE
"${CMAKE_SOURCE_DIR}/src/")

View File

@@ -1898,11 +1898,11 @@ const char *bigint_to_error_string(const BigInt *bigint, uint64_t base)
char *res = NULL;
if (bigint->is_negative)
{
asprintf(&res, "-%" PRIu64, bigint->digit);
(void)asprintf(&res, "-%" PRIu64, bigint->digit);
}
else
{
asprintf(&res, "%" PRIu64, bigint->digit);
(void)asprintf(&res, "%" PRIu64, bigint->digit);
}
return res;
}

View File

@@ -253,10 +253,10 @@ const char *expr_const_to_error_string(const ExprConst *expr)
case TYPE_F32:
case TYPE_F64:
case TYPE_FXX:
asprintf(&buff, "%Lf", expr->f);
(void)asprintf(&buff, "%Lf", expr->f);
return buff;
case TYPE_STRLIT:
asprintf(&buff, "\"%*.s\"", expr->string.len, expr->string.chars);
(void)asprintf(&buff, "\"%*.s\"", expr->string.len, expr->string.chars);
return buff;
default:
UNREACHABLE

View File

@@ -176,7 +176,7 @@ void llvm_dump(void)
LLVMTargetRef target;
char *error;
char *triplet = NULL;
asprintf(&triplet, "%s-unknown-%s-unknown", archs[i], os[j]);
(void)asprintf(&triplet, "%s-unknown-%s-unknown", archs[i], os[j]);
if (LLVMGetTargetFromTriple(triplet, &target, &error)) continue;
LLVMTargetMachineRef machine = NULL;
if (!(machine = LLVMCreateTargetMachine(target, triplet, "", "", 0, LLVMRelocDefault, LLVMCodeModelDefault))) {

View File

@@ -95,10 +95,10 @@ const char *type_quoted_error_string(Type *type)
char *buffer = NULL;
if (type->canonical != type)
{
asprintf(&buffer, "'%s' (%s)", type_to_error_string(type), type_to_error_string(type->canonical));
(void)asprintf(&buffer, "'%s' (%s)", type_to_error_string(type), type_to_error_string(type->canonical));
return buffer;
}
asprintf(&buffer, "'%s'", type_to_error_string(type));
(void)asprintf(&buffer, "'%s'", type_to_error_string(type));
return buffer;
}
const char *type_to_error_string(Type *type)
@@ -123,7 +123,7 @@ const char *type_to_error_string(Type *type)
return type->name;
case TYPE_FUNC:
{
asprintf(&buffer, type->func.signature->failable ? "func %s!(" : "func %s(",
(void)asprintf(&buffer, type->func.signature->failable ? "func %s!(" : "func %s(",
type_to_error_string(type->func.signature->rtype->type));
VECEACH(type->func.signature->params, i)
{
@@ -148,7 +148,7 @@ const char *type_to_error_string(Type *type)
UNREACHABLE
}
case TYPE_VECTOR:
asprintf(&buffer, "%s[<%llu>]", type_to_error_string(type->array.base), (unsigned long long)type->array.len);
(void)asprintf(&buffer, "%s[<%llu>]", type_to_error_string(type->array.base), (unsigned long long)type->array.len);
return buffer;
case TYPE_MEMBER:
return "member";
@@ -161,21 +161,21 @@ const char *type_to_error_string(Type *type)
{
return type_to_error_string(type->pointer);
}
asprintf(&buffer, "%s*", type_to_error_string(type->pointer));
(void)asprintf(&buffer, "%s*", type_to_error_string(type->pointer));
return buffer;
case TYPE_STRLIT:
return "compile time string";
case TYPE_ARRAY:
asprintf(&buffer, "%s[%llu]", type_to_error_string(type->array.base), (unsigned long long)type->array.len);
(void)asprintf(&buffer, "%s[%llu]", type_to_error_string(type->array.base), (unsigned long long)type->array.len);
return buffer;
case TYPE_VARARRAY:
asprintf(&buffer, "%s[*]", type_to_error_string(type->array.base));
(void)asprintf(&buffer, "%s[*]", type_to_error_string(type->array.base));
return buffer;
case TYPE_INFERRED_ARRAY:
asprintf(&buffer, "%s[?]", type_to_error_string(type->array.base));
(void)asprintf(&buffer, "%s[?]", type_to_error_string(type->array.base));
return buffer;
case TYPE_SUBARRAY:
asprintf(&buffer, "%s[]", type_to_error_string(type->array.base));
(void)asprintf(&buffer, "%s[]", type_to_error_string(type->array.base));
return buffer;
case TYPE_ERR_UNION:
return "error";

View File

@@ -117,7 +117,7 @@ void test_compiler(void)
{
printf("Running %s...\n", files[i]);
char *res = NULL;
asprintf(&res, "tests/%s", files[i]);
(void)asprintf(&res, "tests/%s", files[i]);
single_file[0] = res;
BuildTarget target = { .type = TARGET_TYPE_EXECUTABLE, .sources = single_file, .name = "a.out" };
compile_files(&target);

View File

@@ -99,24 +99,24 @@ const char* find_lib_dir(void)
struct stat info;
char *lib_path = NULL;
asprintf(&lib_path, "%s../lib/std/", path);
(void)asprintf(&lib_path, "%s../lib/std/", path);
DEBUG_LOG("Checking %s", lib_path);
int err = stat(lib_path, &info);
// Found it at ../lib/std
if (!err && S_ISDIR(info.st_mode))
{
asprintf(&lib_path, "%s../lib/", path);
(void)asprintf(&lib_path, "%s../lib/", path);
return lib_path;
}
asprintf(&lib_path, "%slib/std/", path);
(void)asprintf(&lib_path, "%slib/std/", path);
err = stat(lib_path, &info);
// Found it at ./lib/std
if (!err && S_ISDIR(info.st_mode))
{
asprintf(&lib_path, "%slib/", path);
(void)asprintf(&lib_path, "%slib/", path);
return lib_path;
}