X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Futil.h;h=57527fcc686edbfcedcf5149ecf369a69e123758;hb=a0ae0b6e8360116c8843325922c3346ab8f208c7;hp=809ae9c5d9fcf59c7e0f30104c6243568c499c17;hpb=d41d4b714d29091dd502dd8705ef489467e11a43;p=openvswitch diff --git a/lib/util.h b/lib/util.h index 809ae9c5..57527fcc 100644 --- a/lib/util.h +++ b/lib/util.h @@ -61,6 +61,16 @@ #define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0) #endif +/* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes + * anything other than an outermost "const" or "volatile" qualifier. + * + * The cast to int is present only to suppress an "expression using sizeof + * bool" warning from "sparse" (see + * http://permalink.gmane.org/gmane.comp.parsers.sparse/2967). */ +#define CONST_CAST(TYPE, POINTER) \ + ((void) sizeof ((int) ((POINTER) == (TYPE) (POINTER))), \ + (TYPE) (POINTER)) + extern const char *program_name; extern const char *subprogram_name; @@ -219,6 +229,9 @@ char *dir_name(const char *file_name); char *base_name(const char *file_name); char *abs_file_name(const char *dir, const char *file_name); +char *xreadlink(const char *filename); +char *follow_symlinks(const char *filename); + void ignore(bool x OVS_UNUSED); int log_2_floor(uint32_t); int log_2_ceil(uint32_t);