Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some minor fixes for C++23 compilation errors. #8422

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/runtime/d3d12compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ WEAK void d3d12_free(void *p) {
free(p);
}

template<typename T>
WEAK T zero_struct() {
T zero = {};
return zero;
}

template<typename T>
WEAK T *malloct() {
TRACELOG;
Expand All @@ -244,12 +250,6 @@ WEAK T *malloct() {
return p;
}

template<typename T>
WEAK T zero_struct() {
T zero = {};
return zero;
}

#define hashmap_malloc(user_context, size) d3d12_malloc(size)
#define hashmap_free(user_context, memory) d3d12_free(memory)
#include "hashmap.h"
Expand Down
30 changes: 15 additions & 15 deletions src/runtime/runtime_atomics.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ ALWAYS_INLINE T atomic_fetch_add_acquire_release(T *addr, T val) {
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_add_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_add_sequentially_consistent(T *addr, TV val) {
return __sync_fetch_and_add(addr, val);
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_sub_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_sub_sequentially_consistent(T *addr, TV val) {
return __sync_fetch_and_sub(addr, val);
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_or_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_or_sequentially_consistent(T *addr, TV val) {
return __sync_fetch_and_or(addr, val);
}

template<typename T>
ALWAYS_INLINE T atomic_add_fetch_sequentially_consistent(T *addr, T val) {
template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE TV atomic_add_fetch_sequentially_consistent(T *addr, TV val) {
return __sync_add_and_fetch(addr, val);
}

template<typename T>
ALWAYS_INLINE T atomic_sub_fetch_sequentially_consistent(T *addr, T val) {
template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE TV atomic_sub_fetch_sequentially_consistent(T *addr, TV val) {
return __sync_sub_and_fetch(addr, val);
}

Expand Down Expand Up @@ -103,7 +103,7 @@ ALWAYS_INLINE T atomic_fetch_and_release(T *addr, T val) {
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_and_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_and_sequentially_consistent(T *addr, TV val) {
return __sync_fetch_and_and(addr, val);
}

Expand Down Expand Up @@ -165,27 +165,27 @@ ALWAYS_INLINE T atomic_fetch_add_acquire_release(T *addr, T val) {
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_add_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_add_sequentially_consistent(T *addr, TV val) {
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_sub_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_sub_sequentially_consistent(T *addr, TV val) {
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
}

template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE T atomic_fetch_or_sequentially_consistent(T *addr, TV val) {
ALWAYS_INLINE TV atomic_fetch_or_sequentially_consistent(T *addr, TV val) {
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
}

template<typename T>
ALWAYS_INLINE T atomic_add_fetch_sequentially_consistent(T *addr, T val) {
template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE TV atomic_add_fetch_sequentially_consistent(T *addr, TV val) {
return __atomic_add_fetch(addr, val, __ATOMIC_SEQ_CST);
}

template<typename T>
ALWAYS_INLINE T atomic_sub_fetch_sequentially_consistent(T *addr, T val) {
template<typename T, typename TV = typename remove_volatile<T>::type>
ALWAYS_INLINE TV atomic_sub_fetch_sequentially_consistent(T *addr, TV val) {
return __atomic_sub_fetch(addr, val, __ATOMIC_SEQ_CST);
}

Expand Down
Loading