RTEMS: Add -D_COMPILING_NEWLIB

Ralf Corsepius ralf.corsepius@rtems.org
Wed Nov 17 16:26:00 GMT 2010


On 11/16/2010 06:20 PM, Corinna Vinschen wrote:
> On Oct  8 17:24, Ralf Corsepius wrote:
>> Hi,
>>
>> similar to Cygwin, compiling newlib for RTEMS needs -D_COMPILING_NEWLIB.
>>
>> BTW: I am wondering if -D_COMPILING_NEWLIB shouldn't be supplied
>> globally for all targets and not only for RTEMS and Cygwin.
>>
>> Ralf
>
>> 2010-10-08	Ralf Cors??pius<ralf.corsepius@rtems.org>
>>
>> 	* configure.host: Add -D_COMPILING_NEWLIB to newlib_cflags.
>
> Patch applied.  I'm not sure it's a good idea to add -D_COMPILING_NEWLIB
> to all targets.
Depends on _COMPILING_NEWLIB's semantics.

> I don't know how RTEMS handles it,
We are treating it as a newlib-private/internal define which is not 
supposed to be used outside of newlib to denote the fact "we're inside 
of newlib" to expose newlib internal parts.

I.e. users are not supposed to use it, it's only legitimate use-case is 
building newlib itself.

> but in Cygwin it's
> only used in very special cases in which we have clashes between newlib
> and Cygwin definitions (for instance when using _off_t vs. off_t).
> Are you sure that all cases in which `#ifdef _COMPILING_NEWLIB' is used
> in newlib are also feasible for RTEMS?
We're using #ifdef __rtems__ for rtems-specific parts and would assume 
all other OSes to also use an OS-specific define for their OS-specific 
parts.

So yes, in my understanding #ifdef _COMPILING_NEWLIB should be generally 
valid.

Ralf



More information about the Newlib mailing list