From: Alan T. DeKok Date: Mon, 14 Aug 2023 12:41:18 +0000 (-0400) Subject: clean up for semicolons X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40a0dedc3b61c57f4801bcfef89e0fdd0b5992ed;p=thirdparty%2Ffreeradius-server.git clean up for semicolons --- diff --git a/src/bin/radlock.c b/src/bin/radlock.c index b58eeb4e5f8..a34f01ab7d1 100644 --- a/src/bin/radlock.c +++ b/src/bin/radlock.c @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) if (argc == 0) { fr_perror("radlock - Need file to operate on"); usage(64); - }; + } if (argc == 1) { fr_perror("radlock - Need action, must be one of (lock|trylock|unlock|remove|info|perm)"); diff --git a/src/bin/radsnmp.c b/src/bin/radsnmp.c index fce5f121c0e..13ad1b44694 100644 --- a/src/bin/radsnmp.c +++ b/src/bin/radsnmp.c @@ -626,7 +626,7 @@ static int radsnmp_send_recv(radsnmp_conf_t *conf, int fd) fr_strerror_clear(); #define NEXT_LINE(_line, _buffer) \ -{ \ +do { \ size_t _len; \ if (stop) return 0; \ errno = 0;\ @@ -636,7 +636,8 @@ static int radsnmp_send_recv(radsnmp_conf_t *conf, int fd) if ((_len > 0) && (_line[_len - 1] == '\n')) _line[_len - 1] = '\0'; \ DEBUG2("read: %s", _line); \ } \ -} +} while (0) + /* * Read commands from pass_persist */ diff --git a/src/lib/eap_aka_sim/state_machine.c b/src/lib/eap_aka_sim/state_machine.c index b3c99f98cdf..a2a26d6ddc6 100644 --- a/src/lib/eap_aka_sim/state_machine.c +++ b/src/lib/eap_aka_sim/state_machine.c @@ -52,7 +52,7 @@ RCSID("$Id$") module_ctx_t const *mctx, \ request_t *request) -#define STATE_TRANSITION(_x) guard_ ## _x(p_result, mctx, request); +#define STATE_TRANSITION(_x) guard_ ## _x(p_result, mctx, request) #define CALL_SECTION(_x) unlang_module_yield_to_section(p_result, \ request, \ @@ -1298,7 +1298,7 @@ STATE(common_failure_notification) default: fail: RWDEBUG("Failure-Notification not ACKed correctly, sending EAP-Failure anyway"); - return STATE_TRANSITION(eap_failure) + return STATE_TRANSITION(eap_failure); } } diff --git a/src/lib/io/atomic_queue.h b/src/lib/io/atomic_queue.h index af34e36c60b..fb096dd9a62 100644 --- a/src/lib/io/atomic_queue.h +++ b/src/lib/io/atomic_queue.h @@ -45,7 +45,7 @@ RCSIDH(atomic_queue_h, "$Id$") #define cas_decr(_store, _var) atomic_compare_exchange_strong_explicit(&_store, &_var, _var - 1, memory_order_release, memory_order_relaxed) #define load(_var) atomic_load_explicit(&_var, memory_order_relaxed) #define aquire(_var) atomic_load_explicit(&_var, memory_order_acquire) -#define store(_store, _var) atomic_store_explicit(&_store, _var, memory_order_release); +#define store(_store, _var) atomic_store_explicit(&_store, _var, memory_order_release) #ifdef __cplusplus extern "C" { diff --git a/src/lib/io/time_tracking.h b/src/lib/io/time_tracking.h index af9d55602eb..c3dfc909a76 100644 --- a/src/lib/io/time_tracking.h +++ b/src/lib/io/time_tracking.h @@ -89,7 +89,7 @@ do { \ fr_assert(fr_time_lteq((_tt)->ended, (_now))); \ fr_assert(fr_time_lteq((_tt)->last_yielded, (_now))); \ fr_assert(fr_time_lteq((_tt)->last_resumed, (_now))); \ -} while(0); +} while(0) /** Set the last time a tracked entity started in its list of parents * @@ -287,8 +287,8 @@ static inline void fr_time_tracking_end(fr_time_delta_t *predicted, */ static inline CC_HINT(nonnull) void fr_time_tracking_debug(fr_time_tracking_t *tt, FILE *fp) { -#define DPRINT_TIME(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_unwrap(tt->_x)); -#define DPRINT(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_delta_unwrap(tt->_x)); +#define DPRINT_TIME(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_unwrap(tt->_x)) +#define DPRINT(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_delta_unwrap(tt->_x)) DPRINT_TIME(started); DPRINT_TIME(ended); diff --git a/src/lib/ldap/base.c b/src/lib/ldap/base.c index 43a244cc359..3d7e4520753 100644 --- a/src/lib/ldap/base.c +++ b/src/lib/ldap/base.c @@ -1059,13 +1059,13 @@ int fr_ldap_global_config(int debug_level, char const *tls_random_file) if (done_config) return 0; #define do_ldap_global_option(_option, _name, _value) \ - if (ldap_set_option(NULL, _option, _value) != LDAP_OPT_SUCCESS) { \ + if (ldap_set_option(NULL, _option, _value) != LDAP_OPT_SUCCESS) do { \ int _ldap_errno; \ ldap_get_option(NULL, LDAP_OPT_RESULT_CODE, &_ldap_errno); \ ERROR("Failed setting global option %s: %s", _name, \ (_ldap_errno != LDAP_SUCCESS) ? ldap_err2string(_ldap_errno) : "Unknown error"); \ return -1;\ - } + } while (0) #define maybe_ldap_global_option(_option, _name, _value) \ if (_value) do_ldap_global_option(_option, _name, _value) diff --git a/src/lib/ldap/connection.c b/src/lib/ldap/connection.c index d74db6db7b9..fb48d46e0c3 100644 --- a/src/lib/ldap/connection.c +++ b/src/lib/ldap/connection.c @@ -89,12 +89,12 @@ int fr_ldap_connection_configure(fr_ldap_connection_t *c, fr_ldap_config_t const * Set a bunch of LDAP options, using common code. */ #define do_ldap_option(_option, _name, _value) \ - if (ldap_set_option(c->handle, _option, _value) != LDAP_OPT_SUCCESS) { \ + if (ldap_set_option(c->handle, _option, _value) != LDAP_OPT_SUCCESS) do { \ ldap_get_option(c->handle, LDAP_OPT_ERROR_NUMBER, &ldap_errno); \ ERROR("Failed setting connection option %s: %s", _name, \ (ldap_errno != LDAP_SUCCESS) ? ldap_err2string(ldap_errno) : "Unknown error"); \ goto error;\ - } + } while (0) DIAG_OFF(unused-macros) #define maybe_ldap_option(_option, _name, _value) \ diff --git a/src/lib/redis/base.h b/src/lib/redis/base.h index 345c540f8b3..77b70f5277a 100644 --- a/src/lib/redis/base.h +++ b/src/lib/redis/base.h @@ -32,7 +32,9 @@ RCSIDH(redis_h, "$Id$") #include #include +DIAG_OFF(extra-semi-stmt) #include +DIAG_ON(extra-semi-stmt) #ifdef __cplusplus extern "C" { diff --git a/src/lib/redis/cluster.c b/src/lib/redis/cluster.c index bd031a44377..af27c3ad4e4 100644 --- a/src/lib/redis/cluster.c +++ b/src/lib/redis/cluster.c @@ -2086,7 +2086,7 @@ int fr_redis_cluster_pool_by_node_addr(fr_pool_t **pool, fr_redis_cluster_t *clu pthread_mutex_unlock(&cluster->mutex); hostname = inet_ntop(node_addr->inet.dst_ipaddr.af, &node_addr->inet.dst_ipaddr.addr, buffer, sizeof(buffer)); - fr_assert(hostname); /* addr.ipaddr is probably corrupt */; + fr_assert(hostname); /* addr.ipaddr is probably corrupt */ fr_strerror_printf("No existing node found with address %s, port %i", hostname, node_addr->inet.dst_port); return -1; diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 6be3f1f1156..07e282dedd5 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -162,7 +162,7 @@ static inline CC_HINT(always_inline) int cf_tmpl_rules_verify(CONF_SECTION *cs, return 0; } -#define RULES_VERIFY(_cs, _rules) if (cf_tmpl_rules_verify(_cs, _rules) < 0) return NULL; +#define RULES_VERIFY(_cs, _rules) if (cf_tmpl_rules_verify(_cs, _rules) < 0) return NULL static ssize_t fr_skip_xlat(char const *start, char const *end); @@ -2796,7 +2796,7 @@ do_frame: frame->filename); goto pop_stack; } - }; + } /* * Read, checking for line continuations ('\\' at EOL) diff --git a/src/lib/server/cf_util.h b/src/lib/server/cf_util.h index 12653689b8d..0b3f2923367 100644 --- a/src/lib/server/cf_util.h +++ b/src/lib/server/cf_util.h @@ -240,14 +240,14 @@ CONF_DATA const *_cf_data_add_static(CONF_ITEM *ci, void const *data, char const * @param[in] _type of data to remove. * @param[in] _name of data to remove. */ -#define cf_data_remove(_cf, _type, _name) _cf_data_remove(CF_TO_ITEM(_cf), cf_data_find(_cf, _type, _name)); +#define cf_data_remove(_cf, _type, _name) _cf_data_remove(CF_TO_ITEM(_cf), cf_data_find(_cf, _type, _name)) /** Remove an item from a parent * * @param[in] _cf conf section or pair to remove data from. * @param[in] _cd conf data to remove. */ -#define cf_data_remove_by_data(_cf, _cd) _cf_data_remove(CF_TO_ITEM(_cf), _cd); +#define cf_data_remove_by_data(_cf, _cd) _cf_data_remove(CF_TO_ITEM(_cf), _cd) void *_cf_data_remove(CONF_ITEM *ci, CONF_DATA const *_cd); #define cf_data_walk(_cf, _type, _cb, _ctx) _cf_data_walk(CF_TO_ITEM(_cf), #_type, _cb, _ctx) diff --git a/src/lib/server/log.c b/src/lib/server/log.c index b17645b4ef6..5d17a46d003 100644 --- a/src/lib/server/log.c +++ b/src/lib/server/log.c @@ -530,7 +530,7 @@ print_fmt: break; default: break; - }; + } log_always(log_dst, type, file, line, "%s" /* prefix */ @@ -1036,7 +1036,7 @@ void log_request_fd_event(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, * Clear out the existing data */ fr_sbuff_shift(&sbuff, fr_sbuff_used(&m_start)); - }; + } } /** Log a fatal error, then exit diff --git a/src/lib/server/log.h b/src/lib/server/log.h index 71015233ecc..7a645f60b14 100644 --- a/src/lib/server/log.h +++ b/src/lib/server/log.h @@ -685,9 +685,9 @@ do {\ * @param[in] ... Additional arguments to print. */ #define _RHEXDUMP_INLINE(_lvl, _data, _len, _fmt, ...) \ - if (log_rdebug_enabled(_lvl, request)) { \ + if (log_rdebug_enabled(_lvl, request)) do { \ log_request(L_DBG, _lvl, request, __FILE__, __LINE__, _fmt " 0x%pH", ## __VA_ARGS__, fr_box_octets(_data, _len)); \ - } + } while (0) #define RHEXDUMP_INLINE1(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) #define RHEXDUMP_INLINE2(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) diff --git a/src/lib/server/process.h b/src/lib/server/process.h index b4b81604f61..09b71e1ed55 100644 --- a/src/lib/server/process.h +++ b/src/lib/server/process.h @@ -132,7 +132,7 @@ do { \ /** Call a named recv function directly */ -#define CALL_RECV(_x) recv_ ## _x(p_result, mctx, request); +#define CALL_RECV(_x) recv_ ## _x(p_result, mctx, request) /** Call a named send function directly */ diff --git a/src/lib/server/stats.c b/src/lib/server/stats.c index 684c6681987..82c71e75b63 100644 --- a/src/lib/server/stats.c +++ b/src/lib/server/stats.c @@ -65,10 +65,10 @@ void request_stats_final(request_t *request) return; #undef INC_AUTH -#define INC_AUTH(_x) radius_auth_stats._x++;request->client->auth._x++; +#define INC_AUTH(_x) do { radius_auth_stats._x++;request->client->auth._x++; } while (0) #undef INC_ACCT -#define INC_ACCT(_x) radius_acct_stats._x++;request->client->acct._x++ +#define INC_ACCT(_x) do { radius_acct_stats._x++;request->client->acct._x++; } while (0) /* * Update the statistics. diff --git a/src/lib/server/tmpl_dcursor_tests.c b/src/lib/server/tmpl_dcursor_tests.c index b6b97fa0099..bf1db42c91d 100644 --- a/src/lib/server/tmpl_dcursor_tests.c +++ b/src/lib/server/tmpl_dcursor_tests.c @@ -75,7 +75,7 @@ static request_t *request_fake_alloc(void) fr_pair_t *mid_vp ## _x; \ fr_pair_t *leaf_int32_vp ## _x -#define pair_populate(_x) \ +#define pair_populate(_x) do { \ pair_append_request(&int32_vp ## _x, fr_dict_attr_test_int32); \ pair_append_request(&string_vp ## _x, fr_dict_attr_test_string); \ pair_append_request(&group_vp ## _x, fr_dict_attr_test_group); \ @@ -83,14 +83,16 @@ static request_t *request_fake_alloc(void) pair_append_request(&top_vp ## _x, fr_dict_attr_test_nested_top_tlv); \ fr_pair_append_by_da(top_vp ## _x, &mid_vp ## _x, &top_vp ## _x->children, fr_dict_attr_test_nested_child_tlv); \ fr_pair_append_by_da(mid_vp ## _x, &leaf_string_vp ## _x, &mid_vp ## _x->children, fr_dict_attr_test_nested_leaf_string); \ - fr_pair_append_by_da(mid_vp ## _x, &leaf_int32_vp ## _x, &mid_vp ## _x->children, fr_dict_attr_test_nested_leaf_int32); + fr_pair_append_by_da(mid_vp ## _x, &leaf_int32_vp ## _x, &mid_vp ## _x->children, fr_dict_attr_test_nested_leaf_int32); \ + } while (0) -#define pair_populate_thin(_x) \ +#define pair_populate_thin(_x) do { \ pair_append_request(&int32_vp ## _x, fr_dict_attr_test_int32); \ pair_append_request(&group_vp ## _x, fr_dict_attr_test_group); \ pair_append_request(&top_vp ## _x, fr_dict_attr_test_nested_top_tlv); \ fr_pair_append_by_da(top_vp ## _x, &mid_vp ## _x, &top_vp ## _x->children, fr_dict_attr_test_nested_child_tlv); \ - fr_pair_append_by_da(mid_vp ## _x, &leaf_int32_vp ## _x, &mid_vp ## _x->children, fr_dict_attr_test_nested_leaf_int32); + fr_pair_append_by_da(mid_vp ## _x, &leaf_int32_vp ## _x, &mid_vp ## _x->children, fr_dict_attr_test_nested_leaf_int32); \ + } while (0) /* * Top level attribute names in the test dictionary all have -0 on the end @@ -122,7 +124,7 @@ typedef struct { */ #define common_vars \ tmpl_dcursor_vars_t vars; \ - request_t *request = request_fake_alloc(); + request_t *request = request_fake_alloc() /** Initialise a tmpl using the _attr_str string, and return the first pair * @@ -151,7 +153,7 @@ int _tmpl_setup_and_cursor_init(fr_pair_t **vp_out, tmpl_dcursor_vars_t *vars, r } #define tmpl_setup_and_cursor_init(_vp_out, _ref) \ - if (_tmpl_setup_and_cursor_init(_vp_out, &vars, request, _ref)) return; + if (_tmpl_setup_and_cursor_init(_vp_out, &vars, request, _ref)) return /** Initialise a tmpl using the _attr_str string, and return the first pair * @@ -180,7 +182,7 @@ int _tmpl_setup_and_cursor_build_init(fr_pair_t **vp_out, tmpl_dcursor_vars_t *v } #define tmpl_setup_and_cursor_build_init(_vp_out, _ref) \ - if (_tmpl_setup_and_cursor_build_init(_vp_out, &vars, request, _ref)) return; + if (_tmpl_setup_and_cursor_build_init(_vp_out, &vars, request, _ref)) return /* * How every test ends diff --git a/src/lib/server/tmpl_eval.c b/src/lib/server/tmpl_eval.c index af469c5f0fb..59e0c4c794d 100644 --- a/src/lib/server/tmpl_eval.c +++ b/src/lib/server/tmpl_eval.c @@ -1229,7 +1229,7 @@ done: if (tmpl_eval_cast_in_place(&list, vpt) < 0) { fr_value_box_list_talloc_free(&list); return -1; - }; + } fr_value_box_list_move(out, &list); return 0; @@ -1449,7 +1449,7 @@ done: if (tmpl_eval_cast_in_place(&list, vpt) < 0) { fr_value_box_list_talloc_free(&list); return -1; - }; + } fr_value_box_list_move(out, &list); return 0; diff --git a/src/lib/server/trigger.c b/src/lib/server/trigger.c index 4419627c8e7..229ff8ea880 100644 --- a/src/lib/server/trigger.c +++ b/src/lib/server/trigger.c @@ -406,7 +406,7 @@ int trigger_exec(unlang_interpret_t *intp, args_error: talloc_free(request); return -1; - }; + } if (request_data_add(request, &trigger_exec_main, REQUEST_INDEX_TRIGGER_ARGS, local_args, false, false, false) < 0) goto args_error; diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index 76cf5fc4f1e..49a71e748b8 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -729,12 +729,12 @@ do { \ /** Remove the current request from the sent list * */ -#define REQUEST_EXTRACT_SENT(_treq) fr_dlist_remove(&tconn->sent, treq); +#define REQUEST_EXTRACT_SENT(_treq) fr_dlist_remove(&tconn->sent, treq) /** Remove the current request from the cancel list * */ -#define REQUEST_EXTRACT_CANCEL(_treq) fr_dlist_remove(&tconn->cancel, treq); +#define REQUEST_EXTRACT_CANCEL(_treq) fr_dlist_remove(&tconn->cancel, treq) /** Remove the current request from the cancel_partial slot * @@ -748,7 +748,7 @@ do { \ /** Remove the current request from the cancel sent list * */ -#define REQUEST_EXTRACT_CANCEL_SENT(_treq) fr_dlist_remove(&tconn->cancel_sent, treq); +#define REQUEST_EXTRACT_CANCEL_SENT(_treq) fr_dlist_remove(&tconn->cancel_sent, treq) /** Reorder the connections in the active heap * @@ -870,7 +870,7 @@ do { \ fr_table_str_by_value(fr_trunk_states, _new, "")); \ CALL_WATCHERS(trunk, _new); \ trunk->pub.state = _new; \ -} while (0); +} while (0) static void trunk_request_enter_backlog(fr_trunk_request_t *treq, bool new); static void trunk_request_enter_pending(fr_trunk_request_t *treq, fr_trunk_connection_t *tconn, bool new); @@ -1666,13 +1666,13 @@ static uint64_t trunk_connection_requests_dequeue(fr_dlist_head_t *out, fr_trunk #define OVER_MAX_CHECK if (++count > max) return (count - 1) -#define DEQUEUE_ALL(_src_list, _state) \ +#define DEQUEUE_ALL(_src_list, _state) do { \ while ((treq = fr_dlist_head(_src_list))) { \ OVER_MAX_CHECK; \ fr_assert(treq->pub.state == (_state)); \ trunk_request_enter_unassigned(treq); \ fr_dlist_insert_tail(out, treq); \ - } + } } while (0) /* * Don't need to do anything with @@ -4365,7 +4365,7 @@ do { \ count += fr_trunk_request_count_by_connection(tconn, req_state); \ } \ } \ -} while (0); +} while (0) if (conn_state & FR_TRUNK_CONN_ACTIVE) { for (tconn = fr_minmax_heap_iter_init(trunk->active, &iter); @@ -4565,7 +4565,7 @@ do { \ fr_connection_signal_reconnect(((fr_trunk_connection_t *)fr_dlist_tail(&trunk->_list))->pub.conn, reason); \ } \ } \ -} while (0); +} while (0) /* * Connections in the 'connecting' state @@ -4926,7 +4926,7 @@ do { \ "CONSISTENCY_CHECK_FAILED %s[%i}: trunk request-trunk mismatch", file, line); \ fr_fatal_assert_msg(_state == _treq->pub.state, \ "CONSISTENCY_CHECK_FAILED %s[%i}: trunk request-state mismatch", file, line); \ -} while (0); +} while (0) #define TREQ_DLIST_VERIFY(_dlist, _state) \ do { \ @@ -4935,7 +4935,7 @@ do { \ fr_trunk_request_verify(file, line, treq); \ TCONN_TREQ_CHECKS(treq, _state); \ } \ -} while (0); +} while (0) #define TREQ_HEAP_VERIFY(_heap, _state) \ do { \ @@ -4947,7 +4947,7 @@ do { \ fr_trunk_request_verify(file, line, treq); \ TCONN_TREQ_CHECKS(treq, _state); \ } \ -} while (0); +} while (0) #define TREQ_OPTION_VERIFY(_option, _state) \ do { \ @@ -4955,7 +4955,7 @@ do { \ fr_trunk_request_verify(file, line, tconn->_option); \ TCONN_TREQ_CHECKS(tconn->_option, _state); \ } \ -} while (0); +} while (0) /* verify associated requests */ TREQ_HEAP_VERIFY(pending, FR_TRUNK_REQUEST_STATE_PENDING); @@ -5036,7 +5036,7 @@ do { \ return true; \ } \ } \ -} while (0); +} while (0) #define TREQ_HEAP_SEARCH(_heap) \ do { \ @@ -5053,7 +5053,7 @@ do { \ return true; \ } \ } \ -} while (0); +} while (0) #define TREQ_OPTION_SEARCH(_option) \ do { \ @@ -5067,7 +5067,7 @@ do { \ return true; \ } \ } \ -} while (0); +} while (0) /* search associated requests */ TREQ_HEAP_SEARCH(pending); diff --git a/src/lib/tls/session.h b/src/lib/tls/session.h index 2de4c0f4b5f..2e029945d86 100644 --- a/src/lib/tls/session.h +++ b/src/lib/tls/session.h @@ -244,7 +244,7 @@ static inline CC_HINT(nonnull) void _fr_tls_session_request_unbind(char const *f * * @param[in] ssl session containing the request pointer. */ -#define fr_tls_session_request_unbind(_ssl) _fr_tls_session_request_unbind(__FILE__, __LINE__, _ssl); +#define fr_tls_session_request_unbind(_ssl) _fr_tls_session_request_unbind(__FILE__, __LINE__, _ssl) /** Add extra pairs to the temporary subrequests * diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index e9a0d242d61..e5881879fc2 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -228,7 +228,7 @@ static inline CC_HINT(always_inline) int unlang_rules_verify(tmpl_rules_t const #if 0 #define ATTR_RULES_VERIFY(_rules) if (unlang_attr_rules_verify(_rules) < 0) return NULL; #endif -#define RULES_VERIFY(_rules) if (unlang_rules_verify(_rules) < 0) return NULL; +#define RULES_VERIFY(_rules) do { if (unlang_rules_verify(_rules) < 0) return NULL; } while (0) static bool pass2_fixup_tmpl(TALLOC_CTX *ctx, tmpl_t **vpt_p, CONF_ITEM const *ci, fr_dict_t const *dict) { @@ -521,7 +521,7 @@ static bool pass2_fixup_cond_map(fr_cond_t *c, CONF_ITEM *ci, fr_dict_t const *d */ if (tmpl_cast_set(map->rhs, tmpl_attr_tail_da(map->lhs)->type) < 0) { cf_log_perr(map->ci, "Failed setting rhs type"); - }; + } if (map->op != T_OP_CMP_EQ) { cf_log_err(map->ci, "Must use '==' for comparisons with virtual attribute %s", map->lhs->name); @@ -4747,7 +4747,7 @@ static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx, fr_assert_msg(method_env->inst_size, "Method environment for module %s, method %s %s declared, " "but no inst_size set", inst->module->name, unlang_ctx->section_name1, unlang_ctx->section_name2); - }; + } /* * If a module reference is a section, then the section diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 18a9cb57464..b89c8fc6ce8 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -107,7 +107,7 @@ static char *stack_unwind_flag_dump(uint8_t unwind) size_t len; #define UNWIND_FLAG_DUMP(attrib) \ - if (unwind & attrib) strcat(buf, #attrib" "); + if (unwind & attrib) strcat(buf, #attrib" ") snprintf(buf, sizeof(buf), "unwind=0x%x (", unwind); @@ -1460,7 +1460,7 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, error: talloc_free(vb); return XLAT_ACTION_FAIL; - }; + } goto finish; } diff --git a/src/lib/unlang/map.c b/src/lib/unlang/map.c index 1ee7dc49d94..7bbdfd0fc0f 100644 --- a/src/lib/unlang/map.c +++ b/src/lib/unlang/map.c @@ -239,7 +239,7 @@ static unlang_action_t list_mod_create(rlm_rcode_t *p_result, request_t *request break; } - }; + } return list_mod_apply(p_result, request); } diff --git a/src/lib/unlang/parallel.c b/src/lib/unlang/parallel.c index f7c00779479..db419c166c5 100644 --- a/src/lib/unlang/parallel.c +++ b/src/lib/unlang/parallel.c @@ -469,7 +469,7 @@ static unlang_action_t unlang_parallel(rlm_rcode_t *p_result, request_t *request if (!state) { *p_result = RLM_MODULE_FAIL; return UNLANG_ACTION_CALCULATE_RESULT; - }; + } (void) talloc_set_type(state, unlang_parallel_state_t); state->result = RLM_MODULE_FAIL; diff --git a/src/lib/unlang/xlat.h b/src/lib/unlang/xlat.h index 3d41debe192..785f77fb6f2 100644 --- a/src/lib/unlang/xlat.h +++ b/src/lib/unlang/xlat.h @@ -286,14 +286,14 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); do { \ *(_a) = fr_value_box_list_head(_list); \ XLAT_ARGS_NEXT(_list, _a, _b); \ - } while (0); + } while (0) #define XLAT_ARGS_3(_list, _a, _b, _c) \ do { \ *(_a) = fr_value_box_list_head(_list); \ XLAT_ARGS_NEXT(_list, _a, _b); \ XLAT_ARGS_NEXT(_list, _b, _c); \ - } while (0); + } while (0) #define XLAT_ARGS_4(_list, _a, _b, _c, _d) \ do { \ @@ -301,7 +301,7 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); XLAT_ARGS_NEXT(_list, _a, _b); \ XLAT_ARGS_NEXT(_list, _b, _c); \ XLAT_ARGS_NEXT(_list, _c, _d); \ - } while (0); + } while (0) #define XLAT_ARGS_5(_list, _a, _b, _c, _d, _e) \ do { \ @@ -310,7 +310,7 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); XLAT_ARGS_NEXT(_list, _b, _c); \ XLAT_ARGS_NEXT(_list, _c, _d); \ XLAT_ARGS_NEXT(_list, _d, _e); \ - } while (0); + } while (0) #define XLAT_ARGS_6(_list, _a, _b, _c, _d, _e, _f) \ do { \ @@ -320,7 +320,7 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); XLAT_ARGS_NEXT(_list, _c, _d); \ XLAT_ARGS_NEXT(_list, _d, _e); \ XLAT_ARGS_NEXT(_list, _e, _f); \ - } while (0); + } while (0) #define XLAT_ARGS_7(_list, _a, _b, _c, _d, _e, _f, _g) \ do { \ @@ -331,7 +331,7 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); XLAT_ARGS_NEXT(_list, _d, _e); \ XLAT_ARGS_NEXT(_list, _e, _f); \ XLAT_ARGS_NEXT(_list, _f, _g); \ - } while (0); + } while (0) #define XLAT_ARGS_8(_list, _a, _b, _c, _d, _e, _f, _g, _h) \ do { \ @@ -343,7 +343,7 @@ typedef int (*xlat_thread_detach_t)(xlat_thread_inst_ctx_t const *xctx); XLAT_ARGS_NEXT(_list, _e, _f); \ XLAT_ARGS_NEXT(_list, _f, _g); \ XLAT_ARGS_NEXT(_list, _g, _h); \ - } while (0); + } while (0) /** Trampoline macro for selecting which ``XLAT_ARGS_`` macro to expand * diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 5d63d3dbb1c..ae7f2594370 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -2056,12 +2056,12 @@ static fr_slen_t expr_cast_from_substr(fr_type_t *cast, fr_sbuff_t *in) if (!fr_type_is_leaf(*cast)) { fr_strerror_printf("Invalid data type '%s' in cast", fr_type_to_str(*cast)); - FR_SBUFF_ERROR_RETURN(&our_in) + FR_SBUFF_ERROR_RETURN(&our_in); } if (!fr_sbuff_next_if_char(&our_in, close)) { fr_strerror_const("Unterminated cast"); - FR_SBUFF_ERROR_RETURN(&our_in) + FR_SBUFF_ERROR_RETURN(&our_in); } fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX, NULL); diff --git a/src/lib/util/atexit.h b/src/lib/util/atexit.h index 77f49d01079..0b172114665 100644 --- a/src/lib/util/atexit.h +++ b/src/lib/util/atexit.h @@ -125,7 +125,7 @@ static inline int fr_atexit_talloc_free(void *to_free) * @param[in] _uctx data to be passed to free function. */ #define fr_atexit_global_once_ret(_ret, _init, _free, _uctx) \ -{ \ +do { \ static atomic_bool _init_done = false; \ static pthread_mutex_t _init_mutex = PTHREAD_MUTEX_INITIALIZER; \ void *_our_uctx = _uctx; /* stop _uctx being evaluated multiple times, it may be a call to malloc() */ \ @@ -140,7 +140,7 @@ static inline int fr_atexit_talloc_free(void *to_free) } \ pthread_mutex_unlock(&_init_mutex); \ } \ -} +} while (0) /** Setup pair of global init/free functions * @@ -184,7 +184,7 @@ do { \ void *_our_uctx = _uctx; /* stop _uctx being evaluated multiple times, it may be a call to malloc() */ \ _fr_atexit_thread_local(__FILE__, __LINE__, _free, _our_uctx); \ _name = _our_uctx; \ -} while (0); +} while (0) int _fr_atexit_thread_local(char const *file, int line, fr_atexit_t func, void const *uctx); diff --git a/src/lib/util/base16.c b/src/lib/util/base16.c index 19d8060cc00..691c9659b38 100644 --- a/src/lib/util/base16.c +++ b/src/lib/util/base16.c @@ -164,7 +164,7 @@ fr_slen_t fr_base16_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr FR_DBUFF_IN_BYTES_RETURN(&our_out, (alphabet[us(p[0])] << 4) | alphabet[us(p[1])]); fr_sbuff_advance(&our_in, 2); - }; + } if (err) *err = FR_SBUFF_PARSE_OK; diff --git a/src/lib/util/dbuff.c b/src/lib/util/dbuff.c index 3a91583c5b3..de5ce998e69 100644 --- a/src/lib/util/dbuff.c +++ b/src/lib/util/dbuff.c @@ -29,7 +29,7 @@ RCSID("$Id$") #include #if defined(STATIC_ANALYZER) || !defined(NDEBUG) -# define CHECK_DBUFF_INIT(_sbuff) if (!(_sbuff)->extend && (unlikely(!(_sbuff)->buff) || unlikely(!(_sbuff)->start) || unlikely(!(_sbuff)->end) || unlikely(!(_sbuff)->p))) return 0; +# define CHECK_DBUFF_INIT(_sbuff) do { if (!(_sbuff)->extend && (unlikely(!(_sbuff)->buff) || unlikely(!(_sbuff)->start) || unlikely(!(_sbuff)->end) || unlikely(!(_sbuff)->p))) return 0; } while (0) #else # define CHECK_DBUFF_INIT(_sbuff) #endif diff --git a/src/lib/util/dbuff.h b/src/lib/util/dbuff.h index b5c1770094a..2f9e02d673e 100644 --- a/src/lib/util/dbuff.h +++ b/src/lib/util/dbuff.h @@ -549,7 +549,7 @@ static inline int _dbuff_thread_local_free(void *dbtl) * @param[in] _max Maximum size of the dbuff buffer. */ #define FR_DBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max) \ -{ \ +do { \ static _Thread_local fr_dbuff_thread_local_t *_dbuff_t_local; \ if (!_dbuff_t_local) { \ fr_dbuff_thread_local_t *dbtl = talloc_zero(NULL, fr_dbuff_thread_local_t); \ @@ -560,7 +560,7 @@ static inline int _dbuff_thread_local_free(void *dbtl) fr_dbuff_reset_talloc(&_dbuff_t_local->dbuff); \ *(_out) = &_dbuff_t_local->dbuff; \ } \ -} +} while (0) /** @} */ /** @name Extension requests diff --git a/src/lib/util/dcursor.h b/src/lib/util/dcursor.h index 67d8612e3f4..acfc4e2562f 100644 --- a/src/lib/util/dcursor.h +++ b/src/lib/util/dcursor.h @@ -115,7 +115,7 @@ typedef struct { } fr_dcursor_stack_t; #ifndef TALLOC_GET_TYPE_ABORT_NOOP -#define VALIDATE(_item) if (cursor->dlist->type && (_item)) _talloc_get_type_abort(_item, cursor->dlist->type, __location__); +#define VALIDATE(_item) do { if (cursor->dlist->type && (_item)) _talloc_get_type_abort(_item, cursor->dlist->type, __location__); } while (0) #else #define VALIDATE(_item) #endif diff --git a/src/lib/util/debug.c b/src/lib/util/debug.c index 6c9536e439e..e93bfabe1f2 100644 --- a/src/lib/util/debug.c +++ b/src/lib/util/debug.c @@ -577,7 +577,7 @@ void backtrace_print(fr_fring_t *fring, void *obj) fprintf(stderr, "Stacktrace for: %p\n", p->obj); backtrace_symbols_fd(p->frames, p->count, STDERR_FILENO); } - }; + } if (!found) { fprintf(stderr, "No backtrace available for %p", obj); diff --git a/src/lib/util/dict_unknown.c b/src/lib/util/dict_unknown.c index c86ac2f1a65..73f3735742f 100644 --- a/src/lib/util/dict_unknown.c +++ b/src/lib/util/dict_unknown.c @@ -579,7 +579,7 @@ fr_slen_t fr_dict_unknown_afrom_oid_substr(TALLOC_CTX *ctx, } } break; - }; + } DA_VERIFY(n); diff --git a/src/lib/util/dlist.h b/src/lib/util/dlist.h index a0413a6e75a..160024f2075 100644 --- a/src/lib/util/dlist.h +++ b/src/lib/util/dlist.h @@ -282,10 +282,10 @@ static inline void fr_dlist_clear(fr_dlist_head_t *list_head) * */ #define CHECK_ELEMENT_COUNT(_head, _add) \ - if (unlikely((_head)->num_elements > (UINT_MAX - (_add)))) { \ + if (unlikely((_head)->num_elements > (UINT_MAX - (_add)))) do { \ fr_strerror_const("Maximum elements in list"); \ return -1; \ - } + } while (0) /** Check if a list entry is part of a list * diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index ea1f8a6a318..527b0ac8c7c 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -208,7 +208,7 @@ void fr_edit_list_abort(fr_edit_list_t *el) * talloc_free(el). That should be somewhat * faster than doing it incrementally. */ - }; + } talloc_free(el); } diff --git a/src/lib/util/heap.c b/src/lib/util/heap.c index 5762a0b75f9..2e4c500dc48 100644 --- a/src/lib/util/heap.c +++ b/src/lib/util/heap.c @@ -38,7 +38,7 @@ RCSID("$Id$") #define HEAP_PARENT(_x) ((_x) >> 1) #define HEAP_LEFT(_x) (2 * (_x)) #define HEAP_RIGHT(_x) (2 * (_x) + 1 ) -#define HEAP_SWAP(_a, _b) { void *_tmp = _a; _a = _b; _b = _tmp; } +#define HEAP_SWAP(_a, _b) do { void *_tmp = _a; _a = _b; _b = _tmp; } while (0) static void fr_heap_bubble(fr_heap_t *h, fr_heap_index_t child); @@ -99,8 +99,8 @@ static inline CC_HINT(always_inline, nonnull) void index_set(fr_heap_t *h, void *((fr_heap_index_t *)(((uint8_t *)data) + h->offset)) = idx; } -#define OFFSET_SET(_heap, _idx) index_set(_heap, _heap->p[_idx], _idx); -#define OFFSET_RESET(_heap, _idx) index_set(_heap, _heap->p[_idx], 0); +#define OFFSET_SET(_heap, _idx) index_set(_heap, _heap->p[_idx], _idx) +#define OFFSET_RESET(_heap, _idx) index_set(_heap, _heap->p[_idx], 0) static inline CC_HINT(always_inline) int realloc_heap(fr_heap_t **hp, unsigned int n_size) diff --git a/src/lib/util/isaac.c b/src/lib/util/isaac.c index 37c5e29a225..34a829076fb 100644 --- a/src/lib/util/isaac.c +++ b/src/lib/util/isaac.c @@ -17,12 +17,12 @@ RCSID("$Id$") #define ind(mm,x) ((mm)[(x >> 2) &(RANDSIZ-1)]) #define rngstep(mix, a, b, mm, m, m2, r, x) \ -{ \ +do { \ x = *m; \ a = ((a^(mix)) + *(m2++)) & 0xffffffff; \ *(m++) = y = (ind(mm, x) + a + b) & 0xffffffff; \ *(r++) = b = (ind(mm, y >> RANDSIZL) + x) & 0xffffffff; \ -} +} while (0) void fr_isaac(fr_randctx *ctx) { @@ -51,7 +51,7 @@ void fr_isaac(fr_randctx *ctx) #define mix(a,b,c,d,e,f,g,h) \ -{ \ +do { \ a ^= b << 11; d += a; b += c; \ b ^= c >> 2; e += b; c += d; \ c ^= d << 8; f += c; d += e; \ @@ -60,7 +60,7 @@ void fr_isaac(fr_randctx *ctx) f ^= g >> 4; a += f; g += h; \ g ^= h << 8; b += g; h += a; \ h ^= a >> 9; c += h; a += b; \ -} +} while (0) /* if (flag==1), then use the contents of randrsl[] to initialize mm[]. */ void fr_rand_init(fr_randctx *ctx, int flag) diff --git a/src/lib/util/log.c b/src/lib/util/log.c index 9be259f1de0..a7b4ef16f08 100644 --- a/src/lib/util/log.c +++ b/src/lib/util/log.c @@ -236,7 +236,7 @@ void fr_log_fd_event(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void * Clear out the existing data */ fr_sbuff_shift(&sbuff, fr_sbuff_used(&m_start)); - }; + } } /** Maps log categories to message prefixes diff --git a/src/lib/util/lst.h b/src/lib/util/lst.h index 69c0ac19d2a..069488816e3 100644 --- a/src/lib/util/lst.h +++ b/src/lib/util/lst.h @@ -116,7 +116,7 @@ void *fr_lst_iter_next(fr_lst_t *lst, fr_lst_iter_t *iter) CC_HINT(nonnull); #ifndef TALLOC_GET_TYPE_ABORT_NOOP void fr_lst_verify(char const *file, int line, fr_lst_t const *lst); -#define FR_LST_VERIFY(_lst) fr_lst_verify(__FILE__, __LINE__, _lst); +#define FR_LST_VERIFY(_lst) fr_lst_verify(__FILE__, __LINE__, _lst) #elif !defined(NDEBUG) #define FR_LST_VERIFY(_lst) fr_assert(_lst) #else diff --git a/src/lib/util/minmax_heap.c b/src/lib/util/minmax_heap.c index 3509ca05b93..3ffddc51569 100644 --- a/src/lib/util/minmax_heap.c +++ b/src/lib/util/minmax_heap.c @@ -75,7 +75,7 @@ typedef struct fr_minmax_heap_s minmax_heap_t; #define HEAP_GRANDPARENT(_x) HEAP_PARENT(HEAP_PARENT(_x)) #define HEAP_LEFT(_x) (2 * (_x)) #define HEAP_RIGHT(_x) (2 * (_x) + 1 ) -#define HEAP_SWAP(_a, _b) { void *_tmp = _a; _a = _b; _b = _tmp; } +#define HEAP_SWAP(_a, _b) do { void *_tmp = _a; _a = _b; _b = _tmp; } while (0) /** * @hidecallergraph @@ -205,8 +205,8 @@ static inline bool has_grandchildren(minmax_heap_t *h, fr_minmax_heap_index_t i) return HEAP_LEFT(HEAP_LEFT(i)) <= h->num_elements; } -#define OFFSET_SET(_heap, _idx) index_set(_heap, _heap->p[_idx], _idx); -#define OFFSET_RESET(_heap, _idx) index_set(_heap, _heap->p[_idx], 0); +#define OFFSET_SET(_heap, _idx) index_set(_heap, _heap->p[_idx], _idx) +#define OFFSET_RESET(_heap, _idx) index_set(_heap, _heap->p[_idx], 0) /* * The minmax heap has the same basic idea as binary heaps: diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index d2ed0e68882..22ceec8014a 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -787,7 +787,7 @@ static inline fr_slen_t CC_HINT(nonnull(2,4)) void fr_pair_fprint(FILE *, fr_pair_t const *vp) CC_HINT(nonnull); -#define fr_pair_list_log(_log, _lvl, _list) _fr_pair_list_log(_log, _lvl, NULL, _list, __FILE__, __LINE__); +#define fr_pair_list_log(_log, _lvl, _list) _fr_pair_list_log(_log, _lvl, NULL, _list, __FILE__, __LINE__) void _fr_pair_list_log(fr_log_t const *log, int lvl, fr_pair_t *parent, fr_pair_list_t const *list, char const *file, int line) CC_HINT(nonnull(1,4)); diff --git a/src/lib/util/rand.c b/src/lib/util/rand.c index bb3da950afd..2fbcc9759dd 100644 --- a/src/lib/util/rand.c +++ b/src/lib/util/rand.c @@ -177,26 +177,26 @@ void fr_rand_str(uint8_t *out, size_t len, char class) * yeah yeah not perfect distribution * but close enough. */ -#define fill(_expr) \ +#define fill(_expr) do { \ while (p < end) { \ if ((mod = ((p - out) & (sizeof(word) - 1))) == 0) word = fr_rand(); \ byte = ((uint8_t *)&word)[mod]; \ *p++ = (_expr); \ -} +} } while (0) switch (class) { /* * Lowercase letters */ case 'c': - fill('a' + (byte % 26)) + fill('a' + (byte % 26)); return; /* * Uppercase letters */ case 'C': - fill('A' + (byte % 26)) + fill('A' + (byte % 26)); return; /* @@ -247,7 +247,7 @@ while (p < end) { \ */ case 'b': default: - fill(byte) + fill(byte); return; } } diff --git a/src/lib/util/sbuff.c b/src/lib/util/sbuff.c index 2770b3525f3..133b56a4d10 100644 --- a/src/lib/util/sbuff.c +++ b/src/lib/util/sbuff.c @@ -44,7 +44,7 @@ fr_table_num_ordered_t const sbuff_parse_error_table[] = { size_t sbuff_parse_error_table_len = NUM_ELEMENTS(sbuff_parse_error_table); #if defined(STATIC_ANALYZER) || !defined(NDEBUG) -# define CHECK_SBUFF_INIT(_sbuff) if (!(_sbuff)->extend && (unlikely(!(_sbuff)->buff) || unlikely(!(_sbuff)->start) || unlikely(!(_sbuff)->end) || unlikely(!(_sbuff)->p))) return 0; +# define CHECK_SBUFF_INIT(_sbuff) do { if (!(_sbuff)->extend && (unlikely(!(_sbuff)->buff) || unlikely(!(_sbuff)->start) || unlikely(!(_sbuff)->end) || unlikely(!(_sbuff)->p))) return 0; } while (0) #else # define CHECK_SBUFF_INIT(_sbuff) #endif @@ -798,7 +798,7 @@ size_t fr_sbuff_out_bstrncpy_allowed(fr_sbuff_t *out, fr_sbuff_t *in, size_t len FILL_OR_GOTO_DONE(out, &our_in, p - our_in.p); if (p != end) break; /* stopped early, break */ - }; + } done: *out->p = '\0'; @@ -871,7 +871,7 @@ size_t fr_sbuff_out_bstrncpy_until(fr_sbuff_t *out, fr_sbuff_t *in, size_t len, FILL_OR_GOTO_DONE(out, &our_in, p - our_in.p); if (p != end) break; /* stopped early, break */ - }; + } done: *out->p = '\0'; @@ -1049,7 +1049,7 @@ size_t fr_sbuff_out_unescape_until(fr_sbuff_t *out, fr_sbuff_t *in, size_t len, next: if (tt && fr_sbuff_terminal_search(in, fr_sbuff_current(&our_in), idx, tt, needle_len)) break; fr_sbuff_advance(&our_in, 1); - }; + } /* * Copy any remaining data over @@ -1850,7 +1850,7 @@ size_t fr_sbuff_adv_until(fr_sbuff_t *sbuff, size_t len, fr_sbuff_term_t const * total += fr_sbuff_set(sbuff, p); if (p != end) break; /* stopped early, break */ - }; + } return total; } diff --git a/src/lib/util/sbuff.h b/src/lib/util/sbuff.h index ef318675a95..4829898f851 100644 --- a/src/lib/util/sbuff.h +++ b/src/lib/util/sbuff.h @@ -559,7 +559,7 @@ static inline int _sbuff_thread_local_free(void *sbtl) * @param[in] _max Maximum size of the sbuff buffer. */ #define FR_SBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max) \ -{ \ +do { \ static _Thread_local fr_sbuff_thread_local_t *_sbuff_t_local; \ if (!_sbuff_t_local) { \ fr_sbuff_thread_local_t *sbtl = talloc_zero(NULL, fr_sbuff_thread_local_t); \ @@ -570,7 +570,7 @@ static inline int _sbuff_thread_local_free(void *sbtl) fr_sbuff_reset_talloc(&_sbuff_t_local->sbuff); \ *(_out) = &_sbuff_t_local->sbuff; \ } \ -} +} while (0) void fr_sbuff_update(fr_sbuff_t *sbuff, char *new_buff, size_t new_len); @@ -936,7 +936,7 @@ static inline fr_slen_t _fr_sbuff_error(fr_sbuff_t *sbuff, char const *err) * An error at offset 0 will be returned as -1. */ #define fr_sbuff_error(_sbuff_or_marker) \ - _fr_sbuff_error(fr_sbuff_ptr(_sbuff_or_marker), fr_sbuff_current(_sbuff_or_marker)); + _fr_sbuff_error(fr_sbuff_ptr(_sbuff_or_marker), fr_sbuff_current(_sbuff_or_marker)) /** Like fr_sbuff_used, but adjusts for the value returned for the amount shifted * diff --git a/src/lib/util/sha1.c b/src/lib/util/sha1.c index 8bcaa6847d8..0bcccca9037 100644 --- a/src/lib/util/sha1.c +++ b/src/lib/util/sha1.c @@ -23,11 +23,11 @@ RCSID("$Id$") ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -# define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -# define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); -# define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -# define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -# define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); +# define R0(v,w,x,y,z,i) do { z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0) +# define R1(v,w,x,y,z,i) do { z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0) +# define R2(v,w,x,y,z,i) do { z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); } while (0) +# define R3(v,w,x,y,z,i) do { z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); } while (0) +# define R4(v,w,x,y,z,i) do { z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); } while (0) /* Hash a single 512-bit block. This is the core of the algorithm. */ diff --git a/src/lib/util/trie.c b/src/lib/util/trie.c index 7323f30ab7a..34c20ce1b4a 100644 --- a/src/lib/util/trie.c +++ b/src/lib/util/trie.c @@ -125,7 +125,7 @@ static void trie_sprint(fr_trie_t *trie, uint8_t const *key, int start_bit, int #ifdef WITH_TRIE_VERIFY static int trie_verify(fr_trie_t *trie); //#define VERIFY(_x) fr_cond_assert(trie_verify((fr_trie_t *) _x) == 0) -#define VERIFY(_x) do { if (trie_verify((fr_trie_t *) _x) < 0) { fprintf(stderr, "FAIL VERIFY at %d - %s\n", __LINE__, fr_strerror()); fr_cond_assert(0);} } while (0) +#define VERIFY(_x) if (trie_verify((fr_trie_t *) _x) < 0) do { fprintf(stderr, "FAIL VERIFY at %d - %s\n", __LINE__, fr_strerror()); fr_cond_assert(0); } while (0) #else #define VERIFY(_x) #endif diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 6069b3e5ae4..2f76d829f63 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -675,7 +675,7 @@ int8_t fr_value_box_cmp(fr_value_box_t const *a, fr_value_box_t const *b) * Short-hand for simplicity. */ #define RETURN(_type) return CMP(a->datum._type, b->datum._type) -#define COMPARE(_type) return CMP(memcmp(&a->datum._type, &b->datum._type, sizeof(a->datum._type)), 0); +#define COMPARE(_type) return CMP(memcmp(&a->datum._type, &b->datum._type, sizeof(a->datum._type)), 0) case FR_TYPE_BOOL: RETURN(boolean); diff --git a/src/listen/ldap_sync/proto_ldap_sync_ldap.c b/src/listen/ldap_sync/proto_ldap_sync_ldap.c index b37de369850..70acf6ad483 100644 --- a/src/listen/ldap_sync/proto_ldap_sync_ldap.c +++ b/src/listen/ldap_sync/proto_ldap_sync_ldap.c @@ -294,7 +294,7 @@ int ldap_sync_cookie_send(sync_packet_ctx_t *sync_packet_ctx) error: talloc_free(local); return -1; - }; + } fr_pair_list_append_by_da(local, vp, &pairs, attr_packet_type, (uint32_t)FR_LDAP_SYNC_CODE_COOKIE_STORE, true); if (!vp) goto error; @@ -425,7 +425,7 @@ int ldap_sync_entry_send(sync_state_t *sync, uint8_t const uuid[SYNC_UUID_LENGTH if (msg) ldap_msgfree(msg); talloc_free(sync_packet_ctx); return -1; - }; + } pcode = sync_packet_code_table[op]; @@ -485,7 +485,7 @@ int ldap_sync_entry_send(sync_state_t *sync, uint8_t const uuid[SYNC_UUID_LENGTH values[i]->bv_len, NULL, true) < 0) { fr_pair_remove(pairs, vp); talloc_free(vp); - }; + } /* Only += operator adds multiple values */ if (map->op != T_OP_ADD_EQ) break; diff --git a/src/modules/rlm_cipher/rlm_cipher.c b/src/modules/rlm_cipher/rlm_cipher.c index 1c455e03774..f003bd241fa 100644 --- a/src/modules/rlm_cipher/rlm_cipher.c +++ b/src/modules/rlm_cipher/rlm_cipher.c @@ -1357,7 +1357,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) default: fr_assert(0); return -1; - }; + } return 0; } diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index 2e269848a02..46f6768041f 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -366,7 +366,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) } #undef READFILE -#define READFILE(_x, _y, _d) do { if (getusersfile(inst, inst->_x, &inst->_y, &inst->_d, inst->key_data_type) != 0) { ERROR("Failed reading %s", inst->_x); return -1;} } while (0) +#define READFILE(_x, _y, _d) if (getusersfile(inst, inst->_x, &inst->_y, &inst->_d, inst->key_data_type) != 0) do { ERROR("Failed reading %s", inst->_x); return -1;} while (0) READFILE(filename, common, common_def); READFILE(usersfile, users, users_def); diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 0c182f9519d..d8b98b80f16 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -696,10 +696,10 @@ static void ldap_memberof_xlat_cancel(UNUSED request_t *request, UNUSED fr_signa } #define REPEAT_LDAP_MEMBEROF_XLAT_RESULTS \ - if (unlang_function_repeat_set(request, ldap_memberof_xlat_results) < 0) { \ + if (unlang_function_repeat_set(request, ldap_memberof_xlat_results) < 0) do { \ rcode = RLM_MODULE_FAIL; \ goto finish; \ - } + } while (0) /** Run the state machine for the LDAP membership xlat * @@ -1327,10 +1327,10 @@ static unlang_action_t mod_authorize_start(UNUSED rlm_rcode_t *p_result, UNUSED } #define REPEAT_MOD_AUTHORIZE_RESUME \ - if (unlang_function_repeat_set(request, mod_authorize_resume) < 0) { \ + if (unlang_function_repeat_set(request, mod_authorize_resume) < 0) do { \ rcode = RLM_MODULE_FAIL; \ goto finish; \ - } + } while (0) /** Resume function called after each potential yield in LDAP authorization * @@ -1415,7 +1415,7 @@ static unlang_action_t mod_authorize_resume(rlm_rcode_t *p_result, UNUSED int *p * Retrieve Universal Password if we use eDirectory */ if (inst->edir) { - autz_ctx->dn = rlm_find_user_dn_cached(request);; + autz_ctx->dn = rlm_find_user_dn_cached(request); /* * Retrive universal password diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 583a6b14720..69772a37df8 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -1136,7 +1136,7 @@ static unlang_action_t CC_HINT(nonnull) mod_alloc(rlm_rcode_t *p_result, module_ * Fall back to lease_time otherwise. */ lease_time = (env->offer_time.type == FR_TYPE_UINT32) ? - env->offer_time.vb_uint32 : env->lease_time.vb_uint32;; + env->offer_time.vb_uint32 : env->lease_time.vb_uint32; ippool_action_print(request, POOL_ACTION_ALLOCATE, L_DBG_LVL_2, &env->pool_name, NULL, &env->owner, &env->gateway_id, lease_time); switch (redis_ippool_allocate(inst, request, env, lease_time)) { diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c index b66273395e6..ee3b2e2050b 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c @@ -1482,7 +1482,7 @@ do { \ p->name = optarg; \ p++; \ need_pool = true; \ -} while (0); +} while (0) while ((c = getopt(argc, argv, "a:d:r:s:Sm:A:U:O:p:ilLhxo:f:")) != -1) switch (c) { case 'a': diff --git a/src/modules/rlm_rest/rest.c b/src/modules/rlm_rest/rest.c index c878d09e904..13d290b4f5c 100644 --- a/src/modules/rlm_rest/rest.c +++ b/src/modules/rlm_rest/rest.c @@ -614,7 +614,7 @@ static ssize_t rest_request_encode_wrapper(char **out, UNUSED rlm_rest_t const * if (alloc > limit) break; MEM(buff = talloc_realloc(NULL, buff, char, alloc)); - }; + } talloc_free(buff); @@ -1908,7 +1908,7 @@ int rest_request_config(module_ctx_t const *mctx, rlm_rest_section_t const *sect default: fr_assert(0); break; - }; + } /* * Set user based authentication parameters @@ -2008,7 +2008,7 @@ do {\ default: fr_assert(0); - }; + } /* * Setup encoder specific options diff --git a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c index ed0d2daff72..b1de15bf633 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c @@ -737,7 +737,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) PERROR("Failed creating directory for SQLite database"); return -1; - }; + } status = sqlite3_open_v2(inst->filename, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (!db) { diff --git a/src/protocols/dhcpv4/base.c b/src/protocols/dhcpv4/base.c index 2b5fb75fe13..62b292324da 100644 --- a/src/protocols/dhcpv4/base.c +++ b/src/protocols/dhcpv4/base.c @@ -523,7 +523,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c len = fr_dhcpv4_encode_option(&work_dbuff, &cursor, &(fr_dhcpv4_ctx_t){ .root = fr_dict_root(dict_dhcpv4) }); if (len <= 0) break; - }; + } FR_DBUFF_IN_BYTES_RETURN(&work_dbuff, FR_END_OF_OPTIONS, 0x00); diff --git a/src/protocols/dhcpv6/decode.c b/src/protocols/dhcpv6/decode.c index 0a5452738c6..3dec19940a8 100644 --- a/src/protocols/dhcpv6/decode.c +++ b/src/protocols/dhcpv6/decode.c @@ -86,7 +86,7 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_pair_list_t *out, raw: return fr_pair_raw_from_network(ctx, out, parent, data, data_len); - }; + } /* * Structs used fixed length IPv6 addressews. diff --git a/src/protocols/dns/decode.c b/src/protocols/dns/decode.c index 636d4556945..04f5947b92c 100644 --- a/src/protocols/dns/decode.c +++ b/src/protocols/dns/decode.c @@ -82,7 +82,7 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_pair_list_t *out, raw: return fr_pair_raw_from_network(ctx, out, parent, data, data_len); - }; + } /* * Structs used fixed length fields diff --git a/src/protocols/radius/radius.h b/src/protocols/radius/radius.h index 6701d8650d5..e92cb7216b6 100644 --- a/src/protocols/radius/radius.h +++ b/src/protocols/radius/radius.h @@ -155,7 +155,7 @@ fr_radius_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, ui int fr_radius_packet_send(fr_radius_packet_t *packet, fr_pair_list_t *list, fr_radius_packet_t const *original, char const *secret) CC_HINT(nonnull (1,2,4)); -#define fr_radius_packet_log_hex(_log, _packet) _fr_radius_packet_log_hex(_log, _packet, __FILE__, __LINE__); +#define fr_radius_packet_log_hex(_log, _packet) _fr_radius_packet_log_hex(_log, _packet, __FILE__, __LINE__) void _fr_radius_packet_log_hex(fr_log_t const *log, fr_radius_packet_t const *packet, char const *file, int line) CC_HINT(nonnull); typedef struct { diff --git a/src/protocols/tacacs/tacacs.h b/src/protocols/tacacs/tacacs.h index b15b8492bf9..6b64507b06e 100644 --- a/src/protocols/tacacs/tacacs.h +++ b/src/protocols/tacacs/tacacs.h @@ -351,5 +351,5 @@ void fr_tacacs_free(void); int fr_tacacs_body_xor(fr_tacacs_packet_t const *pkt, uint8_t *body, size_t body_len, char const *secret, size_t secret_len) CC_HINT(nonnull(1,2,4)); -#define fr_tacacs_packet_log_hex(_log, _packet, _size) _fr_tacacs_packet_log_hex(_log, _packet, _size, __FILE__, __LINE__); +#define fr_tacacs_packet_log_hex(_log, _packet, _size) _fr_tacacs_packet_log_hex(_log, _packet, _size, __FILE__, __LINE__) void _fr_tacacs_packet_log_hex(fr_log_t const *log, fr_tacacs_packet_t const *packet, size_t packet_len, char const *file, int line) CC_HINT(nonnull);