public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Tang <dt.tangr@gmail.com>
To: mmarek@suse.cz
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	trivial@kernel.org, Daniel Tang <dt.tangr@gmail.com>
Subject: [PATCH 2/2] Fix a build warning in scripts/mod/file2alias.c
Date: Sun,  9 Jun 2013 12:33:55 +1000	[thread overview]
Message-ID: <1370745235-12951-2-git-send-email-dt.tangr@gmail.com> (raw)
In-Reply-To: <1370745235-12951-1-git-send-email-dt.tangr@gmail.com>

On some systems, __used is already defined in sys/cdefs.h and causes
a build warning:

scripts/mod/file2alias.c:85:1: warning: "__used" redefined
In file included from /usr/include/stdio.h:64,
                 from scripts/mod/modpost.h:1,
		                  from scripts/mod/file2alias.c:13:
				  /usr/include/sys/cdefs.h:146:1: warning: this is the location of the previous definition

This adds an extra check before defining the __used macro to see if
the macro was already defined elsewhere.

Signed-off-by: Daniel Tang <dt.tangr@gmail.com>
---
 scripts/mod/file2alias.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 45f9a33..ab55456 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -79,10 +79,12 @@ struct devtable **__start___devtable, **__stop___devtable;
 extern struct devtable *__start___devtable[], *__stop___devtable[];
 #endif /* __MACH__ */
 
-#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
-# define __used			__attribute__((__unused__))
-#else
-# define __used			__attribute__((__used__))
+#if !defined(__used)
+# if __GNUC__ == 3 && __GNUC_MINOR__ < 3
+#  define __used			__attribute__((__unused__))
+# else
+#  define __used			__attribute__((__used__))
+# endif
 #endif
 
 /* Define a variable f that holds the value of field f of struct devid
-- 
1.8.1.3


  reply	other threads:[~2013-06-09  2:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09  2:33 [PATCH 1/2] Fix a build warning in scripts/sortextable.h Daniel Tang
2013-06-09  2:33 ` Daniel Tang [this message]
2013-07-03 12:31   ` [PATCH 2/2] Fix a build warning in scripts/mod/file2alias.c Michal Marek
2013-07-03 12:06 ` [PATCH 1/2] Fix a build warning in scripts/sortextable.h Michal Marek
2013-07-03 12:07   ` Michal Marek
2013-07-03 12:12     ` Daniel Tang
2013-07-03 12:28       ` Michal Marek
2013-07-03 12:37         ` Daniel Tang
2013-07-03 12:57           ` Michal Marek
2013-07-03 13:15             ` Michal Marek

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=1370745235-12951-2-git-send-email-dt.tangr@gmail.com \
    --to=dt.tangr@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=trivial@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