Skip to content

Commit

Permalink
Include <cinttypes> instead of <stdint.h>
Browse files Browse the repository at this point in the history
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
  • Loading branch information
damienmg authored and buchgr committed Jul 27, 2017
1 parent 92caf38 commit 0f3481b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/cpp/blaze.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -44,6 +43,7 @@

#include <algorithm>
#include <chrono> // NOLINT (gRPC requires this)
#include <cinttypes>
#include <mutex> // NOLINT
#include <set>
#include <string>
Expand Down
3 changes: 1 addition & 2 deletions src/main/cpp/blaze_util_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#ifndef BAZEL_SRC_MAIN_CPP_BLAZE_UTIL_PLATFORM_H_
#define BAZEL_SRC_MAIN_CPP_BLAZE_UTIL_PLATFORM_H_

#include <stdint.h>

#include <cinttypes>
#include <string>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/blaze_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h> // PATH_MAX
#include <poll.h>
#include <pwd.h>
Expand All @@ -32,6 +31,7 @@
#include <unistd.h>

#include <cassert>
#include <cinttypes>

#include "src/main/cpp/blaze_util.h"
#include "src/main/cpp/blaze_util_platform.h"
Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/util/file_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef BAZEL_SRC_MAIN_CPP_UTIL_FILE_PLATFORM_H_
#define BAZEL_SRC_MAIN_CPP_UTIL_FILE_PLATFORM_H_

#include <stdint.h>
#include <time.h>

#include <cinttypes>
#include <string>

namespace blaze_util {
Expand Down
3 changes: 2 additions & 1 deletion src/main/cpp/util/md5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@

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

#include <stdint.h>
#include <string.h> // for memcpy
#include <stddef.h> // for ofsetof

#include <cinttypes>

#if !_STRING_ARCH_unaligned
# ifdef _LP64
# define UNALIGNED_P(p) (reinterpret_cast<uint64_t>(p) % \
Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/util/numbers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include <errno.h> // errno, ERANGE
#include <limits.h>
#include <stdint.h>
#include <cassert>
#include <cinttypes>
#include <cstdlib>
#include <limits>

Expand Down
3 changes: 2 additions & 1 deletion src/main/cpp/util/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#define BAZEL_SRC_MAIN_CPP_UTIL_PORT_H_

#include <stddef.h> // For size_t on Linux, Darwin
#include <stdint.h> // For size_t on Windows

#include <cinttypes> // For size_t on Windows

// GCC-specific features
#if (defined(COMPILER_GCC3) || defined(__APPLE__)) && !defined(SWIG)
Expand Down
3 changes: 2 additions & 1 deletion src/tools/singlejar/output_jar.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#ifndef SRC_TOOLS_SINGLEJAR_COMBINED_JAR_H_
#define SRC_TOOLS_SINGLEJAR_COMBINED_JAR_H_

#include <stdint.h>
#include <stdio.h>

#include <cinttypes>
#include <memory>
#include <string>
#include <unordered_map>
Expand Down
3 changes: 2 additions & 1 deletion src/tools/singlejar/zip_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
* http://www.pkware.com/documents/casestudies/APPNOTE.TXT
*/

#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <cinttypes>

#if defined(__linux__)
#include <endian.h>
#elif defined(__FreeBSD__)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/singlejar/zlib_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef BAZEL_SRC_TOOLS_SINGLEJAR_ZLIB_INTERFACE_H_
#define BAZEL_SRC_TOOLS_SINGLEJAR_ZLIB_INTERFACE_H_

#include <stdint.h>
#include <cinttypes>

#include "src/tools/singlejar/diag.h"
#include <zlib.h>
Expand Down

0 comments on commit 0f3481b

Please sign in to comment.