]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Fix a build warning in scripts/mod/file2alias.c
authorDaniel Tang <dt.tangr@gmail.com>
Sun, 9 Jun 2013 02:33:55 +0000 (12:33 +1000)
committerMichal Marek <mmarek@suse.cz>
Wed, 3 Jul 2013 12:30:40 +0000 (14:30 +0200)
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>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/mod/file2alias.c

index 45f9a3377dcd8d60f1df08542ca804537e443225..ab554564569aab61c9da76ae6ab92b08553cd04c 100644 (file)
@@ -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