Whamcloud - gitweb
fix unused-function -Wall warnings
authorTheodore Ts'o <tytso@mit.edu>
Tue, 17 Aug 2021 19:56:24 +0000 (15:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 19 Aug 2021 03:01:44 +0000 (23:01 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/logdump.c
e2fsck/e2fsck.h
e2fsck/jfs_user.h
lib/ext2fs/compiler.h
lib/ext2fs/jfs_compat.h
lib/ext2fs/rbtree.h

index 5416f9e..4154ef2 100644 (file)
@@ -33,7 +33,14 @@ extern char *optarg;
 #include "debugfs.h"
 #include "blkid/blkid.h"
 #include "jfs_user.h"
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
 #include "ext2fs/fast_commit.h"
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic pop
+#endif
 #include <uuid/uuid.h>
 
 enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL};
index 5704316..00b2091 100644 (file)
 #endif
 
 #include "support/quotaio.h"
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
 #include "ext2fs/fast_commit.h"
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic pop
+#endif
 
 /*
  * Exit codes used by fsck-type programs
index 6d24558..4ad2005 100644 (file)
@@ -92,14 +92,6 @@ typedef struct kmem_cache {
 #define kmalloc(len, flags) malloc(len)
 #define kfree(p) free(p)
 
-static inline void *kmalloc_array(unsigned n, unsigned size,
-                                 int flags EXT2FS_ATTR((unused)))
-{
-       if (n && (~0U)/n < size)
-               return NULL;
-       return malloc(n * size);
-}
-
 #define cond_resched() do { } while (0)
 
 #define __init
@@ -120,6 +112,11 @@ extern size_t journal_tag_bytes(journal_t *journal);
 extern __u32 __hash_32(__u32 val);
 extern __u32 hash_32(__u32 val, unsigned int bits);
 extern __u32 hash_64(__u64 val, unsigned int bits);
+extern void *kmalloc_array(unsigned n, unsigned size, int flags);
+extern __u32 jbd2_chksum(journal_t *j, __u32 crc, const void *address,
+                        unsigned int length);
+extern void jbd2_descriptor_block_csum_set(journal_t *j,
+                                          struct buffer_head *bh);
 #endif
 
 #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
@@ -182,6 +179,36 @@ _INLINE_ __u32 hash_64(__u64 val, unsigned int bits)
        }
 }
 
+_INLINE_ void *kmalloc_array(unsigned n, unsigned size,
+                            int flags EXT2FS_ATTR((unused)))
+{
+       if (n && (~0U)/n < size)
+               return NULL;
+       return malloc(n * size);
+}
+
+_INLINE_ __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
+                          __u32 crc, const void *address,
+                          unsigned int length)
+{
+       return ext2fs_crc32c_le(crc, address, length);
+}
+
+_INLINE_ void jbd2_descriptor_block_csum_set(journal_t *j,
+                                            struct buffer_head *bh)
+{
+       struct jbd2_journal_block_tail *tail;
+       __u32 csum;
+
+       if (!jbd2_journal_has_csum_v2or3(j))
+               return;
+
+       tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
+                       sizeof(struct jbd2_journal_block_tail));
+       tail->t_checksum = 0;
+       csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
+       tail->t_checksum = cpu_to_be32(csum);
+}
 #undef _INLINE_
 #endif
 
@@ -235,22 +262,6 @@ extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
 #define EFSCORRUPTED   EXT2_ET_FILESYSTEM_CORRUPTED
 #endif
 
-static inline void jbd2_descriptor_block_csum_set(journal_t *j,
-                                                 struct buffer_head *bh)
-{
-       struct jbd2_journal_block_tail *tail;
-       __u32 csum;
-
-       if (!jbd2_journal_has_csum_v2or3(j))
-               return;
-
-       tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
-                       sizeof(struct jbd2_journal_block_tail));
-       tail->t_checksum = 0;
-       csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
-       tail->t_checksum = cpu_to_be32(csum);
-}
-
 /* recovery.c */
 extern int     jbd2_journal_recover    (journal_t *journal);
 extern int     jbd2_journal_skip_recovery (journal_t *);
index baed2a6..3bb3521 100644 (file)
@@ -5,6 +5,15 @@
 
 #ifdef __GNUC__
 
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min) \
+       ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
+
 #define container_of(ptr, type, member) ({                             \
        __typeof__( ((type *)0)->member ) *__mptr = (ptr);      \
        (type *)( (char *)__mptr - offsetof(type,member) );})
index 71483f6..e11cf49 100644 (file)
@@ -51,12 +51,6 @@ typedef unsigned int gfp_t;
 typedef __u64 u64;
 #define put_bh(x)      brelse(x)
 
-static inline __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
-                               __u32 crc, const void *address,
-                               unsigned int length)
-{
-       return ext2fs_crc32c_le(crc, address, length);
-}
 #define crc32_be(x, y, z)      ext2fs_crc32_be((x), (y), (z))
 #define spin_lock_init(x)
 #define spin_lock(x)
index f718ad2..790f5c1 100644 (file)
@@ -98,6 +98,11 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 #include <stdint.h>
 #include "compiler.h"
 
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
 struct rb_node
 {
        uintptr_t  rb_parent_color;
@@ -171,4 +176,8 @@ static inline void ext2fs_rb_link_node(struct rb_node * node,
        *rb_link = node;
 }
 
+#if __GNUC_PREREQ (4, 6)
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* _LINUX_RBTREE_H */