c3c build picks first target rather than the first executable #2105.

This commit is contained in:
Christoffer Lerno
2025-04-25 15:44:34 +02:00
parent 05094b4f47
commit 0129308bf3
2 changed files with 2 additions and 16 deletions

View File

@@ -18,6 +18,7 @@
- `Foo[1..2] = { .baz = 123 }` inference now works. #2095 - `Foo[1..2] = { .baz = 123 }` inference now works. #2095
- Deprecated old inference with slice copy. Copying must now ensure a slicing operator at the end of the right hand side: `foo[1..2] = bar[..]` rather than the old `foo[1..2] = bar`. The old behaviour can be mostly retained with `--use-old-slice-copy`). - Deprecated old inference with slice copy. Copying must now ensure a slicing operator at the end of the right hand side: `foo[1..2] = bar[..]` rather than the old `foo[1..2] = bar`. The old behaviour can be mostly retained with `--use-old-slice-copy`).
- Added `Enum.lookup` and `Enum.lookup_field`. - Added `Enum.lookup` and `Enum.lookup_field`.
- `c3c build` picks first target rather than the first executable #2105.
### Fixes ### Fixes
- Trying to cast an enum to int and back caused the compiler to crash. - Trying to cast an enum to int and back caused the compiler to crash.

View File

@@ -514,21 +514,6 @@ static void project_add_targets(const char *filename, Project *project, JSONObje
} }
} }
/**
* Grab the default target, this will be the executable if one exists, otherwise
* it's the first target in the list.
*
* @param project
* @return the selected build target.
*/
static BuildTarget *project_select_default_target(Project *project)
{
FOREACH(BuildTarget *, target, project->targets)
{
if (target->type == TARGET_TYPE_EXECUTABLE) return target;
}
return project->targets[0];
}
/** /**
* Select the project target. This may be given a target, if so it is looked for. * Select the project target. This may be given a target, if so it is looked for.
@@ -546,7 +531,7 @@ BuildTarget *project_select_target(const char *filename, Project *project, const
} }
if (!optional_target) if (!optional_target)
{ {
return project_select_default_target(project); return project->targets[0];
} }
FOREACH(BuildTarget *, target, project->targets) FOREACH(BuildTarget *, target, project->targets)
{ {