projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
warnings: Support non-literal arguments, and let the user choose the variable
[gnulib.git]
/
tests
/
test-c-stack.c
diff --git
a/tests/test-c-stack.c
b/tests/test-c-stack.c
index
c1600a5
..
96ab152
100644
(file)
--- a/
tests/test-c-stack.c
+++ b/
tests/test-c-stack.c
@@
-22,6
+22,10
@@
#include <stdio.h>
#include <stdlib.h>
#if HAVE_SETRLIMIT
#include <stdio.h>
#include <stdlib.h>
#if HAVE_SETRLIMIT
+/* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
+ will compile. */
+# include <sys/types.h>
+# include <sys/time.h>
# include <sys/resource.h>
#endif
# include <sys/resource.h>
#endif
@@
-37,15
+41,22
@@
} \
while (0)
} \
while (0)
-static long
-recurse (char *p)
+char *program_name;
+
+static volatile int *
+recurse_1 (volatile int n, volatile int *p)
{
{
- char array[500];
-
array[0] = 1
;
- return
*p + recurse (array)
;
+ if (n >= 0)
+
*recurse_1 (n + 1, p) += n
;
+ return
p
;
}
}
-char *program_name;
+static int
+recurse (volatile int n)
+{
+ int sum = 0;
+ return *recurse_1 (n, &sum);
+}
int
main (int argc, char **argv)
int
main (int argc, char **argv)
@@
-68,8
+79,9
@@
main (int argc, char **argv)
exit_failure = 77;
++*argv[argc]; /* Intentionally dereference NULL. */
}
exit_failure = 77;
++*argv[argc]; /* Intentionally dereference NULL. */
}
- return recurse (
"\1"
);
+ return recurse (
0
);
}
}
+ fputs ("skipping test: ", stderr);
perror ("c_stack_action");
return 77;
}
perror ("c_stack_action");
return 77;
}