1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef PERF_UTIL_CLANG_C_H 3 #define PERF_UTIL_CLANG_C_H 4 5 #include <stddef.h> /* for size_t */ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #ifdef HAVE_LIBCLANGLLVM_SUPPORT 12 extern void perf_clang__init(void); 13 extern void perf_clang__cleanup(void); 14 15 struct test_suite; 16 extern int test__clang_to_IR(struct test_suite *test, int subtest); 17 extern int test__clang_to_obj(struct test_suite *test, int subtest); 18 19 extern int perf_clang__compile_bpf(const char *filename, 20 void **p_obj_buf, 21 size_t *p_obj_buf_sz); 22 #else 23 24 #include <errno.h> 25 #include <linux/compiler.h> /* for __maybe_unused */ 26 27 static inline void perf_clang__init(void) { } 28 static inline void perf_clang__cleanup(void) { } 29 30 static inline int 31 perf_clang__compile_bpf(const char *filename __maybe_unused, 32 void **p_obj_buf __maybe_unused, 33 size_t *p_obj_buf_sz __maybe_unused) 34 { 35 return -ENOTSUP; 36 } 37 38 #endif 39 40 #ifdef __cplusplus 41 } 42 #endif 43 #endif 44