From bbaf129adfae4f081468c8bb4e48e2c1bdb9009f Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 27 Aug 2016 15:24:53 -0400 Subject: [PATCH] Fix ruby codegen for bitfields/enums with long base-type --- plugins/ruby/codegen.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/ruby/codegen.pl b/plugins/ruby/codegen.pl index 3e41f93c9..eb9828490 100755 --- a/plugins/ruby/codegen.pl +++ b/plugins/ruby/codegen.pl @@ -657,6 +657,9 @@ sub get_compound_align { if ($st eq 'bitfield' or $st eq 'enum') { my $base = $field->getAttribute('base-type') || 'uint32_t'; + if ($base eq 'long') { + return $SIZEOF_LONG; + } print "$st type $base\n" if $base !~ /int(\d+)_t/; return $1/8; } @@ -793,9 +796,15 @@ sub sizeof_compound { if ($st eq 'bitfield' or $st eq 'enum') { my $base = $field->getAttribute('base-type') || 'uint32_t'; - print "$st type $base\n" if $base !~ /int(\d+)_t/; - $sizeof_cache{$typename} = $1/8 if $typename; - return $1/8; + if ($base eq 'long') { + $sizeof_cache{$typename} = $SIZEOF_LONG if $typename; + return $SIZEOF_LONG; + } + else { + print "$st type $base\n" if $base !~ /int(\d+)_t/; + $sizeof_cache{$typename} = $1/8 if $typename; + return $1/8; + } } if ($field->getAttribute('is-union'))