linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
@ 2012-09-04  9:22 Luis Gonzalez Fernandez
  2012-09-04  9:44 ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Luis Gonzalez Fernandez @ 2012-09-04  9:22 UTC (permalink / raw)
  To: akpm, linux-mm; +Cc: Luis Gonzalez Fernandez

frag_start(), frag_next(), frag_stop(), walk_zones_in_node() throws
compilation warnings (-Wunused-function) even when are currently used.

This patchs fix the compilation warnings in vmstat.c

Signed-off-by: Luis Gonzalez Fernandez <luisgf@gmail.com>
---
 mm/vmstat.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index df7a674..e8f7dbd 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -619,7 +619,8 @@ static char * const migratetype_names[MIGRATE_TYPES] = {
 	"Isolate",
 };
 
-static void *frag_start(struct seq_file *m, loff_t *pos)
+static void __attribute__((unused)) *frag_start(struct seq_file *m,
+							loff_t *pos)
 {
 	pg_data_t *pgdat;
 	loff_t node = *pos;
@@ -631,7 +632,8 @@ static void *frag_start(struct seq_file *m, loff_t *pos)
 	return pgdat;
 }
 
-static void *frag_next(struct seq_file *m, void *arg, loff_t *pos)
+static void __attribute__((unused)) *frag_next(struct seq_file *m,
+						void *arg, loff_t *pos)
 {
 	pg_data_t *pgdat = (pg_data_t *)arg;
 
@@ -639,12 +641,13 @@ static void *frag_next(struct seq_file *m, void *arg, loff_t *pos)
 	return next_online_pgdat(pgdat);
 }
 
-static void frag_stop(struct seq_file *m, void *arg)
+static void __attribute__((unused)) frag_stop(struct seq_file *m, void *arg)
 {
 }
 
 /* Walk all the zones in a node and print using a callback */
-static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
+static void __attribute__((unused)) walk_zones_in_node(struct seq_file *m,
+							pg_data_t *pgdat,
 		void (*print)(struct seq_file *m, pg_data_t *, struct zone *))
 {
 	struct zone *zone;
-- 
1.7.9.5

--
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] 6+ messages in thread

