]> git.draconx.ca Git - cdecl99.git/commitdiff
Work around designated initializer bug on HP-UX cc.
authorNick Bowler <nbowler@draconx.ca>
Wed, 10 Mar 2021 01:34:05 +0000 (20:34 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 10 Mar 2021 01:34:05 +0000 (20:34 -0500)
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.

src/parse.y

index a14f909c530ceb58377743b331e33ae56878a813..11ae6bb824cea90073c64d158a2a9d49ccfaf4cb 100644 (file)
@@ -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 <strval>     vla_ident
 %type <boolval>    varargs
-%type <uintval>    declspec_simple typespec_simple qualifier_simple
+%type <spectype>   declspec_simple typespec_simple qualifier_simple
 %type <declspec>   declspec_notype declspec_noid typespec_noid typespec
 %type <declspec>   qualifier qualifiers
 %type <declspec>   declspecs declspecs_noid