mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Remove suppressed warning.
This commit is contained in:
@@ -143,7 +143,7 @@ add_executable(c3c
|
|||||||
src/compiler/llvm_codegen_c_abi_riscv.c
|
src/compiler/llvm_codegen_c_abi_riscv.c
|
||||||
src/compiler/llvm_codegen_c_abi_wasm.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
|
target_include_directories(c3c PRIVATE
|
||||||
"${CMAKE_SOURCE_DIR}/src/")
|
"${CMAKE_SOURCE_DIR}/src/")
|
||||||
|
|||||||
@@ -1898,11 +1898,11 @@ const char *bigint_to_error_string(const BigInt *bigint, uint64_t base)
|
|||||||
char *res = NULL;
|
char *res = NULL;
|
||||||
if (bigint->is_negative)
|
if (bigint->is_negative)
|
||||||
{
|
{
|
||||||
asprintf(&res, "-%" PRIu64, bigint->digit);
|
(void)asprintf(&res, "-%" PRIu64, bigint->digit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
asprintf(&res, "%" PRIu64, bigint->digit);
|
(void)asprintf(&res, "%" PRIu64, bigint->digit);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,10 +253,10 @@ const char *expr_const_to_error_string(const ExprConst *expr)
|
|||||||
case TYPE_F32:
|
case TYPE_F32:
|
||||||
case TYPE_F64:
|
case TYPE_F64:
|
||||||
case TYPE_FXX:
|
case TYPE_FXX:
|
||||||
asprintf(&buff, "%Lf", expr->f);
|
(void)asprintf(&buff, "%Lf", expr->f);
|
||||||
return buff;
|
return buff;
|
||||||
case TYPE_STRLIT:
|
case TYPE_STRLIT:
|
||||||
asprintf(&buff, "\"%*.s\"", expr->string.len, expr->string.chars);
|
(void)asprintf(&buff, "\"%*.s\"", expr->string.len, expr->string.chars);
|
||||||
return buff;
|
return buff;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE
|
UNREACHABLE
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ void llvm_dump(void)
|
|||||||
LLVMTargetRef target;
|
LLVMTargetRef target;
|
||||||
char *error;
|
char *error;
|
||||||
char *triplet = NULL;
|
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;
|
if (LLVMGetTargetFromTriple(triplet, &target, &error)) continue;
|
||||||
LLVMTargetMachineRef machine = NULL;
|
LLVMTargetMachineRef machine = NULL;
|
||||||
if (!(machine = LLVMCreateTargetMachine(target, triplet, "", "", 0, LLVMRelocDefault, LLVMCodeModelDefault))) {
|
if (!(machine = LLVMCreateTargetMachine(target, triplet, "", "", 0, LLVMRelocDefault, LLVMCodeModelDefault))) {
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ const char *type_quoted_error_string(Type *type)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
if (type->canonical != type)
|
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;
|
return buffer;
|
||||||
}
|
}
|
||||||
asprintf(&buffer, "'%s'", type_to_error_string(type));
|
(void)asprintf(&buffer, "'%s'", type_to_error_string(type));
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
const char *type_to_error_string(Type *type)
|
const char *type_to_error_string(Type *type)
|
||||||
@@ -123,7 +123,7 @@ const char *type_to_error_string(Type *type)
|
|||||||
return type->name;
|
return type->name;
|
||||||
case TYPE_FUNC:
|
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));
|
type_to_error_string(type->func.signature->rtype->type));
|
||||||
VECEACH(type->func.signature->params, i)
|
VECEACH(type->func.signature->params, i)
|
||||||
{
|
{
|
||||||
@@ -148,7 +148,7 @@ const char *type_to_error_string(Type *type)
|
|||||||
UNREACHABLE
|
UNREACHABLE
|
||||||
}
|
}
|
||||||
case TYPE_VECTOR:
|
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;
|
return buffer;
|
||||||
case TYPE_MEMBER:
|
case TYPE_MEMBER:
|
||||||
return "member";
|
return "member";
|
||||||
@@ -161,21 +161,21 @@ const char *type_to_error_string(Type *type)
|
|||||||
{
|
{
|
||||||
return type_to_error_string(type->pointer);
|
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;
|
return buffer;
|
||||||
case TYPE_STRLIT:
|
case TYPE_STRLIT:
|
||||||
return "compile time string";
|
return "compile time string";
|
||||||
case TYPE_ARRAY:
|
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;
|
return buffer;
|
||||||
case TYPE_VARARRAY:
|
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;
|
return buffer;
|
||||||
case TYPE_INFERRED_ARRAY:
|
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;
|
return buffer;
|
||||||
case TYPE_SUBARRAY:
|
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;
|
return buffer;
|
||||||
case TYPE_ERR_UNION:
|
case TYPE_ERR_UNION:
|
||||||
return "error";
|
return "error";
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void test_compiler(void)
|
|||||||
{
|
{
|
||||||
printf("Running %s...\n", files[i]);
|
printf("Running %s...\n", files[i]);
|
||||||
char *res = NULL;
|
char *res = NULL;
|
||||||
asprintf(&res, "tests/%s", files[i]);
|
(void)asprintf(&res, "tests/%s", files[i]);
|
||||||
single_file[0] = res;
|
single_file[0] = res;
|
||||||
BuildTarget target = { .type = TARGET_TYPE_EXECUTABLE, .sources = single_file, .name = "a.out" };
|
BuildTarget target = { .type = TARGET_TYPE_EXECUTABLE, .sources = single_file, .name = "a.out" };
|
||||||
compile_files(&target);
|
compile_files(&target);
|
||||||
|
|||||||
@@ -99,24 +99,24 @@ const char* find_lib_dir(void)
|
|||||||
struct stat info;
|
struct stat info;
|
||||||
char *lib_path = NULL;
|
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);
|
DEBUG_LOG("Checking %s", lib_path);
|
||||||
int err = stat(lib_path, &info);
|
int err = stat(lib_path, &info);
|
||||||
|
|
||||||
// Found it at ../lib/std
|
// Found it at ../lib/std
|
||||||
if (!err && S_ISDIR(info.st_mode))
|
if (!err && S_ISDIR(info.st_mode))
|
||||||
{
|
{
|
||||||
asprintf(&lib_path, "%s../lib/", path);
|
(void)asprintf(&lib_path, "%s../lib/", path);
|
||||||
return lib_path;
|
return lib_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
asprintf(&lib_path, "%slib/std/", path);
|
(void)asprintf(&lib_path, "%slib/std/", path);
|
||||||
err = stat(lib_path, &info);
|
err = stat(lib_path, &info);
|
||||||
|
|
||||||
// Found it at ./lib/std
|
// Found it at ./lib/std
|
||||||
if (!err && S_ISDIR(info.st_mode))
|
if (!err && S_ISDIR(info.st_mode))
|
||||||
{
|
{
|
||||||
asprintf(&lib_path, "%slib/", path);
|
(void)asprintf(&lib_path, "%slib/", path);
|
||||||
return lib_path;
|
return lib_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user