From ebba1a819dbfe0cef48cd863cd186538bdaeaf10 Mon Sep 17 00:00:00 2001 From: zzz701 Date: Tue, 9 Sep 2025 19:00:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20NDK=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=AE=8F=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ndk_musl_include/oh_target_sdk_version.h | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 third_party/musl/ndk_musl_include/oh_target_sdk_version.h diff --git a/third_party/musl/ndk_musl_include/oh_target_sdk_version.h b/third_party/musl/ndk_musl_include/oh_target_sdk_version.h new file mode 100644 index 00000000000..bc8e2114f8b --- /dev/null +++ b/third_party/musl/ndk_musl_include/oh_target_sdk_version.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _OH_TARGET_SDK_VERSION_H +#define _OH_TARGET_SDK_VERSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __DISTRIBUTEOS_VERSION(maj, min, patch) maj##min##patch // min必须是两位数字dd(如00,01), patch也必须是两位(如00,01) +#define __OH_VERSION(maj,min) maj##.##min +#define __INNER_CONCAT(a,b) a##.##b +#define __INNER_DEPRECATED(platform, version) __attribute__((__availability__(platform, deprecated=version))) +#define __INNER_OBSOLETED(platform, version) __attribute__((__availability__(platform, obsoleted=version))) +#define __INNER_AVAILABILITY(platform, version) __attribute__((__availability__(platform, introduced=version))) + +// version: ohos的版本号,17或者是17.1等,最多支持两位小数 +#define __OH_AVAILABILITY(version) __INNER_AVAILABILITY(ohos, version) +// 提供给distribute_os使用的版本号,dos_ver使用__DISTRIBUTEOS_VERSION(5, 00, 01)来定义;oh_ver使用__OH_VERSION(17, 0)来定义 +#define __DISTRIBUTEOS_AVAILABILITY(dos_ver, oh_ver) __INNER_AVAILABILITY(ohos, __INNER_CONCAT(oh_ver,dos_ver)) +// 指定废弃的ohos版本号 +#define __OH_DEPRECATED(version) __INNER_DEPRECATED(ohos, version) +// 指定废弃的hmos版本号 +#define __DISTRIBUTEOS_DEPRECATED(dos_ver, oh_ver) __INNER_DEPRECATED(ohos, __INNER_CONCAT(oh_ver,dos_ver)) +// 指定废弃的ohos版本号 +#define __OH_OBSOLETED(version) __INNER_OBSOLETED(ohos, version) +// 指定废弃的hmos版本 +#define __DISTRIBUTEOS_OBSOLETED(dos_ver, oh_ver) __INNER_OBSOLETED(ohos, __INNER_CONCAT(oh_ver,dos_ver)) +#define SINCE(api) __builtin_available(ohos api, *) + +#ifdef __cplusplus +} +#endif + +#endif // _OH_TARGET_SDK_VERSION_H -- Gitee