The following code compiles without warnings or errors: #include <assert.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <odp_cpumask.h>
void test(odp_cpumask_t mask) { /* Start with a small value so that a retry will be forced */ size_t len = 1; char *str; for (;;) { ssize_t out; str = malloc(len); if (str == NULL) perror("malloc"), exit(EXIT_FAILURE); out = odp_cpumask_to_str(&mask, str, len); if (out > 0) /* success */ break; /* failure, try with the recommended buffer size */ free(str); len = -out; } /* do something with str */ free(str); } void test2(odp_cpumask_t mask) { char *str; size_t len; ssize_t out; /* Call with zero-length buffer, this will fail and return required * buffer size */ len = -odp_cpumask_to_str(&mask, NULL, 0); str = malloc(len); if (str == NULL) perror("malloc"), exit(EXIT_FAILURE); out = odp_cpumask_to_str(&mask, str, len); assert(out > 0); /* do something with str */ free(str); } ssize_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *buf, ssize_t bufsz); gcc -c -std=c99 -W -Wall -ansi -pedantic test.c -I platform/linux-generic/include/api/ Am I missing any important compiler flags this time? On 28 January 2015 at 13:32, Savolainen, Petri (NSN - FI/Espoo) <petri.savolai...@nsn.com> wrote: >> (maybe your audio was breaking on call yesterday on that part). >> I have tested mixing size_t and ssize_t and neither gcc nor clang >> complained. I was using -Wall -ansi -pedantic. > > Missing -W from there ? -Wall is not enough... > > _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp