1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef UNSUPPORTED_API_H
17 #define UNSUPPORTED_API_H
18
19 #include <stdio.h>
20 #include <string.h>
21
22 #define LITEOS_A "liteos_a"
23 #define LINUX "linux"
24
unsupported_api(const char *func)25 static inline void unsupported_api(const char *func)
26 {
27 fprintf(stderr, "[ERR]Unsupported API %s\n", func);
28 }
29
unsupported_api_check(const char *osname)30 static inline int unsupported_api_check(const char *osname)
31 {
32 #ifdef __LITEOS_A__
33 if (!strcmp(osname, LITEOS_A)) {
34 return 1;
35 }
36 #elif !defined(__LITEOS__)
37 if (!strcmp(osname, LINUX)) {
38 return 1;
39 }
40 #endif
41 return 0;
42 }
43
44 #define UNSUPPORTED_API_VOID(osname) \
45 if (unsupported_api_check(osname) > 0) { \
46 fprintf(stderr, "[ERR]Unsupported API %s\n", __FUNCTION__); \
47 }
48 #endif
49