[qfcc] Don't allow overloading of main for glsl

It's supposed to always be void(void), so...
This commit is contained in:
Bill Currie 2025-01-20 22:08:13 +09:00
parent 21cf636875
commit 105edc5126
2 changed files with 6 additions and 3 deletions

View file

@ -331,7 +331,7 @@ function_definition
$<symtab>$ = current_symtab;
auto spec = $1;
spec.sym->params = spec.params;
spec.is_overload = true;
spec.is_overload = strcmp (spec.sym->name, "main") != 0;
spec.type = find_type (parse_params (spec.type, spec.params));
spec.sym = function_symbol (spec, ctx);
current_func = begin_function (spec, nullptr, current_symtab, ctx);

View file

@ -817,6 +817,10 @@ spirv_function (function_t *func, spirvctx_t *ctx)
static void
spirv_EntryPoint (entrypoint_t *entrypoint, spirvctx_t *ctx)
{
if (!entrypoint->func) {
error (0, "entry point %s never defined", entrypoint->name);
return;
}
unsigned func_id = spirv_function (entrypoint->func, ctx);
int len = strlen (entrypoint->name) + 1;
@ -2065,8 +2069,7 @@ static void
spirv_build_code (function_t *func, const expr_t *statements)
{
func->exprs = statements;
if (strncmp ("main", func->o_name, 4) == 0
&& (!func->o_name[4] || func->o_name[4] == '|')) {
if (strcmp ("main", func->o_name) == 0) {
attribute_t *mode = nullptr;
if (pr.module->default_model == SpvExecutionModelFragment) {
mode = new_attribute ("mode",