delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/01/05:44:12

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3CF88D82.349DB1DA@phekda.freeserve.co.uk>
Date: Sat, 01 Jun 2002 10:01:54 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Conflicting types [va_list] in stdarg.h & stdio.h when making
Allegro
References: <3cf5b715$1_1 AT news DOT iprimus DOT com DOT au> <71ubfu00i64v35m2mku1vnj39921l15gns AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com

Hello.

Andrew Cottrell wrote:
> 
> jase,
> 
> >  Just another quick issue.  When making Allegro, it doesn't get very far!
> >The first file to compile stops with an error complaining of conflicting
> >types of va_list in stdarg.h (line 110), with the previous definition
> >coming from stdio.h (line 34).  I didn't think stdio.h even defined
> >va_list!?!  I looked at the header file and, sure enough, it doesn't.
> >So, what is the compiler complaining about?

Actually stdio.h does define va_list. It's just disguised. The key lines are:

...
#include <sys/djtypes.h>
...
__DJ_va_list
#undef __DJ_va_list
#define __DJ_va_list
...

> Please disreagrd this if you are not using GCC 3.1 other wise please
> read this:-
> 
> You must be using GCC 3.1 as these type of issues have only just
> surfaced with the GC 3.1 release. I suggest that you check out the
> djgpp developers list at www.delorie.com for a number of threads that
> have "GCC 3.1 patch" text when perfroming the email searches. The
> threads as still a bit hot and have not been comitted to the CVS
> repositry yet, give it a few days and it will.

The mailing list is called djgpp-workers.

> The code changes are simple, I have been able to apply and post some
> LIBC patches based on Richard's original set of patches sent on
> Tuesday night.

I don't think you will need to apply my patches, to get Allegro to build. The
patches are for building the libc sources with gcc 3.1.

The patch below should fix <sys/djtypes.h> to stop the warnings. gcc 3.x has
its own built-in va_list handling, so we don't need to use DJGPP's
definitions. Please note that this patch is against current DJGPP CVS, so this
patch will appear in the next version of DJGPP (whenever that's released).

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

--- /home/rich/src/tmp/include/sys/djtypes.h	Tue Dec 14 06:56:16 1999
+++ /home/rich/download/djgpp/include/sys/djtypes.h	Sun Jan 27 10:20:11 2002
@@ -1,3 +1,5 @@
+/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
@@ -7,12 +9,21 @@
 #define __DJ_clock_t	typedef int clock_t;
 #define __DJ_gid_t	typedef int gid_t;
 #define __DJ_off_t	typedef int off_t;
+#define __DJ_offset_t	typedef long long offset_t;
 #define __DJ_pid_t	typedef int pid_t;
 #define __DJ_size_t	typedef long unsigned int size_t;
 #define __DJ_ssize_t	typedef int ssize_t;
 #define __DJ_time_t	typedef unsigned int time_t;
 #define __DJ_uid_t	typedef int uid_t;
+
+/* For GCC 3.00 or later we use its builtin va_list.                       */
+/* In most cases these definitions won't be used, because headers provided */
+/* by GCC hide them. But we can DTRT if GCC headers are missing.           */
+#if __GNUC__ >= 3
+#define __DJ_va_list    typedef __builtin_va_list va_list;
+#else
 #define __DJ_va_list	typedef void *va_list;
+#endif
 
 #if defined(__cplusplus) && ( (__GNUC_MINOR__ >= 8 && __GNUC__ == 2 ) ||
__GNUC__ >= 3 )
 /* wchar_t is now a keyword in C++ */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019