Skip to contentSkip to conversation

libxfs: fix compilation errors

PATCH In review Darrick J. Wong 2 participants 7 messages Oct 14 – Oct 15

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxfs: fix compilation errors

From: Darrick J. Wong <[email protected]>

Add includes to eliminate warnings from -Werror=missing-prototypes. It's not a good idea to let the compiler apply the default function declaration.

---
 libxfs/defer_item.c |    6 ++++++
 libxfs/trans.c      |    1 +
 2 files changed, 7 insertions(+)
libxfs/defer_item.c +6 -0
index 72d79b10d82064..c6ea292d3d6940 100644
@@ -30,6 +30,12 @@
 #include "xfs_group.h"
 #include "xfs_rtgroup.h"
 #include "xfs_attr_item.h"
+#include "xfs_extfree_item.h"
+#include "xfs_bmap_item.h"
+#include "xfs_rmap_item.h"
+#include "xfs_refcount_item.h"
+#include "xfs_exchmaps_item.h"
+#include "xfs_icreate_item.h"
 
 /* Dummy defer item ops, since we don't do logging. */
 
libxfs/trans.c +1 -0
index 128e9f4431dc7c..c509ca1131116d 100644
@@ -22,6 +22,7 @@
 #include "xfs_defer.h"
 #include "xfs_trace.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_icreate_item.h"
 
 static void xfs_trans_free_items(struct xfs_trans *tp);
 STATIC struct xfs_trans *xfs_trans_dup(struct xfs_trans *tp);
#1 lore raw
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Add includes to eliminate warnings from -Werror=missing-prototypes. It's not a good idea to let the compiler apply the default function declaration.

What do I need to do to see these warnings? I'm getting a few warnings at the moment (and plan to look into them), but they are entirely different:

xfs_alloc.c: In function '__xfs_free_extent':
xfs_alloc.c:4017:41: warning: variable 'busy_flags' set but not used [-Wunused-but-set-variable=]

 4017 |         unsigned int                    busy_flags = 0;
      |                                         ^~~~~~~~~~
xfs_bmap.c: In function 'xfs_bmapi_convert_one_delalloc':
xfs_bmap.c:4360:33: warning: variable 'flags' set but not used [-Wunused-but-set-variable=]
 4360 |         uint16_t                flags = 0;
      |                                 ^~~~~
xfs_log_rlimit.c: In function 'libxfs_log_get_max_trans_res':
xfs_log_rlimit.c:162:33: warning: variable 'i' set but not used [-Wunused-but-set-variable=]
  162 |         unsigned int            i;
      |                                 ^

2345 translated messages.
3139 translated messages.
prefetch.c: In function ‘do_inode_prefetch’:
prefetch.c:1027:33: warning: variable ‘queues_started’ set but not used [-Wunused-but-set-variable=]

 1027 |         int                     queues_started = 0;
      |                                 ^~~~~~~~~~~~~~

btheight.c: In function ‘construct_records_per_block’:
btheight.c:158:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
158 | p = strchr(tag, ':');

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Add includes to eliminate warnings from -Werror=missing-prototypes. It's not a good idea to let the compiler apply the default function declaration.

What do I need to do to see these warnings? I'm getting a few warnings at the moment (and plan to look into them), but they are entirely different:

Add -Werror=missing-prototype (or -Werror) to WARNINGS in include/builddefs.in:

WARNINGS += -Werror

Then rerun configure and make

--D

Quoted 22 lines

xfs_alloc.c: In function '__xfs_free_extent':
xfs_alloc.c:4017:41: warning: variable 'busy_flags' set but not used [-Wunused-but-set-variable=]

 4017 |         unsigned int                    busy_flags = 0;
      |                                         ^~~~~~~~~~
xfs_bmap.c: In function 'xfs_bmapi_convert_one_delalloc':
xfs_bmap.c:4360:33: warning: variable 'flags' set but not used [-Wunused-but-set-variable=]
 4360 |         uint16_t                flags = 0;
      |                                 ^~~~~
xfs_log_rlimit.c: In function 'libxfs_log_get_max_trans_res':
xfs_log_rlimit.c:162:33: warning: variable 'i' set but not used [-Wunused-but-set-variable=]
  162 |         unsigned int            i;
      |                                 ^

2345 translated messages.
3139 translated messages.
prefetch.c: In function ‘do_inode_prefetch’:
prefetch.c:1027:33: warning: variable ‘queues_started’ set but not used [-Wunused-but-set-variable=]

 1027 |         int                     queues_started = 0;
      |                                 ^~~~~~~~~~~~~~

btheight.c: In function ‘construct_records_per_block’:
btheight.c:158:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
158 | p = strchr(tag, ':');

#3 lore raw
Quoted 6 lines · Darrick J. Wong

Add -Werror=missing-prototype (or -Werror) to WARNINGS in include/builddefs.in:

WARNINGS += -Werror

Then rerun configure and make

Ah. This is not "compiler apply the default function declaration", but the compiler warning about not having a prototype for a non-static definition. Which is still somewhat useful, so I think we should enable it as a warning (but not as an error like above) for xfsprogs as well to stay in sync.

#4 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong

Add -Werror=missing-prototype (or -Werror) to WARNINGS in include/builddefs.in:

WARNINGS += -Werror

Quoted 7 lines
Quoted 1 line

Then rerun configure and make

Ah. This is not "compiler apply the default function declaration", but the compiler warning about not having a prototype for a non-static definition. Which is still somewhat useful, so I think we should enable it as a warning (but not as an error like above) for xfsprogs as well to stay in sync.

Well if you really want I'll share my old debug patch that tries to enable as much of the kernel's W=3e as one can do sanely.

--D

#5 lore raw
Quoted 2 lines · Darrick J. Wong

Well if you really want I'll share my old debug patch that tries to enable as much of the kernel's W=3e as one can do sanely.

I'd rather go for roughly the same level as a normal kernel build :)