Skip to content

Commit f189668

Browse files
committed
PHPC-175: Windows doesn't have these compiler attributes
1 parent 6282bb4 commit f189668

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

php_compat_53.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@
4141
# define PHONGO_CRYPTO_METHOD STREAM_CRYPTO_METHOD_SSLv23_CLIENT
4242
#endif
4343

44+
#if defined(__GNUC__)
45+
# define ARG_UNUSED __attribute__ ((unused))
46+
#else
47+
# define ARG_UNUSED
48+
#endif

php_phongo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ typedef struct
9393
PHONGO_API zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_domain_t */ domain, uint32_t /* mongoc_error_code_t */ code);
9494
PHONGO_API zend_class_entry* phongo_exception_from_phongo_domain(php_phongo_error_domain_t domain);
9595
PHONGO_API zval* phongo_throw_exception(php_phongo_error_domain_t domain TSRMLS_DC, const char *format, ...)
96+
#ifndef PHP_WIN32
9697
#ifdef ZTS
9798
__attribute__ ((format(printf, 3, 4)))
9899
#else
99100
__attribute__ ((format(printf, 2, 3)))
100101
#endif
102+
#endif
101103
;
102104

103105
PHONGO_API zend_object_handlers *phongo_get_std_object_handlers(void);

src/bson.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ PHP_MINIT_FUNCTION(bson)
6868
}
6969

7070
/* Forward declarations */
71-
bool php_phongo_bson_visit_document(const bson_iter_t *iter __attribute__((unused)), const char *key, const bson_t *v_document, void *data);
72-
bool php_phongo_bson_visit_array(const bson_iter_t *iter __attribute__((unused)), const char *key, const bson_t *v_document, void *data);
71+
bool php_phongo_bson_visit_document(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data);
72+
bool php_phongo_bson_visit_array(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data);
7373

