mirror of
https://github.com/encounter/bdwgc.git
synced 2026-03-30 10:57:55 -07:00
Workaround 'tainted int used as loop bound' static analysis tool warning
No need to check upper bound of n here, so a dummy check is added. * tests/test_cpp.cc (main) [LINT2]: Check upper bound of n local variable (the check is actually dummy). * tests/test_cpp.cc (main): Reformat code (which handles n variable).
This commit is contained in:
+10
-3
@@ -251,9 +251,16 @@ void* Undisguise( GC_word i ) {
|
||||
*xptr = x;
|
||||
x = 0;
|
||||
# endif
|
||||
if (argc != 2 || (0 >= (n = atoi( argv[ 1 ] )))) {
|
||||
GC_printf( "usage: test_cpp number-of-iterations\nAssuming 10 iters\n" );
|
||||
n = 10;}
|
||||
if (argc != 2
|
||||
|| (n = atoi(argv[1])) <= 0
|
||||
# ifdef LINT2
|
||||
|| n >= (((unsigned)-1) >> 1) - 1
|
||||
# endif
|
||||
) {
|
||||
GC_printf("usage: test_cpp number-of-iterations\n"
|
||||
"Assuming 10 iters\n");
|
||||
n = 10;
|
||||
}
|
||||
|
||||
for (iters = 1; iters <= n; iters++) {
|
||||
GC_printf( "Starting iteration %d\n", iters );
|
||||
|
||||
Reference in New Issue
Block a user