Enable -Wextra in tests.

This commit is contained in:
4lDO2
2023-11-12 12:07:49 +01:00
parent c76a12347f
commit 5f929ed51e
26 changed files with 158 additions and 132 deletions
+9 -3
View File
@@ -10,9 +10,15 @@ int main(void) {
char buf[33] = { 0 };
for (int i = 1; i <= 32; ++i) {
if (fread(buf, 1, i, fp) < 0) {
perror("fread");
exit(EXIT_FAILURE);
size_t nread = fread(buf, 1, i, fp);
if (nread == 0) {
if (feof(fp)) {
fprintf(stderr, "early EOF\n");
return EXIT_FAILURE;
} else {
perror("fread");
return EXIT_FAILURE;
}
}
buf[i] = 0;
+2 -1
View File
@@ -1,4 +1,5 @@
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <wchar.h>
@@ -32,7 +33,7 @@ int main(void) {
&test_reopen_opens_file,
&test_reopen_resets_orientation,
};
for(int i=0; i<sizeof(tests)/sizeof(int(*)(void)); i++) {
for(size_t i = 0; i < sizeof(tests) / sizeof(int(*)(void)); i++) {
printf("%d\n", (*tests[i])());
}
}