From e5e9e8c0e8a27010d3bc860b36461c347e10268a Mon Sep 17 00:00:00 2001 From: mccallum Date: Sun, 31 Mar 1996 21:54:02 +0000 Subject: [PATCH] Include . (class_add_behavior): Use NSCAssert() to make sure that we don't try to increase the instance size of a class that has been subclassed; (hopeless ivar layout confusion would result). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1319 72102866-910b-0410-8b05-ffd578937521 --- Source/behavior.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/behavior.m b/Source/behavior.m index 93bb377cb..b053a8596 100644 --- a/Source/behavior.m +++ b/Source/behavior.m @@ -48,11 +48,9 @@ */ -#include -#include -#include -#include +#include #include +#include static int behavior_debug = 0; @@ -93,7 +91,16 @@ class_add_behavior (Class class, Class behavior) /* If necessary, increase instance_size of CLASS. */ if (class->instance_size < behavior->instance_size) - class->instance_size = behavior->instance_size; + { + NSCAssert (!class->subclass_list, + @"The behavior-addition code wants to increase the\n" + @"instance size of a class, but it cannot because you\n" + @"have subclassed the class. There are two solutions:\n" + @"(1) Don't subclass it; (2) Add placeholder instance\n" + @"variables to the class, so the behavior-addition code\n" + @"will not have to increase the instance size."); + class->instance_size = behavior->instance_size; + } #if 0 /* xxx Do protocols */