summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2018-07-18 13:58:49 +0200
committerBas Nieuwenhuizen <[email protected]>2018-07-20 12:09:19 +0200
commitcc10b34e9ed1104f4ceb88a49a42e1d6a743d52f (patch)
tree92a3778495fecce8eb617f5abaacf87908c96f2a /src
parent8cacf38f527d42e41441ef8c25d95d4b2f4e8602 (diff)
util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.
radv always needs it, so just check the header instead. Also do not declare the function if the variable is not set, so we get a nice compile error instead of failing to open a device at runtime. Fixes: b87ef9e606a "util: fix MSVC build issue in disk_cache.h" Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/util/disk_cache.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index f84840fb5ca..50bd9f41ac4 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -24,7 +24,7 @@
#ifndef DISK_CACHE_H
#define DISK_CACHE_H
-#ifdef ENABLE_SHADER_CACHE
+#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <assert.h>
@@ -88,10 +88,10 @@ disk_cache_format_hex_id(char *buf, const uint8_t *hex_id, unsigned size)
return buf;
}
+#ifdef HAVE_DLFCN_H
static inline bool
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
{
-#ifdef ENABLE_SHADER_CACHE
Dl_info info;
struct stat st;
if (!dladdr(ptr, &info) || !info.dli_fname) {
@@ -102,10 +102,8 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
}
*timestamp = st.st_mtime;
return true;
-#else
- return false;
-#endif
}
+#endif
/* Provide inlined stub functions if the shader cache is disabled. */