ref: 27af3a9ca569496bd041c227fdfff599bf656a57
parent: 93e74dd57e1c6b799ff2b72a36d6feef51c2bf9c
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Mar 1 11:40:25 EST 2015
Add type struct for functions This is needed because we assign the content of the type to the node, so if function has no struct then we will get a segmentation fault.
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -25,6 +25,10 @@
static Node nodepool[NR_NODEPOOL], *newp;
+Type Funct = {
+ .letter = L_FUNCTION,
+};
+
Type l_int8 = {
.letter = L_INT8,
.size = 1,
@@ -194,8 +198,8 @@
return &l_uint32;
case L_UINT64:
return &l_uint64;
- case 'F':
- return NULL;
+ case L_FUNCTION:
+ return &Funct;;
default:
error(ETYPERR);
}
@@ -460,7 +464,7 @@
break;
}
- if (sym->u.v.type.size == 0)
+ if (sym->u.v.type.letter != L_FUNCTION)
return;
if (curfun)