/* libmisc/_intercept.h - Interceptable ("weak") functions
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * 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.
 */

[[format(printf, 1, 2)]]
int __lm_printf(const char *format, ...);

[[noreturn]] void __lm_abort(void);

#endif /* _LIBMISC__INTERCEPT_H_ */