/* libmisc/_intercept.h - Interceptable ("weak") functions * * Copyright (C) 2024-2025 Luke T. Shumaker * SPDX-License-Identifier: AGPL-3.0-or-later */ #ifndef _LIBMISC__INTERCEPT_H_ #define _LIBMISC__INTERCEPT_H_ /* pico-sdk/newlib define these to be [[gnu:weak]] already, but * depending on optimization options glibc might not, and GCC might * assume it knows what they do and optimize them out. So define our * own `__lm_` wrappers that GCC/glibc won't interfere with. */ [[gnu::format(printf, 1, 2)]] int __lm_printf(const char *format, ...); [[noreturn]] void __lm_abort(void); /* __lm_light_printf is expected to have less stack use than regular * __lm_printf, if possible. */ [[gnu::format(printf, 1, 2)]] int __lm_light_printf(const char *format, ...); #endif /* _LIBMISC__INTERCEPT_H_ */