This is an automated email from the ASF dual-hosted git repository. rduan pushed a commit to branch revert-394-intel-2.17 in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git
commit dd98e70c8a12c894e675af41a145f0475c4a6a0d Author: volcano <[email protected]> AuthorDate: Tue Jun 28 10:49:23 2022 +0800 Revert "Fix thread_local macro" This reverts commit a5bcd783d6e0daf92b115d7be1d2da09e0cb78e0. --- sgx_tstd/src/thread/local.rs | 53 +++++++------------------------------------- sgx_types/src/function.rs | 4 ++-- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/sgx_tstd/src/thread/local.rs b/sgx_tstd/src/thread/local.rs index 430360df..63195145 100644 --- a/sgx_tstd/src/thread/local.rs +++ b/sgx_tstd/src/thread/local.rs @@ -143,13 +143,13 @@ macro_rules! thread_local { ); } -#[cfg(not(feature = "thread"))] #[macro_export] #[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)] #[allow_internal_unsafe] macro_rules! __thread_local_inner { // used to generate the `LocalKey` value for const-initialized thread locals (@key $t:ty, const $init:expr) => {{ + #[cfg(not(feature = "thread"))] #[inline] // see comments below unsafe fn __getit() -> $crate::result::Result<&'static $t, $crate::thread::AccessError> { const INIT_EXPR: $t = $init; @@ -165,49 +165,7 @@ macro_rules! __thread_local_inner { } } - unsafe { - $crate::thread::LocalKey::new(__getit) - } - }}; - - // used to generate the `LocalKey` value for `thread_local!` - (@key $t:ty, $init:expr) => { - { - #[inline] - fn __init() -> $t { $init } - - #[inline] - unsafe fn __getit() -> $crate::result::Result<&'static $t, $crate::thread::AccessError> { - #[thread_local] - static __KEY: $crate::thread::__StaticLocalKeyInner<$t> = - $crate::thread::__StaticLocalKeyInner::new(); - - // FIXME: remove the #[allow(...)] marker when macros don't - // raise warning for missing/extraneous unsafe blocks anymore. - // See https://github.com/rust-lang/rust/issues/74838. - #[allow(unused_unsafe)] - unsafe { __KEY.get(__init) } - } - - unsafe { - $crate::thread::LocalKey::new(__getit) - } - } - }; - ($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $($init:tt)*) => { - $(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> = - $crate::__thread_local_inner!(@key $t, $($init)*); - } -} - -#[cfg(feature = "thread")] -#[macro_export] -#[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)] -#[allow_internal_unsafe] -macro_rules! __thread_local_inner { - // used to generate the `LocalKey` value for const-initialized thread locals - (@key $t:ty, const $init:expr) => {{ - #[inline] + #[cfg(feature = "thread")] unsafe fn __getit() -> $crate::result::Result<&'static $t, $crate::thread::AccessError> { const INIT_EXPR: $t = $init; @@ -275,8 +233,13 @@ macro_rules! __thread_local_inner { #[inline] fn __init() -> $t { $init } - #[inline] unsafe fn __getit() -> $crate::result::Result<&'static $t, $crate::thread::AccessError> { + #[cfg(not(feature = "thread"))] + #[thread_local] + static __KEY: $crate::thread::__StaticLocalKeyInner<$t> = + $crate::thread::__StaticLocalKeyInner::new(); + + #[cfg(feature = "thread")] #[thread_local] static __KEY: $crate::thread::__FastLocalKeyInner<$t> = $crate::thread::__FastLocalKeyInner::new(); diff --git a/sgx_types/src/function.rs b/sgx_types/src/function.rs index 3f8600c6..025c4a04 100644 --- a/sgx_types/src/function.rs +++ b/sgx_types/src/function.rs @@ -1013,7 +1013,7 @@ extern "C" { /* intel DCAP 1.13 */ pub fn sgx_ql_get_quote_verification_collateral_with_params( fmspc: *const uint8_t, - fmspc_size: uint16_t, + fmspc_size: u16, pck_ra: *const c_char, custom_param: *const c_void, custom_param_length: uint16_t, @@ -1025,7 +1025,7 @@ extern "C" { /* intel DCAP 1.14 */ pub fn tdx_ql_get_quote_verification_collateral( fmspc: *const uint8_t, - fmspc_size: uint16_t, + fmspc_size: u16, pck_ra: *const c_char, pp_quote_collateral: *mut *mut tdx_ql_qve_collateral_t, ) -> sgx_quote3_error_t; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
