Fix some warnings

This commit is contained in:
Patrick Pelissier committed 2020-07-09 23:38:34 +02:00
1 parent 8a36b5ff15
commit 56d2a74818
11 files changed
+37 -36

No files matched your search

+2 -2
View File
@@ -21,8 +21,8 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CC=cc -std=c99
WCFLAGS_GCC=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code -Wlogical-op -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition -Wunused-function -ftrapv -Wsign-conversion
WCFLAGS_CLANG=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition -Wunused-function -ftrapv -Wsign-conversion
WCFLAGS_GCC=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code -Wlogical-op -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition -Wunused-function -ftrapv -Wsign-conversion -Wdate-time -Wconversion -Wformat=2 -Winit-self -Wjump-misses-init -Wstack-protector -Wtrampolines -Wwrite-strings -Wformat-security
WCFLAGS_CLANG=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition -Wunused-function -ftrapv -Wsign-conversion
WCFLAGS_CPP=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wstrict-overflow=5 -Winline -Wundef -Wcast-qual -Wshadow -Wunreachable-code -Wstrict-aliasing=2 -Wredundant-decls -Wunused-function -ftrapv -Wsign-conversion
XCFLAGS=
CFLAGS=$(WCFLAGS_GCC) $(XCFLAGS)
+4 -3
View File
@@ -179,7 +179,7 @@ static void test_stack2(void)
char c;
buffer_char_init(buff, 10);
for(int i = 0; i < 10; i++) {
c = i;
c = (char) i;
b = buffer_char_push(buff, c);
assert (b == true);
assert (buffer_char_empty_p(buff) == false);
@@ -307,8 +307,9 @@ static void test_prod(void *arg)
assert (arg == NULL);
for(unsigned int i = 0; i < 10;i++) {
test_t *p = test_new();
for(int j = 0; j < 52; j++)
p->buffer[j] = (j * j * 17) + j * 42 + 1;
for(int j = 0; j < 52; j++) {
p->buffer[j] = (char) ((j * j * 17) + j * 42 + 1);
}
buffer_itest_push(comm1, p);
buffer_itest_push(comm2, p);
ishared_itest_clear(p);
+6 -6
View File
@@ -469,14 +469,14 @@ static void test_builtin(void)
{
assert(m_core_clz32(0) == 32);
for(unsigned i = 0; i < 31; i++) {
assert(m_core_clz32(1UL<<i) == 31U - i);
assert(m_core_clz32((1UL<<i) | 1) == 31U - i);
assert(m_core_clz32((uint32_t) (1UL<<i)) == 31U - i);
assert(m_core_clz32((uint32_t) ((1UL<<i) | 1)) == 31U - i);
}
assert(m_core_clz64(0) == 64);
for(unsigned i = 0; i < 63; i++) {
assert(m_core_clz64(1ULL<<i) == 63U - i);
assert(m_core_clz64((1ULL<<i) | 1) == 63U - i);
assert(m_core_clz64((uint64_t) (1ULL<<i)) == 63U - i);
assert(m_core_clz64((uint64_t) ((1ULL<<i) | 1)) == 63U - i);
}
assert ( m_core_roundpow2(0) == 0);
@@ -488,8 +488,8 @@ static void test_builtin(void)
for(unsigned i = 0; i < 3000; i++) {
assert( m_core_rotl32a(i, 1) == i * 2);
assert( m_core_rotl32a(i, 2) == i * 4);
assert( m_core_rotl32a((1UL<<31) + i, 1) == i * 2 + 1);
assert( m_core_rotl32a((1UL<<31) + i, 2) == i * 4 + 2);
assert( m_core_rotl32a((uint32_t) ((1UL<<31) + i), 1) == i * 2 + 1);
assert( m_core_rotl32a((uint32_t) ((1UL<<31) + i), 2) == i * 4 + 2);
}
for(unsigned i = 0; i < 3000; i++) {
+1 -1
View File
@@ -62,7 +62,7 @@ static void init_data(int data_size)
unsigned int j = (unsigned int)(data_size * ((double)x / UINT_MAX) / 4) * 271828183u;
string_printf(s, "%x", j);
array_string_push_back (v_str, s);
x = 1664525L * x + 1013904223L;
x = (uint32_t) (1664525L * x + 1013904223L);
}
string_clear(s);
}