Skip to content

Commit bf4de8f

Browse files
committed
* malloc/memusagestat.c (main): Use return instead of exit to
avoid warning. * io/pwd.c (main): Likewise. * iconvdata/tst-table-from.c (main): Likewise. * ctype/test_ctype.c (main): Likewise. * setjmp/tst-setjmp.c (main): Likewise. * signal/tst-signal.c (main): Likewise. * stdlib/tst-strtol.c (main): Likewise. * stdlib/tst-strtod.c (main): Likewise. * stdlib/tst-strtoll.c (main): Likewise. * stdlib/tst-xpg-basename.c (main): Likewise. * dirent/tst-seekdir.c (main): Likewise. * grp/testgrp.c (main): Likewise. * inet/test_ifindex.c (main): Likewise. * io/test-utime.c (main): Likewise. * posix/test-vfork.c (main): Likewise. * posix/testfnm.c (main): Likewise. * stdio-common/temptest.c (main): Likewise. * stdio-common/test_rdwr.c (main): Likewise. * stdio-common/tst-fileno.c (main): Likewise. * stdio-common/tst-sscanf.c (main): Likewise. * stdio-common/tstscanf.c (main): Likewise. * string/bug-strncat1.c (main): Likewise. * string/bug-strpbrk1.c (main): Likewise. * string/bug-strspn1.c (main): Likewise. * string/test-ffs.c (main): Likewise. * string/tst-inlcall.c (main): Likewise. * string/tst-svc.c (main): Likewise. * timezone/test-tz.c (main): Likewise. * wctype/test_wcfuncs.c (main): Likewise. * wctype/test_wctype.c (main): Likewise. * stdlib/tst-random.c: Add attribute noreturn to fail.
1 parent 41b64fc commit bf4de8f

31 files changed

+61
-56
lines changed

