1 // Copyright (C) 2023 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 macro_rules! cfg_oh { 15 ($($item:item)*) => { 16 $( 17 #[cfg(feature = "oh")] 18 $item 19 )* 20 } 21 } 22 23 macro_rules! cfg_not_oh { 24 ($($item:item)*) => { 25 $( 26 #[cfg(not(feature = "oh"))] 27 $item 28 )* 29 } 30 } 31 32 #[cfg(not(feature = "oh"))] 33 macro_rules! cvt_res_error { 34 ($res: expr, $($args:tt)*) => {{ 35 match $res { 36 Ok(value) => value, 37 Err(e) => { 38 error!($($args)*); 39 error!("Error msg: {:?}", e); 40 return Err(e); 41 } 42 } 43 }} 44 } 45