X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Furcu%2Fcompiler.h;h=48211293417131c6ff73d0d107de84c4284d9589;hb=72d24c88ee075c8368fe57ee7e8fc66d99ce7e39;hp=0de713adc1a03f4affc48eda0efd03c1b7c1a470;hpb=dd8987a4052e51b87d2a399fec8997c5192f362f;p=urcu.git diff --git a/include/urcu/compiler.h b/include/urcu/compiler.h index 0de713a..4821129 100644 --- a/include/urcu/compiler.h +++ b/include/urcu/compiler.h @@ -1,22 +1,12 @@ +// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers +// +// SPDX-License-Identifier: LGPL-2.1-or-later + #ifndef _URCU_COMPILER_H #define _URCU_COMPILER_H /* - * compiler.h - * * Compiler definitions. - * - * Copyright (c) 2009 Mathieu Desnoyers - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. */ #include /* for offsetof */ @@ -25,10 +15,16 @@ # include /* for std::remove_cv */ #endif +#include + #define caa_likely(x) __builtin_expect(!!(x), 1) #define caa_unlikely(x) __builtin_expect(!!(x), 0) -#define cmm_barrier() __asm__ __volatile__ ("" : : : "memory") +#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS +# define cmm_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST) +#else +# define cmm_barrier() __asm__ __volatile__ ("" : : : "memory") +#endif /* * Instruct the compiler to perform only a single access to a variable