Skip to content

Commit 8ebe656

Browse files
committed
__sync* are GCC/Clang atomic builtins supported on any platform
In file included from Source/GmmLib/Platform/GmmGen11Platform.cpp:23: In file included from Source/GmmLib/inc/Internal/Common/GmmLibInc.h:35: In file included from Source/GmmLib/inc/External/Common/GmmCachePolicy.h:332: Source/GmmLib/inc/External/Common/GmmCachePolicyCommon.h:74:13: error: control reaches end of non-void function [-Werror,-Wreturn-type] } ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:600:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type] } ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:635:5: error: expected 'while' in do/while loop else ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:616:9: note: to match this 'do' do ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:803:18: error: qualified reference to 'Context' is a constructor name rather than a type in this context GmmLib::Context::Context() ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:804:5: error: expected ';' after expression : ClientType(), ^ [...]
1 parent c272e0c commit 8ebe656

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Source/GmmLib/GlobalInfo/GmmInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ int32_t GmmLib::Context::IncrementRefCount()
937937
{
938938
int32_t *Ref = &RefCount;
939939

940-
#if defined(__linux__)
940+
#if defined(__GNUC__)
941941
// returns 0 only when registering the first client
942942
return (__sync_fetch_and_add(Ref, 1));
943943
#endif
@@ -972,7 +972,7 @@ int32_t GmmLib::Context::DecrementRefCount()
972972
{
973973
break;
974974
}
975-
#if defined(__linux__)
975+
#if defined(__GNUC__)
976976
} while(!__sync_bool_compare_and_swap(Ref, CurrentValue, TargetValue));
977977
#endif
978978
return TargetValue;

Source/GmmLib/inc/External/Common/GmmInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ namespace GmmLib
141141
{
142142
#if defined(_WIN32)
143143
return(InterlockedIncrement((LONG *)&RefCount) - 1); //InterLockedIncrement() returns incremented value
144-
#elif defined(__linux__)
144+
#elif defined(__GNUC__)
145145
return(__sync_fetch_and_add(&RefCount, 1));
146146
#endif
147147
}
@@ -163,7 +163,7 @@ namespace GmmLib
163163
}
164164
#if defined(_WIN32)
165165
} while (!(InterlockedCompareExchange((LONG *)&RefCount, TargetValue, CurrentValue) == CurrentValue));
166-
#elif defined(__linux__)
166+
#elif defined(__GNUC__)
167167
} while (!__sync_bool_compare_and_swap(&RefCount, CurrentValue, TargetValue));
168168
#endif
169169

0 commit comments

Comments
 (0)