Browse Source

ccan: update.

This gives us a slew of -Wextra fixes (not all of them though!) but
we're actually doing it for the monotonic version of timers.

This breaks some stuff, so we fix that up next.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
74d471d4e4
  1. 2
      ccan/README
  2. 2
      ccan/ccan/alignof/_info
  3. 2
      ccan/ccan/alignof/test/run.c
  4. 2
      ccan/ccan/array_size/test/compile_fail-function-param.c
  5. 2
      ccan/ccan/array_size/test/compile_fail.c
  6. 2
      ccan/ccan/array_size/test/run.c
  7. 2
      ccan/ccan/asort/_info
  8. 2
      ccan/ccan/asort/test/compile_fail-context-type.c
  9. 2
      ccan/ccan/build_assert/test/compile_fail-expr.c
  10. 2
      ccan/ccan/build_assert/test/compile_fail.c
  11. 2
      ccan/ccan/build_assert/test/compile_ok.c
  12. 2
      ccan/ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c
  13. 4
      ccan/ccan/cast/_info
  14. 2
      ccan/ccan/cast/test/compile_fail-cast_const.c
  15. 2
      ccan/ccan/cast/test/compile_fail-cast_const2.c
  16. 2
      ccan/ccan/cast/test/compile_fail-cast_const3.c
  17. 2
      ccan/ccan/cast/test/compile_fail-cast_signed-const.c
  18. 2
      ccan/ccan/cast/test/compile_fail-cast_signed-sizesame.c
  19. 2
      ccan/ccan/cast/test/compile_fail-cast_signed.c
  20. 2
      ccan/ccan/cast/test/compile_fail-cast_static-2.c
  21. 2
      ccan/ccan/cast/test/compile_fail-cast_static-3.c
  22. 2
      ccan/ccan/cast/test/compile_fail-cast_static.c
  23. 1
      ccan/ccan/cast/test/compile_ok-static.c
  24. 3
      ccan/ccan/cdump/_info
  25. 2
      ccan/ccan/cdump/cdump.c
  26. 2
      ccan/ccan/check_type/test/compile_fail-check_type.c
  27. 2
      ccan/ccan/check_type/test/compile_fail-check_type_unsigned.c
  28. 1
      ccan/ccan/check_type/test/compile_fail-check_types_match.c
  29. 1
      ccan/ccan/check_type/test/run.c
  30. 2
      ccan/ccan/compiler/_info
  31. 4
      ccan/ccan/compiler/test/compile_fail-printf.c
  32. 2
      ccan/ccan/compiler/test/run-is_compile_constant.c
  33. 12
      ccan/ccan/container_of/_info
  34. 2
      ccan/ccan/container_of/test/compile_fail-bad-type.c
  35. 2
      ccan/ccan/container_of/test/compile_fail-types.c
  36. 2
      ccan/ccan/container_of/test/compile_fail-var-types.c
  37. 2
      ccan/ccan/container_of/test/run.c
  38. 1
      ccan/ccan/crypto/siphash24/siphash24.c
  39. 2
      ccan/ccan/endian/test/run.c
  40. 13
      ccan/ccan/err/test/run.c
  41. 5
      ccan/ccan/htable/_info
  42. 1
      ccan/ccan/htable/htable.h
  43. 4
      ccan/ccan/htable/test/run-copy.c
  44. 4
      ccan/ccan/htable/test/run-size.c
  45. 4
      ccan/ccan/htable/test/run-type-int.c
  46. 4
      ccan/ccan/htable/test/run-type.c
  47. 2
      ccan/ccan/htable/test/run-zero-hash-first-entry.c
  48. 4
      ccan/ccan/htable/test/run.c
  49. 2
      ccan/ccan/ilog/test/run-out-of-line.c
  50. 2
      ccan/ccan/ilog/test/run.c
  51. 7
      ccan/ccan/io/io.h
  52. 10
      ccan/ccan/io/poll.c
  53. 2
      ccan/ccan/io/test/run-01-start-finish.c
  54. 2
      ccan/ccan/io/test/run-02-read.c
  55. 7
      ccan/ccan/io/test/run-15-timeout.c
  56. 14
      ccan/ccan/io/test/run-20-io_time_override.c
  57. 2
      ccan/ccan/isaac/test/run.c
  58. 2
      ccan/ccan/isaac/test/run64.c
  59. 2
      ccan/ccan/likely/test/run-debug.c
  60. 2
      ccan/ccan/likely/test/run.c
  61. 2
      ccan/ccan/list/_info
  62. 23
      ccan/ccan/list/list.h
  63. 5
      ccan/ccan/list/test/run-CCAN_LIST_DEBUG.c
  64. 3
      ccan/ccan/list/test/run-check-corrupt.c
  65. 2
      ccan/ccan/list/test/run-check-nonconst.c
  66. 2
      ccan/ccan/list/test/run-list_del_from-assert.c
  67. 2
      ccan/ccan/list/test/run-list_prev-list_next.c
  68. 2
      ccan/ccan/list/test/run-prepend_list.c
  69. 2
      ccan/ccan/list/test/run-single-eval.c
  70. 2
      ccan/ccan/list/test/run.c
  71. 1
      ccan/ccan/mem/mem.h
  72. 2
      ccan/ccan/noerr/_info
  73. 2
      ccan/ccan/noerr/test/run.c
  74. 2
      ccan/ccan/opt/opt.h
  75. 2
      ccan/ccan/opt/test/compile_ok-const-arg.c
  76. 6
      ccan/ccan/opt/test/run-add_desc.c
  77. 2
      ccan/ccan/opt/test/run-checkopt.c
  78. 2
      ccan/ccan/opt/test/run-consume_words.c
  79. 2
      ccan/ccan/opt/test/run-helpers.c
  80. 2
      ccan/ccan/opt/test/run-iter.c
  81. 6
      ccan/ccan/opt/test/run-set_alloc.c
  82. 6
      ccan/ccan/opt/test/run-usage.c
  83. 2
      ccan/ccan/opt/test/utils.c
  84. 3
      ccan/ccan/order/order.c
  85. 2
      ccan/ccan/order/test/compile_fail_1.c
  86. 2
      ccan/ccan/order/test/compile_fail_2.c
  87. 2
      ccan/ccan/order/test/compile_ok.c
  88. 2
      ccan/ccan/order/test/run-fancy.c
  89. 3
      ccan/ccan/pipecmd/_info
  90. 12
      ccan/ccan/pipecmd/pipecmd.c
  91. 2
      ccan/ccan/ptrint/_info
  92. 2
      ccan/ccan/read_write_all/_info
  93. 3
      ccan/ccan/read_write_all/test/run-read_all.c
  94. 5
      ccan/ccan/read_write_all/test/run-write_all.c
  95. 6
      ccan/ccan/str/_info
  96. 2
      ccan/ccan/str/test/compile_fail-STR_MAX_CHARS.c
  97. 1
      ccan/ccan/str/test/compile_fail-isalnum.c
  98. 1
      ccan/ccan/str/test/compile_fail-isalpha.c
  99. 1
      ccan/ccan/str/test/compile_fail-isascii.c
  100. 1
      ccan/ccan/str/test/compile_fail-isblank.c