ctype/test_ctype.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc.
1+
/* Copyright (C) 1991, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
22
This file is part of the GNU C Library.
33
44
The GNU C Library is free software; you can redistribute it and/or
@@ -97,5 +97,5 @@ main (int argc, char **argv)
9797
TRYEM;
9898
#undef TRY
9999

100-
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
100+
return lose ? EXIT_FAILURE : EXIT_SUCCESS;
101101
}

dirent/tst-seekdir.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ main (int argc, char *argv[])
3838

3939

4040
closedir (dirp);
41-
exit(0);
41+
return 0;
4242
}

grp/testgrp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ main (int argc, char *argv[])
3737
}
3838
}
3939

40-
exit (my_passwd && my_group ? EXIT_SUCCESS : EXIT_FAILURE);
40+
return my_passwd && my_group ? EXIT_SUCCESS : EXIT_FAILURE;
4141
}

iconvdata/tst-table-from.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,5 @@ main (int argc, char *argv[])
222222
exit (1);
223223
}
224224

225-
exit (0);
225+
return 0;
226226
}

inet/test_ifindex.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Test interface name <-> index conversions.
2-
Copyright (C) 1997 Free Software Foundation, Inc.
2+
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
33
This file is part of the GNU C Library.
44
Contributed by Philip Blundell <[email protected]>.
55
@@ -61,5 +61,5 @@ main (void)
6161
failures += result;
6262
}
6363
if_freenameindex (idx);
64-
exit (failures ? 1 : 0);
64+
return failures ? 1 : 0;
6565
}

io/pwd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ main (void)
3939
free (dir);
4040
}
4141

42-
exit (dir == NULL ? EXIT_FAILURE : EXIT_SUCCESS);
42+
return (dir == NULL ? EXIT_FAILURE : EXIT_SUCCESS);
4343
}

io/test-utime.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ main (int argc, char *argv[])
3737
if (tmpnam (file) == 0)
3838
{
3939
perror ("tmpnam");
40-
exit (1);
40+
return 1;
4141
}
4242

4343
fd = creat (file, 0666);
4444
if (fd < 0)
4545
{
4646
perror ("creat");
47-
exit (1);
47+
return 1;
4848
}
4949
close (fd);
5050

@@ -55,14 +55,14 @@ main (int argc, char *argv[])
5555
{
5656
perror ("utime");
5757
remove (file);
58-
exit (1);
58+
return 1;
5959
}
6060

6161
if (stat (file, &st))
6262
{
6363
perror ("stat");
6464
remove (file);
65-
exit (1);
65+
return 1;
6666
}
6767

6868
/* Test utime with NULL.
@@ -73,57 +73,57 @@ main (int argc, char *argv[])
7373
{
7474
perror ("time");
7575
remove (file);
76-
exit (1);
76+
return 1;
7777
}
7878

7979
if (utime (file, NULL))
8080
{
8181
perror ("utime NULL");
8282
remove (file);
83-
exit (1);
83+
return 1;
8484
}
8585

8686
now2 = time (NULL);
8787
if (now2 == (time_t)-1)
8888
{
8989
perror ("time");
9090
remove (file);
91-
exit (1);
91+
return 1;
9292
}
9393

9494
if (stat (file, &stnow))
9595
{
9696
perror ("stat");
9797
remove (file);
98-
exit (1);
98+
return 1;
9999
}
100100

101101
remove (file);
102102

103103
if (st.st_mtime != ut.modtime)
104104
{
105105
printf ("modtime %ld != %ld\n", st.st_mtime, ut.modtime);
106-
exit (1);
106+
return 1;
107107
}
108108

109109
if (st.st_atime != ut.actime)
110110
{
111111
printf ("actime %ld != %ld\n", st.st_atime, ut.actime);
112-
exit (1);
112+
return 1;
113113
}
114114

115115
if (stnow.st_mtime < now1 || stnow.st_mtime > now2)
116116
{
117117
printf ("modtime %ld <%ld >%ld\n", st.st_mtime, now1, now2);
118-
exit (1);
118+
return 1;
119119
}
120120

121121
if (stnow.st_atime < now1 || stnow.st_atime > now2)
122122
{
123123
printf ("actime %ld <%ld >%ld\n", st.st_atime, now1, now2);
124-
exit (1);
124+
return 1;
125125
}
126126

127127
puts ("Test succeeded.");
128-
exit (0);
128+
return 0;
129129
}

malloc/memusagestat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ main (int argc, char *argv[])
550550

551551
gdImageDestroy (im_out);
552552

553-
exit (0);
553+
return 0;
554554
}
555555

556556

posix/test-vfork.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ main (void)
3232
if (waitpid (0, &status, 0) != pid
3333
|| !WIFEXITED (status) || WEXITSTATUS (status) != NR)
3434
exit (1);
35-
exit (0);
35+
36+
return 0;
3637
}
3738

3839
void

posix/testfnm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ main (void)
7777
++errors ;
7878
}
7979

80-
exit (errors != 0);
80+
return errors != 0;
8181
}

setjmp/tst-setjmp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,6 @@ main (void)
113113
puts ("Test FAILED!");
114114
else
115115
puts ("Test succeeded!");
116-
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
116+
117+
return lose ? EXIT_FAILURE : EXIT_SUCCESS;
117118
}

signal/tst-signal.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ main (void)
3939
}
4040

4141
puts ("Got a signal. Test succeeded.");
42-
exit (EXIT_SUCCESS);
42+
43+
return EXIT_SUCCESS;
4344
}

stdio-common/temptest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ main (int argc, char *argv[])
2424
for (i = 0; i < 500; i++)
2525
remove (files[i]);
2626

27-
exit (0);
27+
return 0;
2828
}

stdio-common/test_rdwr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
1+
/* Copyright (C) 1991,1992,1996,1997,1998,2000 Free Software Foundation, Inc.
22
This file is part of the GNU C Library.
33
44
The GNU C Library is free software; you can redistribute it and/or
@@ -125,5 +125,5 @@ main (int argc, char **argv)
125125
puts ("Test succeeded.");
126126
}
127127

128-
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
128+
return lose ? EXIT_FAILURE : EXIT_SUCCESS;
129129
}

stdio-common/tst-fileno.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ static int
2424
check (const char *name, FILE *stream, int fd)
2525
{
2626
int sfd = fileno (stream);
27-
printf ("(fileno (%s) = %d) %c= %d\n", name, sfd, sfd == fd ? '=' : '!', fd);
27+
printf ("(fileno (%s) = %d) %c= %d\n", name, sfd,
28+
sfd == fd ? '=' : '!', fd);
2829
return sfd != fd;
2930
}
3031

3132
int
3233
main (void)
3334
{
34-
exit (check ("stdin", stdin, STDIN_FILENO) ||
35-
check ("stdout", stdout, STDOUT_FILENO) ||
36-
check ("stderr", stderr, STDERR_FILENO));
35+
return (check ("stdin", stdin, STDIN_FILENO) ||
36+
check ("stdout", stdout, STDOUT_FILENO) ||
37+
check ("stderr", stderr, STDERR_FILENO));
3738
}

stdio-common/tst-sscanf.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,6 @@ main (void)
117117
if (! tst_locale)
118118
break;
119119
}
120-
exit (result);
120+
121+
return result;
121122
}

stdio-common/tstscanf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,5 +305,5 @@ main (int argc, char **argv)
305305
}
306306
}
307307

308-
exit (result);
308+
return result;
309309
}

stdlib/tst-random.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const int nseq = 3; /* number of test sequences */
4444
const int nrnd = 50; /* length of each test sequence */
4545
const unsigned int seed[3] = { 0x12344321U, 0xEE11DD22U, 0xFEDCBA98 };
4646

