Open Bug 2010563 Opened 1 day ago

Include endian.h for BYTE_ORDER

Categories

(NSS :: Build, defect)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: prlw1, Unassigned)

Details

Steps to reproduce:

When compiling nss from nss-3.120.tar.gz (3.120 doesn't appear in the bugzilla Version drop down menu), I see

Actual results:

h_page.c: In function 'dbm_get_page':
h_page.c:729:30: error: 'BYTE_ORDER' undeclared (first use in this function)
  729 |         if (hashp->LORDER != BYTE_ORDER) {
      |                              ^~~~~~~~~~
h_page.c:729:30: note: each undeclared identifier is reported only once for each function it appears in
h_page.c: In function 'dbm_put_page':
h_page.c:820:26: error: 'BYTE_ORDER' undeclared (first use in this function)
  820 |     if (hashp->LORDER != BYTE_ORDER) {
      |                          ^~~~~~~~~~

etc

Expected results:

According to POSIX, endian.h is the header file which needs to be included to define BYTE_ORDER.

Looking at nss/lib/dbm/include/mcom_db.h, we see that it is only included for builds on linux., (#if defined(__linux)). I suppose one could add a long list of operating systems to the conditional, but preferably, do your build system equivalent of AC_CHECK_HEADERS([endian.h]), and

#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif

in nss/lib/dbm/include/mcom_db.h

You need to log in before you can comment on or make changes to this bug.