diff --git a/bin/template_loader.rl b/bin/template_loader.rl index 56bd46e..1e91e0e 100644 --- a/bin/template_loader.rl +++ b/bin/template_loader.rl @@ -50,7 +50,7 @@ void TemplateParse(void *yyp, int yymajor, void *yyminor, Debug::TemplateParseIn void TemplateParse(void *yyp, int yymajor, int yyminor, Debug::TemplateParseInfo *info) { - TemplateParse(yyp, yymajor, &yyminor, info); + TemplateParse(yyp, yymajor, (void *)yyminor, info); } void TemplateParse(void *yyp, int yymajor, const std::string *yyminor, Debug::TemplateParseInfo *info) diff --git a/bin/template_parser.lemon b/bin/template_parser.lemon index 88f7632..f3f64a7 100644 --- a/bin/template_parser.lemon +++ b/bin/template_parser.lemon @@ -67,7 +67,7 @@ struct_field(rhs) ::= opt_volatile TEMPLATE(a) opt_star(star) IDENTIFIER(b) arra %type array_count { int } array_count(rhs) ::= . { rhs = 0; } array_count(rhs) ::= LBRACKET INTEGER(a) RBRACKET. { - int i = *(int *)a; + int i = (int)(ptrdiff_t)a; if (i == 0) { fprintf(stderr, "Template error: line %u: 0-sized arrays are not allowed.\n", info->LineNumber); @@ -110,7 +110,7 @@ typecode(rhs) ::= UNSIGNED LONG opt_int. { rhs = kUInt32; } typecode(rhs) ::= opt_signed LONG LONG. { rhs = kSInt64; } typecode(rhs) ::= UNSIGNED LONG LONG. { rhs = kUInt64; } -typecode(rhs) ::= TYPECODE(a). { rhs = *(int *)a; } +typecode(rhs) ::= TYPECODE(a). { rhs = (int)(ptrdiff_t)a; } /* pointers are not fully supported yet */ typecode(rhs) ::= VOID STAR. { rhs = kVoidPtr; }