brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 8a48abd Raw
52 lines · c
1//===-- Printf Configuration Handler ----------------------------*- 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 LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H10#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H11 12// The index array buffer is always initialized when printf is called. In cases13// where index mode is necessary but memory is limited, or when index mode14// performance is important and memory is available, this compile option15// provides a knob to adjust memory usage to an appropriate level. 128 is picked16// as the default size since that's big enough to handle even extreme cases and17// the runtime penalty for not having enough space is severe.18// When an index mode argument is requested, if its index is before the most19// recently read index, then the arg list must be restarted from the beginning,20// and all of the arguments before the new index must be requested with the21// correct types. The index array caches the types of the values in the arg22// list. For every number between the last index cached in the array and the23// requested index, the format string must be parsed again to find the24// type of that index. As an example, if the format string has 20 indexes, and25// the index array is 10, then when the 20th index is requested the first 1026// types can be found immediately, and then the format string must be parsed 1027// times to find the types of the next 10 arguments.28#ifndef LIBC_COPT_PRINTF_INDEX_ARR_LEN29#define LIBC_COPT_PRINTF_INDEX_ARR_LEN 12830#endif31 32// If fixed point is available and the user hasn't explicitly opted out, then33// enable fixed point.34#if defined(LIBC_COMPILER_HAS_FIXED_POINT) &&                                  \35    !defined(LIBC_COPT_PRINTF_DISABLE_FIXED_POINT)36#define LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT37#endif38 39// TODO(michaelrj): Provide a proper interface for these options.40// LIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE41// LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT42// LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT_LD43// LIBC_COPT_FLOAT_TO_STR_USE_INT_CALC44// LIBC_COPT_FLOAT_TO_STR_NO_TABLE45// LIBC_COPT_PRINTF_HEX_LONG_DOUBLE46 47// TODO(michaelrj): Move the other printf configuration options into this file.48 49// LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS50 51#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H52