Skip to content

Commit 4b82b97

Browse files
damienmgbuchgr
authored andcommitted
Include <cinttypes> instead of <stdint.h>
cinttypes is the C++ header that should replace stdint.h. Not using the correct header was leading to compilation error on CentOS 6.7 Fixes #3455. To be cherry-picked for #3375. Change-Id: I6df22134a4a4902ec9fa7ecdfaeb5408eacf3564 PiperOrigin-RevId: 163334651
1 parent 689c011 commit 4b82b97

File tree

10 files changed

+14
-11
lines changed

10 files changed

+14
-11
lines changed

src/main/cpp/blaze.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <fcntl.h>
3131
#include <limits.h>
3232
#include <stdarg.h>
33-
#include <stdint.h>
3433
#include <stdio.h>
3534
#include <stdlib.h>
3635
#include <string.h>
@@ -44,6 +43,7 @@
4443

4544
#include <algorithm>
4645
#include <chrono> // NOLINT (gRPC requires this)
46+
#include <cinttypes>
4747
#include <mutex> // NOLINT
4848
#include <set>
4949
#include <string>

src/main/cpp/blaze_util_platform.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#ifndef BAZEL_SRC_MAIN_CPP_BLAZE_UTIL_PLATFORM_H_
1616
#define BAZEL_SRC_MAIN_CPP_BLAZE_UTIL_PLATFORM_H_
1717

18-
#include <stdint.h>
19-
18+
#include <cinttypes>
2019
#include <string>
2120
#include <vector>
2221

src/main/cpp/blaze_util_posix.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <dirent.h>
1616
#include <errno.h>
1717
#include <fcntl.h>
18-
#include <inttypes.h>
1918
#include <limits.h> // PATH_MAX
2019
#include <poll.h>
2120
#include <pwd.h>
@@ -32,6 +31,7 @@
3231
#include <unistd.h>
3332

3433
#include <cassert>
34+
#include <cinttypes>
3535

3636
#include "src/main/cpp/blaze_util.h"
3737
#include "src/main/cpp/blaze_util_platform.h"

src/main/cpp/util/file_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#ifndef BAZEL_SRC_MAIN_CPP_UTIL_FILE_PLATFORM_H_
1616
#define BAZEL_SRC_MAIN_CPP_UTIL_FILE_PLATFORM_H_
1717

18-
#include <stdint.h>
1918
#include <time.h>
2019

20+
#include <cinttypes>
2121
#include <string>
2222

2323
namespace blaze_util {

src/main/cpp/util/md5.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939

4040
#include "src/main/cpp/util/md5.h"
4141

42-
#include <stdint.h>
4342
#include <string.h> // for memcpy
4443
#include <stddef.h> // for ofsetof
4544

45+
#include <cinttypes>
46+
4647
#if !_STRING_ARCH_unaligned
4748
# ifdef _LP64
4849
# define UNALIGNED_P(p) (reinterpret_cast<uint64_t>(p) % \

src/main/cpp/util/numbers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
#include <errno.h> // errno, ERANGE
1717
#include <limits.h>
18-
#include <stdint.h>
1918
#include <cassert>
19+
#include <cinttypes>
2020
#include <cstdlib>
2121
#include <limits>
2222

src/main/cpp/util/port.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#define BAZEL_SRC_MAIN_CPP_UTIL_PORT_H_
1616

1717
#include <stddef.h> // For size_t on Linux, Darwin
18-
#include <stdint.h> // For size_t on Windows
18+
19+
#include <cinttypes> // For size_t on Windows
1920

2021
// GCC-specific features
2122
#if (defined(COMPILER_GCC3) || defined(__APPLE__)) && !defined(SWIG)

src/tools/singlejar/output_jar.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#ifndef SRC_TOOLS_SINGLEJAR_COMBINED_JAR_H_
1616
#define SRC_TOOLS_SINGLEJAR_COMBINED_JAR_H_
1717

18-
#include <stdint.h>
1918
#include <stdio.h>
19+
20+
#include <cinttypes>
2021
#include <memory>
2122
#include <string>
2223
#include <unordered_map>

src/tools/singlejar/zip_headers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
* http://www.pkware.com/documents/casestudies/APPNOTE.TXT
2121
*/
2222

23-
#include <stdint.h>
2423
#include <stdlib.h>
2524
#include <string.h>
2625

26+
#include <cinttypes>
27+
2728
#if defined(__linux__)
2829
#include <endian.h>
2930
#elif defined(__FreeBSD__)

src/tools/singlejar/zlib_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#ifndef BAZEL_SRC_TOOLS_SINGLEJAR_ZLIB_INTERFACE_H_
1616
#define BAZEL_SRC_TOOLS_SINGLEJAR_ZLIB_INTERFACE_H_
1717

18-
#include <stdint.h>
18+
#include <cinttypes>
1919

2020
#include "src/tools/singlejar/diag.h"
2121
#include <zlib.h>

0 commit comments

Comments
 (0)