Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Define a prologue/epilogue for CTASSERTs using local...



details:   https://anonhg.NetBSD.org/src/rev/06fdbbe80fd4
branches:  trunk
changeset: 789984:06fdbbe80fd4
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Sep 14 13:46:30 2013 +0000

description:
Define a prologue/epilogue for CTASSERTs using local variables (to avoid
warnings about decalarations of localy defined but unused types)

diffstat:

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

diffs (28 lines):

diff -r ac9e323934c4 -r 06fdbbe80fd4 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Sat Sep 14 13:20:45 2013 +0000
+++ b/sys/sys/cdefs.h   Sat Sep 14 13:46:30 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.110 2013/09/10 12:54:14 gsutre Exp $       */
+/*     $NetBSD: cdefs.h,v 1.111 2013/09/14 13:46:30 martin Exp $       */
 
 /*
  * Copyright (c) 1991, 1993
@@ -152,6 +152,18 @@
 #define        __CTASSERT1(x, y, z)    typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1]
 
 /*
+ * Provide a prologue/epilogue for __CTASSERT uses within a local function
+ * to supress warnings about unused local typedefs
+ */
+#if __GNUC_PREREQ__(4, 8)
+#define        __CT_LOCAL_PROLOGUE     _Pragma("GCC diagnostic push")  _Pragma("GCC diagnostic ignored \"-Wunused-local-typedefs\"")
+#define        __CT_LOCAL_EPILOGUE     _Pragma("GCC diagnostic pop")
+#else
+#define        __CT_LOCAL_PROLOGUE
+#define        __CT_LOCAL_EPILOGUE
+#endif
+
+/*
  * The following macro is used to remove const cast-away warnings
  * from gcc -Wcast-qual; it should be used with caution because it
  * can hide valid errors; in particular most valid uses are in



Home | Main Index | Thread Index | Old Index