diff mbox series

[v2,4/5] btrfs: introduce EXPORT_FOR_TESTS macro

Message ID 20181119093817.9291-5-jthumshirn@suse.de (mailing list archive)
State New, archived
Headers show
Series btrfs: fix compiler warning with make W=1 | expand

Commit Message

Johannes Thumshirn Nov. 19, 2018, 9:38 a.m. UTC
Depending on whether CONFIG_BTRFS_FS_RUN_SANITY_TESTS is set, some BTRFS
functions are either local to the file they are implemented in and thus
should be declared static or are called from within the test implementation
defined in a different file.

Introduce an EXPORT_FOR_TESTS macro which depending on
CONFIG_BTRFS_FS_RUN_SANITY_TESTS either adds the 'static' keyword to a
function or not.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 fs/btrfs/ctree.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Nikolay Borisov Nov. 19, 2018, 9:49 a.m. UTC | #1
On 19.11.18 г. 11:38 ч., Johannes Thumshirn wrote:
> Depending on whether CONFIG_BTRFS_FS_RUN_SANITY_TESTS is set, some BTRFS
> functions are either local to the file they are implemented in and thus
> should be declared static or are called from within the test implementation
> defined in a different file.
> 
> Introduce an EXPORT_FOR_TESTS macro which depending on
> CONFIG_BTRFS_FS_RUN_SANITY_TESTS either adds the 'static' keyword to a
> function or not.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/ctree.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index e62824cae00a..5119dacab981 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3471,6 +3471,12 @@ static inline void assfail(const char *expr, const char *file, int line)
>  #define ASSERT(expr)	((void)0)
>  #endif
>  
> +#ifndef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
> +#define EXPORT_FOR_TESTS static
> +#else
> +#define EXPORT_FOR_TESTS
> +#endif
> +
>  __cold
>  static inline void btrfs_print_v0_err(struct btrfs_fs_info *fs_info)
>  {
>
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e62824cae00a..5119dacab981 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3471,6 +3471,12 @@  static inline void assfail(const char *expr, const char *file, int line)
 #define ASSERT(expr)	((void)0)
 #endif
 
+#ifndef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+#define EXPORT_FOR_TESTS static
+#else
+#define EXPORT_FOR_TESTS
+#endif
+
 __cold
 static inline void btrfs_print_v0_err(struct btrfs_fs_info *fs_info)
 {