summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/slang.h7
-rw-r--r--source/compiler-core/windows/slang-win-visual-studio-util.cpp6
-rw-r--r--source/core/slang-allocator.h6
-rw-r--r--source/core/slang-platform.cpp2
-rw-r--r--source/core/slang-secure-crt.h2
5 files changed, 12 insertions, 11 deletions
diff --git a/include/slang.h b/include/slang.h
index 2ba7150ec..24db0a6ff 100644
--- a/include/slang.h
+++ b/include/slang.h
@@ -227,10 +227,9 @@ convention for interface methods.
#if defined(_MSC_VER)
#define SLANG_DLL_EXPORT __declspec(dllexport)
#else
- #if 0 && __GNUC__ >= 4
-// Didn't work on latest gcc on linux.. so disable for now
-// https://gcc.gnu.org/wiki/Visibility
- #define SLANG_DLL_EXPORT __attribute__((dllexport))
+ #if SLANG_WINDOWS_FAMILY
+ #define SLANG_DLL_EXPORT \
+ __attribute__((dllexport)) __attribute__((__visibility__("default")))
#else
#define SLANG_DLL_EXPORT __attribute__((__visibility__("default")))
#endif
diff --git a/source/compiler-core/windows/slang-win-visual-studio-util.cpp b/source/compiler-core/windows/slang-win-visual-studio-util.cpp
index e97a998d6..21830bd47 100644
--- a/source/compiler-core/windows/slang-win-visual-studio-util.cpp
+++ b/source/compiler-core/windows/slang-win-visual-studio-util.cpp
@@ -69,7 +69,7 @@ static SlangResult _readRegistryKey(const char* path, const char* keyName, Strin
// Make easier to set up the array
-static DownstreamCompilerMatchVersion _makeVersion(int main)
+[[maybe_unused]] static DownstreamCompilerMatchVersion _makeVersion(int main)
{
DownstreamCompilerMatchVersion version;
version.type = SLANG_PASS_THROUGH_VISUAL_STUDIO;
@@ -77,7 +77,7 @@ static DownstreamCompilerMatchVersion _makeVersion(int main)
return version;
}
-static DownstreamCompilerMatchVersion _makeVersion(int main, int dot)
+[[maybe_unused]] static DownstreamCompilerMatchVersion _makeVersion(int main, int dot)
{
DownstreamCompilerMatchVersion version;
version.type = SLANG_PASS_THROUGH_VISUAL_STUDIO;
@@ -149,6 +149,7 @@ static SlangResult _parseVersion(UnownedStringSlice versionString, SemanticVersi
/* static */ DownstreamCompilerMatchVersion WinVisualStudioUtil::getCompiledVersion()
{
+#ifdef _MSC_VER
// Get the version of visual studio used to compile this source
// Not const, because otherwise we get an warning/error about constant expression...
uint32_t version = _MSC_VER;
@@ -247,6 +248,7 @@ static SlangResult _parseVersion(UnownedStringSlice versionString, SemanticVersi
SLANG_PASS_THROUGH_VISUAL_STUDIO,
MatchSemanticVersion::makeFuture());
}
+#endif
// Unknown version
return DownstreamCompilerMatchVersion(SLANG_PASS_THROUGH_VISUAL_STUDIO, MatchSemanticVersion());
diff --git a/source/core/slang-allocator.h b/source/core/slang-allocator.h
index 03cfabe40..38d46c9bd 100644
--- a/source/core/slang-allocator.h
+++ b/source/core/slang-allocator.h
@@ -4,7 +4,7 @@
#include "slang-common.h"
#include <stdlib.h>
-#ifdef _MSC_VER
+#if SLANG_WINDOWS_FAMILY
#include <malloc.h>
#endif
@@ -14,7 +14,7 @@ namespace Slang
{
inline void* alignedAllocate(size_t size, size_t alignment)
{
-#ifdef _MSC_VER
+#if SLANG_WINDOWS_FAMILY
return _aligned_malloc(size, alignment);
#elif defined(__CYGWIN__)
return aligned_alloc(alignment, size);
@@ -27,7 +27,7 @@ inline void* alignedAllocate(size_t size, size_t alignment)
inline void alignedDeallocate(void* ptr)
{
-#ifdef _MSC_VER
+#if SLANG_WINDOWS_FAMILY
_aligned_free(ptr);
#else
free(ptr);
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index 79b883e39..51f6b97c7 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -157,7 +157,7 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
/* static */ void* SharedLibrary::findSymbolAddressByName(Handle handle, char const* name)
{
SLANG_ASSERT(handle);
- return GetProcAddress((HMODULE)handle, name);
+ return reinterpret_cast<void*>(GetProcAddress((HMODULE)handle, name));
}
/* static */ void SharedLibrary::appendPlatformFileName(
diff --git a/source/core/slang-secure-crt.h b/source/core/slang-secure-crt.h
index 57e38f0dd..607fc7a73 100644
--- a/source/core/slang-secure-crt.h
+++ b/source/core/slang-secure-crt.h
@@ -1,4 +1,4 @@
-#ifndef _MSC_VER
+#ifndef _WIN32
#ifndef SLANG_CORE_SECURE_CRT_H
#define SLANG_CORE_SECURE_CRT_H
#include <assert.h>