brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 1004a2c Raw
34 lines · c
1//===-- printf.h ------------------------------------------------*- C++ -*-===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef GWP_ASAN_OPTIONAL_PRINTF_H_10#define GWP_ASAN_OPTIONAL_PRINTF_H_11 12namespace gwp_asan {13 14// ================================ Requirements ===============================15// This function is required to be provided by the supporting allocator iff the16// allocator wants to use any of the optional components.17// ================================ Description ================================18// This function shall produce output according to a strict subset of the C19// standard library's printf() family. This function must support printing the20// following formats:21//   1. integers: "%([0-9]*)?(z|ll)?{d,u,x,X}"22//   2. pointers: "%p"23//   3. strings:  "%[-]([0-9]*)?(\\.\\*)?s"24//   4. chars:    "%c"25// This function must be implemented in a signal-safe manner, and thus must not26// malloc().27// =================================== Notes ===================================28// This function has a slightly different signature than the C standard29// library's printf(). Notably, it returns 'void' rather than 'int'.30typedef void (*Printf_t)(const char *Format, ...);31 32} // namespace gwp_asan33#endif // GWP_ASAN_OPTIONAL_PRINTF_H_34