[BusyBox 0000760]: [PORTABILITY] endian.h stuff [PATCH]

bugs at busybox.net bugs at busybox.net
Wed Mar 1 14:07:34 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=760 
====================================================================== 
Reported By:                rfelker
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   760
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             02-28-2006 13:51 PST
Last Modified:              03-01-2006 06:07 PST
====================================================================== 
Summary:                    [PORTABILITY] endian.h stuff [PATCH]
Description: 
The attached patch replaces the preprocessor checks for endianness using
endian.h with a fully portable check that should work on any usable
version of gcc or any C99-compliant compiler. As long as optimization is
enabled gcc eliminates the dead code. The way I've done this seems to
match the desired direction of config options in BusyBox (from
preprocessor hacks towards C conditionals with dead-code elimination).
====================================================================== 

---------------------------------------------------------------------- 
 vodz - 02-28-06 21:44  
---------------------------------------------------------------------- 
Hmm. You removed #include <endian.h>. But use #if __BYTE_ORDER ==
__BIG_ENDIAN too. Its strange for me.

strndup->bb_strndup for get_header_tar.c applied. 

---------------------------------------------------------------------- 
 rfelker - 03-01-06 06:07  
---------------------------------------------------------------------- 
No, reread the patch. It removes all references to __BYTE_ORDER and
__BIG_ENDIAN in these files. That is the whole point, to get rid of
endian.h which is a GNU-specific interface.

Most programs that need to know test endianness at build time using a
configure script, but since BusyBox does not take this approach, the
C99/gcc way works. And as I said it seems to conform to the BusyBox design
direction of replacing #if with if. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-28-06 13:51  rfelker        New Issue                                    
02-28-06 13:51  rfelker        Status                   new => assigned     
02-28-06 13:51  rfelker        Assigned To               => BusyBox         
02-28-06 13:51  rfelker        File Added: endian.diff                      
02-28-06 21:44  vodz           Note Added: 0001151                          
03-01-06 06:07  rfelker        Note Added: 0001153                          
======================================================================




More information about the busybox-cvs mailing list