Path: blob/main/contrib/llvm-project/compiler-rt/lib/gwp_asan/optional/printf.h
35271 views
//===-- printf.h ------------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef GWP_ASAN_OPTIONAL_PRINTF_H_9#define GWP_ASAN_OPTIONAL_PRINTF_H_1011namespace gwp_asan {1213// ================================ Requirements ===============================14// This function is required to be provided by the supporting allocator iff the15// allocator wants to use any of the optional components.16// ================================ Description ================================17// This function shall produce output according to a strict subset of the C18// standard library's printf() family. This function must support printing the19// following formats:20// 1. integers: "%([0-9]*)?(z|ll)?{d,u,x,X}"21// 2. pointers: "%p"22// 3. strings: "%[-]([0-9]*)?(\\.\\*)?s"23// 4. chars: "%c"24// This function must be implemented in a signal-safe manner, and thus must not25// malloc().26// =================================== Notes ===================================27// This function has a slightly different signature than the C standard28// library's printf(). Notably, it returns 'void' rather than 'int'.29typedef void (*Printf_t)(const char *Format, ...);3031} // namespace gwp_asan32#endif // GWP_ASAN_OPTIONAL_PRINTF_H_333435