mirror of https://gerrit.osmocom.org/libosmocore
gsm: ensure completeness of osmo_bts_features_{descs,names}[]
It already happened several times [1][2] that new features were added to enum osmo_bts_features, but the osmo_bts_features_{descs,names}[] were left unchanged. Let's add static_assert()s to prevent this. Change-Id: I8e3b7d3996e9f3e16c6d4e0d1d406fa538d5e9be Related: [1]f4f5d54ea2
Related: [2]18c6a8183f
This commit is contained in:
parent
f4f5d54ea2
commit
82001ebc2a
|
@ -7,7 +7,7 @@
|
|||
|
||||
/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility
|
||||
with BTS compiled against earlier version of this header. Also make sure that the description strings
|
||||
osmo_bts_features_descs[] in gsm_data.c are also updated accordingly! */
|
||||
osmo_bts_features_{descs,names}[] in bts_features.c are also updated accordingly! */
|
||||
enum osmo_bts_features {
|
||||
BTS_FEAT_HSCSD,
|
||||
BTS_FEAT_GPRS,
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <osmocom/gsm/bts_features.h>
|
||||
|
||||
const struct value_string osmo_bts_features_descs[] = {
|
||||
|
@ -49,6 +50,9 @@ const struct value_string osmo_bts_features_descs[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Ensure that all BTS_FEAT_* entries are present in osmo_bts_features_descs[] */
|
||||
osmo_static_assert(ARRAY_SIZE(osmo_bts_features_descs) == _NUM_BTS_FEAT + 1, _bts_features_descs);
|
||||
|
||||
/*! return description string of a BTS feature (osmo_bts_features_descs).
|
||||
* To get the plain feature name, use osmo_bts_features_name() instead. */
|
||||
const char *osmo_bts_feature_name(enum osmo_bts_features feature)
|
||||
|
@ -86,3 +90,6 @@ const struct value_string osmo_bts_features_names[] = {
|
|||
{ BTS_FEAT_VGCS, "VGCS" },
|
||||
{}
|
||||
};
|
||||
|
||||
/* Ensure that all BTS_FEAT_* entries are present in osmo_bts_features_names[] */
|
||||
osmo_static_assert(ARRAY_SIZE(osmo_bts_features_names) == _NUM_BTS_FEAT + 1, _bts_features_names);
|
||||
|
|
Loading…
Reference in New Issue