Define a prologue/epilogue for CTASSERTs using local variables (to avoid

warnings about decalarations of localy defined but unused types)
This commit is contained in:
martin 2013-09-14 13:46:30 +00:00
parent 16460541b2
commit cd2d3c18eb
1 changed files with 13 additions and 1 deletions

View File

@ -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
@ -151,6 +151,18 @@
#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z)
#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