mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Don't generate .o files on compile and compile-run if there is no main.
This commit is contained in:
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\ls.c3
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\load_world.c3
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\process.c3
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile --test -g -O0 --threads 1 --target macos-x64 examples\constants.c3
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile --no-entry --test -g -O0 --threads 1 --target macos-x64 examples\constants.c3
|
||||
..\build\${{ matrix.build_type }}\c3c.exe compile-run msvc_stack.c3
|
||||
|
||||
- name: Build testproject
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
../build/c3c compile-run --print-linking examples/fannkuch-redux.c3
|
||||
../build/c3c compile-run --print-linking examples/contextfree/boolerr.c3
|
||||
../build/c3c compile-run --print-linking examples/load_world.c3
|
||||
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
|
||||
../build/c3c compile --no-entry --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
|
||||
|
||||
- name: Build testproject
|
||||
run: |
|
||||
@@ -187,7 +187,7 @@ jobs:
|
||||
../build/c3c compile-run examples/fannkuch-redux.c3
|
||||
../build/c3c compile-run examples/contextfree/boolerr.c3
|
||||
../build/c3c compile-run examples/load_world.c3
|
||||
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
|
||||
../build/c3c compile --no-entry --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
|
||||
- name: Build testproject
|
||||
run: |
|
||||
cd resources/testproject
|
||||
@@ -281,9 +281,9 @@ jobs:
|
||||
../build/c3c compile examples/fasta.c3
|
||||
../build/c3c compile examples/gameoflife.c3
|
||||
../build/c3c compile examples/hash.c3
|
||||
../build/c3c compile examples/levenshtein.c3
|
||||
../build/c3c compile-only examples/levenshtein.c3
|
||||
../build/c3c compile examples/load_world.c3
|
||||
../build/c3c compile examples/map.c3
|
||||
../build/c3c compile-only examples/map.c3
|
||||
../build/c3c compile examples/mandelbrot.c3
|
||||
../build/c3c compile examples/plus_minus.c3
|
||||
../build/c3c compile examples/nbodies.c3
|
||||
@@ -403,8 +403,8 @@ jobs:
|
||||
run: |
|
||||
cd resources
|
||||
../build/c3c compile examples/gameoflife.c3
|
||||
../build/c3c compile examples/levenshtein.c3
|
||||
../build/c3c compile examples/map.c3
|
||||
../build/c3c compile-only examples/levenshtein.c3
|
||||
../build/c3c compile-only examples/map.c3
|
||||
../build/c3c compile examples/mandelbrot.c3
|
||||
../build/c3c compile examples/plus_minus.c3
|
||||
../build/c3c compile examples/spectralnorm.c3
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
- `*-add` keys in targets in `manifest.json` and `project.json` are deprecated.
|
||||
- Made "add" the default for things like `sources`, `dependencies` and other keys in project and library files.
|
||||
- Give some symbol name suggestions when the path is matched.
|
||||
- Don't generate .o files on `compile` and `compile-run` if there is no `main`.
|
||||
|
||||
### Fixes
|
||||
- Broken WASM library code.
|
||||
|
||||
@@ -16,7 +16,7 @@ void check_json_keys(const char* valid_keys[][2], size_t key_count, const char*
|
||||
{
|
||||
if (str_eq(key, deprecated_keys[j]))
|
||||
{
|
||||
eprintf("'%s' is using the deprecated parameter '%s'", target_name, key);
|
||||
eprintf("Note: Target '%s' is using the deprecated parameter '%s'\n", target_name, key);
|
||||
goto OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,20 +65,12 @@ static inline void parse_library_target(Library *library, LibraryTarget *target,
|
||||
JSONObject *object)
|
||||
{
|
||||
target->link_flags = get_string_array(library->dir, target_name, object, "linkflags", false);
|
||||
if (target->link_flags)
|
||||
{
|
||||
eprintf("Library %s is using the deprecated `linkflags` parameter.", library->provides);
|
||||
}
|
||||
else
|
||||
if (!target->link_flags)
|
||||
{
|
||||
target->link_flags = get_string_array(library->dir, target_name, object, "link-args", false);
|
||||
}
|
||||
target->linked_libs = get_string_array(library->dir, target_name, object, "linked-libs", false);
|
||||
if (target->linked_libs)
|
||||
{
|
||||
eprintf("Library %s is using the deprecated `linked-libs` parameter.", library->provides);
|
||||
}
|
||||
else
|
||||
if (!target->linked_libs)
|
||||
{
|
||||
target->linked_libs = get_string_array(library->dir, target_name, object, "linked-libraries", false);
|
||||
}
|
||||
|
||||
@@ -435,6 +435,14 @@ void compiler_compile(void)
|
||||
error_exit("Failed to create output directory '%s'.", active_target.object_file_dir);
|
||||
}
|
||||
}
|
||||
if (active_target.type == TARGET_TYPE_EXECUTABLE && !global_context.main && !active_target.no_entry)
|
||||
{
|
||||
error_exit("The 'main' function for the executable could not found, did you forget to add it?\n\n"
|
||||
"- If you're using an alternative entry point you can suppress this message using '--no-entry'.\n"
|
||||
"- If you want to build a library, use 'static-lib' or 'dynamic-lib'.\n"
|
||||
"- If you just want to output object files for later linking, use 'compile-only'.");
|
||||
}
|
||||
|
||||
switch (active_target.backend)
|
||||
{
|
||||
case BACKEND_LLVM:
|
||||
@@ -466,14 +474,8 @@ void compiler_compile(void)
|
||||
output_exe = exe_name();
|
||||
break;
|
||||
case TARGET_TYPE_EXECUTABLE:
|
||||
if (!global_context.main && !active_target.no_entry)
|
||||
{
|
||||
puts("No main function was found, compilation only object files are generated.");
|
||||
}
|
||||
else
|
||||
{
|
||||
output_exe = exe_name();
|
||||
}
|
||||
assert(global_context.main || active_target.no_entry);
|
||||
output_exe = exe_name();
|
||||
break;
|
||||
case TARGET_TYPE_STATIC_LIB:
|
||||
output_static = static_lib_name();
|
||||
|
||||
@@ -153,7 +153,7 @@ class Issues:
|
||||
self.current_file.close()
|
||||
print("- " + str(self.conf.numtests) + "/" + str(
|
||||
self.conf.numtests - self.conf.numsuccess - 1) + " " + self.sourcefile.filepath + ":", end="")
|
||||
self.compile("--test compile " + self.current_file.filepath)
|
||||
self.compile("--test compile-only " + self.current_file.filepath)
|
||||
if not self.has_errors:
|
||||
self.conf.numsuccess += 1
|
||||
print(" Passed.")
|
||||
@@ -229,7 +229,7 @@ class Issues:
|
||||
if file.is_target:
|
||||
files_to_compile += " " + file.filepath
|
||||
|
||||
self.compile("--test compile " + files_to_compile)
|
||||
self.compile("--test compile-only " + files_to_compile)
|
||||
if self.has_errors:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user