Fail gracefully when an unpacked struct is declared.

This commit is contained in:
Martin Whitaker 2015-05-17 21:59:05 +01:00
parent 578a2543f7
commit 71b1546a7d
2 changed files with 7 additions and 3 deletions

View File

@ -1044,7 +1044,11 @@ data_type /* IEEE1800-2005: A.2.2.1 */
$$ = tmp;
}
| struct_data_type
{ $$ = $1; }
{ if (!$1->packed_flag) {
yyerror(@1, "sorry: Unpacked structs not supported.");
}
$$ = $1;
}
| enum_data_type
{ $$ = $1; }
| atom2_type signed_unsigned_opt

View File

@ -79,8 +79,8 @@ static void pform_set_struct_type(struct_type_t*struct_type, perm_string name, N
return;
}
// For now, can only handle packed structs.
ivl_assert(*struct_type, 0);
// For now, can only handle packed structs. The parser generates
// a "sorry" message, so no need to do anything here.
}
void pform_set_struct_type(struct_type_t*struct_type, list<perm_string>*names, NetNet::Type net_type, list<named_pexpr_t>*attr)