mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 12:57:58 +02:00
build: always define NM_MORE_LOGGING define and don't check with #ifdef
Using '#ifdef' is generally error prone. It's better to always define a define and check for it explicitly. This way, the compiler can issue a warning if the define does not exist. Also, note how meson would always define NM_MORE_LOGGING, possibly to "0". That means, for meson, we unintentionally always enabled more logging because the define was always present. Fix that.
This commit is contained in:
parent
68691eb009
commit
3b5f8c91fe
6 changed files with 10 additions and 8 deletions
|
|
@ -1111,6 +1111,8 @@ if test "${enable_more_logging}" = ""; then
|
|||
fi
|
||||
if test "${enable_more_logging}" = "yes"; then
|
||||
AC_DEFINE(NM_MORE_LOGGING, [1], [Define if more debug logging is enabled])
|
||||
else
|
||||
AC_DEFINE(NM_MORE_LOGGING, [0], [Define if more debug logging is enabled])
|
||||
fi
|
||||
|
||||
NM_LTO
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ typedef struct {
|
|||
static void
|
||||
_call_trace (const char *comment, OvsdbMethodCall *call, json_t *msg)
|
||||
{
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
char *str = NULL;
|
||||
|
||||
if (msg)
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ periodic_update (NMDeviceWifi *self)
|
|||
percent = nm_platform_wifi_get_quality (nm_device_get_platform (NM_DEVICE (self)), ifindex);
|
||||
if (percent >= 0 || ++priv->invalid_strength_counter > 3) {
|
||||
if (nm_wifi_ap_set_strength (priv->current_ap, (gint8) percent)) {
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
_ap_dump (self, LOGL_TRACE, priv->current_ap, "updated", 0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
#define _NMLOG_ENABLED(level) TRUE
|
||||
#else
|
||||
#define _NMLOG_ENABLED(level) ((level) <= LOG_ERR)
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ gboolean nm_logging_syslog_enabled (void);
|
|||
|
||||
/* _LOGT() and _LOGt() both log with level TRACE, but the latter is disabled by default,
|
||||
* unless building with --with-more-logging. */
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
||||
#define _LOGt_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||
|
|
@ -311,7 +311,7 @@ gboolean nm_logging_syslog_enabled (void);
|
|||
#define _LOG2W_err(errsv, ...) _NMLOG2_err (errsv, LOGL_WARN , __VA_ARGS__)
|
||||
#define _LOG2E_err(errsv, ...) _NMLOG2_err (errsv, LOGL_ERR , __VA_ARGS__)
|
||||
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
#define _LOG2t_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||
#define _LOG2t(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
||||
#define _LOG2t_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||
|
|
@ -342,7 +342,7 @@ gboolean nm_logging_syslog_enabled (void);
|
|||
#define _LOG3W_err(errsv, ...) _NMLOG3_err (errsv, LOGL_WARN , __VA_ARGS__)
|
||||
#define _LOG3E_err(errsv, ...) _NMLOG3_err (errsv, LOGL_ERR , __VA_ARGS__)
|
||||
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
#define _LOG3t_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
||||
#define _LOG3t(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
||||
#define _LOG3t_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -3413,7 +3413,7 @@ typedef struct {
|
|||
|
||||
struct nl_sock *nlh;
|
||||
guint32 nlh_seq_next;
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
guint32 nlh_seq_last_handled;
|
||||
#endif
|
||||
guint32 nlh_seq_last_seen;
|
||||
|
|
@ -4772,7 +4772,7 @@ event_seq_check (NMPlatform *platform, guint32 seq_number, WaitForNlResponseResu
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NM_MORE_LOGGING
|
||||
#if NM_MORE_LOGGING
|
||||
if (seq_number != priv->nlh_seq_last_handled)
|
||||
_LOGt ("netlink: recvmsg: unwaited sequence number %u", seq_number);
|
||||
priv->nlh_seq_last_handled = seq_number;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue