From 3ad23552fbd463d97a3e26c900655b9d134516e4 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 15 Aug 2013 23:16:59 +1000 Subject: syntax: add a local_data_key macro that creates a key for access to the TLS. This allows the internal implementation details of the TLS keys to be changed without requiring the update of all the users. (Or, applying changes that have to be applied for the keys to work correctly, e.g. forcing LLVM to not merge these constants.) --- src/libsyntax/ext/expand.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 1547446957e..49eb9f12212 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -957,6 +957,17 @@ pub fn std_macros() -> @str { println(fmt!($($arg),+)) ) ) + + // NOTE: use this after a snapshot lands to abstract the details + // of the TLS interface. + macro_rules! local_data_key ( + ($name:ident: $ty:ty) => ( + static $name: ::std::local_data::Key<$ty> = &::std::local_data::Key; + ); + (pub $name:ident: $ty:ty) => ( + pub static $name: ::std::local_data::Key<$ty> = &::std::local_data::Key; + ) + ) }"; } -- cgit 1.4.1-3-g733a5