From: Nick Bowler Date: Wed, 10 Mar 2021 01:34:05 +0000 (-0500) Subject: Work around designated initializer bug on HP-UX cc. X-Git-Tag: v1.1~10 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/f7cfa924116d4dd36b107fa534fff2b5e5e4fa13?hp=1964240454d93493ee68a75b171fdf7934332200 Work around designated initializer bug on HP-UX cc. Work around a designated initializer bug encountered on old versions of HP-UX. It seems there are some glitches leading to compilation failures when the initializers are out of order (or omitted), and the initializer for such a member is non-constant, and there is a type conversion involved. This affects several of the parser actions that initialize declspec values. In this case, it is super easy to just change the type and avoid type conversion, which easily avoids the bug. --- diff --git a/src/parse.y b/src/parse.y index a14f909..11ae6bb 100644 --- a/src/parse.y +++ b/src/parse.y @@ -64,6 +64,7 @@ int cdecl__yyparse(void *scanner, struct cdecl **out); %union { uintmax_t uintval; + unsigned spectype; _Bool boolval; char *strval; struct cdecl_declspec *declspec; @@ -205,7 +206,7 @@ void cdecl__free(struct cdecl *decl) %type vla_ident %type varargs -%type declspec_simple typespec_simple qualifier_simple +%type declspec_simple typespec_simple qualifier_simple %type declspec_notype declspec_noid typespec_noid typespec %type qualifier qualifiers %type declspecs declspecs_noid