summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/amgc_output_enum.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/output/amgc_output_enum.c b/src/output/amgc_output_enum.c
index c69d49f..be399df 100644
--- a/src/output/amgc_output_enum.c
+++ b/src/output/amgc_output_enum.c
@@ -89,6 +89,7 @@ int amgc_output_unit_enum(
FILE * fout)
{
struct amgc_entity * enumvals;
+ const char * symbol;
int ret;
if (entity->base.kind != ENTITY_ENUM)
@@ -96,7 +97,12 @@ int amgc_output_unit_enum(
else if (amgc_get_enum_members(uctx,entity,&enumvals))
return -1;
- ret = output_enum(entity->base.symbol->string,enumvals,layout,fout);
+ if (entity->base.symbol)
+ symbol = entity->base.symbol->string;
+ else
+ symbol = "";
+
+ ret = output_enum(symbol,enumvals,layout,fout);
amgc_free_enum_members(enumvals);
return ret;
@@ -108,7 +114,8 @@ int amgc_output_custom_enum(
const struct amgc_layout * layout,
FILE * fout)
{
- const struct amgc_entity * aentity;
+ const struct amgc_entity * aentity;
+ const char * symbol;
if (penum->entity && penum->entity->base.kind != ENTITY_ENUM)
return -1;
@@ -119,10 +126,14 @@ int amgc_output_custom_enum(
if (aentity->entity && aentity->entity->base.kind != ENTITY_ENUM_VALUE)
return -1;
- return output_enum(penum->entity
- ? penum->entity->base.symbol->string
- : penum->altname,
- enumvals,layout,fout);
+ if (!penum->entity)
+ symbol = penum->altname;
+ else if (penum->entity->base.symbol)
+ symbol = penum->entity->base.symbol->string;
+ else
+ symbol = "";
+
+ return output_enum(symbol,enumvals,layout,fout);
}
int amgc_output_unit_enums(