chore: Added compile warnings
Enabled compilation warnings and solved compilation problems. TODO: Is it correct to have the warnings `hard-coded` on the CMakeFiles?
This commit is contained in:
parent
85a34bdd65
commit
85dd8bc10f
15
.clangd
15
.clangd
@ -1,4 +1,17 @@
|
||||
CompileFlags:
|
||||
Add: [ -std=c++23 ]
|
||||
Add:
|
||||
- -pedantic
|
||||
- -Wall
|
||||
- -Wextra
|
||||
- -Wold-style-cast
|
||||
- -Wsign-conversion
|
||||
- -Wsign-promo
|
||||
- -Wstrict-null-sentinel
|
||||
- -Wstrict-overflow=5
|
||||
- -Wswitch-default
|
||||
- -Wundef
|
||||
- -Werror
|
||||
- -Wno-unused
|
||||
- -std=c++23
|
||||
Compiler: g++
|
||||
CompilationDatabase: build
|
||||
|
||||
@ -10,6 +10,22 @@ set_target_properties(
|
||||
OUTPUT_NAME "artichoke-c"
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
frontend PRIVATE
|
||||
-pedantic
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wold-style-cast
|
||||
-Wsign-conversion
|
||||
-Wsign-promo
|
||||
-Wstrict-null-sentinel
|
||||
-Wstrict-overflow=5
|
||||
-Wswitch-default
|
||||
-Wundef
|
||||
-Werror
|
||||
-Wno-unused
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
frontend PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
||||
@ -14,6 +14,22 @@ set_target_properties(
|
||||
OUTPUT_NAME "artichoke"
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
library PRIVATE
|
||||
-pedantic
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wold-style-cast
|
||||
-Wsign-conversion
|
||||
-Wsign-promo
|
||||
-Wstrict-null-sentinel
|
||||
-Wstrict-overflow=5
|
||||
-Wswitch-default
|
||||
-Wundef
|
||||
-Werror
|
||||
-Wno-unused
|
||||
)
|
||||
|
||||
target_sources(
|
||||
library PUBLIC
|
||||
FILE_SET HEADERS
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include <artichoke/Tokenizer/Token.hpp>
|
||||
|
||||
#include <format>
|
||||
#include <utility>
|
||||
|
||||
namespace arti::lang {
|
||||
|
||||
@ -186,7 +187,10 @@ namespace arti::lang {
|
||||
return std::format("Token{{ {}, {} }}", "kwExport", value.strValue);
|
||||
case kwModule:
|
||||
return std::format("Token{{ {}, {} }}", "kwModule", value.strValue);
|
||||
default:
|
||||
return "<Undefined>";
|
||||
}
|
||||
return "<Undefined>";
|
||||
|
||||
std::unreachable();
|
||||
}
|
||||
} // namespace arti::lang
|
||||
|
||||
@ -134,7 +134,10 @@ namespace arti::lang {
|
||||
}
|
||||
}
|
||||
|
||||
coret Token{ .value = TokenV::tkEOF, .line = line, .column = column };
|
||||
coret Token{ .value = TokenV::tkEOF,
|
||||
.line = line,
|
||||
.column = column,
|
||||
.strValue = "" };
|
||||
}
|
||||
|
||||
void Tokenizer::skip_whitespace() {
|
||||
@ -146,7 +149,6 @@ namespace arti::lang {
|
||||
column = 0;
|
||||
line += 1;
|
||||
break;
|
||||
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ namespace arti::lang {
|
||||
|
||||
auto deallocator = [](char *mem) {
|
||||
if (mem) {
|
||||
free((void *) mem);
|
||||
free(static_cast<void *>(mem));
|
||||
}
|
||||
};
|
||||
|
||||
@ -44,6 +44,7 @@ namespace arti::lang {
|
||||
switch(ec) {
|
||||
case ecMemAlloc: return "Memory allocation failed";
|
||||
case ecInvalid: return "Invalid argument";
|
||||
default: std::unreachable(); break;
|
||||
}
|
||||
|
||||
std::unreachable();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user