From: Mathieu Desnoyers Date: Wed, 8 Mar 2023 21:18:21 +0000 (-0500) Subject: Fix: c99: use __asm__ __volatile__ X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=742ac92a271c97c49bd79444594c0e8dfe099f9e;p=lttng-ust.git Fix: c99: use __asm__ __volatile__ Allow building with -std=c99 by using __asm__ __volatile__ rather than asm volatile. Signed-off-by: Mathieu Desnoyers Change-Id: I7d81d34e62c37f417b7d6deeec432e8794abf345 --- diff --git a/src/common/ringbuffer-clients/template.h b/src/common/ringbuffer-clients/template.h index 824c344d..fe8f8e02 100644 --- a/src/common/ringbuffer-clients/template.h +++ b/src/common/ringbuffer-clients/template.h @@ -74,7 +74,7 @@ static DEFINE_URCU_TLS(private_ctx_stack_t, private_ctx_stack); */ void RING_BUFFER_MODE_TEMPLATE_ALLOC_TLS(void) { - asm volatile ("" : : "m" (URCU_TLS(private_ctx_stack))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(private_ctx_stack))); } static inline uint64_t lib_ring_buffer_clock_read( diff --git a/src/common/ringbuffer/frontend_api.h b/src/common/ringbuffer/frontend_api.h index a697ed2e..e3507073 100644 --- a/src/common/ringbuffer/frontend_api.h +++ b/src/common/ringbuffer/frontend_api.h @@ -26,7 +26,7 @@ * Returns a nesting level >= 0 on success, -EPERM on failure (nesting * count too high). * - * asm volatile and "memory" clobber prevent the compiler from moving + * __asm__ __volatile__ and "memory" clobber prevent the compiler from moving * instructions out of the ring buffer nesting count. This is required to ensure * that probe side-effects which can cause recursion (e.g. unforeseen traps, * divisions by 0, ...) are triggered within the incremented nesting count diff --git a/src/common/ringbuffer/ring_buffer_frontend.c b/src/common/ringbuffer/ring_buffer_frontend.c index 817cc842..5dcc0be7 100644 --- a/src/common/ringbuffer/ring_buffer_frontend.c +++ b/src/common/ringbuffer/ring_buffer_frontend.c @@ -2582,7 +2582,7 @@ void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_ring_buffer_confi */ void lttng_ringbuffer_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(lib_ring_buffer_nesting))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(lib_ring_buffer_nesting))); } void lib_ringbuffer_signal_init(void) diff --git a/src/lib/lttng-ust-common/fd-tracker.c b/src/lib/lttng-ust-common/fd-tracker.c index 8638ea02..f5e6ed21 100644 --- a/src/lib/lttng-ust-common/fd-tracker.c +++ b/src/lib/lttng-ust-common/fd-tracker.c @@ -76,7 +76,7 @@ static int init_done; */ void lttng_ust_fd_tracker_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(ust_fd_mutex_nest))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(ust_fd_mutex_nest))); } /* diff --git a/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c b/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c index 48d37f81..479040d2 100644 --- a/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c +++ b/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c @@ -428,7 +428,7 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) static void lttng_ust_malloc_nesting_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(malloc_nesting))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(malloc_nesting))); } void lttng_ust_libc_wrapper_malloc_ctor(void) diff --git a/src/lib/lttng-ust/lttng-context-cgroup-ns.c b/src/lib/lttng-ust/lttng-context-cgroup-ns.c index 5accd2df..182d3966 100644 --- a/src/lib/lttng-ust/lttng-context-cgroup-ns.c +++ b/src/lib/lttng-ust/lttng-context-cgroup-ns.c @@ -157,7 +157,7 @@ error_find_context: */ void lttng_ust_cgroup_ns_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_cgroup_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_cgroup_ns))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)get_cgroup_ns(); } diff --git a/src/lib/lttng-ust/lttng-context-ipc-ns.c b/src/lib/lttng-ust/lttng-context-ipc-ns.c index 078e6461..6193d8ed 100644 --- a/src/lib/lttng-ust/lttng-context-ipc-ns.c +++ b/src/lib/lttng-ust/lttng-context-ipc-ns.c @@ -155,7 +155,7 @@ error_find_context: */ void lttng_ust_ipc_ns_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_ipc_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_ipc_ns))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)get_ipc_ns(); } diff --git a/src/lib/lttng-ust/lttng-context-net-ns.c b/src/lib/lttng-ust/lttng-context-net-ns.c index 66fcb045..4f62c055 100644 --- a/src/lib/lttng-ust/lttng-context-net-ns.c +++ b/src/lib/lttng-ust/lttng-context-net-ns.c @@ -155,7 +155,7 @@ error_find_context: */ void lttng_ust_net_ns_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_net_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_net_ns))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)get_net_ns(); } diff --git a/src/lib/lttng-ust/lttng-context-perf-counters.c b/src/lib/lttng-ust/lttng-context-perf-counters.c index 52371a0d..082d4240 100644 --- a/src/lib/lttng-ust/lttng-context-perf-counters.c +++ b/src/lib/lttng-ust/lttng-context-perf-counters.c @@ -89,7 +89,7 @@ static DEFINE_URCU_TLS(int, ust_perf_mutex_nest); */ void lttng_ust_perf_counter_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(ust_perf_mutex_nest))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(ust_perf_mutex_nest))); (void)flags; } @@ -182,7 +182,7 @@ uint64_t rdpmc(unsigned int counter) { unsigned int low, high; - asm volatile("rdpmc" : "=a" (low), "=d" (high) : "c" (counter)); + __asm__ __volatile__("rdpmc" : "=a" (low), "=d" (high) : "c" (counter)); return low | ((uint64_t) high) << 32; } diff --git a/src/lib/lttng-ust/lttng-context-procname.c b/src/lib/lttng-ust/lttng-context-procname.c index 16f34c46..dcad18af 100644 --- a/src/lib/lttng-ust/lttng-context-procname.c +++ b/src/lib/lttng-ust/lttng-context-procname.c @@ -124,7 +124,7 @@ error_find_context: */ void lttng_ust_procname_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_procname)[0])); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_procname)[0])); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)wrapper_getprocname(); } diff --git a/src/lib/lttng-ust/lttng-context-time-ns.c b/src/lib/lttng-ust/lttng-context-time-ns.c index e84b7048..2ac672e6 100644 --- a/src/lib/lttng-ust/lttng-context-time-ns.c +++ b/src/lib/lttng-ust/lttng-context-time-ns.c @@ -154,7 +154,7 @@ error_find_context: */ void lttng_ust_time_ns_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_time_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_time_ns))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)get_time_ns(); } diff --git a/src/lib/lttng-ust/lttng-context-uts-ns.c b/src/lib/lttng-ust/lttng-context-uts-ns.c index 51d6092e..cef6cf17 100644 --- a/src/lib/lttng-ust/lttng-context-uts-ns.c +++ b/src/lib/lttng-ust/lttng-context-uts-ns.c @@ -156,7 +156,7 @@ error_find_context: */ void lttng_ust_uts_ns_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_uts_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_uts_ns))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)get_uts_ns(); } diff --git a/src/lib/lttng-ust/lttng-context-vtid.c b/src/lib/lttng-ust/lttng-context-vtid.c index e9bbbf85..a9ba3054 100644 --- a/src/lib/lttng-ust/lttng-context-vtid.c +++ b/src/lib/lttng-ust/lttng-context-vtid.c @@ -114,7 +114,7 @@ error_find_context: */ void lttng_ust_vtid_init_thread(int flags) { - asm volatile ("" : : "m" (URCU_TLS(cached_vtid))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_vtid))); if (flags & LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) (void)wrapper_getvtid(); } diff --git a/src/lib/lttng-ust/lttng-ust-comm.c b/src/lib/lttng-ust/lttng-ust-comm.c index 7903550f..e57caa12 100644 --- a/src/lib/lttng-ust/lttng-ust-comm.c +++ b/src/lib/lttng-ust/lttng-ust-comm.c @@ -389,13 +389,13 @@ const char *get_lttng_home_dir(void) static void lttng_ust_nest_count_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(lttng_ust_nest_count))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(lttng_ust_nest_count))); } static void lttng_ust_mutex_nest_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(ust_mutex_nest))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(ust_mutex_nest))); } /*