[OpenJDK 2D-Dev] _LITTLE_ENDIAN

Phil Race Phil.Race at Sun.COM
Tue Jun 23 21:37:59 UTC 2009



Roman Kennke wrote:
> Hi,
> 
> first of all, I think this is a LCMS problem, so we should think about 
> how to fix this _upstream_, otherwise we end up maintaining a patched 
> version of lcms *shudder*.

But I see only that in the lcms.h file. And it is protected inside
#if macintosh so I can't believe Mario is hitting this ?

#if macintosh
# ifndef __LITTLE_ENDIAN__
#   define USE_BIG_ENDIAN      1
# endif
#endif


Ah, everyone must be looking at the old (1.16) lcms that we
replaced quite a few builds ago. It didn't have the #if macintosh

But since at some point (when lcms 2 is out), we'd enable using the
platform version, then modifying this copy isn't going to help
even if its needed.

But in addition I see it *used* in LCMS.c (2D glue code to LCMS),
where its relying on this being defined in the make files
(make/common/Defs-linux.gmk etc) as cited below as are a good number
of other places in the JDK sources as Mario noted.
If its really just that then making that test more sophisticated
(Vxworks aware) might be OK.

I think its going to be painful to change all the rest and most
of those as most are in medialib code, and that's from another group
in Sun and I presume followed the conventions of what's in
the Solaris header files.

-phil.


> 
> Then I don't think it's a good idea to depend on such 'internal' 
> defines. One OS defines or not _LITTLE_ENDIAN, others (like VxWorks) 
> define it either as 0 or 1, depending on the systems, even others don't 
> care and define __LITTLE_ENDIAN or whatever. IMO, a better way to solve 
> this is to make LCMS check LCMS_LITTLE_ENDIAN, and define it somewhere. 
> Configure based builds would figure this out when running configure. 
> OpenJDK would set this in the files mentioned below, instead of setting 
> _LITTLE_ENDIAN. AFAICS, this is the only way to make sure we don't 
> conflict with any internal settings of some OS include or compiler.
> 
>> For better or worse, there seems to be
>> ./common/Defs-linux.gmk:CFLAGS_REQUIRED_amd64   += 
>> -fno-omit-frame-pointer -D_LITTLE_ENDIAN
>> ./common/Defs-linux.gmk:CFLAGS_REQUIRED_i586    += 
>> -fno-omit-frame-pointer -D_LITTLE_ENDIAN
>> ./common/Defs-linux.gmk:CFLAGS_REQUIRED_ia64    += 
>> -fno-omit-frame-pointer -D_LITTLE_ENDIAN
>> ./common/Defs-solaris.gmk:  # The macro _LITTLE_ENDIAN needs to be 
>> defined the same to avoid the
>> ./common/Defs-solaris.gmk:  #   Sun C compiler warning message: 
>> warning: macro redefined: _LITTLE_ENDIAN
>> ./common/Defs-solaris.gmk:  CPPFLAGS_COMMON +=  -DcpuIntel 
>> -D_LITTLE_ENDIAN= -D$(LIBARCH)
>> ./common/Defs-windows.gmk:CPPFLAGS_COMMON = -DWIN32 -DIAL 
>> -D_LITTLE_ENDIAN
>> ./netbeans/awt2d/README:    D3D_OVERLOADS; UNICODE; _UNICODE; WIN32; 
>> IAL; _LITTLE_ENDIAN; WIN32; _X86_;
> 
> 
> /Roman



More information about the 2d-dev mailing list