How to remopve "volatile" qualifier from pointer without warning from gcc?

mdf at FreeBSD.org mdf at FreeBSD.org
Sun Oct 30 16:12:55 UTC 2011


2011/10/30 Lev Serebryakov <lev at freebsd.org>:
> Hello, Hackers.
>
>  I need to pass "volatile void *" to API function, which takes
> "void*". gcc (on FreeBSD 8.2) emits warning, and as in FreeBSD-styed
> code warnings are treated as errors, program could not be built.
>
>  Manual casting gives warning, too...

See the __DEVOLATILE() hack that will do sufficient casting to silence
the compiler.  As with any compiler warning, silencing it incorrectly
comes with a risk...

Cheers,
matthew


More information about the freebsd-hackers mailing list