build: fix 7 risky warnings + slim debug profile to -g1

Warning fixes (from a 730-warning full-build census; these were the
semantically risky ones):

- test_repl_majority.c:272: remove a broken "field-existence" loop whose
  condition (i < ep != NULL) parsed wrong (-Wparentheses); the direct
  pending_ack_count write it guarded already exists and still fails the
  build if the field disappears.
- ha.c:8593: ha_rdhup_election_hook now takes const xce_candidate_t**
  so RDHUP election can hand over candidates straight from the const
  peers_cfg without stripping const. All 5 test-side hook impls only
  (void)peers -- signature updated in ha.h + 3 test files.
- ha.c:726/872/10804 endpoint_connect: constify the host parameter of
  endpoint_connect/socket_connect (netio.h/netio.c). The functions only
  pass host to gethostbyname(); peer->hostname etc. can now flow in
  without discarding const. All callers are read-only and unaffected.

Debug profile (src/meson.build): drop -gdwarf-4 -g3
-fvar-tracking(-assignments) in favor of -ggdb -g1. Debug objects were
~16x larger with full DWARF (scheduler.c: 1.3MB vs 0.08MB), pushing the
build tree to 3.9G; at -g1 it is 850M and a clean build drops from
6m43s to 4m36s. -g1 keeps file/line and backtraces; gdb variable/
macro inspection needs the asan profile. -fno-omit-frame-pointer kept.

Verified: controller_unit_test 1342/1342, xcelib_test 758/758, all 126
scheduler suites + 18 worker suites green; modified sources compile
with zero warnings.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-21 08:32:41 +00:00
parent edb63e6095
commit f1801fbef9
9 changed files with 24 additions and 27 deletions

View file

@ -8585,7 +8585,7 @@ static void ha_enter_real_election(ha_state_t *ha, cluster_t *c)
if (c->myconf && c->myconf->peers_cfg.candidates_count > 0) {
const xce_cluster_config_t *cfg = &c->myconf->peers_cfg;
int n = cfg->candidates_count > 0 ? cfg->candidates_count - 1 : 0;
xce_candidate_t *peer_ptrs[MAX_HA_CANDIDATES];
const xce_candidate_t *peer_ptrs[MAX_HA_CANDIDATES];
int np = 0;
for (int i = 0; i < cfg->candidates_count && np < n; i++) {
if (strcmp(cfg->candidates[i].name,
@ -9313,7 +9313,7 @@ void ha_start_election_async(ha_state_t *ha, cluster_t *c,
* this instead of the real ha_start_election_async(). Req 6.3, 6.5, 9.3.
*/
void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
int n_peers, xce_candidate_t **peers,
int n_peers, const xce_candidate_t **peers,
uint64_t my_config_tag, uint64_t my_lsn,
const char *my_name) = NULL;
#endif