From 344e29e38d891802150ab37bb1af7509c6815310 Mon Sep 17 00:00:00 2001 From: arighi Date: Fri, 11 Feb 2011 15:02:16 +0000 Subject: [PATCH] move ACCESS_SAFE() macro into bertos/cfg/compiler.h git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4698 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/compiler.h | 7 +++++++ bertos/mware/event.h | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bertos/cfg/compiler.h b/bertos/cfg/compiler.h index 0121b963..c2e814e5 100644 --- a/bertos/cfg/compiler.h +++ b/bertos/cfg/compiler.h @@ -603,4 +603,11 @@ typedef unsigned char sigmask_t; /**< Type for signal masks. */ do { (void)(&(var) == (type *)0); } while(0) #endif +/** + * Prevent the compiler from optimizing access to the variable \a x, enforcing + * a refetch from memory. This also forbid from reordering successing instances + * of ACCESS_SAFE(). + */ +#define ACCESS_SAFE(x) (*(volatile typeof(x) *)&(x)) + #endif /* BERTOS_COMPILER_H */ diff --git a/bertos/mware/event.h b/bertos/mware/event.h index e9f9e4a2..0a87af1a 100644 --- a/bertos/mware/event.h +++ b/bertos/mware/event.h @@ -188,15 +188,6 @@ INLINE Event event_createSignal(struct Process *proc, sigbit_t bit) #endif -/** - * Prevent the compiler from optimizing access to the variable \a x, enforcing - * a refetch from memory. This also forbid from reordering successing instances - * of ACCESS_SAFE(). - * - * TODO: move this to cfg/compiler.h - */ -#define ACCESS_SAFE(x) (*(volatile typeof(x) *)&(x)) - #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS /** Initialize the generic sleepable event \a e */ #define event_initGeneric(e) \ -- 2.25.1