mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-12-28 01:50:51 +00:00
Allow building lib with gcc/clang
Needed when using ...libtcc1-usegcc=yes in lib/Makefile. lib/bcheck.c: Add __clang__ for pragma diagnostic lib/bt-log.c: Add pragma diagnostic as in lib/bcheck.c lib/builtin.c: Add a lot of alias code to allow building with gcc/clang lib/stdatomic.c: Same as lib/builtin.c lib/tcov.c: Avoid clang compiler warning
This commit is contained in:
@@ -115,11 +115,18 @@ ATOMIC_GEN(uint32_t, 4, "l")
|
||||
ATOMIC_GEN(uint64_t, 8, "q")
|
||||
#endif
|
||||
|
||||
void __atomic_signal_fence (int memorder)
|
||||
/* uses alias to allow building with gcc/clang */
|
||||
#ifdef __TINYC__
|
||||
#define ATOMIC(x) __atomic_##x
|
||||
#else
|
||||
#define ATOMIC(x) __tcc_atomic_##x
|
||||
#endif
|
||||
|
||||
void ATOMIC(signal_fence) (int memorder)
|
||||
{
|
||||
}
|
||||
|
||||
void __atomic_thread_fence (int memorder)
|
||||
void ATOMIC(thread_fence) (int memorder)
|
||||
{
|
||||
#if defined __i386__
|
||||
__asm__ volatile("lock orl $0, (%esp)");
|
||||
@@ -134,7 +141,7 @@ void __atomic_thread_fence (int memorder)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool __atomic_is_lock_free(size_t size, void *ptr)
|
||||
bool ATOMIC(is_lock_free) (unsigned long size, const volatile void *ptr)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
@@ -151,3 +158,9 @@ bool __atomic_is_lock_free(size_t size, void *ptr)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef __TINYC__
|
||||
void __atomic_signal_fence(int memorder) __attribute__((alias("__tcc_atomic_signal_fence")));
|
||||
void __atomic_thread_fence(int memorder) __attribute__((alias("__tcc_atomic_thread_fence")));
|
||||
bool __atomic_is_lock_free(unsigned long size, const volatile void *ptr) __attribute__((alias("__tcc_atomic_is_lock_free")));
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user