* Re: [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
  2012-09-04  9:22 [PATCH 1/1] mm: Fix unused function warnings in vmstat.c Luis Gonzalez Fernandez
@ 2012-09-04  9:44 ` Ezequiel Garcia
  2012-09-04  9:51   ` Luis G.F
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2012-09-04  9:44 UTC (permalink / raw)
  To: Luis Gonzalez Fernandez; +Cc: akpm, linux-mm

Hi Luis,


On Tue, Sep 4, 2012 at 6:22 AM, Luis Gonzalez Fernandez
<luisgf@gmail.com> wrote:
> frag_start(), frag_next(), frag_stop(), walk_zones_in_node() throws
> compilation warnings (-Wunused-function) even when are currently used.
>

This is very odd. I don't get that warning, and (as you said) there's
no reason to get it,
since those functions are used.

What compiler are you using?

Thanks,
Ezequiel.

--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
  2012-09-04  9:44 ` Ezequiel Garcia
@ 2012-09-04  9:51   ` Luis G.F
  2012-09-04 10:01     ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Luis G.F @ 2012-09-04  9:51 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: akpm, linux-mm

Hi Ezequiel:

I'm using GCC 4.6.3

2012/9/4 Ezequiel Garcia <elezegarcia@gmail.com>:
> Hi Luis,
>
>
> On Tue, Sep 4, 2012 at 6:22 AM, Luis Gonzalez Fernandez
> <luisgf@gmail.com> wrote:
>> frag_start(), frag_next(), frag_stop(), walk_zones_in_node() throws
>> compilation warnings (-Wunused-function) even when are currently used.
>>
>
> This is very odd. I don't get that warning, and (as you said) there's
> no reason to get it,
> since those functions are used.
>
> What compiler are you using?
>
> Thanks,
> Ezequiel.



-- 

--
Luis Gonzalez Fernandez
Telf: 661772374
E-Mail: luisgf@gmail.com

--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
  2012-09-04  9:51   ` Luis G.F
@ 2012-09-04 10:01     ` Ezequiel Garcia
  2012-09-04 21:12       ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2012-09-04 10:01 UTC (permalink / raw)
  To: Luis G.F; +Cc: akpm, linux-mm

Hi Luis,

On Tue, Sep 4, 2012 at 6:51 AM, Luis G.F <luisgf@gmail.com> wrote:
> Hi Ezequiel:
>
> I'm using GCC 4.6.3
>

Please, avoid top posting as it makes very difficult to follow the discussion
(and people around here hate it).

Also, in the future when fixing warnings you may want to add the warning message
to the commit message.

Anyway, I don't really know why are you getting that (wrong) warning,
but I don't think the solution is to add the 'unused' attribute.

Hope this helps,
Ezequiel.

--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
  2012-09-04 10:01     ` Ezequiel Garcia
@ 2012-09-04 21:12       ` Andrew Morton
  2012-09-05  6:54         ` Luis G.F
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2012-09-04 21:12 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Luis G.F, linux-mm

On Tue, 4 Sep 2012 07:01:20 -0300
Ezequiel Garcia <elezegarcia@gmail.com> wrote:

> Also, in the future when fixing warnings you may want to add the warning message
> to the commit message.

Yes, please always quote the messages in the changelog.

> Anyway, I don't really know why are you getting that (wrong) warning,
> but I don't think the solution is to add the 'unused' attribute.

And yes, let's not work around compiler problems too eagerly.  We _do_
occasionally work around bogus warnings, but only long-established ones
which we see no other way of fixing.

In this case, it might be that these functions are indeed unused with
certain Kconfig combinations.  For example and from inspection,
CONFIG_PROCFS=n, CONFIG_DEBUG_FS=n, CONFIG_COMPACTION=y might cause
such a warning?

Also, please don't directly use __attribute__((unused)) - we have
various helper macros in include/linux/compiler*.h for this.

--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] mm: Fix unused function warnings in vmstat.c
  2012-09-04 21:12       ` Andrew Morton
@ 2012-09-05  6:54         ` Luis G.F
  0 siblings, 0 replies; 6+ messages in thread
From: Luis G.F @ 2012-09-05  6:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ezequiel Garcia, linux-mm

Hi Andrew:

2012/9/4 Andrew Morton <akpm@linux-foundation.org>:
> On Tue, 4 Sep 2012 07:01:20 -0300
> Ezequiel Garcia <elezegarcia@gmail.com> wrote:
>
>> Also, in the future when fixing warnings you may want to add the warning message
>> to the commit message.
>
> Yes, please always quote the messages in the changelog.
>
>> Anyway, I don't really know why are you getting that (wrong) warning,
>> but I don't think the solution is to add the 'unused' attribute.
>
> And yes, let's not work around compiler problems too eagerly.  We _do_
> occasionally work around bogus warnings, but only long-established ones
> which we see no other way of fixing.
>
> In this case, it might be that these functions are indeed unused with
> certain Kconfig combinations.  For example and from inspection,
> CONFIG_PROCFS=n, CONFIG_DEBUG_FS=n, CONFIG_COMPACTION=y might cause
> such a warning?
>

I generate a complete random conf (with make randconfig) and the
problem with warnings is that
CONFIG_PROC_FS is undefined but CONFIG_COMPACTION=y (as you say).That's create
certain scenario where the variables are defined but never used.


> Also, please don't directly use __attribute__((unused)) - we have
> various helper macros in include/linux/compiler*.h for this.

--
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	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-05  6:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04  9:22 [PATCH 1/1] mm: Fix unused function warnings in vmstat.c Luis Gonzalez Fernandez
2012-09-04  9:44 ` Ezequiel Garcia
2012-09-04  9:51   ` Luis G.F
2012-09-04 10:01     ` Ezequiel Garcia
2012-09-04 21:12       ` Andrew Morton
2012-09-05  6:54         ` Luis G.F

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).