libosmocore/include/osmocom
Vadim Yanitskiy 22ade291ad msgb: use OSMO_ASSERT in msgb_alloc_headroom[_c]()
This patch is a preparation for the upcoming change making use of
the built-in static_assert(), which is available since C11.

When using built-in static_assert(), gcc v12.2.1 fails:

include/osmocom/core/msgb.h: In function 'msgb_alloc_headroom_c':
include/osmocom/core/msgb.h:532:33: error: expression in static assertion is not constant
  532 |         osmo_static_assert(size >= headroom, headroom_bigger);
include/osmocom/core/utils.h:86:24: note: in definition of macro 'osmo_static_assert'
   86 |         static_assert((exp), "(" #exp ") failed")
      |                        ^~~
include/osmocom/core/msgb.h: In function 'msgb_alloc_headroom':
include/osmocom/core/msgb.h:554:33: error: expression in static assertion is not constant
  554 |         osmo_static_assert(size >= headroom, headroom_bigger);
include/osmocom/core/utils.h:86:24: note: in definition of macro 'osmo_static_assert'
   86 |         static_assert((exp), "(" #exp ") failed")
      |                        ^~~

These are not really *static* assert()s, because they operate on the
user supplied arguments 'size' and 'headroom', which are not guaranteed
to be integer literals.  Neither they trigger compilation failures
as expected, nor do they abort at run-time.  They simply do nothing.

Change-Id: I17ef4f3283ce20a5b452b7874c826acfb02a0123
2023-02-27 09:58:46 +00:00
..
codec Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
coding Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
core msgb: use OSMO_ASSERT in msgb_alloc_headroom[_c]() 2023-02-27 09:58:46 +00:00
crypt Rename OSMO_AUTH_ALG_XOR to OSMO_AUTH_ALG_XOR_3G 2023-02-22 09:45:15 +01:00
ctrl Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
gprs Move libosmogsm TS 44.060 declarations under include/osmocom/gsm/ 2023-02-20 12:21:30 +01:00
gsm gsm: ensure completeness of osmo_bts_features_{descs,names}[] 2023-02-24 17:06:21 +07:00
isdn i460_mux: add define constant for maximum number of subchannels 2023-02-24 13:38:22 +00:00
sim Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
usb Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
vty Split include/Makefile.am content into subdirs 2023-01-18 18:29:34 +01:00
Makefile.am create libosmoisdn sub-library 2023-01-21 22:41:57 +01:00