X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fcast.h;h=1e33857c1e3afa0a879512378df55694ca3900bc;hb=c360fff4fd3e4a98cfe02441f43c27725cead44b;hp=30927899c8bfb81dee56d509d16d7a5a3a72f52e;hpb=0b0a278699196c25f4cf0f690e21c5aea2ccabfb;p=pspp diff --git a/src/libpspp/cast.h b/src/libpspp/cast.h index 30927899c8..1e33857c1e 100644 --- a/src/libpspp/cast.h +++ b/src/libpspp/cast.h @@ -76,6 +76,13 @@ above, can easily be devised. */ #define CHECK_POINTER_COMPATIBILITY(A, B) ((void) sizeof ((A) == (B))) +/* Equivalent to casting POINTER to TYPE, but also issues a + warning if the cast changes anything other than an outermost + "const" or "volatile" qualifier. */ +#define CONST_CAST(TYPE, POINTER) \ + (CHECK_POINTER_HAS_TYPE (POINTER, TYPE), \ + (TYPE) (POINTER)) + /* Given POINTER, a pointer to the given MEMBER within structure STRUCT, returns the address of the STRUCT. */ #define UP_CAST(POINTER, STRUCT, MEMBER) \