Skip to content

Commit a3b096b

Browse files
committed
phydm/core: fix -Wempty-body in disabled debug-macro branches
RF_DBG, PHYDM_DBG and DBG_COUNTER expand to nothing in their debug-disabled branches, so call sites like `if (cond) RF_DBG(...);` collapse to `if (cond) ;` and gcc reports -Wempty-body. Give those empty branches a `do {} while (0)` body so they stay valid single statements; a bare `{}` would break `if (...) MACRO(); else ...` chains (dangling else). Also brace genuinely empty if-bodies. Assisted-by: Claude:claude-opus-4.8
1 parent 8fbd0bd commit a3b096b

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎core/rtw_mlme_ext.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,12 +2151,12 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
21512151
rtw_list_delete(&pstat->asoc_list);
21522152
pstapriv->asoc_list_cnt--;
21532153
if (pstat->expire_to > 0)
2154-
;/* TODO: STA re_auth within expire_to */
2154+
{ } /* TODO: STA re_auth within expire_to */
21552155
}
21562156
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
21572157

21582158
if (seq == 1)
2159-
; /* TODO: STA re_auth and auth timeout */
2159+
{ } /* TODO: STA re_auth and auth timeout */
21602160

21612161
}
21622162
}

‎hal/phydm/halrf/halrf_debug.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static __inline void RF_DBG(struct dm_struct *dm, int comp, char *fmt, ...)
9696
{
9797
}
9898
#else
99-
#define RF_DBG(dm, comp, fmt, args...)
99+
#define RF_DBG(dm, comp, fmt, args...) do {} while (0)
100100
#endif
101101

102102
#endif /*#if DBG*/

‎hal/phydm/phydm_debug.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,7 @@ static void phydm_dump_bb_reg(void *dm_void, u32 *_used, char *output, u32 *_out
32683268
#if (ODM_IC_11AC_SERIES_SUPPORT)
32693269
phydm_dump_bb_reg_ac(dm, &used, output, &out_len);
32703270
#else
3271-
;
3271+
{ }
32723272
#endif
32733273

32743274
*_used = used;

‎hal/phydm/phydm_debug.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static __inline void PHYDM_DBG_F(PDM_ODM_T dm, int comp, char *fmt, ...)
238238

239239
#elif defined(DM_ODM_CE_MAC80211_V2)
240240

241-
#define PHYDM_DBG(dm, comp, fmt, args...)
241+
#define PHYDM_DBG(dm, comp, fmt, args...) do {} while (0)
242242
#define PHYDM_DBG_F(dm, comp, fmt, args...)
243243
#define PHYDM_PRINT_ADDR(dm, comp, title_str, addr)
244244

@@ -295,7 +295,7 @@ static __inline void PHYDM_DBG_F(struct dm_struct *dm, int comp, char *fmt, ...)
295295
{
296296
}
297297
#else
298-
#define PHYDM_DBG(dm, comp, fmt, args...)
298+
#define PHYDM_DBG(dm, comp, fmt, args...) do {} while (0)
299299
#define PHYDM_DBG_F(dm, comp, fmt, args...)
300300
#endif
301301
#define PHYDM_PRINT_ADDR(dm, comp, title_str, ptr)

‎include/rtw_debug.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ extern uint rtw_drv_log_level;
216216
#ifdef CONFIG_DBG_COUNTER
217217
#define DBG_COUNTER(counter) counter++
218218
#else
219-
#define DBG_COUNTER(counter)
219+
#define DBG_COUNTER(counter) do {} while (0)
220220
#endif
221221

222222
void dump_drv_version(void *sel);

0 commit comments

Comments
 (0)