Catching missing #include of <endian.h>

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at osmocom.org
Mon Nov 1 09:07:06 UTC 2021


Hi Vadim,

On Sat, Oct 30, 2021 at 01:40:38AM +0300, Vadim Yanitskiy wrote:
> TL;DR, using OSMO_IS_{LITTLE,BIG}_ENDIAN macros without including the
> <osmocom/core/endian.h> header leads to empty struct definitions, and thus
> weird compiler warnings like 'struct `foo` has no member `bar`'.

I think a more "automatic" solution to catch those errors is to try to build
with -Wundef.  For libosmocore, there is currently some fall-out with EMBEDDED (we'd have to explicitly #define EMBEDDED 0 via autoconf).

The advantage of the -Wundef approach is that it should work for all such
'forgot to include a header defining a macro' use cases, and it doesn't require
an external tool for validation.  Just add -Wundef to our normal build flags.

-- 
- Harald Welte <laforge at osmocom.org>            http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



More information about the OpenBSC mailing list