delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/16/16:16:22

Message-ID: <39219CC4.EC6D90A@softhome.net>
Date: Tue, 16 May 2000 22:08:52 +0300
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Minor GCC & DJGPP header problem
Reply-To: djgpp-workers AT delorie DOT com

It is not (as far as I can see) related to the previous discussion:

Excerpt from one GCC internal include file (gcc/system.h):

#ifndef offsetof
#define offsetof(TYPE, MEMBER)  ((size_t) &((TYPE *)0)->MEMBER)
#endif

And from DJGPP's stddef.h:

#define offsetof(s_type, mbr) ((size_t) &((s_type *)0)->mbr)

offsetof in DJGPP is defined uncoditionally, so there are lots
of harmless but annoying warnings like

In file included from ../../gcc/../include/libiberty.h:132,
                 from ../../gcc/system.h:563,
                 from ../../gcc/cppmain.c:24:
d:/djgpp/include/stddef.h:12: warning: `offsetof' redefined

I see two solutions:
1) as it is done with NULL in stdio.h:
#undef offsetof
#define offsetof we_dont_care_about_previous_def

2) as gcc does
#ifndef offsetof
#define offsetof we_care_about_previous_def
#endif

Which one (or noone) is OK?

Laurynas Biveinis

- Raw text -


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