1 //===-- printf.h ------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef GWP_ASAN_OPTIONAL_PRINTF_H_
10 #define GWP_ASAN_OPTIONAL_PRINTF_H_
14 // ================================ Requirements ===============================
15 // This function is required to be provided by the supporting allocator iff the
16 // allocator wants to use any of the optional components.
17 // ================================ Description ================================
18 // This function shall produce output according to a strict subset of the C
19 // standard library's printf() family. This function must support printing the
21 // 1. integers: "%([0-9]*)?(z|ll)?{d,u,x,X}"
23 // 3. strings: "%[-]([0-9]*)?(\\.\\*)?s"
25 // This function must be implemented in a signal-safe manner, and thus must not
27 // =================================== Notes ===================================
28 // This function has a slightly different signature than the C standard
29 // library's printf(). Notably, it returns 'void' rather than 'int'.
30 typedef void (*Printf_t
)(const char *Format
, ...);
32 } // namespace gwp_asan
33 #endif // GWP_ASAN_OPTIONAL_PRINTF_H_