mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- --path does not interact correctly with relative path arguments #2149.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
- Empty default case in @jump switch does not fallthrough #2147.
|
||||
- `&&&` was accidentally available as a valid prefix operator.
|
||||
- Missing error on default values for body with default arguments #2148.
|
||||
- `--path` does not interact correctly with relative path arguments #2149.
|
||||
|
||||
### Stdlib changes
|
||||
- Added `String.quick_ztr` and `String.is_zstr`
|
||||
|
||||
@@ -495,6 +495,7 @@ typedef struct BuildOptions_
|
||||
const char *path;
|
||||
const char *vendor_download_path;
|
||||
const char *template;
|
||||
const char **unchecked_directories;
|
||||
LinkerType linker_type;
|
||||
ValidationLevel validation_level;
|
||||
Ansi ansi;
|
||||
@@ -829,6 +830,7 @@ bool command_accepts_files(CompilerCommand command);
|
||||
bool command_passes_args(CompilerCommand command);
|
||||
void update_build_target_with_opt_level(BuildTarget *target,
|
||||
OptimizationSetting level);
|
||||
const char *check_dir(const char *path);
|
||||
void create_project(BuildOptions *build_options);
|
||||
void create_library(BuildOptions *build_options);
|
||||
void resolve_libraries(BuildTarget *build_target);
|
||||
|
||||
@@ -17,7 +17,7 @@ static const char *current_arg;
|
||||
extern const char *llvm_version;
|
||||
extern const char *llvm_target;
|
||||
|
||||
static const char *check_dir(const char *path);
|
||||
static const char *unchecked_dir(BuildOptions *options, const char *path);
|
||||
static inline bool at_end();
|
||||
static inline const char *next_arg();
|
||||
static inline bool next_is_opt();
|
||||
@@ -674,7 +674,7 @@ static void parse_option(BuildOptions *options)
|
||||
if (match_shortopt("L"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: -L needs a directory.");
|
||||
options->linker_lib_dir[options->linker_lib_dir_count++] = check_dir(next_arg());
|
||||
options->linker_lib_dir[options->linker_lib_dir_count++] = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -1039,7 +1039,7 @@ static void parse_option(BuildOptions *options)
|
||||
if (match_longopt("stdlib"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --stdlib needs a directory.");
|
||||
options->std_lib_dir = check_dir(next_arg());
|
||||
options->std_lib_dir = unchecked_dir(options, next_arg());
|
||||
options->emit_stdlib = EMIT_STDLIB_ON;
|
||||
return;
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ static void parse_option(BuildOptions *options)
|
||||
if (match_longopt("macossdk"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --macossdk needs a directory.");
|
||||
options->macos.sysroot = check_dir(next_arg());
|
||||
options->macos.sysroot = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("winsdk"))
|
||||
@@ -1074,7 +1074,7 @@ static void parse_option(BuildOptions *options)
|
||||
error_exit("error: --winsdk cannot be combined with --win-vs-dirs.");
|
||||
}
|
||||
if (at_end() || next_is_opt()) error_exit("error: --winsdk needs a directory.");
|
||||
options->win.sdk = check_dir(next_arg());
|
||||
options->win.sdk = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if ((argopt = match_argopt("trust")))
|
||||
@@ -1193,13 +1193,13 @@ static void parse_option(BuildOptions *options)
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --libdir needs a directory.");
|
||||
if (options->lib_dir_count == MAX_BUILD_LIB_DIRS) error_exit("Max %d library directories may be specified.", MAX_BUILD_LIB_DIRS);
|
||||
options->lib_dir[options->lib_dir_count++] = check_dir(next_arg());
|
||||
options->lib_dir[options->lib_dir_count++] = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("run-dir"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --run-dir needs a directory.");
|
||||
options->run_dir = check_dir(next_arg());
|
||||
options->run_dir = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("benchmark"))
|
||||
@@ -1238,19 +1238,19 @@ static void parse_option(BuildOptions *options)
|
||||
if (match_longopt("linux-crt"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --linux-crt needs a directory.");
|
||||
options->linuxpaths.crt = check_dir(next_arg());
|
||||
options->linuxpaths.crt = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("linux-crtbegin"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --linux-crtbegin needs a directory.");
|
||||
options->linuxpaths.crtbegin = check_dir(next_arg());
|
||||
options->linuxpaths.crtbegin = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("android-ndk"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: android-ndk needs a directory.");
|
||||
options->android.ndk_path = check_dir(next_arg());
|
||||
options->android.ndk_path = unchecked_dir(options, next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("android-api"))
|
||||
@@ -1422,7 +1422,13 @@ ArchOsTarget arch_os_target_from_string(const char *target)
|
||||
|
||||
// -- helpers
|
||||
|
||||
static const char *check_dir(const char *path)
|
||||
static const char *unchecked_dir(BuildOptions *options, const char *path)
|
||||
{
|
||||
vec_add(options->unchecked_directories, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
const char *check_dir(const char *path)
|
||||
{
|
||||
char original_path[PATH_MAX + 1];
|
||||
if (!getcwd(original_path, PATH_MAX)) error_exit("Failed to store path.");
|
||||
|
||||
@@ -48,6 +48,11 @@ void compiler_init(BuildOptions *build_options)
|
||||
error_exit("Failed to change path to '%s'.", build_options->path);
|
||||
}
|
||||
|
||||
FOREACH(const char *, dir, build_options->unchecked_directories)
|
||||
{
|
||||
(void)check_dir(dir);
|
||||
}
|
||||
|
||||
compiler_init_time = -1;
|
||||
compiler_parsing_time = -1;
|
||||
compiler_sema_time = -1;
|
||||
|
||||
Reference in New Issue
Block a user