Skip to content

Commit afa3ac5

Browse files
dgrove-ossdas
authored andcommitted
fixes for compiler warnings
Collection of small fixes to eliminate compiler warnings when building libdispatch and its tests. Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent ab9652e commit afa3ac5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/BlocksRuntime/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We allocate space and export a symbol to be used as the Class for the on-stack a
1414
1515
We keep these in a separate file so that we can include the runtime code in test subprojects but not include the data so that compiled code that sees the data in libSystem doesn't get confused by a second copy. Somehow these don't get unified in a common block.
1616
**********************/
17-
#define BLOCK_EXPORT extern __attribute__((visibility("default")))
17+
#define BLOCK_EXPORT __attribute__((visibility("default")))
1818

1919
BLOCK_EXPORT void * _NSConcreteStackBlock[32] = { 0 };
2020
BLOCK_EXPORT void * _NSConcreteMallocBlock[32] = { 0 };

src/BlocksRuntime/runtime.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ static __inline bool OSAtomicCompareAndSwapInt(int oldi, int newi, int volatile
5353
Globals
5454
************************/
5555

56+
#if HAVE_OBJC
5657
static void *_Block_copy_class = _NSConcreteMallocBlock;
5758
static void *_Block_copy_finalizing_class = _NSConcreteMallocBlock;
5859
static int _Block_copy_flag = BLOCK_NEEDS_FREE;
60+
#endif
5961
static int _Byref_flag_initial_value = BLOCK_BYREF_NEEDS_FREE | 4; // logical 2
6062

6163
static bool isGC = false;
@@ -156,7 +158,9 @@ static void _Block_assign_default(void *value, void **destptr) {
156158
static void _Block_setHasRefcount_default(const void *ptr, const bool hasRefcount) {
157159
}
158160

161+
#if HAVE_OBJC
159162
static void _Block_do_nothing(const void *aBlock) { }
163+
#endif
160164

161165
static void _Block_retain_object_default(const void *ptr) {
162166
}
@@ -176,6 +180,7 @@ static void _Block_memmove_default(void *dst, void *src, unsigned long size) {
176180
memmove(dst, src, (size_t)size);
177181
}
178182

183+
#if HAVE_OBJC
179184
static void _Block_memmove_gc_broken(void *dest, void *src, unsigned long size) {
180185
void **destp = (void **)dest;
181186
void **srcp = (void **)src;
@@ -186,6 +191,7 @@ static void _Block_memmove_gc_broken(void *dest, void *src, unsigned long size)
186191
size -= sizeof(void *);
187192
}
188193
}
194+
#endif
189195

190196
static void _Block_destructInstance_default(const void *aBlock) {}
191197

src/source.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,7 @@ _dispatch_source_debug_attr(dispatch_source_t ds, char* buf, size_t bufsiz)
25152515
"mask = 0x%x, pending_data = 0x%llx, registered = %d, "
25162516
"armed = %d, deleted = %d%s, canceled = %d, ",
25172517
target && target->dq_label ? target->dq_label : "", target,
2518-
dr->du_ident, dr->du_fflags, ds->ds_pending_data,
2518+
dr->du_ident, dr->du_fflags, (unsigned long long)ds->ds_pending_data,
25192519
ds->ds_is_installed, (bool)(ds->dq_atomic_flags & DSF_ARMED),
25202520
(bool)(ds->dq_atomic_flags & DSF_DELETED),
25212521
(ds->dq_atomic_flags & DSF_DEFERRED_DELETE) ? " (pending)" : "",

0 commit comments

Comments
 (0)