test-fileio: avoid warning about ineffective comparison
On arm64 with gcc-8.2.1-5.fc29.aarch64: ../src/test/test-fileio.c:645:29: warning: comparison is always false due to limited range of data type [-Wtype-limits] assert_se(c == EOF || safe_fgetc(f, &c) == 1); ^~ Casting c to int is not enough, gcc is able to figure out that the original type was unsigned and still warns. So let's just silence the warning like in test-sizeof.c.
This commit is contained in:
parent
afd5c1e373
commit
d3bdba3816
|
@ -629,6 +629,10 @@ static void test_tempfn(void) {
|
|||
static const char chars[] =
|
||||
"Aąę„”\n루\377";
|
||||
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
static void test_fgetc(void) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
char c;
|
||||
|
@ -640,7 +644,7 @@ static void test_fgetc(void) {
|
|||
assert_se(safe_fgetc(f, &c) == 1);
|
||||
assert_se(c == chars[i]);
|
||||
|
||||
/* EOF is -1, and hence we can't push value 255 in this way */
|
||||
/* EOF is -1, and hence we can't push value 255 in this way if char is signed */
|
||||
assert_se(ungetc(c, f) != EOF || c == EOF);
|
||||
assert_se(c == EOF || safe_fgetc(f, &c) == 1);
|
||||
assert_se(c == chars[i]);
|
||||
|
@ -654,6 +658,8 @@ static void test_fgetc(void) {
|
|||
assert_se(safe_fgetc(f, &c) == 0);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
static const char buffer[] =
|
||||
"Some test data\n"
|
||||
"루Non-ascii chars: ąę„”\n"
|
||||
|
|
Loading…
Reference in a new issue