Skip to content

Commit 957935d

Browse files
Christoph HellwigAlex Elder
Christoph Hellwig
authored and
Alex Elder
committed
xfs: fix xfs_debug warnings
For a CONFIG_XFS_DEBUG=n build gcc complains about statements with no effect in xfs_debug: fs/xfs/quota/xfs_qm_syscalls.c: In function 'xfs_qm_scall_trunc_qfiles': fs/xfs/quota/xfs_qm_syscalls.c:291:3: warning: statement with no effect The reason for that is that the various new xfs message functions have a return value which is never used, and in case of the non-debug build xfs_debug the macro evaluates to a plain 0 which produces the above warnings. This can be fixed by turning xfs_debug into an inline function instead of a macro, but in addition to that I've also changed all the message helpers to return void as we never use their return values. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
1 parent ecb697c commit 957935d

File tree

2 files changed

+22
-29
lines changed

2 files changed

+22
-29
lines changed

fs/xfs/linux-2.6/xfs_message.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,47 @@
2828
/*
2929
* XFS logging functions
3030
*/
31-
static int
31+
static void
3232
__xfs_printk(
3333
const char *level,
3434
const struct xfs_mount *mp,
3535
struct va_format *vaf)
3636
{
3737
if (mp && mp->m_fsname)
38-
return printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);
39-
return printk("%sXFS: %pV\n", level, vaf);
38+
printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);
39+
printk("%sXFS: %pV\n", level, vaf);
4040
}
4141

42-
int xfs_printk(
42+
void xfs_printk(
4343
const char *level,
4444
const struct xfs_mount *mp,
4545
const char *fmt, ...)
4646
{
4747
struct va_format vaf;
4848
va_list args;
49-
int r;
5049

5150
va_start(args, fmt);
5251

5352
vaf.fmt = fmt;
5453
vaf.va = &args;
5554

56-
r = __xfs_printk(level, mp, &vaf);
55+
__xfs_printk(level, mp, &vaf);
5756
va_end(args);
58-
59-
return r;
6057
}
6158

6259
#define define_xfs_printk_level(func, kern_level) \
63-
int func(const struct xfs_mount *mp, const char *fmt, ...) \
60+
void func(const struct xfs_mount *mp, const char *fmt, ...) \
6461
{ \
6562
struct va_format vaf; \
6663
va_list args; \
67-
int r; \
6864
\
6965
va_start(args, fmt); \
7066
\
7167
vaf.fmt = fmt; \
7268
vaf.va = &args; \
7369
\
74-
r = __xfs_printk(kern_level, mp, &vaf); \
70+
__xfs_printk(kern_level, mp, &vaf); \
7571
va_end(args); \
76-
\
77-
return r; \
7872
} \
7973

8074
define_xfs_printk_level(xfs_emerg, KERN_EMERG);
@@ -88,7 +82,7 @@ define_xfs_printk_level(xfs_info, KERN_INFO);
8882
define_xfs_printk_level(xfs_debug, KERN_DEBUG);
8983
#endif
9084

91-
int
85+
void
9286
xfs_alert_tag(
9387
const struct xfs_mount *mp,
9488
int panic_tag,
@@ -97,7 +91,6 @@ xfs_alert_tag(
9791
struct va_format vaf;
9892
va_list args;
9993
int do_panic = 0;
100-
int r;
10194

10295
if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
10396
xfs_printk(KERN_ALERT, mp,
@@ -110,12 +103,10 @@ xfs_alert_tag(
110103
vaf.fmt = fmt;
111104
vaf.va = &args;
112105

113-
r = __xfs_printk(KERN_ALERT, mp, &vaf);
106+
__xfs_printk(KERN_ALERT, mp, &vaf);
114107
va_end(args);
115108

116109
BUG_ON(do_panic);
117-
118-
return r;
119110
}
120111

121112
void

fs/xfs/linux-2.6/xfs_message.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,34 @@
33

44
struct xfs_mount;
55

6-
extern int xfs_printk(const char *level, const struct xfs_mount *mp,
6+
extern void xfs_printk(const char *level, const struct xfs_mount *mp,
77
const char *fmt, ...)
88
__attribute__ ((format (printf, 3, 4)));
9-
extern int xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...)
9+
extern void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...)
1010
__attribute__ ((format (printf, 2, 3)));
11-
extern int xfs_alert(const struct xfs_mount *mp, const char *fmt, ...)
11+
extern void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...)
1212
__attribute__ ((format (printf, 2, 3)));
13-
extern int xfs_alert_tag(const struct xfs_mount *mp, int tag,
13+
extern void xfs_alert_tag(const struct xfs_mount *mp, int tag,
1414
const char *fmt, ...)
1515
__attribute__ ((format (printf, 3, 4)));
16-
extern int xfs_crit(const struct xfs_mount *mp, const char *fmt, ...)
16+
extern void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...)
1717
__attribute__ ((format (printf, 2, 3)));
18-
extern int xfs_err(const struct xfs_mount *mp, const char *fmt, ...)
18+
extern void xfs_err(const struct xfs_mount *mp, const char *fmt, ...)
1919
__attribute__ ((format (printf, 2, 3)));
20-
extern int xfs_warn(const struct xfs_mount *mp, const char *fmt, ...)
20+
extern void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...)
2121
__attribute__ ((format (printf, 2, 3)));
22-
extern int xfs_notice(const struct xfs_mount *mp, const char *fmt, ...)
22+
extern void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...)
2323
__attribute__ ((format (printf, 2, 3)));
24-
extern int xfs_info(const struct xfs_mount *mp, const char *fmt, ...)
24+
extern void xfs_info(const struct xfs_mount *mp, const char *fmt, ...)
2525
__attribute__ ((format (printf, 2, 3)));
2626

2727
#ifdef DEBUG
28-
extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
28+
extern void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
2929
__attribute__ ((format (printf, 2, 3)));
3030
#else
31-
#define xfs_debug(mp, fmt, ...) (0)
31+
static inline void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
32+
{
33+
}
3234
#endif
3335

3436
extern void assfail(char *expr, char *f, int l);

0 commit comments

Comments
 (0)