All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] shmem: fix compilation warnings on unused functions
@ 2016-11-18  5:57 Jérémy Lefaure
  2016-11-18 23:38 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Jérémy Lefaure @ 2016-11-18  5:57 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-mm, Jérémy Lefaure

Compiling shmem.c with CONFIG_SHMEM and
CONFIG_TRANSAPRENT_HUGE_PAGECACHE enabled raises warnings on two unused
functions when CONFIG_TMPFS and CONFIG_SYSFS are both disabled:

mm/shmem.c:390:20: warning: a??shmem_format_hugea?? defined but not used
[-Wunused-function]
 static const char *shmem_format_huge(int huge)
                    ^~~~~~~~~~~~~~~~~
mm/shmem.c:373:12: warning: a??shmem_parse_hugea?? defined but not used
[-Wunused-function]
 static int shmem_parse_huge(const char *str)
             ^~~~~~~~~~~~~~~~

A conditional compilation on tmpfs or sysfs removes the warnings.

Signed-off-by: JA(C)rA(C)my Lefaure <jeremy.lefaure@lse.epita.fr>
---
 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 2c74186..99595d8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -370,6 +370,7 @@ static bool shmem_confirm_swap(struct address_space *mapping,
 
 int shmem_huge __read_mostly;
 
+#if defined(CONFIG_SYSFS) || defined(CONFIG_TMPFS)
 static int shmem_parse_huge(const char *str)
 {
 	if (!strcmp(str, "never"))
@@ -407,6 +408,7 @@ static const char *shmem_format_huge(int huge)
 		return "bad_val";
 	}
 }
+#endif
 
 static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
 		struct shrink_control *sc, unsigned long nr_to_split)
-- 
2.10.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] shmem: fix compilation warnings on unused functions
  2016-11-18  5:57 [PATCH] shmem: fix compilation warnings on unused functions Jérémy Lefaure
@ 2016-11-18 23:38 ` Hugh Dickins
  0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2016-11-18 23:38 UTC (permalink / raw)
  To: Jeremy Lefaure; +Cc: Andrew Morton, Hugh Dickins, linux-mm

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1538 bytes --]

On Fri, 18 Nov 2016, Jeremy Lefaure wrote:

> Compiling shmem.c with CONFIG_SHMEM and
> CONFIG_TRANSAPRENT_HUGE_PAGECACHE enabled raises warnings on two unused
> functions when CONFIG_TMPFS and CONFIG_SYSFS are both disabled:
> 
> mm/shmem.c:390:20: warning: ‘shmem_format_huge’ defined but not used
> [-Wunused-function]
>  static const char *shmem_format_huge(int huge)
>                     ^~~~~~~~~~~~~~~~~
> mm/shmem.c:373:12: warning: ‘shmem_parse_huge’ defined but not used
> [-Wunused-function]
>  static int shmem_parse_huge(const char *str)
>              ^~~~~~~~~~~~~~~~
> 
> A conditional compilation on tmpfs or sysfs removes the warnings.
> 
> Signed-off-by: Jeremy Lefaure <jeremy.lefaure@lse.epita.fr>

Acked-by: Hugh Dickins <hughd@google.com>

Thank you!

> ---
>  mm/shmem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 2c74186..99595d8 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -370,6 +370,7 @@ static bool shmem_confirm_swap(struct address_space *mapping,
>  
>  int shmem_huge __read_mostly;
>  
> +#if defined(CONFIG_SYSFS) || defined(CONFIG_TMPFS)
>  static int shmem_parse_huge(const char *str)
>  {
>  	if (!strcmp(str, "never"))
> @@ -407,6 +408,7 @@ static const char *shmem_format_huge(int huge)
>  		return "bad_val";
>  	}
>  }
> +#endif
>  
>  static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
>  		struct shrink_control *sc, unsigned long nr_to_split)
> -- 
> 2.10.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-18 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18  5:57 [PATCH] shmem: fix compilation warnings on unused functions Jérémy Lefaure
2016-11-18 23:38 ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.