2
ccan/README

@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net.
CCAN version: init-2247-g5e37a0f
CCAN version: init-2302-g6b74669

2
ccan/ccan/alignof/_info

@ -21,7 +21,7 @@
*
* // Output contains "ALIGNOF(char) == 1"
* // Will also print out whether an onstack char array can hold a long.
* int main(int argc, char *argv[])
* int main(void)
* {
* char arr[sizeof(int)];
*

2
ccan/ccan/alignof/test/run.c

@ -24,7 +24,7 @@ struct lots_of_types
char c5;
};
int main(int argc, char *argv[])
int main(void)
{
struct lots_of_types lots_of_types, *lp = malloc(sizeof(*lp));
char c;

2
ccan/ccan/array_size/test/compile_fail-function-param.c

@ -18,7 +18,7 @@ int check_parameter(const struct foo *array)
#endif
}
int main(int argc, char *argv[])
int main(void)
{
return check_parameter(NULL);
}

2
ccan/ccan/array_size/test/compile_fail.c

@ -2,6 +2,8 @@
int main(int argc, char *argv[8])
{
(void)argc;
(void)argv;
char array[100];
#ifdef FAIL
return ARRAY_SIZE(argv) + ARRAY_SIZE(array);

2
ccan/ccan/array_size/test/run.c

@ -16,7 +16,7 @@ static int array2_size = ARRAY_SIZE(array2);
static int array3_size = ARRAY_SIZE(array3);
static int array4_size = ARRAY_SIZE(array4);
int main(int argc, char *argv[])
int main(void)
{
plan_tests(8);
ok1(array1_size == 1);

2
ccan/ccan/asort/_info

@ -31,7 +31,7 @@
* int main(int argc, char *argv[])
* {
* bool casefold = false;
* unsigned int i;
* int i;
*
* if (argc < 2) {
* fprintf(stderr, "Usage: %s [-i] <list>...\n"

2
ccan/ccan/asort/test/compile_fail-context-type.c

@ -1,7 +1,7 @@
#include <ccan/asort/asort.h>
#include <ccan/asort/asort.c>
static int cmp(char *const *a, char *const *b, int *flag)
static int cmp(char *const *a UNNEEDED, char *const *b UNNEEDED, int *flag UNNEEDED)
{
return 0;
}

2
ccan/ccan/build_assert/test/compile_fail-expr.c

@ -1,6 +1,6 @@
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
return BUILD_ASSERT_OR_ZERO(1 == 0);

2
ccan/ccan/build_assert/test/compile_fail.c

@ -1,6 +1,6 @@
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
BUILD_ASSERT(1 == 0);

2
ccan/ccan/build_assert/test/compile_ok.c

@ -1,6 +1,6 @@
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
BUILD_ASSERT(1 == 1);
return 0;

2
ccan/ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c

@ -1,7 +1,7 @@
#include <ccan/build_assert/build_assert.h>
#include <ccan/tap/tap.h>
int main(int argc, char *argv[])
int main(void)
{
plan_tests(1);
ok1(BUILD_ASSERT_OR_ZERO(1 == 1) == 0);

4
ccan/ccan/cast/_info

@ -24,6 +24,7 @@
* #include <ccan/cast/cast.h>
* #include <stdint.h>
* #include <stdio.h>
* #include <stdlib.h>
*
* // Find char @orig in @str, if @repl, replace them. Return number.
* static size_t find_chars(char *str, char orig, char repl)
@ -53,6 +54,9 @@
* {
* uint64_t hash;
*
* if (argc != 2) {
* fprintf(stderr, "Needs argument\n"); exit(1);
* }
* // find_chars wants a non-const string, but doesn't
* // need it if repl == 0.
* printf("%zu %c's in 'test string'\n",

2
ccan/ccan/cast/test/compile_fail-cast_const.c

@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char *uc;
const

2
ccan/ccan/cast/test/compile_fail-cast_const2.c

@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char **uc;
const

2
ccan/ccan/cast/test/compile_fail-cast_const3.c

@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char ***uc;
const

2
ccan/ccan/cast/test/compile_fail-cast_signed-const.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL

2
ccan/ccan/cast/test/compile_fail-cast_signed-sizesame.c

@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL

2
ccan/ccan/cast/test/compile_fail-cast_signed.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL

2
ccan/ccan/cast/test/compile_fail-cast_static-2.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
char *c;
#ifdef FAIL

2
ccan/ccan/cast/test/compile_fail-cast_static-3.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
char *c;
#ifdef FAIL

2
ccan/ccan/cast/test/compile_fail-cast_static.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
long c;
#ifdef FAIL

1
ccan/ccan/cast/test/compile_ok-static.c

@ -6,5 +6,6 @@ static char *p = cast_const(char *, (const char *)"hello");
int main(int argc, char *argv[])
{
(void)argc;
return p[0] == argv[0][0];
}

3
ccan/ccan/cdump/_info

@ -29,7 +29,8 @@
* {
* char *code, *problems;
* struct cdump_definitions *defs;
* int i, j;
* int i;
* size_t j;
*
* // Read code from stdin.
* code = grab_file(NULL, NULL);

2
ccan/ccan/cdump/cdump.c

@ -213,7 +213,7 @@ static struct cdump_type *get_type(struct cdump_definitions *defs,
enum cdump_type_kind kind,
const char *name)
{
cdump_map_t *m;
cdump_map_t *m = (void *)0x1L; /* Shouldn't be used */
struct cdump_type *t;
switch (kind) {

2
ccan/ccan/check_type/test/compile_fail-check_type.c

@ -2,6 +2,8 @@
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
#ifdef FAIL
check_type(argc, char);
#endif

2
ccan/ccan/check_type/test/compile_fail-check_type_unsigned.c

@ -2,6 +2,8 @@
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
#ifdef FAIL
#if HAVE_TYPEOF
check_type(argc, unsigned int);

1
ccan/ccan/check_type/test/compile_fail-check_types_match.c

@ -3,6 +3,7 @@
int main(int argc, char *argv[])
{
unsigned char x = argc;
(void)argv;
#ifdef FAIL
check_types_match(argc, x);
#endif

1
ccan/ccan/check_type/test/run.c

@ -5,6 +5,7 @@ int main(int argc, char *argv[])
{
int x = 0, y = 0;
(void)argv;
plan_tests(9);
ok1(check_type(argc, int) == 0);

2
ccan/ccan/compiler/_info

@ -41,7 +41,7 @@
* va_end(ap);
* }
*
* int main(int argc, char *argv[])
* int main(int argc, char *argv[] UNNEEDED)
* {
* if (argc != 1) {
* logger(3, "Don't want %i arguments!\n", argc-1);

4
ccan/ccan/compiler/test/compile_fail-printf.c

@ -2,9 +2,11 @@
static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...)
{
(void)x;
(void)fmt;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i = 0;

2
ccan/ccan/compiler/test/run-is_compile_constant.c

@ -3,6 +3,8 @@
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
plan_tests(2);
ok1(!IS_COMPILE_CONSTANT(argc));

12
ccan/ccan/container_of/_info

@ -26,17 +26,19 @@
* struct timer timer;
* };
*
* static void register_timer(struct timer *timer)
* {
* //...
* }
*
* static void my_timer_callback(struct timer *timer)
* {
* struct info *info = container_of(timer, struct info, timer);
* printf("my_stuff is %u\n", info->my_stuff);
* }
*
* static void register_timer(struct timer *timer)
* {
* (void)timer;
* (void)my_timer_callback;
* //...
* }
*
* int main(void)
* {
* struct info info = { .my_stuff = 1 };

2
ccan/ccan/container_of/test/compile_fail-bad-type.c

@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 };
int *intp = &foo.a;

2
ccan/ccan/container_of/test/compile_fail-types.c

@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 }, *foop;
int *intp = &foo.a;

2
ccan/ccan/container_of/test/compile_fail-var-types.c

@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 }, *foop;
int *intp = &foo.a;

2
ccan/ccan/container_of/test/run.c

@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 };
int *intp = &foo.a;

1
ccan/ccan/crypto/siphash24/siphash24.c

@ -45,6 +45,7 @@ static void check_siphash24(struct siphash24_ctx *ctx)
static bool alignment_ok(const void *p, size_t n)
{
#if HAVE_UNALIGNED_ACCESS
(void)p; (void)n;
return true;
#else
return ((size_t)p % n == 0);

2
ccan/ccan/endian/test/run.c

@ -3,7 +3,7 @@
#include <stddef.h>
#include <ccan/tap/tap.h>
int main(int argc, char *argv[])
int main(void)
{
union {
uint64_t u64;

13
ccan/ccan/err/test/run.c

@ -15,6 +15,7 @@ int main(int argc, char *argv[])
int pfd[2];
const char *base;
(void)argc;
plan_tests(24);
err_set_progname(argv[0]);
@ -27,7 +28,8 @@ int main(int argc, char *argv[])
base = argv[0];
/* Test err() in child */
pipe(pfd);
if (pipe(pfd))
abort();
fflush(stdout);
if (fork()) {
char buffer[BUFFER_MAX+1];
@ -59,7 +61,8 @@ int main(int argc, char *argv[])
}
/* Test errx() in child */
pipe(pfd);
if (pipe(pfd))
abort();
fflush(stdout);
if (fork()) {
char buffer[BUFFER_MAX+1];
@ -89,7 +92,8 @@ int main(int argc, char *argv[])
/* Test warn() in child */
pipe(pfd);
if (pipe(pfd))
abort();
fflush(stdout);
if (fork()) {
char buffer[BUFFER_MAX+1];
@ -121,7 +125,8 @@ int main(int argc, char *argv[])
}
/* Test warnx() in child */
pipe(pfd);
if (pipe(pfd))
abort();
fflush(stdout);
if (fork()) {
char buffer[BUFFER_MAX+1];

5
ccan/ccan/htable/_info

@ -36,6 +36,7 @@
* // Wrapper for rehash function pointer.
* static size_t rehash(const void *e, void *unused)
* {
* (void)unused;
* return hash_string(((struct name_to_digit *)e)->name);
* }
*
@ -64,7 +65,7 @@
* int main(int argc, char *argv[])
* {
* struct htable ht;
* unsigned int i;
* int i;
* unsigned long val;
*
* if (argc < 2)
@ -73,7 +74,7 @@
*
* // Create and populate hash table.
* htable_init(&ht, rehash, NULL);
* for (i = 0; i < sizeof(map)/sizeof(map[0]); i++)
* for (i = 0; i < (int)(sizeof(map)/sizeof(map[0])); i++)
* htable_add(&ht, hash_string(map[i].name), &map[i]);
*
* // Add any aliases to the hash table.

1
ccan/ccan/htable/htable.h

@ -35,6 +35,7 @@ struct htable {
* // For simplicity's sake, say hash value is contents of elem.
* static size_t rehash(const void *elem, void *unused)
* {
* (void)unused;
* return *(size_t *)elem;
* }
* static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL);

4
ccan/ccan/htable/test/run-copy.c

@ -6,7 +6,7 @@
#define NUM_VALS 512
static size_t hash(const void *elem, void *unused)
static size_t hash(const void *elem, void *unused UNNEEDED)
{
size_t h = *(uint64_t *)elem / 2;
return h;
@ -17,7 +17,7 @@ static bool cmp(const void *candidate, void *ptr)
return *(const uint64_t *)candidate == *(const uint64_t *)ptr;
}
int main(int argc, char *argv[])
int main(void)
{
struct htable ht, ht2;
uint64_t val[NUM_VALS], i;

4
ccan/ccan/htable/test/run-size.c

@ -8,13 +8,13 @@
/* We use the number divided by two as the hash (for lots of
collisions). */
static size_t hash(const void *elem, void *unused)
static size_t hash(const void *elem, void *unused UNNEEDED)
{
size_t h = *(uint64_t *)elem / 2;
return h;
}
int main(int argc, char *argv[])
int main(void)
{
struct htable ht;
uint64_t val[NUM_VALS];

4
ccan/ccan/htable/test/run-type-int.c

@ -88,7 +88,7 @@ static void del_vals(struct htable_obj *ht,
}
static void del_vals_bykey(struct htable_obj *ht,
const struct obj val[], unsigned int num)
const struct obj val[] UNNEEDED, unsigned int num)
{
unsigned int i;
@ -112,7 +112,7 @@ static bool check_mask(struct htable *ht, const struct obj val[], unsigned num)
return true;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i;
struct htable_obj ht, ht2;

4
ccan/ccan/htable/test/run-type.c

@ -83,7 +83,7 @@ static void del_vals(struct htable_obj *ht,
}
static void del_vals_bykey(struct htable_obj *ht,
const struct obj val[], unsigned int num)
const struct obj val[] UNNEEDED, unsigned int num)
{
unsigned int i;
@ -107,7 +107,7 @@ static bool check_mask(struct htable *ht, const struct obj val[], unsigned num)
return true;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i;
struct htable_obj ht, ht2;

2
ccan/ccan/htable/test/run-zero-hash-first-entry.c

@ -8,7 +8,7 @@ struct data {
};
/* Hash is simply key itself. */
static size_t hash(const void *e, void *unused)
static size_t hash(const void *e, void *unused UNNEEDED)
{
struct data *d = (struct data *)e;

4
ccan/ccan/htable/test/run.c

@ -10,7 +10,7 @@
/* We use the number divided by two as the hash (for lots of
collisions), plus set all the higher bits so we can detect if they
don't get masked out. */
static size_t hash(const void *elem, void *unused)
static size_t hash(const void *elem, void *unused UNNEEDED)
{
size_t h = *(uint64_t *)elem / 2;
h |= -1UL << NUM_BITS;
@ -95,7 +95,7 @@ static bool check_mask(struct htable *ht, uint64_t val[], unsigned num)
return true;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i, weight;
uintptr_t perfect_bit;

2
ccan/ccan/ilog/test/run-out-of-line.c

@ -19,7 +19,7 @@ static int test_ilog64(uint64_t _v){
#define NTRIALS (64)
int main(int _argc,const char *_argv[]){
int main(void){
int i;
int j;
int (*il32)(uint32_t) = ilog32;

2
ccan/ccan/ilog/test/run.c

@ -19,7 +19,7 @@ static int test_ilog64(uint64_t _v){
#define NTRIALS (64)
int main(int _argc,const char *_argv[]){
int main(void){
int i;
int j;
/*This is how many tests you plan to run.*/

7
ccan/ccan/io/io.h

@ -47,7 +47,8 @@ struct io_conn;
* int fd[2];
* struct io_conn *conn;
*
* pipe(fd);
* if (pipe(fd) != 0)
* exit(1);
* conn = io_new_conn(NULL, fd[0], conn_init, (const char *)"hi!");
* if (!conn)
* exit(1);
@ -653,11 +654,11 @@ int io_conn_fd(const struct io_conn *conn);
* io_time_override - override the normal call for time.
* @nowfn: the function to call.
*
* io usually uses time_now() internally, but this forces it
* io usually uses time_mono() internally, but this forces it
* to use your function (eg. for debugging). Returns the old
* one.
*/
struct timeabs (*io_time_override(struct timeabs (*now)(void)))(void);
struct timemono (*io_time_override(struct timemono (*now)(void)))(void);
/**
* io_set_debug - set synchronous mode on a connection.

10
ccan/ccan/io/poll.c

@ -16,11 +16,11 @@ static struct pollfd *pollfds = NULL;
static struct fd **fds = NULL;
static LIST_HEAD(closing);
static LIST_HEAD(always);
static struct timeabs (*nowfn)(void) = time_now;
static struct timemono (*nowfn)(void) = time_mono;
struct timeabs (*io_time_override(struct timeabs (*now)(void)))(void)
struct timemono (*io_time_override(struct timemono (*now)(void)))(void)
{
struct timeabs (*old)(void) = nowfn;
struct timemono (*old)(void) = nowfn;
nowfn = now;
return old;
}
@ -262,7 +262,7 @@ void *io_loop(struct timers *timers, struct timer **expired)
assert(num_waiting);
if (timers) {
struct timeabs now, first;
struct timemono now, first;
now = nowfn();
@ -274,7 +274,7 @@ void *io_loop(struct timers *timers, struct timer **expired)
/* Now figure out how long to wait for the next one. */
if (timer_earliest(timers, &first)) {
uint64_t next;
next = time_to_msec(time_between(first, now));
next = time_to_msec(timemono_between(first, now));
if (next < INT_MAX)
ms_timeout = next;
else

2
ccan/ccan/io/test/run-01-start-finish.c

@ -69,7 +69,7 @@ static int make_listen_fd(const char *port, struct addrinfo **info)
int main(void)
{
int state = 0;
struct addrinfo *addrinfo;
struct addrinfo *addrinfo = NULL;
struct io_listener *l;
int fd;

2
ccan/ccan/io/test/run-02-read.c

@ -71,7 +71,7 @@ static int make_listen_fd(const char *port, struct addrinfo **info)
int main(void)
{
struct data *d = malloc(sizeof(*d));
struct addrinfo *addrinfo;
struct addrinfo *addrinfo = NULL;
struct io_listener *l;
int fd, status;

7
ccan/ccan/io/test/run-15-timeout.c

@ -47,8 +47,7 @@ static struct io_plan *init_conn(struct io_conn *conn, struct data *d)
d->conn = conn;
io_set_finish(conn, finish_ok, d);
timer_add(&d->timers, &d->timer,
timeabs_add(time_now(), time_from_usec(d->timeout_usec)));
timer_addrel(&d->timers, &d->timer, time_from_usec(d->timeout_usec));
return io_read(conn, d->buf, sizeof(d->buf), no_timeout, d);
}
@ -97,7 +96,7 @@ int main(void)
plan_tests(21);
d->state = 0;
d->timeout_usec = 100000;
timers_init(&d->timers, time_now());
timers_init(&d->timers, time_mono());
timer_init(&d->timer);
fd = make_listen_fd(PORT, &addrinfo);
ok1(fd >= 0);
@ -131,7 +130,7 @@ int main(void)
/* One element, d->timer. */
ok1(expired == &d->timer);
ok1(!timers_expire(&d->timers, time_now()));
ok1(!timers_expire(&d->timers, time_mono()));
ok1(d->state == 1);
io_close(d->conn);

14
ccan/ccan/io/test/run-20-io_time_override.c

@ -45,9 +45,9 @@ static int make_listen_fd(const char *port, struct addrinfo **info)
return fd;
}
static struct timeabs fake_time;
static struct timemono fake_time;
static struct timeabs get_fake_time(void)
static struct timemono get_fake_time(void)
{
return fake_time;
}
@ -63,12 +63,12 @@ int main(void)
/* This is how many tests you plan to run */
plan_tests(7);
fake_time = time_now();
fake_time = time_mono();
timers_init(&timers, fake_time);
timer_init(&timer);
timer_add(&timers, &timer,
timeabs_add(fake_time, time_from_sec(1000)));
timer_addmono(&timers, &timer,
timemono_add(fake_time, time_from_sec(1000)));
fd = make_listen_fd(PORT, &addrinfo);
freeaddrinfo(addrinfo);
@ -77,12 +77,12 @@ int main(void)
ok1(l);
fake_time.ts.tv_sec += 1000;
ok1(io_time_override(get_fake_time) == time_now);
ok1(io_time_override(get_fake_time) == time_mono);
ok1(io_loop(&timers, &expired) == NULL);
ok1(expired == &timer);
ok1(!timers_expire(&timers, fake_time));
ok1(io_time_override(time_now) == get_fake_time);
ok1(io_time_override(time_mono) == get_fake_time);
io_close_listener(l);
timers_cleanup(&timers);

2
ccan/ccan/isaac/test/run.c

@ -134,7 +134,7 @@ static const uint32_t STATEVEC[ISAAC_SZ<<1]={
0x46D95CA5, 0xC54CD95B, 0x9D855E89, 0x4BB5AF29
};
int main(int _argc,const char *_argv[]){
int main(void){
isaac_ctx isaac;
int i;
int j;

2
ccan/ccan/isaac/test/run64.c

@ -262,7 +262,7 @@ static const uint64_t STATEVEC64[ISAAC64_SZ<<1]={
0x1877B51E57A764D5ULL, 0x001F837CC7350524ULL
};
int main(int _argc,const char *_argv[]){
int main(void){
isaac64_ctx isaac64;
int i;
int j;

2
ccan/ccan/likely/test/run-debug.c

@ -26,7 +26,7 @@ static bool likely_one_unlikely_two(unsigned int val1, unsigned int val2)
return false;
}
int main(int argc, char *argv[])
int main(void)
{
char *bad;

2
ccan/ccan/likely/test/run.c

@ -17,7 +17,7 @@ static bool one_seems_unlikely(unsigned int val)
return false;
}
int main(int argc, char *argv[])
int main(void)
{
plan_tests(4);

2
ccan/ccan/list/_info

@ -31,7 +31,7 @@
* {
* struct parent p;
* struct child *c;
* unsigned int i;
* int i;
*
* if (argc < 2)
* errx(1, "Usage: %s parent children...", argv[0]);

23
ccan/ccan/list/list.h

@ -291,6 +291,21 @@ static inline bool list_empty_nodebug(const struct list_head *h)
}
#endif
/**
* list_empty_nocheck - is a list empty?
* @h: the list_head
*
* If the list is empty, returns true. This doesn't perform any
* debug check for list consistency, so it can be called without
* locks, racing with the list being modified. This is ok for
* checks where an incorrect result is not an issue (optimized
* bail out path for example).
*/
static inline bool list_empty_nocheck(const struct list_head *h)
{
return h->n.next == &h->n;
}
/**
* list_del - delete an entry from an (unknown) linked list.
* @n: the list_node to delete from the list.
@ -701,12 +716,12 @@ static inline void list_prepend_list_(struct list_head *to,
* so you can break and continue as normal.
*
* WARNING! Being the low-level macro that it is, this wrapper doesn't know
* nor care about the type of @i. The only assumtion made is that @i points
* nor care about the type of @i. The only assumption made is that @i points
* to a chunk of memory that at some @offset, relative to @i, contains a
* properly filled `struct node_list' which in turn contains pointers to
* memory chunks and it's turtles all the way down. Whith all that in mind
* properly filled `struct list_node' which in turn contains pointers to
* memory chunks and it's turtles all the way down. With all that in mind
* remember that given the wrong pointer/offset couple this macro will
* happilly churn all you memory untill SEGFAULT stops it, in other words
* happily churn all you memory until SEGFAULT stops it, in other words
* caveat emptor.
*
* It is worth mentioning that one of legitimate use-cases for that wrapper

5
ccan/ccan/list/test/run-CCAN_LIST_DEBUG.c

@ -17,6 +17,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
{
va_list ap;
int ret;
(void)stream;
va_start(ap, format);
ret = vsprintf(printf_buffer, format, ap);
va_end(ap);
@ -28,7 +29,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
#include <ccan/tap/tap.h>
#include <ccan/list/list.c>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list;
struct list_node n1;
@ -44,7 +45,7 @@ int main(int argc, char *argv[])
list.n.prev = &n1;
/* Aborting version. */
sprintf(expect, "run-CCAN_LIST_DEBUG.c:50: prev corrupt in node %p (0) of %p\n",
sprintf(expect, "run-CCAN_LIST_DEBUG.c:51: prev corrupt in node %p (0) of %p\n",
&list, &list);
if (setjmp(aborted) == 0) {
assert(list_empty(&list));

3
ccan/ccan/list/test/run-check-corrupt.c

@ -16,6 +16,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
{
va_list ap;
int ret;
(void)stream;
va_start(ap, format);
ret = vsprintf(printf_buffer, format, ap);
va_end(ap);
@ -26,7 +27,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
#include <ccan/tap/tap.h>
#include <ccan/list/list.c>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list;
struct list_node n1;

2
ccan/ccan/list/test/run-check-nonconst.c

@ -8,7 +8,7 @@ struct child {
struct list_node list;
};
int main(int argc, char *argv[])
int main(void)
{
struct child c1, c2;
struct list_head list = LIST_HEAD_INIT(list);

2
ccan/ccan/list/test/run-list_del_from-assert.c

@ -7,7 +7,7 @@
#include <unistd.h>
#include <signal.h>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list1, list2;
struct list_node n1, n2, n3;

2
ccan/ccan/list/test/run-list_prev-list_next.c

@ -14,7 +14,7 @@ struct child {
struct list_node list;
};
int main(int argc, char *argv[])
int main(void)
{
struct parent parent;
struct child c1, c2, c3;

2
ccan/ccan/list/test/run-prepend_list.c

@ -17,7 +17,7 @@ static bool list_expect(struct list_head *h, ...)
return (n->next == &h->n);
}
int main(int argc, char *argv[])
int main(void)
{
struct list_head h1, h2;
struct list_node n[4];

2
ccan/ccan/list/test/run-single-eval.c

@ -19,7 +19,7 @@ static LIST_HEAD(static_list);
#define ref(obj, counter) ((counter)++, (obj))
int main(int argc, char *argv[])
int main(void)
{
struct parent parent;
struct child c1, c2, c3, *c, *n;

2
ccan/ccan/list/test/run.c

@ -16,7 +16,7 @@ struct child {
static LIST_HEAD(static_list);
int main(int argc, char *argv[])
int main(void)
{
struct parent parent;
struct child c1, c2, c3, x1, *c, *n;

1
ccan/ccan/mem/mem.h

@ -250,6 +250,7 @@ static inline void *memcheck_(const void *data, size_t len)
#else
static inline void *memcheck_(const void *data, size_t len)
{
(void)len;
return (void *)data;
}
#endif

2
ccan/ccan/noerr/_info

@ -37,7 +37,7 @@
* return false;
* }
* // A short write means out of space.
* if (ret < strlen(string)) {
* if (ret < (int)strlen(string)) {
* unlink(file);
* errno = ENOSPC;
* return false;

2
ccan/ccan/noerr/test/run.c

@ -7,7 +7,7 @@
#include <stdio.h>
#include <assert.h>
int main(int argc, char *argv[])
int main(void)
{
const char *name = "noerr.file";
int fd;

2
ccan/ccan/opt/opt.h

@ -185,7 +185,7 @@ void opt_register_table(const struct opt_table *table, const char *desc);
* string (or see opt_set_alloc) and return false.
*
* Example:
* static char *explode(const char *optarg, void *unused)
* static char *explode(const char *optarg, void *unused UNNEEDED)
* {
* errx(1, "BOOM! %s", optarg);
* }

2
ccan/ccan/opt/test/compile_ok-const-arg.c

@ -4,7 +4,7 @@
#include <ccan/opt/parse.c>
#include <ccan/opt/usage.c>
int main(int argc, char *argv[])
int main(void)
{
opt_register_noarg("-v", opt_version_and_exit,
(const char *)"1.2.3",

6
ccan/ccan/opt/test/run-add_desc.c

@ -4,19 +4,19 @@
#include <ccan/opt/helpers.c>
#include <ccan/opt/parse.c>
static void show_10(char buf[OPT_SHOW_LEN], const void *arg)
static void show_10(char buf[OPT_SHOW_LEN], const void *arg UNNEEDED)
{
memset(buf, 'X', 10);
buf[10] = '\0';
}
static void show_max(char buf[OPT_SHOW_LEN], const void *arg)
static void show_max(char buf[OPT_SHOW_LEN], const void *arg UNNEEDED)
{
memset(buf, 'X', OPT_SHOW_LEN);
}
/* Test add_desc helper. */
int main(int argc, char *argv[])
int main(void)
{
struct opt_table opt;
char *ret;

2
ccan/ccan/opt/test/run-checkopt.c

@ -53,7 +53,7 @@ static void reset(void)
opt_count = opt_num_short = opt_num_short_arg = opt_num_long = 0;
}
int main(int argc, char *argv[])
int main(void)
{
int exitval;

2
ccan/ccan/opt/test/run-consume_words.c

@ -5,7 +5,7 @@
#include <ccan/opt/parse.c>
/* Test consume_words helper. */
int main(int argc, char *argv[])
int main(void)
{
size_t prefix, len;
bool start = true;

2
ccan/ccan/opt/test/run-helpers.c

@ -52,7 +52,7 @@ static int saved_printf(const char *fmt, ...)
return ret;
}
static int saved_fprintf(FILE *ignored, const char *fmt, ...)
static int saved_fprintf(FILE *ignored UNNEEDED, const char *fmt, ...)
{
va_list ap;
int ret;

2
ccan/ccan/opt/test/run-iter.c

@ -10,7 +10,7 @@
#include <ccan/opt/parse.c>
/* Test iterators. */
int main(int argc, char *argv[])
int main(void)
{
unsigned j, i, len = 0;
const char *p;

6
ccan/ccan/opt/test/run-set_alloc.c

@ -2,15 +2,15 @@
#include <stdlib.h>
/* Make sure we override these! */
static void *no_malloc(size_t size)
static void *no_malloc(size_t size UNNEEDED)
{
abort();
}
static void *no_realloc(void *p, size_t size)
static void *no_realloc(void *p UNNEEDED, size_t size UNNEEDED)
{
abort();
}
static void no_free(void *p)
static void no_free(void *p UNNEEDED)
{
abort();
}

6
ccan/ccan/opt/test/run-usage.c

@ -6,7 +6,7 @@
#include "utils.h"
/* Ensure width is sane. */
static const char *getenv_override(const char *name)
static const char *getenv_override(const char *name UNNEEDED)
{
return "100";
}
@ -18,13 +18,13 @@ static const char *getenv_override(const char *name)
#include <ccan/opt/helpers.c>
#include <ccan/opt/parse.c>
static char *my_cb(void *p)
static char *my_cb(void *p UNNEEDED)
{
return NULL;
}
/* Test helpers. */
int main(int argc, char *argv[])
int main(void)
{
char *output;
char *longname = strdup("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

2
ccan/ccan/opt/test/utils.c

@ -8,7 +8,7 @@
#include "utils.h"
unsigned int test_cb_called;
char *test_noarg(void *arg)
char *test_noarg(void *arg UNNEEDED)
{
test_cb_called++;
return NULL;

3
ccan/ccan/order/order.c

@ -24,7 +24,7 @@
const _type *b, \
void *ctx) \
{ \
return _order_##_oname(a, b, int2ptr(0)); \
(void)ctx; return _order_##_oname(a, b, int2ptr(0)); \
} \
int _order_##_oname##_reverse(const void *a, \
const void *b, \
@ -36,6 +36,7 @@
const _type *b, \
void *ctx) \
{ \
(void)ctx; \
return _order_##_oname##_reverse(a, b, int2ptr(0)); \
} \
int order_##_oname##_noctx(const void *a, \

2
ccan/ccan/order/test/compile_fail_1.c

@ -12,7 +12,7 @@ typedef int item_t;
typedef struct item item_t;
#endif
int main(int argc, char *argv[])
int main(void)
{
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp,

2
ccan/ccan/order/test/compile_fail_2.c

@ -12,7 +12,7 @@ typedef int ctx_t;
typedef struct cmp_info ctx_t;
#endif
int main(int argc, char *argv[])
int main(void)
{
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp, struct item,

2
ccan/ccan/order/test/compile_ok.c

@ -6,7 +6,7 @@
#include "fancy_cmp.h"
int main(int argc, char *argv[])
int main(void)
{
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp,

2
ccan/ccan/order/test/run-fancy.c

@ -8,7 +8,7 @@
#include "fancy_cmp.h"
int main(int argc, char *argv[])
int main(void)
{
struct item item1 = {
.value = 0,

3
ccan/ccan/pipecmd/_info

@ -28,7 +28,8 @@
* char input[12];
*
* if (argc == 2) {
* write(STDOUT_FILENO, "hello world\n", 12);
* if (write(STDOUT_FILENO, "hello world\n", 12) != 12)
* exit(1);
* exit(0);
* }
* child = pipecmd(&outputfd, NULL, NULL, argv[0], "ignoredarg", NULL);

12
ccan/ccan/pipecmd/pipecmd.c

@ -16,9 +16,12 @@ static char **gather_args(const char *arg0, va_list ap)
arr[0] = (char *)arg0;
while ((arr[n++] = va_arg(ap, char *)) != NULL) {
arr = realloc(arr, sizeof(char *) * (n + 1));
if (!arr)
char **narr = realloc(arr, sizeof(char *) * (n + 1));
if (!narr) {
free(arr);
return NULL;
}
arr = narr;
}
return arr;
}
@ -119,7 +122,10 @@ pid_t pipecmdarr(int *fd_fromchild, int *fd_tochild, int *fd_errfromchild,
child_errno_fail:
err = errno;
write(execfail[1], &err, sizeof(err));
/* Gcc's warn-unused-result fail. */
if (write(execfail[1], &err, sizeof(err))) {
;
}
exit(127);
}

2
ccan/ccan/ptrint/_info

@ -29,7 +29,7 @@
*
* void (*cb)(void *opaque) = callback;
*
* int main(int argc, char *argv[])
* int main(void)
* {
* int val = 17;
*

2
ccan/ccan/read_write_all/_info

@ -17,7 +17,7 @@
* #include <ccan/read_write_all/read_write_all.h>
*
* #define BUFFER_SIZE 10
* int main(int argc, char *argv[])
* int main(void)
* {
* char buffer[BUFFER_SIZE+1];
*

3
ccan/ccan/read_write_all/test/run-read_all.c

@ -17,6 +17,7 @@ static int p2c[2], c2p[2];
static void got_signal(int sig)
{
char c = 0;
(void)sig;
if (write(p2c[1], &c, 1) == 1)
sigcount++;
}
@ -24,7 +25,7 @@ static void got_signal(int sig)
/* < PIPE_BUF *will* be atomic. But > PIPE_BUF only *might* be non-atomic. */
#define BUFSZ (1024*1024)
int main(int argc, char *argv[])
int main(void)
{
char *buffer;
char c = 0;

5
ccan/ccan/read_write_all/test/run-write_all.c

@ -19,6 +19,9 @@ static ssize_t write_return;
static ssize_t test_write(int fd, const void *buf, size_t count)
{
(void)fd;
(void)buf;
if (write_return == 0) {
errno = ENOSPC;
return 0;
@ -39,7 +42,7 @@ static ssize_t test_write(int fd, const void *buf, size_t count)
#define BUFSZ 1024
int main(int argc, char *argv[])
int main(void)
{
char *buffer;

6
ccan/ccan/str/_info

@ -26,11 +26,11 @@
*
* int main(int argc, char *argv[])
* {
* if (argv[1] && streq(argv[1], "--verbose"))
* if (argc > 1 && streq(argv[1], "--verbose"))
* printf("verbose set\n");
* if (argv[1] && strstarts(argv[1], "--"))
* if (argc > 1 && strstarts(argv[1], "--"))
* printf("Some option set\n");
* if (argv[1] && strends(argv[1], "cow-powers"))
* if (argc > 1 && strends(argv[1], "cow-powers"))
* printf("Magic option set\n");
* return 0;
* }

2
ccan/ccan/str/test/compile_fail-STR_MAX_CHARS.c

@ -4,7 +4,7 @@ struct s {
int val;
};
int main(int argc, char *argv[])
int main(void)
{
struct s
#ifdef FAIL

1
ccan/ccan/str/test/compile_fail-isalnum.c

@ -3,6 +3,7 @@
int main(int argc, char *argv[])
{
(void)argc;
#ifdef FAIL
#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF
#error We need typeof to check isalnum.

1
ccan/ccan/str/test/compile_fail-isalpha.c

@ -3,6 +3,7 @@
int main(int argc, char *argv[])
{
(void)argc;
#ifdef FAIL
#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF
#error We need typeof to check isalpha.

1
ccan/ccan/str/test/compile_fail-isascii.c

@ -3,6 +3,7 @@
int main(int argc, char *argv[])
{
(void)argc;
#ifdef FAIL
#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF
#error We need typeof to check isascii.

1
ccan/ccan/str/test/compile_fail-isblank.c

@ -3,6 +3,7 @@
int main(int argc, char *argv[])
{
(void)argc;
#ifdef FAIL
#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF || !HAVE_ISBLANK
#error We need typeof to check isblank.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save