Subject: Header File problem
From: [email-masked] (David Relson)

22 Nov 1996 21:28:27 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Sender: [email-masked]
X-Mailer: Windows Eudora Pro Version 2.2 (32)
Original-To: [email-masked]
Original-Sender: [email-masked]

Sirs,

I have encountered a problem building the Objective-C runtime, with my
system configured as --host=i386-unknown-winnt351.

>From directory /H-i386-cygwin32/src/gcc, I execute 'make objc-runtime'.
After a while 'byacc cexp.y' generates file cexp.c which is then compiled
via GCC and results in the following error messages:

	/usr/local/include/string.h:53: warning: conflicting types for built-in
function `memcmp'
	/usr/local/include/string.h:54: warning: conflicting types for built-in
function `memcpy'
	/usr/local/include/string.h:55: syntax error before `0'
	/usr/local/include/string.h:55: warning: conflicting types for built-in
function `memset'

The problem is due to compounded definitions, and can be demonstrated by
compiling a two line file, i.e.

        #include "config.h"
        #include <string.h>

What is happening is that "config.h" includes "i386/xm-winnt.h", which is in
/H-i386-cygwin32/SRC/GCC/CONFIG.  "i386/xm-winnt.h" then includes
"winnt/xm-winnt.h", also in /H-i386-cygwin32/SRC/GCC/CONFIG, and which has
the following as line 47:

   #define bzero(a,b) memset (a,0,b)

<string.h> also includes #include "_ansi.h", which has the following as line 34:

        #define	_EXFUN(name, proto)		name proto

then line 55 of <string.h> which is:

    void _EXFUN(bzero,(char *, size_t));

first expands to:

    void bzero(char *, size_t);

and then expands to:

    void memset(char *, 0, size_t)

Viola ! we have a compilation error.

I'm not sure of the proper fix, but I do know that there is no need to have
both a macro definition and a prototype of the same function.

David

David Relson                internet: [email-masked]
Ann Arbor, MI	            compuserve: 71441,1160

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".