move a largish block of code around to trick a GCC warning

(the fallthrough detection is thrown off by the other comments,
and it doesn’t recognise NOTREACHED anyway…)
This commit is contained in:
tg 2018-10-20 21:04:28 +00:00
parent f95e05d511
commit 8e4829bc5f
1 changed files with 32 additions and 32 deletions

64
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.354 2018/08/10 02:53:34 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.355 2018/10/20 21:04:28 tg Exp $");
#if HAVE_KILLPG
/*
@ -2964,6 +2964,37 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2,
case TO_STGT:
return (strcmp(opnd1, opnd2) > 0);
/* -nt */
case TO_FILNT:
/*
* ksh88/ksh93 succeed if file2 can't be stated
* (subtly different from 'does not exist').
*/
return (stat(opnd1, &b1) == 0 &&
(((s = stat(opnd2, &b2)) == 0 &&
b1.st_mtime > b2.st_mtime) || s < 0));
/* -ot */
case TO_FILOT:
/*
* ksh88/ksh93 succeed if file1 can't be stated
* (subtly different from 'does not exist').
*/
return (stat(opnd2, &b2) == 0 &&
(((s = stat(opnd1, &b1)) == 0 &&
b1.st_mtime < b2.st_mtime) || s < 0));
/* -ef */
case TO_FILEQ:
return (stat (opnd1, &b1) == 0 && stat (opnd2, &b2) == 0 &&
b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino);
/* all other cases */
case TO_NONOP:
case TO_NONNULL:
/* throw the error */
break;
/* -eq */
case TO_INTEQ:
/* -ne */
@ -3000,37 +3031,6 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2,
break;
}
/* NOTREACHED */
/* -nt */
case TO_FILNT:
/*
* ksh88/ksh93 succeed if file2 can't be stated
* (subtly different from 'does not exist').
*/
return (stat(opnd1, &b1) == 0 &&
(((s = stat(opnd2, &b2)) == 0 &&
b1.st_mtime > b2.st_mtime) || s < 0));
/* -ot */
case TO_FILOT:
/*
* ksh88/ksh93 succeed if file1 can't be stated
* (subtly different from 'does not exist').
*/
return (stat(opnd2, &b2) == 0 &&
(((s = stat(opnd1, &b1)) == 0 &&
b1.st_mtime < b2.st_mtime) || s < 0));
/* -ef */
case TO_FILEQ:
return (stat (opnd1, &b1) == 0 && stat (opnd2, &b2) == 0 &&
b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino);
/* all other cases */
case TO_NONOP:
case TO_NONNULL:
/* throw the error */
break;
}
(*te->error)(te, 0, "internal error: unknown op");
return (1);