LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] extend the set of "__attribute__" shortcut macros
@ 2007-01-18 17:35 Robert P. J. Day
2007-01-18 17:58 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2007-01-18 17:35 UTC (permalink / raw)
To: Linux kernel mailing list; +Cc: Roman Zippel, Ralf Baechle
Extend the set of "__attribute__" shortcut macros, and remove
identical (and now superfluous) definitions from a couple of source
files.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
---
based on a page at robert love's blog:
http://rlove.org/log/2005102601
extend the set of shortcut macros defined in compiler-gcc.h with the
following:
#define __packed __attribute__((packed))
#define __weak __attribute__((weak))
#define __naked __attribute__((naked))
#define __noreturn __attribute__((noreturn))
#define __pure __attribute__((pure))
#define __aligned(x) __attribute__((aligned(x)))
#define __printf(a,b) __attribute__((format(printf,a,b)))
once these are in place, it's up to subsystem maintainers to decide
if they want to take advantage of them. there is already a strong
precedent for using shortcuts like this in the source tree.
the ones that might give people pause are "__aligned" and
"__printf", but shortcuts for both of those are already in use, and in
some ways very confusingly. note the two very different definitions
for a macro named "ALIGNED":
drivers/net/sgiseeq.c:#define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf))
drivers/scsi/ultrastor.c:#define ALIGNED(x) __attribute__((aligned(x)))
also:
include/acpi/platform/acgcc.h:
#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
given the precedent, then, it seems logical to at least standardize on
a consistent set of these macros.
arch/mips/mm/cache.c | 2 --
fs/hfs/hfs.h | 2 --
fs/hfsplus/hfsplus_raw.h | 2 --
include/linux/compiler-gcc.h | 7 +++++++
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 1f954a2..31819c5 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -107,8 +107,6 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
}
}
-#define __weak __attribute__((weak))
-
static char cache_panic[] __initdata = "Yeee, unsupported cache architecture.";
void __init cpu_cache_init(void)
diff --git a/fs/hfs/hfs.h b/fs/hfs/hfs.h
index 88099ab..1445e3a 100644
--- a/fs/hfs/hfs.h
+++ b/fs/hfs/hfs.h
@@ -83,8 +83,6 @@
/*======== HFS structures as they appear on the disk ========*/
-#define __packed __attribute__ ((packed))
-
/* Pascal-style string of up to 31 characters */
struct hfs_name {
u8 len;
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
index 4920553..fe99fe8 100644
--- a/fs/hfsplus/hfsplus_raw.h
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -15,8 +15,6 @@
#include <linux/types.h>
-#define __packed __attribute__ ((packed))
-
/* Some constants */
#define HFSPLUS_SECTOR_SIZE 512
#define HFSPLUS_SECTOR_SHIFT 9
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 6e1c44a..9008eab 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -27,6 +27,13 @@
#define __inline__ __inline__ __attribute__((always_inline))
#define __inline __inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
+#define __packed __attribute__((packed))
+#define __weak __attribute__((weak))
+#define __naked __attribute__((naked))
+#define __noreturn __attribute__((noreturn))
+#define __pure __attribute__((pure))
+#define __aligned(x) __attribute__((aligned(x)))
+#define __printf(a,b) __attribute__((format(printf,a,b)))
#define noinline __attribute__((noinline))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] extend the set of "__attribute__" shortcut macros
2007-01-18 17:35 [PATCH] extend the set of "__attribute__" shortcut macros Robert P. J. Day
@ 2007-01-18 17:58 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2007-01-18 17:58 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Linux kernel mailing list, Roman Zippel
On Thu, Jan 18, 2007 at 12:35:18PM -0500, Robert P. J. Day wrote:
> Extend the set of "__attribute__" shortcut macros, and remove
> identical (and now superfluous) definitions from a couple of source
> files.
>
> Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Nice clenaup, thanks!
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-18 17:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-18 17:35 [PATCH] extend the set of "__attribute__" shortcut macros Robert P. J. Day
2007-01-18 17:58 ` Ralf Baechle
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).