mirror of
https://github.com/yshui/picom.git
synced 2025-02-17 15:56:21 -05:00
Add compiler dependent macros for thread_local
Also add stdc-predef.h because __STDC_NO_THREADS__ is defined there. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e19e78d974
commit
4040ad259d
1 changed files with 12 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
|||
// Copyright (c) 2018 Yuxuan Shui <yshuiv7@gmail.com>
|
||||
#pragma once
|
||||
|
||||
#include <stdc-predef.h>
|
||||
|
||||
#define auto __auto_type
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
@ -79,3 +81,13 @@
|
|||
#else
|
||||
# define unreachable do {} while(0)
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_NO_THREADS__
|
||||
# include <threads.h>
|
||||
#elif __STDC_VERSION__ >= 201112L
|
||||
# define thread_local _Thread_local
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define thread_local __thread
|
||||
#else
|
||||
# define thread_local _Pragma("GCC error \"No thread local storage support\"") __error__
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue