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/.

Vadim Yanitskiy vyanitskiy at sysmocom.de
Fri Oct 29 22:40:38 UTC 2021


Hi list,

today I fixed a header file in libosmocore:

https://gerrit.osmocom.org/c/libosmocore/+/26044

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`'.

We may want to catch missing #include of the <endian.h> automatically, 
so I wrote a simple script to check whether it is absent:

https://gerrit.osmocom.org/c/osmo-ci/+/26045

Below is an example of using it:

   $ cd libosmocore/
   $ verify_endian_header.sh $(find . -name "*.[hc]")
   File './include/osmocom/gsm/protocol/gsm_44_004.h'
     does not #include <osmocom/core/endian.h>

What's still missing is the actual integration into the build 
verification process.  I guess there is currently no easy way other than 
calling this script from 'contrib/jenkins.sh' of each project?

P.S. I found out that we also have 'scripts/verify_log_statements.py' in 
osmo-ci.git, but we don't seem to call it anywhere?

Best regards,
Vadim.

-- 
- Vadim Yanitskiy <vyanitskiy at sysmocom.de>    http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Director: Harald Welte



More information about the OpenBSC mailing list