Message ID | 20180315150814.9412-7-bart.vanassche@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 15/03/2018 11:08 PM, Bart Van Assche wrote: > This patch does not change any functionality. > > Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Hi Bart, This patch looks good to me. A question is, does GCC later than 4.3 supports such annotation like '__maybe_unused' ? Thanks. Coly Li > --- > drivers/md/bcache/bset.c | 4 ++-- > drivers/md/bcache/journal.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c > index e56d3ecdbfcb..579c696a5fe0 100644 > --- a/drivers/md/bcache/bset.c > +++ b/drivers/md/bcache/bset.c > @@ -1072,7 +1072,7 @@ EXPORT_SYMBOL(bch_btree_iter_init); > static inline struct bkey *__bch_btree_iter_next(struct btree_iter *iter, > btree_iter_cmp_fn *cmp) > { > - struct btree_iter_set unused; > + struct btree_iter_set b __maybe_unused; > struct bkey *ret = NULL; > > if (!btree_iter_end(iter)) { > @@ -1087,7 +1087,7 @@ static inline struct bkey *__bch_btree_iter_next(struct btree_iter *iter, > } > > if (iter->data->k == iter->data->end) > - heap_pop(iter, unused, cmp); > + heap_pop(iter, b, cmp); > else > heap_sift(iter, 0, cmp); > } > diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c > index 1b736b860739..605368ff13c9 100644 > --- a/drivers/md/bcache/journal.c > +++ b/drivers/md/bcache/journal.c > @@ -493,7 +493,7 @@ static void journal_reclaim(struct cache_set *c) > struct cache *ca; > uint64_t last_seq; > unsigned iter, n = 0; > - atomic_t p; > + atomic_t p __maybe_unused; > > atomic_long_inc(&c->reclaim); > >
On Fri, 2018-03-16 at 00:20 +0800, Coly Li wrote: > On 15/03/2018 11:08 PM, Bart Van Assche wrote: > > This patch does not change any functionality. > > > > Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> > > Hi Bart, > > This patch looks good to me. A question is, does GCC later than 4.3 > supports such annotation like '__maybe_unused' ? Hello Coly, You may want to have a look at the following commit: commit 0d7ebbbc6eaa5539f78ab20ed6ff1725a4e332ef Author: David Rientjes <rientjes@google.com> Date: Wed May 9 02:35:27 2007 -0700 compiler: introduce __used and __maybe_unused __used is defined to be __attribute__((unused)) for all pre-3.3 gcc compilers to suppress warnings for unused functions because perhaps they are referenced only in inline assembly. It is defined to be __attribute__((used)) for gcc 3.3 and later so that the code is still emitted for such functions. Thanks, Bart.
On 16/03/2018 12:50 AM, Bart Van Assche wrote: > On Fri, 2018-03-16 at 00:20 +0800, Coly Li wrote: >> On 15/03/2018 11:08 PM, Bart Van Assche wrote: >>> This patch does not change any functionality. >>> >>> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> >> >> Hi Bart, >> >> This patch looks good to me. A question is, does GCC later than 4.3 >> supports such annotation like '__maybe_unused' ? > > Hello Coly, > > You may want to have a look at the following commit: > > commit 0d7ebbbc6eaa5539f78ab20ed6ff1725a4e332ef > Author: David Rientjes <rientjes@google.com> > Date: Wed May 9 02:35:27 2007 -0700 > > compiler: introduce __used and __maybe_unused > > __used is defined to be __attribute__((unused)) for all pre-3.3 gcc > compilers to suppress warnings for unused functions because perhaps they > are referenced only in inline assembly. It is defined to be > __attribute__((used)) for gcc 3.3 and later so that the code is still > emitted for such functions. > Hi Bart, Thanks for the hint, I don't need to worry about it. Reviewed-by: Coly Li <colyli@suse.de> Coly Li
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index e56d3ecdbfcb..579c696a5fe0 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c @@ -1072,7 +1072,7 @@ EXPORT_SYMBOL(bch_btree_iter_init); static inline struct bkey *__bch_btree_iter_next(struct btree_iter *iter, btree_iter_cmp_fn *cmp) { - struct btree_iter_set unused; + struct btree_iter_set b __maybe_unused; struct bkey *ret = NULL; if (!btree_iter_end(iter)) { @@ -1087,7 +1087,7 @@ static inline struct bkey *__bch_btree_iter_next(struct btree_iter *iter, } if (iter->data->k == iter->data->end) - heap_pop(iter, unused, cmp); + heap_pop(iter, b, cmp); else heap_sift(iter, 0, cmp); } diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 1b736b860739..605368ff13c9 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -493,7 +493,7 @@ static void journal_reclaim(struct cache_set *c) struct cache *ca; uint64_t last_seq; unsigned iter, n = 0; - atomic_t p; + atomic_t p __maybe_unused; atomic_long_inc(&c->reclaim);
This patch does not change any functionality. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- drivers/md/bcache/bset.c | 4 ++-- drivers/md/bcache/journal.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)