Skip to content

Commit 527238e

Browse files
mdempskycommit-bot@chromium.org
authored andcommitted
[vm] Cleanup C99 header includes
Now that MSVC 2013 is required (commit f4824d3), we can simply use C99 headers that are provided [1]. This means we can rely on <stdint.h> to provide intXX_t and uintXX_t types, and <inttypes.h> to provide PRIxx macros. [1] https://devblogs.microsoft.com/cppblog/c99-library-support-in-visual-studio-2013/ Change-Id: I0cc707907f8aca05ae543188cc01e6c50d517f5a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107839 Auto-Submit: Matthew Dempsky <[email protected]> Commit-Queue: Vyacheslav Egorov <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
1 parent 9f32f9b commit 527238e

8 files changed

+16
-89
lines changed

runtime/bin/observatory_assets_empty.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
// This file is linked into the dart executable when it does not have
66
// Observatory baked in.
77

8-
#if defined(_WIN32)
9-
typedef unsigned __int8 uint8_t;
10-
#else
11-
#include <inttypes.h>
128
#include <stdint.h>
13-
#endif
14-
#include <stddef.h>
159

1610
namespace dart {
1711
namespace bin {

runtime/bin/snapshot_empty.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
// This file is linked into the dart executable when it does not have a
66
// snapshot linked into it.
77

8-
#if defined(_WIN32)
9-
typedef unsigned __int8 uint8_t;
10-
#else
11-
#include <inttypes.h>
128
#include <stdint.h>
13-
#endif
14-
#include <stddef.h>
159

1610
extern "C" {
17-
const uint8_t* kDartVmSnapshotData = NULL;
18-
const uint8_t* kDartVmSnapshotInstructions = NULL;
19-
const uint8_t* kDartCoreIsolateSnapshotData = NULL;
20-
const uint8_t* kDartCoreIsolateSnapshotInstructions = NULL;
11+
const uint8_t* kDartVmSnapshotData = nullptr;
12+
const uint8_t* kDartVmSnapshotInstructions = nullptr;
13+
const uint8_t* kDartCoreIsolateSnapshotData = nullptr;
14+
const uint8_t* kDartCoreIsolateSnapshotInstructions = nullptr;
2115
}

runtime/bin/snapshot_in.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
// This file is linked into the dart executable when it has a snapshot
88
// linked into it.
99

10-
#if defined(_WIN32)
11-
typedef unsigned __int8 uint8_t;
12-
#else
13-
#include <inttypes.h>
1410
#include <stdint.h>
15-
#endif
16-
#include <stddef.h>
1711

1812
extern "C" {
1913

runtime/include/dart_api.h

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
* This reference is generated from the header include/dart_api.h.
1616
*/
1717

18+
/* __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to
19+
* enable platform independent printf format specifiers. */
20+
#ifndef __STDC_FORMAT_MACROS
21+
#define __STDC_FORMAT_MACROS
22+
#endif
23+
24+
#include <assert.h>
25+
#include <inttypes.h>
26+
#include <stdbool.h>
27+
1828
#ifdef __cplusplus
1929
#define DART_EXTERN_C extern "C"
2030
#else
@@ -24,32 +34,12 @@
2434
#if defined(__CYGWIN__)
2535
#error Tool chain and platform not supported.
2636
#elif defined(_WIN32)
27-
// Define bool if necessary.
28-
#ifndef __cplusplus
29-
typedef unsigned __int8 bool;
30-
#endif
31-
// Define integer types.
32-
typedef signed __int8 int8_t;
33-
typedef signed __int16 int16_t;
34-
typedef signed __int32 int32_t;
35-
typedef signed __int64 int64_t;
36-
typedef unsigned __int8 uint8_t;
37-
typedef unsigned __int16 uint16_t;
38-
typedef unsigned __int32 uint32_t;
39-
typedef unsigned __int64 uint64_t;
4037
#if defined(DART_SHARED_LIB)
4138
#define DART_EXPORT DART_EXTERN_C __declspec(dllexport)
4239
#else
4340
#define DART_EXPORT DART_EXTERN_C
4441
#endif
4542
#else
46-
/* __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to
47-
* enable platform independent printf format specifiers. */
48-
#ifndef __STDC_FORMAT_MACROS
49-
#define __STDC_FORMAT_MACROS
50-
#endif
51-
#include <inttypes.h>
52-
#include <stdbool.h>
5343
#if __GNUC__ >= 4
5444
#if defined(DART_SHARED_LIB)
5545
#define DART_EXPORT \
@@ -70,8 +60,6 @@ typedef unsigned __int64 uint64_t;
7060
#define DART_WARN_UNUSED_RESULT
7161
#endif
7262

73-
#include <assert.h>
74-
7563
/*
7664
* =======
7765
* Handles

runtime/platform/globals.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,23 @@
6262

6363
#if !defined(_WIN32)
6464
#include <arpa/inet.h>
65-
#include <inttypes.h>
66-
#include <stdint.h>
6765
#include <unistd.h>
6866
#endif // !defined(_WIN32)
6967

7068
#include <float.h>
69+
#include <inttypes.h>
7170
#include <limits.h>
7271
#include <math.h>
7372
#include <stdarg.h>
7473
#include <stddef.h>
74+
#include <stdint.h>
7575
#include <stdio.h>
7676
#include <stdlib.h>
7777
#include <string.h>
7878
#include <sys/types.h>
7979

8080
#if defined(_WIN32)
8181
#include "platform/floating_point_win.h"
82-
#include "platform/inttypes_support_win.h"
8382
#endif // defined(_WIN32)
8483

8584
#if !defined(_WIN32)

runtime/platform/inttypes_support_win.h

Lines changed: 0 additions & 35 deletions
This file was deleted.

runtime/platform/platform_sources.gni

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ platform_sources = [
2222
"growable_array.h",
2323
"hashmap.cc",
2424
"hashmap.h",
25-
"inttypes_support_win.h",
2625
"memory_sanitizer.h",
2726
"safe_stack.h",
2827
"signal_blocker.h",

runtime/tools/create_archive.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,7 @@ def WriteCCFile(output_file,
8585
''' % date.today().year)
8686
out.write('''
8787
88-
#if defined(_WIN32)
89-
typedef unsigned __int8 uint8_t;
90-
#else
91-
#include <inttypes.h>
9288
#include <stdint.h>
93-
#endif
94-
#include <stddef.h>
9589
9690
''')
9791
out.write('namespace %s {\n' % outer_namespace)

0 commit comments

Comments
 (0)