summaryrefslogtreecommitdiff
path: root/lib/ffi/struct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ffi/struct.rb')
-rw-r--r--lib/ffi/struct.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ffi/struct.rb b/lib/ffi/struct.rb
index 7028258..725b9cb 100644
--- a/lib/ffi/struct.rb
+++ b/lib/ffi/struct.rb
@@ -203,9 +203,10 @@ module FFI
# :field3, :string
# end
def layout(*spec)
- warn "[DEPRECATION] Struct layout is already defined for class #{self.inspect}. Redefinition as in #{caller[0]} will be disallowed in ffi-2.0." if defined?(@layout)
return @layout if spec.size == 0
+ warn "[DEPRECATION] Struct layout is already defined for class #{self.inspect}. Redefinition as in #{caller[0]} will be disallowed in ffi-2.0." if defined?(@layout)
+
builder = StructLayoutBuilder.new
builder.union = self < Union
builder.packed = @packed if defined?(@packed)