From 5e2444690bd0d2003e7d283f890b33e11ddd371f Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Thu, 7 Feb 2019 20:10:31 -0200 Subject: lib: add extern "C" {} blocks to all libfrr headers These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter Signed-off-by: Renato Westphal --- lib/module.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/module.h') diff --git a/lib/module.h b/lib/module.h index 68ed959270..73ba8665ed 100644 --- a/lib/module.h +++ b/lib/module.h @@ -20,6 +20,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if !defined(__GNUC__) #error module code needs GCC visibility extensions #elif __GNUC__ < 4 @@ -95,4 +99,8 @@ extern struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, extern void frrmod_unload(struct frrmod_runtime *module); #endif +#ifdef __cplusplus +} +#endif + #endif /* _FRR_MODULE_H */ -- cgit v1.2.3 From 7f04943d6b860f5e74a8fc652a106c3a2046a0ce Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 11 Feb 2019 16:10:40 -0200 Subject: lib: a few more trivial changes for C++ compatibility * command_graph.h: stop using "new" as a parameter name as that's a reserved C++ keyword. * module.h: avoid using C99 designated initializers since C++ doesn't support them. This change hurts code readability quite considerably, so we should try to find a better solution later. * pw.h: remove unneeded empty structure to silence a C++ warning. Signed-off-by: Renato Westphal --- lib/command_graph.h | 2 +- lib/module.h | 7 ++++--- lib/pw.h | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/module.h') diff --git a/lib/command_graph.h b/lib/command_graph.h index cfacad43e2..903d515834 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -118,7 +118,7 @@ extern void cmd_token_varname_set(struct cmd_token *token, const char *varname); extern void cmd_graph_parse(struct graph *graph, struct cmd_element *cmd); extern void cmd_graph_names(struct graph *graph); -extern void cmd_graph_merge(struct graph *old, struct graph *new, +extern void cmd_graph_merge(struct graph *old, struct graph *n, int direction); /* * Print callback for DOT dumping. diff --git a/lib/module.h b/lib/module.h index 73ba8665ed..c5f96db85b 100644 --- a/lib/module.h +++ b/lib/module.h @@ -82,9 +82,10 @@ extern union _frrmod_runtime_u _frrmod_this_module; #define FRR_COREMOD_SETUP(...) \ static const struct frrmod_info _frrmod_info = {__VA_ARGS__}; \ - DSO_LOCAL union _frrmod_runtime_u _frrmod_this_module = { \ - .r.info = &_frrmod_info, \ - }; + DSO_LOCAL union _frrmod_runtime_u _frrmod_this_module = {{ \ + NULL, \ + &_frrmod_info, \ + }}; #define FRR_MODULE_SETUP(...) \ FRR_COREMOD_SETUP(__VA_ARGS__) \ DSO_SELF struct frrmod_runtime *frr_module = &_frrmod_this_module.r; diff --git a/lib/pw.h b/lib/pw.h index 0b923ed6b1..42b3ee2155 100644 --- a/lib/pw.h +++ b/lib/pw.h @@ -48,9 +48,6 @@ union pw_protocol_fields { uint32_t pwid; char vpn_name[L2VPN_NAME_LEN]; } ldp; - struct { - /* TODO */ - } bgp; }; #ifdef __cplusplus -- cgit v1.2.3