7474
/* {{{ Santa's Little Helper: Object getters */
7575
void php_phongo_objectid_get_id(zval *object, bson_oid_t *oid TSRMLS_DC)
@@ -163,18 +163,18 @@ char *php_phongo_regex_get_flags(zval *object TSRMLS_DC)
163163
}
164164
/* }}} */
165165
#if 0
166-
bool php_phongo_bson_visit_before(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
166+
bool php_phongo_bson_visit_before(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
167167
{
168168
return false;
169169
}
170170
/* }}} */
171-
bool php_phongo_bson_visit_after(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
171+
bool php_phongo_bson_visit_after(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
172172
{
173173
return false;
174174
}
175175
/* }}} */
176176
#endif
177-
void php_phongo_bson_visit_corrupt(const bson_iter_t *iter __attribute__((unused)), void *data) /* {{{ */
177+
void php_phongo_bson_visit_corrupt(const bson_iter_t *iter ARG_UNUSED, void *data) /* {{{ */
178178
{
179179
zval *retval = ((php_phongo_bson_state *)data)->zchild;
180180

@@ -183,7 +183,7 @@ void php_phongo_bson_visit_corrupt(const bson_iter_t *iter __attribute__((unused
183183
zval_ptr_dtor(&retval);
184184
}
185185
/* }}} */
186-
bool php_phongo_bson_visit_double(const bson_iter_t *iter __attribute__((unused)), const char *key, double v_double, void *data) /* {{{ */
186+
bool php_phongo_bson_visit_double(const bson_iter_t *iter ARG_UNUSED, const char *key, double v_double, void *data) /* {{{ */
187187
{
188188
zval *retval = ((php_phongo_bson_state *)data)->zchild;
189189

@@ -192,7 +192,7 @@ bool php_phongo_bson_visit_double(const bson_iter_t *iter __attribute__((unused)
192192
return false;
193193
}
194194
/* }}} */
195-
bool php_phongo_bson_visit_utf8(const bson_iter_t *iter __attribute__((unused)), const char *key, size_t v_utf8_len, const char *v_utf8, void *data) /* {{{ */
195+
bool php_phongo_bson_visit_utf8(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_utf8_len, const char *v_utf8, void *data) /* {{{ */
196196
{
197197
zval *retval = ((php_phongo_bson_state *)data)->zchild;
198198

@@ -201,7 +201,7 @@ bool php_phongo_bson_visit_utf8(const bson_iter_t *iter __attribute__((unused)),
201201
return false;
202202
}
203203
/* }}} */
204-
bool php_phongo_bson_visit_binary(const bson_iter_t *iter __attribute__((unused)), const char *key, bson_subtype_t v_subtype, size_t v_binary_len, const uint8_t *v_binary, void *data) /* {{{ */
204+
bool php_phongo_bson_visit_binary(const bson_iter_t *iter ARG_UNUSED, const char *key, bson_subtype_t v_subtype, size_t v_binary_len, const uint8_t *v_binary, void *data) /* {{{ */
205205
{
206206
zval *retval = ((php_phongo_bson_state *)data)->zchild;
207207
zval *zchild = NULL;
@@ -226,7 +226,7 @@ bool php_phongo_bson_visit_binary(const bson_iter_t *iter __attribute__((unused)
226226
}
227227
/* }}} */
228228
#if 0
229-
bool php_phongo_bson_visit_undefined(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
229+
bool php_phongo_bson_visit_undefined(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
230230
{
231231
printf("Not Implemented\n");
232232

@@ -235,7 +235,7 @@ bool php_phongo_bson_visit_undefined(const bson_iter_t *iter __attribute__((unus
235235
/* }}} */
236236
#endif
237237

238-
bool php_phongo_bson_visit_oid(const bson_iter_t *iter __attribute__((unused)), const char *key, const bson_oid_t *v_oid, void *data) /* {{{ */
238+
bool php_phongo_bson_visit_oid(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_oid_t *v_oid, void *data) /* {{{ */
239239
{
240240
zval *retval = ((php_phongo_bson_state *)data)->zchild;
241241
zval *zchild = NULL;
@@ -251,7 +251,7 @@ bool php_phongo_bson_visit_oid(const bson_iter_t *iter __attribute__((unused)),
251251
return false;
252252
}
253253
/* }}} */
254-
bool php_phongo_bson_visit_bool(const bson_iter_t *iter __attribute__((unused)), const char *key, bool v_bool, void *data) /* {{{ */
254+
bool php_phongo_bson_visit_bool(const bson_iter_t *iter ARG_UNUSED, const char *key, bool v_bool, void *data) /* {{{ */
255255
{
256256
zval *retval = ((php_phongo_bson_state *)data)->zchild;
257257

@@ -260,7 +260,7 @@ bool php_phongo_bson_visit_bool(const bson_iter_t *iter __attribute__((unused)),
260260
return false;
261261
}
262262
/* }}} */
263-
bool php_phongo_bson_visit_date_time(const bson_iter_t *iter __attribute__((unused)), const char *key, int64_t msec_since_epoch, void *data) /* {{{ */
263+
bool php_phongo_bson_visit_date_time(const bson_iter_t *iter ARG_UNUSED, const char *key, int64_t msec_since_epoch, void *data) /* {{{ */
264264
{
265265
zval *retval = ((php_phongo_bson_state *)data)->zchild;
266266
zval *zchild = NULL;
@@ -276,7 +276,7 @@ bool php_phongo_bson_visit_date_time(const bson_iter_t *iter __attribute__((unus
276276
return false;
277277
}
278278
/* }}} */
279-
bool php_phongo_bson_visit_null(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
279+
bool php_phongo_bson_visit_null(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
280280
{
281281
zval *retval = ((php_phongo_bson_state *)data)->zchild;
282282

@@ -285,7 +285,7 @@ bool php_phongo_bson_visit_null(const bson_iter_t *iter __attribute__((unused)),
285285
return false;
286286
}
287287
/* }}} */
288-
bool php_phongo_bson_visit_regex(const bson_iter_t *iter __attribute__((unused)), const char *key, const char *v_regex, const char *v_options, void *data) /* {{{ */
288+
bool php_phongo_bson_visit_regex(const bson_iter_t *iter ARG_UNUSED, const char *key, const char *v_regex, const char *v_options, void *data) /* {{{ */
289289
{
290290
zval *retval = ((php_phongo_bson_state *)data)->zchild;
291291
zval *zchild = NULL;
@@ -302,15 +302,15 @@ bool php_phongo_bson_visit_regex(const bson_iter_t *iter __attribute__((unused))
302302
}
303303
/* }}} */
304304
#if 0
305-
bool php_phongo_bson_visit_dbpointer(const bson_iter_t *iter __attribute__((unused)), const char *key, size_t v_collection_len, const char *v_collection, const bson_oid_t *v_oid, void *data) /* {{{ */
305+
bool php_phongo_bson_visit_dbpointer(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_collection_len, const char *v_collection, const bson_oid_t *v_oid, void *data) /* {{{ */
306306
{
307307
printf("Not Implemented\n");
308308

309309
return true;
310310
}
311311
/* }}} */
312312
#endif
313-
bool php_phongo_bson_visit_code(const bson_iter_t *iter __attribute__((unused)), const char *key, size_t v_code_len, const char *v_code, void *data) /* {{{ */
313+
bool php_phongo_bson_visit_code(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_code_len, const char *v_code, void *data) /* {{{ */
314314
{
315315
zval *retval = ((php_phongo_bson_state *)data)->zchild;
316316
zval *zchild = NULL;
@@ -327,15 +327,15 @@ bool php_phongo_bson_visit_code(const bson_iter_t *iter __attribute__((unused)),
327327
}
328328
/* }}} */
329329
#if 0
330-
bool php_phongo_bson_visit_symbol(const bson_iter_t *iter __attribute__((unused)), const char *key, size_t v_symbol_len, const char *v_symbol, void *data) /* {{{ */
330+
bool php_phongo_bson_visit_symbol(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_symbol_len, const char *v_symbol, void *data) /* {{{ */
331331
{
332332
printf("Not Implemented\n");
333333

334334
return true;
335335
}
336336
/* }}} */
337337
#endif
338-
bool php_phongo_bson_visit_codewscope(const bson_iter_t *iter __attribute__((unused)), const char *key, size_t v_code_len, const char *v_code, const bson_t *v_scope, void *data) /* {{{ */
338+
bool php_phongo_bson_visit_codewscope(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_code_len, const char *v_code, const bson_t *v_scope, void *data) /* {{{ */
339339
{
340340
zval *retval = ((php_phongo_bson_state *)data)->zchild;
341341
zval *zchild = NULL;
@@ -351,7 +351,7 @@ bool php_phongo_bson_visit_codewscope(const bson_iter_t *iter __attribute__((unu
351351
return false;
352352
}
353353
/* }}} */
354-
bool php_phongo_bson_visit_int32(const bson_iter_t *iter __attribute__((unused)), const char *key, int32_t v_int32, void *data) /* {{{ */
354+
bool php_phongo_bson_visit_int32(const bson_iter_t *iter ARG_UNUSED, const char *key, int32_t v_int32, void *data) /* {{{ */
355355
{
356356
zval *retval = ((php_phongo_bson_state *)data)->zchild;
357357

@@ -360,7 +360,7 @@ bool php_phongo_bson_visit_int32(const bson_iter_t *iter __attribute__((unused))
360360
return false;
361361
}
362362
/* }}} */
363-
bool php_phongo_bson_visit_timestamp(const bson_iter_t *iter __attribute__((unused)), const char *key, uint32_t v_timestamp, uint32_t v_increment, void *data) /* {{{ */
363+
bool php_phongo_bson_visit_timestamp(const bson_iter_t *iter ARG_UNUSED, const char *key, uint32_t v_timestamp, uint32_t v_increment, void *data) /* {{{ */
364364
{
365365
zval *retval = ((php_phongo_bson_state *)data)->zchild;
366366
zval *zchild = NULL;
@@ -376,7 +376,7 @@ bool php_phongo_bson_visit_timestamp(const bson_iter_t *iter __attribute__((unus
376376
return false;
377377
}
378378
/* }}} */
379-
bool php_phongo_bson_visit_int64(const bson_iter_t *iter __attribute__((unused)), const char *key, int64_t v_int64, void *data) /* {{{ */
379+
bool php_phongo_bson_visit_int64(const bson_iter_t *iter ARG_UNUSED, const char *key, int64_t v_int64, void *data) /* {{{ */
380380
{
381381
zval *retval = ((php_phongo_bson_state *)data)->zchild;
382382

@@ -392,7 +392,7 @@ bool php_phongo_bson_visit_int64(const bson_iter_t *iter __attribute__((unused))
392392
return false;
393393
}
394394
/* }}} */
395-
bool php_phongo_bson_visit_maxkey(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
395+
bool php_phongo_bson_visit_maxkey(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
396396
{
397397
zval *retval = ((php_phongo_bson_state *)data)->zchild;
398398
zval *zchild = NULL;
@@ -408,7 +408,7 @@ bool php_phongo_bson_visit_maxkey(const bson_iter_t *iter __attribute__((unused)
408408
return false;
409409
}
410410
/* }}} */
411-
bool php_phongo_bson_visit_minkey(const bson_iter_t *iter __attribute__((unused)), const char *key, void *data) /* {{{ */
411+
bool php_phongo_bson_visit_minkey(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
412412
{
413413
zval *retval = ((php_phongo_bson_state *)data)->zchild;
414414
zval *zchild = NULL;
@@ -454,7 +454,7 @@ static const bson_visitor_t php_bson_visitors = {
454454
};
455455

456456

457-
bool php_phongo_bson_visit_document(const bson_iter_t *iter __attribute__((unused)), const char *key, const bson_t *v_document, void *data)
457+
bool php_phongo_bson_visit_document(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data)
458458
{
459459
zval *retval = ((php_phongo_bson_state *)data)->zchild;
460460
bson_iter_t child;
@@ -489,7 +489,7 @@ bool php_phongo_bson_visit_document(const bson_iter_t *iter __attribute__((unuse
489489
}
490490

491491

492-
bool php_phongo_bson_visit_array(const bson_iter_t *iter __attribute__((unused)), const char *key, const bson_t *v_array, void *data)
492+
bool php_phongo_bson_visit_array(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_array, void *data)
493493
{
494494
zval *retval = ((php_phongo_bson_state *)data)->zchild;
495495
bson_iter_t child;

0 commit comments

Comments
 (0)