]> git.proxmox.com Git - mirror_frr.git/commit
lib: add macro that performs explicit static casts when using a C++ compiler
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 11 Feb 2019 18:04:26 +0000 (16:04 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 12 Feb 2019 00:34:12 +0000 (22:34 -0200)
commit343cd13e17062eb024f45b44036d930988bd0299
treeaad680435656df1cd6b2bd64ea74bbdf79b8abb0
parentc139972c0ffcabe73cafc3d20f257163fa81ddd0
lib: add macro that performs explicit static casts when using a C++ compiler

C++ doesn't support implicit casts from void pointers like C
does. And the libfrr headers have some bits of code that rely on
implicit casts in order to work. To solve this problem, add a new
"static_cast" macro that performs explicit static casts when a C++
compiler is being used, or do nothing otherwise.

NOTE: since macros are only evaluated when they are used, there
might be other macros from libfrr that will need to use "static_cast"
as well. If a header is successfully compiled using a C++ compiler,
there's no guarantee that its macros are compatible with C++. We'll
only know about such macros when they are used by C++ code, then
we'll need to adapt them one by one in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/linklist.h
lib/zebra.h