Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Semantic analysis was reporting a NULL datatype for funcs with void r…
…etvals.
  • Loading branch information
icculus committed Dec 31, 2014
1 parent dd73bac commit 44bf450
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions mojoshader_compiler.c
Expand Up @@ -1888,22 +1888,23 @@ static const MOJOSHADER_astDataType *build_function_datatype(Context *ctx,
const MOJOSHADER_astDataType **params,
const int intrinsic)
{
if ( ((paramcount > 0) && (params == NULL)) ||
((paramcount == 0) && (params != NULL)) )
return NULL;
const MOJOSHADER_astDataType **dtparams = NULL;
void *ptr;

// !!! FIXME: this is hacky.
const MOJOSHADER_astDataType **dtparams;
void *ptr = Malloc(ctx, sizeof (*params) * paramcount);
if (ptr == NULL)
return NULL;
if (!buffer_append(ctx->garbage, &ptr, sizeof (ptr)))
if (paramcount > 0)
{
Free(ctx, ptr);
return NULL;
} // if
dtparams = (const MOJOSHADER_astDataType **) ptr;
memcpy(dtparams, params, sizeof (*params) * paramcount);
// !!! FIXME: this is hacky.
ptr = Malloc(ctx, sizeof (*params) * paramcount);
if (ptr == NULL)
return NULL;
if (!buffer_append(ctx->garbage, &ptr, sizeof (ptr)))
{
Free(ctx, ptr);
return NULL;
} // if
dtparams = (const MOJOSHADER_astDataType **) ptr;
memcpy(dtparams, params, sizeof (*params) * paramcount);
}

ptr = Malloc(ctx, sizeof (MOJOSHADER_astDataType));
if (ptr == NULL)
Expand Down

0 comments on commit 44bf450

Please sign in to comment.