From b66282d4430c852936a0a317b29474ae1bf9e061 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 31 Aug 2022 02:05:35 +0800 Subject: [PATCH] gallium/hud: Fixes compile error in hud/hud_context.c: ../../src/gallium/auxiliary/hud/hud_context.c:1017:1: error: static declaration of 'access' follows non-static declaration These error will shown when any header #include Signed-off-by: Yonggang Luo Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/auxiliary/hud/hud_context.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 75a0a80..b76981f 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -37,6 +37,20 @@ #include #include +#include "util/detect_os.h" + +#if DETECT_OS_WINDOWS +#include + +/** + * Access flags W_OK are defined by mingw, but not defined by MSVC, we defined it according to + * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess + */ +#ifndef W_OK +#define W_OK 02 +#endif +#endif /* DETECT_OS_WINDOWS */ + #include "hud/hud_context.h" #include "hud/hud_private.h" @@ -1011,14 +1025,7 @@ static void strcat_without_spaces(char *dst, const char *src) } -#ifdef PIPE_OS_WINDOWS -#define W_OK 0 -static int -access(const char *pathname, int mode) -{ - /* no-op */ - return 0; -} +#if DETECT_OS_WINDOWS #define PATH_SEP "\\" -- 2.7.4