From: Juergen Werner Date: Tue, 1 Oct 2019 15:01:10 +0000 (+0200) Subject: lib: Fix static variable initialization X-Git-Tag: base_7.3~253^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ee46da26917029f786e504008c350efe0a27a298;p=mirror%2Ffrr.git lib: Fix static variable initialization Signed-off-by: Juergen Werner --- diff --git a/doc/developer/memtypes.rst b/doc/developer/memtypes.rst index 1af871963a..e04049001d 100644 --- a/doc/developer/memtypes.rst +++ b/doc/developer/memtypes.rst @@ -52,6 +52,12 @@ Definition a function taking a ``struct memtype *`` argument can be called with an ``MTYPE_name`` argument (as opposed to ``&MTYPE_name``.) + .. note:: + + As ``MTYPE_name`` is a variable assigned from ``&_mt_name`` and not a + constant expression, it cannot be used as initializer for static + variables. In the case please fall back to ``&_mt_name``. + .. c:macro:: DECLARE_MGROUP(name) This macro forward-declares a memory group and should be placed in a diff --git a/lib/frrcu.c b/lib/frrcu.c index 7e6475b648..d65a4a98bf 100644 --- a/lib/frrcu.c +++ b/lib/frrcu.c @@ -206,7 +206,7 @@ void rcu_thread_unprepare(struct rcu_thread *rt) rcu_bump(); if (rt != &rcu_thread_main) /* this free() happens after seqlock_release() below */ - rcu_free_internal(MTYPE_RCU_THREAD, rt, rcu_head); + rcu_free_internal(&_mt_RCU_THREAD, rt, rcu_head); rcu_threads_del(&rcu_threads, rt); seqlock_release(&rt->rcu); @@ -269,7 +269,7 @@ static void rcu_bump(void) * "last item is being deleted - start over" case, and then we may end * up accessing old RCU queue items that are already free'd. */ - rcu_free_internal(MTYPE_RCU_NEXT, rn, head_free); + rcu_free_internal(&_mt_RCU_NEXT, rn, head_free); /* Only allow the RCU sweeper to run after these 2 items are queued. *