Closed Bug 1065055 Opened 10 years ago Closed 10 years ago

Dont assume endian.h defines only __BYTE_ORDER

Categories

(Core :: JavaScript Engine, defect)

x86_64
OpenBSD
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: gaston, Assigned: gaston)

Details

Attachments

(1 file)

Funnily, in bug #714312 i added support to detect machine/endian.h on BSD systems to detect endianness.. time passed, and OpenBSD recently gained an endian.h include, but it does *not* define __BYTE_ORDER (cf http://marc.info/?l=openbsd-cvs&m=140518236422542&w=2) but only BYTE_ORDER.

I've been told (and accordingly to http://austingroupbugs.net/view.php?id=162#c665) that posix is in the process of standardizing endian.h, assuming that it defines BYTE_ORDER. So i think jscpucfg.h should also handle the case where endian.h is here, and do its #ifdef dance also for BYTE_ORDER. Diff in a few.
If it is the way to go, could use a backport to aurora/beta... i will also push it to try. who knows what dragons can live there..
Attachment #8486631 - Flags: review?(n.nethercote)
Comment on attachment 8486631 [details] [diff] [review]
also define IS_{LITTLE,BIG}_ENDIAN according to BYTE_ORDER

Review of attachment 8486631 [details] [diff] [review]:
-----------------------------------------------------------------

A brief comment explaining the two cases would be nice. Thanks.
Attachment #8486631 - Flags: review?(n.nethercote) → review+
Some builds are burning on try, and i cant make any sense of the failures.. as for the comment, i suppose you prefer it directly within jscpucfg.h, explaining the previous status quo with __BYTE_ORDER and the direction posix goes ?
(In reply to Landry Breuil (:gaston) from comment #5)
> Some builds are burning on try, and i cant make any sense of the failures..

Could the errors be from another patch just before yours? I.e. you pushed on top of bustage?

> as for the comment, i suppose you prefer it directly within jscpucfg.h,
> explaining the previous status quo with __BYTE_ORDER and the direction posix
> goes ?

Yes please.
All green this time, so yeah probably pushed on top of bustage..

as for the comment, would that do ?

/* historically, OSes providing <endian.h> only defined
 * __BYTE_ORDER to either __LITTLE_ENDIAN or __BIG_ENDIAN.
 * The austin group decided to standardise <endian.h> in
 * POSIX around 2011, expecting it to provide a BYTE_ORDER
 * #define set to either LITTLE_ENDIAN or BIG_ENDIAN. We
 * should try to cope with both possibilities here */
> All green this time, so yeah probably pushed on top of bustage..

Pushing to try from a mozilla-central generally avoids this problem. I have a script that copies patches from a mozilla-inbound repo to a mozilla-central repo and then pushes. Occasionally you get conflicts in the copying stage. Something to consider :)

That comment is perfect, word-wise. Just needs some tweaking of formatting and punctuation, viz:

/*
 * Historically, OSes providing <endian.h> only defined
 * __BYTE_ORDER to either __LITTLE_ENDIAN or __BIG_ENDIAN.
 * The Austin group decided to standardise <endian.h> in
 * POSIX around 2011, expecting it to provide a BYTE_ORDER
 * #define set to either LITTLE_ENDIAN or BIG_ENDIAN. We
 * should try to cope with both possibilities here.
 */

Once you've updated the patch, set the "checkin-needed" flag and you should be good. Thanks!
https://hg.mozilla.org/mozilla-central/rev/01223f8127da
Assignee: nobody → landry
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: