From: Mathieu Desnoyers Date: Wed, 8 Mar 2023 21:53:32 +0000 (-0500) Subject: Fix: c99: use __asm__ __volatile__ X-Git-Tag: v2.13.6~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88c48b17609ba466626b6e1caed4d7578d6efc9c;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: Ideed00c3847065327c6d195d0b95b882dd82c2c3 --- 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 70539cab..a17907d0 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 3951f5b0..c96a51c9 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 34523ea1..7e49a7dc 100644 --- a/src/lib/lttng-ust/lttng-context-cgroup-ns.c +++ b/src/lib/lttng-ust/lttng-context-cgroup-ns.c @@ -157,5 +157,5 @@ error_find_context: */ void lttng_cgroup_ns_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_cgroup_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_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 63401e8d..f076e307 100644 --- a/src/lib/lttng-ust/lttng-context-ipc-ns.c +++ b/src/lib/lttng-ust/lttng-context-ipc-ns.c @@ -155,5 +155,5 @@ error_find_context: */ void lttng_ipc_ns_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_ipc_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_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 960591c2..1991473b 100644 --- a/src/lib/lttng-ust/lttng-context-net-ns.c +++ b/src/lib/lttng-ust/lttng-context-net-ns.c @@ -155,5 +155,5 @@ error_find_context: */ void lttng_net_ns_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_net_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_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 2db11436..37be77df 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_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(ust_perf_mutex_nest))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(ust_perf_mutex_nest))); } void lttng_perf_lock(void) @@ -181,7 +181,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 b5bf77be..66efefd9 100644 --- a/src/lib/lttng-ust/lttng-context-procname.c +++ b/src/lib/lttng-ust/lttng-context-procname.c @@ -124,5 +124,5 @@ error_find_context: */ void lttng_procname_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_procname)[0])); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_procname)[0])); } diff --git a/src/lib/lttng-ust/lttng-context-time-ns.c b/src/lib/lttng-ust/lttng-context-time-ns.c index ec32a1de..ff1e95d5 100644 --- a/src/lib/lttng-ust/lttng-context-time-ns.c +++ b/src/lib/lttng-ust/lttng-context-time-ns.c @@ -154,5 +154,5 @@ error_find_context: */ void lttng_time_ns_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_time_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_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 06a978fd..66220947 100644 --- a/src/lib/lttng-ust/lttng-context-uts-ns.c +++ b/src/lib/lttng-ust/lttng-context-uts-ns.c @@ -156,5 +156,5 @@ error_find_context: */ void lttng_uts_ns_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_uts_ns))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_uts_ns))); } diff --git a/src/lib/lttng-ust/lttng-context-vtid.c b/src/lib/lttng-ust/lttng-context-vtid.c index 880e34b9..cfd0a117 100644 --- a/src/lib/lttng-ust/lttng-context-vtid.c +++ b/src/lib/lttng-ust/lttng-context-vtid.c @@ -114,5 +114,5 @@ error_find_context: */ void lttng_vtid_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(cached_vtid))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(cached_vtid))); } diff --git a/src/lib/lttng-ust/lttng-ust-comm.c b/src/lib/lttng-ust/lttng-ust-comm.c index a07e1e12..d0cb9f24 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_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))); } /*