Git fork

reftable/basics: introduce `REFTABLE_UNUSED` annotation

Introduce the `REFTABLE_UNUSED` annotation and replace all existing
users of `UNUSED` in the reftable library to use the new macro instead.

Note that we unconditionally define `MAYBE_UNUSED` in the exact same
way, so doing so unconditionally for `REFTABLE_UNUSED` should be fine,
too.

Suggested-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
f93b2a04 f8ed12de

+24 -22
+2
reftable/basics.h
··· 16 16 #include "system.h" 17 17 #include "reftable-basics.h" 18 18 19 + #define REFTABLE_UNUSED __attribute__((__unused__)) 20 + 19 21 struct reftable_buf { 20 22 size_t alloc; 21 23 size_t len;
+3 -3
reftable/blocksource.c
··· 13 13 #include "reftable-blocksource.h" 14 14 #include "reftable-error.h" 15 15 16 - static void reftable_buf_return_block(void *b UNUSED, struct reftable_block *dest) 16 + static void reftable_buf_return_block(void *b REFTABLE_UNUSED, struct reftable_block *dest) 17 17 { 18 18 if (dest->len) 19 19 memset(dest->data, 0xff, dest->len); 20 20 reftable_free(dest->data); 21 21 } 22 22 23 - static void reftable_buf_close(void *b UNUSED) 23 + static void reftable_buf_close(void *b REFTABLE_UNUSED) 24 24 { 25 25 } 26 26 ··· 67 67 return ((struct file_block_source *)b)->size; 68 68 } 69 69 70 - static void file_return_block(void *b UNUSED, struct reftable_block *dest UNUSED) 70 + static void file_return_block(void *b REFTABLE_UNUSED, struct reftable_block *dest REFTABLE_UNUSED) 71 71 { 72 72 } 73 73
+5 -5
reftable/iter.c
··· 25 25 return it->ops->next(it->iter_arg, rec); 26 26 } 27 27 28 - static int empty_iterator_seek(void *arg UNUSED, struct reftable_record *want UNUSED) 28 + static int empty_iterator_seek(void *arg REFTABLE_UNUSED, struct reftable_record *want REFTABLE_UNUSED) 29 29 { 30 30 return 0; 31 31 } 32 32 33 - static int empty_iterator_next(void *arg UNUSED, struct reftable_record *rec UNUSED) 33 + static int empty_iterator_next(void *arg REFTABLE_UNUSED, struct reftable_record *rec REFTABLE_UNUSED) 34 34 { 35 35 return 1; 36 36 } 37 37 38 - static void empty_iterator_close(void *arg UNUSED) 38 + static void empty_iterator_close(void *arg REFTABLE_UNUSED) 39 39 { 40 40 } 41 41 ··· 143 143 return 0; 144 144 } 145 145 146 - static int indexed_table_ref_iter_seek(void *p UNUSED, 147 - struct reftable_record *want UNUSED) 146 + static int indexed_table_ref_iter_seek(void *p REFTABLE_UNUSED, 147 + struct reftable_record *want REFTABLE_UNUSED) 148 148 { 149 149 return REFTABLE_API_ERROR; 150 150 }
+13 -13
reftable/record.c
··· 490 490 } 491 491 492 492 static int reftable_obj_record_copy_from(void *rec, const void *src_rec, 493 - uint32_t hash_size UNUSED) 493 + uint32_t hash_size REFTABLE_UNUSED) 494 494 { 495 495 struct reftable_obj_record *obj = rec; 496 496 const struct reftable_obj_record *src = src_rec; ··· 528 528 } 529 529 530 530 static int reftable_obj_record_encode(const void *rec, struct string_view s, 531 - uint32_t hash_size UNUSED) 531 + uint32_t hash_size REFTABLE_UNUSED) 532 532 { 533 533 const struct reftable_obj_record *r = rec; 534 534 struct string_view start = s; ··· 563 563 564 564 static int reftable_obj_record_decode(void *rec, struct reftable_buf key, 565 565 uint8_t val_type, struct string_view in, 566 - uint32_t hash_size UNUSED, 567 - struct reftable_buf *scratch UNUSED) 566 + uint32_t hash_size REFTABLE_UNUSED, 567 + struct reftable_buf *scratch REFTABLE_UNUSED) 568 568 { 569 569 struct string_view start = in; 570 570 struct reftable_obj_record *r = rec; ··· 618 618 return start.len - in.len; 619 619 } 620 620 621 - static int not_a_deletion(const void *p UNUSED) 621 + static int not_a_deletion(const void *p REFTABLE_UNUSED) 622 622 { 623 623 return 0; 624 624 } 625 625 626 626 static int reftable_obj_record_equal_void(const void *a, const void *b, 627 - uint32_t hash_size UNUSED) 627 + uint32_t hash_size REFTABLE_UNUSED) 628 628 { 629 629 struct reftable_obj_record *ra = (struct reftable_obj_record *) a; 630 630 struct reftable_obj_record *rb = (struct reftable_obj_record *) b; ··· 1054 1054 } 1055 1055 1056 1056 static int reftable_index_record_copy_from(void *rec, const void *src_rec, 1057 - uint32_t hash_size UNUSED) 1057 + uint32_t hash_size REFTABLE_UNUSED) 1058 1058 { 1059 1059 struct reftable_index_record *dst = rec; 1060 1060 const struct reftable_index_record *src = src_rec; ··· 1075 1075 reftable_buf_release(&idx->last_key); 1076 1076 } 1077 1077 1078 - static uint8_t reftable_index_record_val_type(const void *rec UNUSED) 1078 + static uint8_t reftable_index_record_val_type(const void *rec REFTABLE_UNUSED) 1079 1079 { 1080 1080 return 0; 1081 1081 } 1082 1082 1083 1083 static int reftable_index_record_encode(const void *rec, struct string_view out, 1084 - uint32_t hash_size UNUSED) 1084 + uint32_t hash_size REFTABLE_UNUSED) 1085 1085 { 1086 1086 const struct reftable_index_record *r = 1087 1087 (const struct reftable_index_record *)rec; ··· 1097 1097 } 1098 1098 1099 1099 static int reftable_index_record_decode(void *rec, struct reftable_buf key, 1100 - uint8_t val_type UNUSED, 1100 + uint8_t val_type REFTABLE_UNUSED, 1101 1101 struct string_view in, 1102 - uint32_t hash_size UNUSED, 1103 - struct reftable_buf *scratch UNUSED) 1102 + uint32_t hash_size REFTABLE_UNUSED, 1103 + struct reftable_buf *scratch REFTABLE_UNUSED) 1104 1104 { 1105 1105 struct string_view start = in; 1106 1106 struct reftable_index_record *r = rec; ··· 1120 1120 } 1121 1121 1122 1122 static int reftable_index_record_equal(const void *a, const void *b, 1123 - uint32_t hash_size UNUSED) 1123 + uint32_t hash_size REFTABLE_UNUSED) 1124 1124 { 1125 1125 struct reftable_index_record *ia = (struct reftable_index_record *) a; 1126 1126 struct reftable_index_record *ib = (struct reftable_index_record *) b;
+1 -1
reftable/writer.c
··· 649 649 done:; 650 650 } 651 651 652 - static void object_record_free(void *void_arg UNUSED, void *key) 652 + static void object_record_free(void *void_arg REFTABLE_UNUSED, void *key) 653 653 { 654 654 struct obj_index_tree_node *entry = key; 655 655