Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add __strict_weak_alias(), the type-safe alternative...



details:   https://anonhg.NetBSD.org/src/rev/c20760550cb7
branches:  trunk
changeset: 768439:c20760550cb7
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Tue Aug 16 23:30:24 2011 +0000

description:
Add __strict_weak_alias(), the type-safe alternative to __weak_alias().

diffstat:

 sys/sys/cdefs.h |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 173efead9ec2 -r c20760550cb7 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Tue Aug 16 22:33:38 2011 +0000
+++ b/sys/sys/cdefs.h   Tue Aug 16 23:30:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.86 2011/06/23 12:16:03 nonaka Exp $        */
+/*     $NetBSD: cdefs.h,v 1.87 2011/08/16 23:30:24 dyoung Exp $        */
 
 /*
  * Copyright (c) 1991, 1993
@@ -63,6 +63,14 @@
 #include <sys/cdefs_aout.h>
 #endif
 
+#ifdef __GNUC__
+#define        __strict_weak_alias(alias,sym)                                  \
+       __unused static __typeof__(alias) *__weak_alias_##alias = &sym; \
+       __weak_alias(alias,sym)
+#else
+#define        __strict_weak_alias(alias,sym) __weak_alias(alias,sym)
+#endif
+
 /*
  * Optional marker for size-optimised MD calling convention.
  */



Home | Main Index | Thread Index | Old Index