From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-kernel@lists.codethink.co.uk
Cc: Ben Dooks <ben.dooks@codethink.co.uk>, linux-kernel@vger.kernel.org
Subject: [PATCH] lib: lcm.c: make __attribute_const__ consistent
Date: Thu, 9 Jun 2016 12:31:32 +0100 [thread overview]
Message-ID: <1465471892-18604-1-git-send-email-ben.dooks@codethink.co.uk> (raw)
The lcm and lcm_not_zero() are producing sparse warnings due to
the use of __attribute_const__ in the header but not in the lcm.c
file. Add the __attribute_const__ to lcm.c and make the header
consistent with using the attribute before the function to fix
the following sparse warnings:
lib/lcm.c:7:15: error: symbol 'lcm' redeclared with different type (originally declared at include/linux/lcm.h:6) - different modifiers
lib/lcm.c:16:15: error: symbol 'lcm_not_zero' redeclared with different type (originally declared at include/linux/lcm.h:7) - different modifiers
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
Cc: linux-kernel@vger.kernel.org
Note, this makes scripts/get_maintainer.pl go:
Bad divisor in main::vcs_assign: 0
Bad divisor in main::vcs_assign: 0
---
include/linux/lcm.h | 4 ++--
lib/lcm.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/lcm.h b/include/linux/lcm.h
index 1ce79a7..a1bb0bb 100644
--- a/include/linux/lcm.h
+++ b/include/linux/lcm.h
@@ -3,7 +3,7 @@
#include <linux/compiler.h>
-unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__;
-unsigned long lcm_not_zero(unsigned long a, unsigned long b) __attribute_const__;
+unsigned long __attribute_const__ lcm(unsigned long a, unsigned long b);
+unsigned long __attribute_const__ lcm_not_zero(unsigned long a, unsigned long b);
#endif /* _LCM_H */
diff --git a/lib/lcm.c b/lib/lcm.c
index 03d7fcb..ced8532 100644
--- a/lib/lcm.c
+++ b/lib/lcm.c
@@ -4,7 +4,7 @@
#include <linux/lcm.h>
/* Lowest common multiple */
-unsigned long lcm(unsigned long a, unsigned long b)
+unsigned long __attribute_const__ lcm(unsigned long a, unsigned long b)
{
if (a && b)
return (a / gcd(a, b)) * b;
@@ -13,7 +13,7 @@ unsigned long lcm(unsigned long a, unsigned long b)
}
EXPORT_SYMBOL_GPL(lcm);
-unsigned long lcm_not_zero(unsigned long a, unsigned long b)
+unsigned long __attribute_const__ lcm_not_zero(unsigned long a, unsigned long b)
{
unsigned long l = lcm(a, b);
--
2.8.1
reply other threads:[~2016-06-09 11:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465471892-18604-1-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).