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:
|
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++
|
Compiler: g++
|
||||||
CompilationDatabase: build
|
CompilationDatabase: build
|
||||||
|
|||||||
@ -10,6 +10,22 @@ set_target_properties(
|
|||||||
OUTPUT_NAME "artichoke-c"
|
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(
|
target_include_directories(
|
||||||
frontend PUBLIC
|
frontend PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
|||||||
@ -14,6 +14,22 @@ set_target_properties(
|
|||||||
OUTPUT_NAME "artichoke"
|
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(
|
target_sources(
|
||||||
library PUBLIC
|
library PUBLIC
|
||||||
FILE_SET HEADERS
|
FILE_SET HEADERS
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include <artichoke/Tokenizer/Token.hpp>
|
#include <artichoke/Tokenizer/Token.hpp>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace arti::lang {
|
namespace arti::lang {
|
||||||
|
|
||||||
@ -186,7 +187,10 @@ namespace arti::lang {
|
|||||||
return std::format("Token{{ {}, {} }}", "kwExport", value.strValue);
|
return std::format("Token{{ {}, {} }}", "kwExport", value.strValue);
|
||||||
case kwModule:
|
case kwModule:
|
||||||
return std::format("Token{{ {}, {} }}", "kwModule", value.strValue);
|
return std::format("Token{{ {}, {} }}", "kwModule", value.strValue);
|
||||||
|
default:
|
||||||
|
return "<Undefined>";
|
||||||
}
|
}
|
||||||
return "<Undefined>";
|
|
||||||
|
std::unreachable();
|
||||||
}
|
}
|
||||||
} // namespace arti::lang
|
} // 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() {
|
void Tokenizer::skip_whitespace() {
|
||||||
@ -146,7 +149,6 @@ namespace arti::lang {
|
|||||||
column = 0;
|
column = 0;
|
||||||
line += 1;
|
line += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace arti::lang {
|
|||||||
|
|
||||||
auto deallocator = [](char *mem) {
|
auto deallocator = [](char *mem) {
|
||||||
if (mem) {
|
if (mem) {
|
||||||
free((void *) mem);
|
free(static_cast<void *>(mem));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ namespace arti::lang {
|
|||||||
switch(ec) {
|
switch(ec) {
|
||||||
case ecMemAlloc: return "Memory allocation failed";
|
case ecMemAlloc: return "Memory allocation failed";
|
||||||
case ecInvalid: return "Invalid argument";
|
case ecInvalid: return "Invalid argument";
|
||||||
|
default: std::unreachable(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unreachable();
|
std::unreachable();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user