qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Patch: dyngen-exec.h for OpenBSD


From: Thiemo Seufer
Subject: Re: [Qemu-devel] Patch: dyngen-exec.h for OpenBSD
Date: Sat, 7 Apr 2007 00:21:26 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Todd T. Fries wrote:
> 
> Penned by Thiemo Seufer on 20070402 10:54.53, we have:
> | >  /* NOTE: standard headers should be used with special care at this
> | >     point because host CPU registers are used as global variables. Some
> | >     host headers do not allow that. */
> | >  #include <stddef.h>
> | > -
> | > +#ifdef __OpenBSD__
> | > +#include <sys/types.h>
> | > +#else
> | >  typedef unsigned char uint8_t;
> | >  typedef unsigned short uint16_t;
> | >  typedef unsigned int uint32_t;
> | > @@ -61,6 +65,7 @@ typedef signed long int64_t;
> | >  typedef signed long long int64_t;
> | >  #endif
> | >  #endif
> | > +#endif
> | 
> | Is this specialcase really needed for OpenBSD?
> 
> Can you honestly tell me that on all platforms this is true?
> 
> Hello? Portability?  sys/types.h defines these types portably.
> Doing so the way this code does it, is not portable.
> 
> I left your non portable code to you; if systems in general
> define these types in sys/types.h then just remove the
> typedefs, problem solved.

Please consider the NOTE: above those includes.

> | >  /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
> | >  typedef void * host_reg_t;
> | > @@ -78,11 +83,15 @@ typedef void * host_reg_t;
> | >  #define UINT32_MAX               (4294967295U)
> | >  #define UINT64_MAX               ((uint64_t)(18446744073709551615))
> | >  
> | > +#ifdef __OpenBSD__
> | > +typedef struct __sFILE FILE;
> | > +#else
> | >  typedef struct FILE FILE;
> | >  extern int fprintf(FILE *, const char *, ...);
> | >  extern int printf(const char *, ...);
> | >  #undef NULL
> | >  #define NULL 0
> | > +#endif
> | 
> | Shouldn't this cover only the FILE typedef?
> 
> Why is it that qemu knows what the definition of these prototypes
> are on all systems without consulting the header files.  I have a
> better idea, lets let the header files define the prototypes.
> Who would have though of that?
> 
> .. of course I purposefully intended to remove cruft that is
> in header files and belongs in header files.

See above.


Thiemo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]