mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Support printing of object files. Issue #687
This commit is contained in:
@@ -147,6 +147,8 @@ static void usage(void)
|
||||
OUTPUT(" --list-targets - List all architectures the compiler supports.");
|
||||
OUTPUT(" --list-type-properties - List all type properties.");
|
||||
OUTPUT("");
|
||||
OUTPUT(" --print-output - Print the object files created to stdout.");
|
||||
OUTPUT("");
|
||||
OUTPUT(" --winsdk <dir> - Set the directory for Windows system library files for cross compilation.");
|
||||
OUTPUT(" --wincrt=<option> - Windows CRT linking: none, static, dynamic (default).");
|
||||
OUTPUT("");
|
||||
@@ -643,6 +645,11 @@ static void parse_option(BuildOptions *options)
|
||||
options->emit_asm = true;
|
||||
return;
|
||||
}
|
||||
if (match_longopt("print-output"))
|
||||
{
|
||||
options->print_output = true;
|
||||
return;
|
||||
}
|
||||
if (match_longopt("cc"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --cc needs a compiler name.");
|
||||
|
||||
@@ -272,6 +272,7 @@ typedef struct BuildOptions_
|
||||
bool no_libc;
|
||||
bool force_linker;
|
||||
bool read_stdin;
|
||||
bool print_output;
|
||||
const char *panicfn;
|
||||
const char *cc;
|
||||
const char *build_dir;
|
||||
@@ -357,6 +358,7 @@ typedef struct
|
||||
bool benchmarking;
|
||||
bool testing;
|
||||
bool read_stdin;
|
||||
bool print_output;
|
||||
int build_threads;
|
||||
OptimizationLevel optimization_level;
|
||||
SizeOptimizationLevel size_optimization_level;
|
||||
|
||||
@@ -219,6 +219,7 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
||||
}
|
||||
if (options->no_stdlib) target->no_stdlib = true;
|
||||
if (options->no_libc) target->no_libc = true;
|
||||
target->print_output = options->print_output;
|
||||
target->emit_llvm = options->emit_llvm;
|
||||
target->build_threads = options->build_threads;
|
||||
target->emit_asm = options->emit_asm;
|
||||
|
||||
@@ -413,11 +413,23 @@ void compiler_compile(void)
|
||||
TaskQueueRef queue = taskqueue_create(active_target.build_threads, tasks);
|
||||
taskqueue_wait_for_completion(queue);
|
||||
|
||||
if (active_target.print_output)
|
||||
{
|
||||
puts("# output-files-begin");
|
||||
}
|
||||
for (unsigned i = 0; i < output_file_count; i++)
|
||||
{
|
||||
obj_files[i] = compile_data[i].object_name;
|
||||
if (active_target.print_output)
|
||||
{
|
||||
puts(obj_files[i]);
|
||||
}
|
||||
assert(obj_files[i] || !output_exe);
|
||||
}
|
||||
if (active_target.print_output)
|
||||
{
|
||||
puts("# output-files-end");
|
||||
}
|
||||
|
||||
output_file_count += cfiles;
|
||||
free(compile_data);
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.2"
|
||||
#define COMPILER_VERSION "0.4.3"
|
||||
Reference in New Issue
Block a user