Commit 85efe157 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[cleanup] Remove unused format macros plus header

All macros defined in "format-macros.h" are dead now (after
https://crrev.com/c/1613243). This CL removes this header, and includes
<cinttypes> instead wherever we use format macros for the types defined
in <cstdint>.

Plus some drive-by cleanup of includes.

R=mlippautz@chromium.org

Bug: v8:9183
Change-Id: Ic379759b79edb50e38833defb1577cc3af7c8150
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1611800
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61540}
parent 123fbb77
......@@ -3433,7 +3433,6 @@ v8_component("v8_libbase") {
"src/base/file-utils.cc",
"src/base/file-utils.h",
"src/base/flags.h",
"src/base/format-macros.h",
"src/base/free_deleter.h",
"src/base/functional.cc",
"src/base/functional.h",
......
......@@ -22,11 +22,11 @@
// of code into a FILE*, meaning that the above functionality could also be
// achieved by just calling Disassembler::Disassemble(stdout, begin, end);
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <cassert>
#include <cinttypes>
#include <cstdarg>
#include <cstdio>
#include <cstring>
#if V8_TARGET_ARCH_ARM
......
......@@ -4,6 +4,8 @@
#include "src/asmjs/asm-scanner.h"
#include <cinttypes>
#include "src/char-predicates-inl.h"
#include "src/conversions.h"
#include "src/flags.h"
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_BASE_FORMAT_MACROS_H_
#define V8_BASE_FORMAT_MACROS_H_
// This file defines the format macros for some integer types.
// To print a 64-bit value in a portable way:
// int64_t value;
// printf("xyz:%" PRId64, value);
// The "d" in the macro corresponds to %d; you can also use PRIu64 etc.
//
// For wide strings, prepend "Wide" to the macro:
// int64_t value;
// StringPrintf(L"xyz: %" WidePRId64, value);
#include <stddef.h>
#include <stdint.h>
#include "src/base/build_config.h"
#if defined(V8_OS_POSIX) && (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && \
!defined(PRId64)
#error "inttypes.h has already been included before this header file, but "
#error "without __STDC_FORMAT_MACROS defined."
#endif
#if defined(V8_OS_POSIX) && !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#if defined(V8_OS_POSIX)
// GCC will concatenate wide and narrow strings correctly, so nothing needs to
// be done here.
#define WidePRId64 PRId64
#define WidePRIu64 PRIu64
#define WidePRIx64 PRIx64
// The size of NSInteger and NSUInteger varies between 32-bit and 64-bit
// architectures and Apple does not provides standard format macros and
// recommends casting. This has many drawbacks, so instead define macros
// for formatting those types.
#if defined(V8_OS_MACOSX)
#if defined(V8_HOST_ARCH_64_BIT)
#if !defined(PRIdNS)
#define PRIdNS "ld"
#endif
#if !defined(PRIuNS)
#define PRIuNS "lu"
#endif
#if !defined(PRIxNS)
#define PRIxNS "lx"
#endif
#else // defined(V8_HOST_ARCH_64_BIT)
#if !defined(PRIdNS)
#define PRIdNS "d"
#endif
#if !defined(PRIuNS)
#define PRIuNS "u"
#endif
#if !defined(PRIxNS)
#define PRIxNS "x"
#endif
#endif
#endif // defined(V8_OS_MACOSX)
#else // V8_OS_WIN
#if !defined(PRId64) || !defined(PRIu64) || !defined(PRIx64)
#error "inttypes.h provided by win toolchain should define these."
#endif
#define WidePRId64 L"I64d"
#define WidePRIu64 L"I64u"
#define WidePRIx64 L"I64x"
#endif
#endif // V8_BASE_FORMAT_MACROS_H_
......@@ -8,7 +8,6 @@
#include <limits>
#include "src/base/compiler-specific.h"
#include "src/base/format-macros.h"
#include "src/base/logging.h"
// No-op macro which is used to work around MSVC's funky VA_ARGS support.
......
......@@ -6,6 +6,7 @@
#include <cctype>
#include <cerrno>
#include <cinttypes>
#include <cstdlib>
#include <sstream>
......
......@@ -4,6 +4,7 @@
#include "src/heap/heap.h"
#include <cinttypes>
#include <unordered_map>
#include <unordered_set>
......
......@@ -4,6 +4,7 @@
#include "src/heap/spaces.h"
#include <cinttypes>
#include <utility>
#include "src/base/bits.h"
......
......@@ -6,6 +6,7 @@
#include <algorithm>
#include <cctype>
#include <cinttypes>
#include <cstdlib>
#include <cstring>
#include <limits>
......
......@@ -4,6 +4,7 @@
#include "src/inspector/string-util.h"
#include <cinttypes>
#include <cmath>
#include "src/base/platform/platform.h"
......
......@@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "src/ostreams.h"
#include <cinttypes>
#include "src/objects.h"
#include "src/objects/string.h"
......
......@@ -5,6 +5,7 @@
#ifndef V8_SNAPSHOT_EMBEDDED_FILE_WRITER_H_
#define V8_SNAPSHOT_EMBEDDED_FILE_WRITER_H_
#include <cinttypes>
#include <cstdio>
#include <cstring>
......
......@@ -5,6 +5,7 @@
#ifndef V8_WASM_DECODER_H_
#define V8_WASM_DECODER_H_
#include <cinttypes>
#include <cstdarg>
#include <memory>
......
......@@ -4,6 +4,8 @@
#include "src/wasm/memory-tracing.h"
#include <cinttypes>
#include "src/utils.h"
#include "src/v8memory.h"
#include "src/vector.h"
......
......@@ -4,7 +4,8 @@
#include "src/wasm/wasm-js.h"
#include <string>
#include <cinttypes>
#include <cstring>
#include "src/api-inl.h"
#include "src/api-natives.h"
......
......@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <cassert>
#include <cinttypes>
#include <cstdarg>
#include <cstdio>
#if V8_TARGET_ARCH_X64
......
......@@ -26,7 +26,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include <stdlib.h>
#include <cinttypes>
#include <cstdlib>
// The C++ style guide recommends using <re2> instead of <regex>. However, the
// former isn't available in V8.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment