Re: [PATCH] GCC 3.4.3: libobjc build failure

Andrew Pinski <[email protected]> Mon, 20 Dec 2004 17:32:39 -0500
Newsgroups org.kernel.vger.linux-gcc
Message-ID <[email protected]>
On Dec 20, 2004, at 5:26 PM, Denis Zaitsev wrote:

> On Mon, Dec 20, 2004 at 05:03:45PM -0500, Andrew Pinski wrote:
>>
>> This one is better and should work.
>>
>>
>> If it does not report the errors please as it will help to fix the
>> problem.
>
> Yes, this patch seems to work, thanks.  But the compiler still
> complains about undeclared atoi.  Maybe it worth something to include
> <stdlib.h> somewhere?

Yes, this is what I applied to both the mainline and the 3.4 branch.

Thanks,
Andrew Pinski

ChangeLog:

	* gc.c: Remove definition of LOGWL, modWORDSZ, and divWORDSZ since
	they are not used.  Include limits.h and stdlib.h.
temp1.diff.txt (text/plain, 946 B)
Index: gc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/gc.c,v
retrieving revision 1.6
diff -u -p -r1.6 gc.c
--- gc.c	23 May 2003 20:04:58 -0000	1.6
+++ gc.c	20 Dec 2004 22:29:44 -0000
@@ -31,26 +31,17 @@ Boston, MA 02111-1307, USA.  */
 
 #include <assert.h>
 #include <string.h>
+#include <stdlib.h>
 
 #if OBJC_WITH_GC
 
 #include <gc.h>
+#include <limits.h>
 
 /* gc_typed.h uses the following but doesn't declare them */
 typedef GC_word word;
 typedef GC_signed_word signed_word;
-
-#if BITS_PER_WORD == 32
-# define LOGWL	5
-# define modWORDSZ(n) ((n) & 0x1f)        /* n mod size of word	    */
-#endif
-
-#if BITS_PER_WORD == 64
-# define LOGWL 6
-# define modWORDSZ(n) ((n) & 0x3f)        /* n mod size of word	    */
-#endif
-
-#define divWORDSZ(n) ((n) >> LOGWL)	   /* divide n by size of word      */
+#define BITS_PER_WORD (CHAR_BIT * sizeof (word))
 
 #include <gc_typed.h>