Bug 932991: Partly revert bug 898274 on jscpucfg.h, breaks OpenBSD/sparc64 (at least) where <machine/endian.h> must be included after <sys/types.h>. r=njn
authorLandry Breuil <landry@openbsd.org>
Mon, 04 Nov 2013 22:05:51 +0100
changeset 153485 7b9765059205a3ed02c49ccf64bade2cabc15da0
parent 153484 96420ca4720053c24f9570dca5cd932acc00e22e
child 153486 076fb6b1d2f9bab816964150cb12090ad9fbd76d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersnjn
bugs932991, 898274
milestone28.0a1
Bug 932991: Partly revert bug 898274 on jscpucfg.h, breaks OpenBSD/sparc64 (at least) where <machine/endian.h> must be included after <sys/types.h>. r=njn
config/check_spidermonkey_style.py
js/src/config/check_spidermonkey_style.py
js/src/jscpucfg.h
--- a/config/check_spidermonkey_style.py
+++ b/config/check_spidermonkey_style.py
@@ -90,16 +90,17 @@ included_inclnames_to_ignore = set([
 ])
 
 # These files have additional constraints on where they are #included, so we
 # ignore #includes of them when checking #include ordering.
 oddly_ordered_inclnames = set([
     'ctypes/typedefs.h',        # Included multiple times in the body of ctypes/CTypes.h
     'jsautokw.h',               # Included in the body of frontend/TokenStream.h
     'jswin.h',                  # Must be #included before <psapi.h>
+    'machine/endian.h',         # Must be included after <sys/types.h> on BSD
     'winbase.h',                # Must precede other system headers(?)
     'windef.h'                  # Must precede other system headers(?)
 ])
 
 # The files in tests/style/ contain code that fails this checking in various
 # ways.  Here is the output we expect.  If the actual output differs from
 # this, one of the following must have happened.
 # - New SpiderMonkey code violates one of the checked rules.
--- a/js/src/config/check_spidermonkey_style.py
+++ b/js/src/config/check_spidermonkey_style.py
@@ -90,16 +90,17 @@ included_inclnames_to_ignore = set([
 ])
 
 # These files have additional constraints on where they are #included, so we
 # ignore #includes of them when checking #include ordering.
 oddly_ordered_inclnames = set([
     'ctypes/typedefs.h',        # Included multiple times in the body of ctypes/CTypes.h
     'jsautokw.h',               # Included in the body of frontend/TokenStream.h
     'jswin.h',                  # Must be #included before <psapi.h>
+    'machine/endian.h',         # Must be included after <sys/types.h> on BSD
     'winbase.h',                # Must precede other system headers(?)
     'windef.h'                  # Must precede other system headers(?)
 ])
 
 # The files in tests/style/ contain code that fails this checking in various
 # ways.  Here is the output we expect.  If the actual output differs from
 # this, one of the following must have happened.
 # - New SpiderMonkey code violates one of the checked rules.
--- a/js/src/jscpucfg.h
+++ b/js/src/jscpucfg.h
@@ -48,18 +48,18 @@
 #   define IS_BIG_ENDIAN 1
 #  endif
 # else /* !defined(__BYTE_ORDER) */
 #  error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
 # endif
 
 /* BSDs */
 #elif defined(JS_HAVE_MACHINE_ENDIAN_H)
+# include <sys/types.h>
 # include <machine/endian.h>
-# include <sys/types.h>
 
 # if defined(_BYTE_ORDER)
 #  if _BYTE_ORDER == _LITTLE_ENDIAN
 #   define IS_LITTLE_ENDIAN 1
 #   undef  IS_BIG_ENDIAN
 #  elif _BYTE_ORDER == _BIG_ENDIAN
 #   undef  IS_LITTLE_ENDIAN
 #   define IS_BIG_ENDIAN 1