Add an __UNVOLATILE() macro. It should be used with caution, but

it is required to use this whenever you want to pass a pointer to
volatile data e.g. to memset().  This allows us to still compile
files doing such things with -Wcast-qual and get the rest of the
code checked under that option.

Based on suggestions from tron and christos.
This commit is contained in:
he 2005-06-02 14:31:38 +00:00
parent 096dae56ce
commit 26318fe161
1 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cdefs.h,v 1.58 2004/12/11 05:59:00 christos Exp $ */
/* $NetBSD: cdefs.h,v 1.59 2005/06/02 14:31:38 he Exp $ */
/*
* Copyright (c) 1991, 1993
@ -146,6 +146,15 @@
*/
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
/*
* The following macro is used to remove the volatile cast-away warnings
* from gcc -Wcast-qual; as above it should be used with caution
* because it can hide valid errors or warnings. Valid uses include
* making it possible to pass a volatile pointer to memset().
* For the same reasons as above, we use unsigned long and not intptr_t.
*/
#define __UNVOLATILE(a) ((void *)(unsigned long)(volatile void *)(a))
/*
* GCC2 provides __extension__ to suppress warnings for various GNU C
* language extensions under "-ansi -pedantic".