Skip to content
This repository was archived by the owner on May 4, 2018. It is now read-only.

Commit 983fa68

Browse files
committed
darwin: fix 10.6 build error in fsevents.c
Work around an 'initializer element is not constant' build error in src/unix/fsevents.c by turning the const int flags into #defines. Only an issue on OS X 10.6 due to the old compiler it uses. Fixes #908. This is a back-port of commit 82f2472 from the master branch.
1 parent 712835a commit 983fa68

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/unix/fsevents.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) {
4646
#include <CoreFoundation/CFRunLoop.h>
4747
#include <CoreServices/CoreServices.h>
4848

49+
/* These are macros to avoid "initializer element is not constant" errors
50+
* with old versions of gcc.
51+
*/
52+
#define kFSEventsModified (kFSEventStreamEventFlagItemFinderInfoMod | \
53+
kFSEventStreamEventFlagItemModified | \
54+
kFSEventStreamEventFlagItemInodeMetaMod | \
55+
kFSEventStreamEventFlagItemChangeOwner | \
56+
kFSEventStreamEventFlagItemXattrMod)
57+
58+
#define kFSEventsRenamed (kFSEventStreamEventFlagItemCreated | \
59+
kFSEventStreamEventFlagItemRemoved | \
60+
kFSEventStreamEventFlagItemRenamed)
61+
62+
#define kFSEventsSystem (kFSEventStreamEventFlagUserDropped | \
63+
kFSEventStreamEventFlagKernelDropped | \
64+
kFSEventStreamEventFlagEventIdsWrapped | \
65+
kFSEventStreamEventFlagHistoryDone | \
66+
kFSEventStreamEventFlagMount | \
67+
kFSEventStreamEventFlagUnmount | \
68+
kFSEventStreamEventFlagRootChanged)
69+
4970
typedef struct uv__fsevents_event_s uv__fsevents_event_t;
5071
typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t;
5172
typedef struct uv__cf_loop_state_s uv__cf_loop_state_t;
@@ -72,22 +93,6 @@ struct uv__fsevents_event_s {
7293
char path[1];
7394
};
7495

75-
static const int kFSEventsModified = kFSEventStreamEventFlagItemFinderInfoMod |
76-
kFSEventStreamEventFlagItemModified |
77-
kFSEventStreamEventFlagItemInodeMetaMod |
78-
kFSEventStreamEventFlagItemChangeOwner |
79-
kFSEventStreamEventFlagItemXattrMod;
80-
static const int kFSEventsRenamed = kFSEventStreamEventFlagItemCreated |
81-
kFSEventStreamEventFlagItemRemoved |
82-
kFSEventStreamEventFlagItemRenamed;
83-
static const int kFSEventsSystem = kFSEventStreamEventFlagUserDropped |
84-
kFSEventStreamEventFlagKernelDropped |
85-
kFSEventStreamEventFlagEventIdsWrapped |
86-
kFSEventStreamEventFlagHistoryDone |
87-
kFSEventStreamEventFlagMount |
88-
kFSEventStreamEventFlagUnmount |
89-
kFSEventStreamEventFlagRootChanged;
90-
9196
/* Forward declarations */
9297
static void uv__cf_loop_cb(void* arg);
9398
static void* uv__cf_loop_runner(void* arg);

0 commit comments

Comments
 (0)