mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Update name to "validation"
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
- Improve ordering of method registration to support adding methods to generic modules with method constraints #1746
|
||||
- Support experimental `@operator(construct)` operator overload.
|
||||
- Allow using 'var' to declare lambdas in functions.
|
||||
- Add 'warnings' setting and make dead code a warning.
|
||||
- Add 'validation' setting and make dead code a warning.
|
||||
|
||||
### Fixes
|
||||
- Fix case trying to initialize a `char[*]*` from a String.
|
||||
|
||||
@@ -150,11 +150,11 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WARNING_NOT_SET = -1,
|
||||
WARNING_NORMAL = 0,
|
||||
WARNING_ERROR = 1,
|
||||
WARNING_OBNOXIOUS = 2,
|
||||
} WarningLevel;
|
||||
VALIDATION_NOT_SET = -1,
|
||||
VALIDATION_LENIENT = 0,
|
||||
VALIDATION_STRICT = 1,
|
||||
VALIDATION_OBNOXIOUS = 2,
|
||||
} ValidationLevel;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -451,7 +451,7 @@ typedef struct BuildOptions_
|
||||
const char *vendor_download_path;
|
||||
const char *template;
|
||||
LinkerType linker_type;
|
||||
WarningLevel warning_level;
|
||||
ValidationLevel validation_level;
|
||||
const char *custom_linker_path;
|
||||
uint32_t symtab_size;
|
||||
unsigned version;
|
||||
@@ -619,7 +619,7 @@ typedef struct
|
||||
MemoryEnvironment memory_environment;
|
||||
SizeOptimizationLevel optsize;
|
||||
SingleModule single_module;
|
||||
WarningLevel warning_level;
|
||||
ValidationLevel validation_level;
|
||||
UseStdlib use_stdlib;
|
||||
EmitStdlib emit_stdlib;
|
||||
LinkLibc link_libc;
|
||||
@@ -709,7 +709,7 @@ static BuildTarget default_build_target = {
|
||||
.link_libc = LINK_LIBC_NOT_SET,
|
||||
.emit_stdlib = EMIT_STDLIB_NOT_SET,
|
||||
.linker_type = LINKER_TYPE_NOT_SET,
|
||||
.warning_level = WARNING_NOT_SET,
|
||||
.validation_level = VALIDATION_NOT_SET,
|
||||
.single_module = SINGLE_MODULE_NOT_SET,
|
||||
.unroll_loops = UNROLL_LOOPS_NOT_SET,
|
||||
.merge_functions = MERGE_FUNCTIONS_NOT_SET,
|
||||
|
||||
@@ -94,10 +94,10 @@ static const char *backends[3] = {
|
||||
[BACKEND_C] = "c",
|
||||
};
|
||||
|
||||
static const char *warnings[3] = {
|
||||
[WARNING_NORMAL] = "normal",
|
||||
[WARNING_ERROR] = "error",
|
||||
[WARNING_OBNOXIOUS] = "obnoxious",
|
||||
static const char *validation_levels[3] = {
|
||||
[VALIDATION_LENIENT] = "lenient",
|
||||
[VALIDATION_STRICT] = "strict",
|
||||
[VALIDATION_OBNOXIOUS] = "obnoxious",
|
||||
};
|
||||
|
||||
static const char *backtrace_levels[2] = {
|
||||
|
||||
@@ -97,7 +97,7 @@ static void usage(bool full)
|
||||
PRINTF(" --lib <name> - Add this c3l library to the compilation.");
|
||||
if (full)
|
||||
{
|
||||
PRINTF(" --warnings=<option> - How to treat warnings: normal (default), error (treat as errors), obnoxious (more errors)");
|
||||
PRINTF(" --validation=<option> - Strictness of code validation: lenient (default), strict, obnoxious (very strict)");
|
||||
PRINTF(" --stdlib <dir> - Use this directory as the C3 standard library path.");
|
||||
PRINTF(" --no-entry - Do not generate (or require) a main function.");
|
||||
PRINTF(" --path <dir> - Use this as the base directory for the current command.");
|
||||
@@ -622,9 +622,9 @@ static void parse_option(BuildOptions *options)
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
if ((argopt = match_argopt("warnings")))
|
||||
if ((argopt = match_argopt("validation")))
|
||||
{
|
||||
options->warning_level = (WarningLevel)parse_multi_option(argopt, 3, warnings);
|
||||
options->validation_level = (ValidationLevel)parse_multi_option(argopt, 3, validation_levels);
|
||||
return;
|
||||
}
|
||||
if (match_longopt("max-mem"))
|
||||
@@ -1166,7 +1166,7 @@ BuildOptions parse_arguments(int argc, const char *argv[])
|
||||
.link_libc = LINK_LIBC_NOT_SET,
|
||||
.use_stdlib = USE_STDLIB_NOT_SET,
|
||||
.linker_type = LINKER_TYPE_NOT_SET,
|
||||
.warning_level = WARNING_NOT_SET,
|
||||
.validation_level = VALIDATION_NOT_SET,
|
||||
.strip_unused = STRIP_UNUSED_NOT_SET,
|
||||
.single_module = SINGLE_MODULE_NOT_SET,
|
||||
.sanitize_mode = SANITIZE_NOT_SET,
|
||||
|
||||
@@ -354,7 +354,7 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
||||
if (options->merge_functions != MERGE_FUNCTIONS_NOT_SET) target->merge_functions = options->merge_functions;
|
||||
if (options->loop_vectorization != VECTORIZATION_NOT_SET) target->loop_vectorization = options->loop_vectorization;
|
||||
if (options->slp_vectorization != VECTORIZATION_NOT_SET) target->slp_vectorization = options->slp_vectorization;
|
||||
if (options->warning_level != WARNING_NORMAL) target->warning_level = options->warning_level;
|
||||
if (options->validation_level != VALIDATION_LENIENT) target->validation_level = options->validation_level;
|
||||
if (options->safety_level != SAFETY_NOT_SET) target->feature.safe_mode = options->safety_level;
|
||||
if (options->panic_level != PANIC_NOT_SET) target->feature.panic_level = options->panic_level;
|
||||
if (options->strip_unused != STRIP_UNUSED_NOT_SET) target->strip_unused = options->strip_unused;
|
||||
|
||||
@@ -555,7 +555,7 @@ void sema_error_at(SemaContext *context, SourceSpan span, const char *message, .
|
||||
|
||||
bool sema_warn_at(SemaContext *context, SourceSpan span, const char *message, ...)
|
||||
{
|
||||
bool is_warn = compiler.build.warning_level < WARNING_ERROR;
|
||||
bool is_warn = compiler.build.validation_level < VALIDATION_STRICT;
|
||||
va_list list;
|
||||
va_start(list, message);
|
||||
if (is_warn)
|
||||
|
||||
Reference in New Issue
Block a user