47-
void fail (const char *msg, int s, int i);
47+
void fail (const char *msg, int s, int i) __attribute__ ((__noreturn__));
4848

4949
int
5050
main (void)

stdlib/tst-strtod.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ main (int argc, char ** argv)
117117

118118
status |= long_dbl ();
119119

120-
exit (status ? EXIT_FAILURE : EXIT_SUCCESS);
120+
return status ? EXIT_FAILURE : EXIT_SUCCESS;
121121
}
122122

123123
static void

stdlib/tst-strtol.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ main (void)
169169
}
170170
}
171171

172-
exit (status ? EXIT_FAILURE : EXIT_SUCCESS);
172+
return status ? EXIT_FAILURE : EXIT_SUCCESS;
173173
}
174174

175175
static void

stdlib/tst-strtoll.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ main (void)
157157
}
158158
}
159159

160-
exit (status ? EXIT_FAILURE : EXIT_SUCCESS);
160+
return status ? EXIT_FAILURE : EXIT_SUCCESS;
161161
}
162162

163163
static void

stdlib/tst-xpg-basename.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ main (void)
6363
}
6464
}
6565

66-
exit (errors);
66+
return errors;
6767
}

string/bug-strncat1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ main (void)
2727
exit (1);
2828
}
2929

30-
exit (0);
30+
return 0;
3131
}

string/bug-strpbrk1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ main (void)
1313

1414
strpbrk (b++, "");
1515
if (b != a + 1)
16-
exit (1);
16+
return 1;
1717

18-
exit (0);
18+
return 0;
1919
}

string/bug-strspn1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ main (void)
1313

1414
strspn (b++, "");
1515
if (b != a + 1)
16-
exit (1);
16+
return 1;
1717

18-
exit (0);
18+
return 0;
1919
}

string/test-ffs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ main (void)
2929
int i;
3030

3131
auto void try (int value, int expected);
32-
32+
3333
void try (int value, int expected)
3434
{
3535
if (ffs (value) != expected)
@@ -52,5 +52,5 @@ main (void)
5252
else
5353
puts ("Test succeeded.");
5454

55-
exit (failures);
55+
return failures;
5656
}

string/tst-inlcall.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Tester for calling inline string functions.
2-
Copyright (C) 1998 Free Software Foundation, Inc.
2+
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
33
This file is part of the GNU C Library.
44
55
The GNU C Library is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@ main (void)
4040
char buf1[1000];
4141
char *cp;
4242
char ch;
43-
43+
4444
cp = strcpy (buf1, "hello world");
4545
if (strcmp ("hello world", cp++) != 0)
4646
{
@@ -72,5 +72,5 @@ main (void)
7272
status = EXIT_FAILURE;
7373
printf ("%d errors.\n", errors);
7474
}
75-
exit (status);
75+
return status;
7676
}

string/tst-svc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ main (int argc, char *argv[])
4141
for (i = 0; i < count; ++i)
4242
puts (str[i]);
4343

44-
exit (EXIT_SUCCESS);
44+
return EXIT_SUCCESS;
4545
}

timezone/test-tz.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ main (int argc, char ** argv)
4646
if (errors == 0)
4747
{
4848
puts ("No errors.");
49-
exit (EXIT_SUCCESS);
49+
return EXIT_SUCCESS;
5050
}
5151
else
5252
{
5353
printf ("%d errors.\n", errors);
54-
exit (EXIT_FAILURE);
54+
return EXIT_FAILURE;
5555
}
5656
}

wctype/test_wcfuncs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ main (int argc, char *argv[])
8484

8585
if (result == 0)
8686
puts ("All test successful!");
87-
exit (result);
87+
return result != 0;
8888
}

0 commit comments

Comments
 (0)