Skip to content

Commit 4211f34

Browse files
committed
time: explicitly size the time macros
The default backing for `enum` types on Windows are signed values, and the enumerators are handled via integer promotion to the type. Explicitly type the enums to ensure that the type is correct.
1 parent e83f3aa commit 4211f34

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dispatch/time.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct timespec;
6666
*/
6767
typedef uint64_t dispatch_time_t;
6868

69-
enum {
69+
enum : unsigned long long {
7070
DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull,
7171
};
7272

private/time_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ __BEGIN_DECLS
4949
* dispatch_source_set_timer(ds, t, 10 * NSEC_PER_SEC, 0);
5050
* dispatch_activate(ds);
5151
*/
52-
enum {
52+
enum : unsigned long long {
5353
DISPATCH_MONOTONICTIME_NOW DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = (1ull << 63)
5454
};
5555

0 commit comments

Comments
 (0)