gdb.base/fileio.c: Fix several -Wreturn-type warnings

All the "test_" functions warn like:

  src/gdb/testsuite/gdb.base/fileio.c: In function ‘test_close’:
  src/gdb/testsuite/gdb.base/fileio.c:280:1: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^

Nothing looks at the return of these functions, so just make them
return void.  While at it, "()" is not the same as "(void)" in C - fix
that too.

gdb/ChangeLog:
2017-05-18  Pedro Alves  <palves@redhat.com>

	* gdb.base/fileio.c (stop, test_open, test_write, test_read)
	(test_lseek, test_close, test_stat, test_fstat, test_isatty)
	(test_system, test_rename, test_unlink, test_time): Change
	prototypes.
	* gdb.base/fileio.exp (stop_msg): Adjust.
This commit is contained in:
Pedro Alves 2017-05-18 11:37:55 +01:00
parent d2a03b7745
commit c8f6abd10d
3 changed files with 34 additions and 26 deletions

View file

@ -1,3 +1,11 @@
2017-05-18 Pedro Alves <palves@redhat.com>
* gdb.base/fileio.c (stop, test_open, test_write, test_read)
(test_lseek, test_close, test_stat, test_fstat, test_isatty)
(test_system, test_rename, test_unlink, test_time): Change
prototypes.
* gdb.base/fileio.exp (stop_msg): Adjust.
2017-05-18 Pedro Alves <palves@redhat.com> 2017-05-18 Pedro Alves <palves@redhat.com>
* gdb.base/fileio.c (null_str): New global. * gdb.base/fileio.c (null_str): New global.

View file

@ -74,14 +74,14 @@ static const char *strerrno (int err);
#define STRING "Hello World" #define STRING "Hello World"
static void stop () {} static void stop (void) {}
/* A NULL string. We pass this to stat below instead of a NULL /* A NULL string. We pass this to stat below instead of a NULL
literal to avoid -Wnonnull warnings. */ literal to avoid -Wnonnull warnings. */
const char *null_str; const char *null_str;
int void
test_open () test_open (void)
{ {
int ret; int ret;
@ -140,8 +140,8 @@ test_open ()
stop (); stop ();
} }
int void
test_write () test_write (void)
{ {
int fd, ret; int fd, ret;
@ -181,8 +181,8 @@ test_write ()
stop (); stop ();
} }
int void
test_read () test_read (void)
{ {
int fd, ret; int fd, ret;
char buf[16]; char buf[16];
@ -213,8 +213,8 @@ test_read ()
stop (); stop ();
} }
int void
test_lseek () test_lseek (void)
{ {
int fd; int fd;
off_t ret = 0; off_t ret = 0;
@ -255,8 +255,8 @@ test_lseek ()
stop (); stop ();
} }
int void
test_close () test_close (void)
{ {
int fd, ret; int fd, ret;
@ -281,8 +281,8 @@ test_close ()
stop (); stop ();
} }
int void
test_stat () test_stat (void)
{ {
int ret; int ret;
struct stat st; struct stat st;
@ -316,8 +316,8 @@ test_stat ()
stop (); stop ();
} }
int void
test_fstat () test_fstat (void)
{ {
int fd, ret; int fd, ret;
struct stat st; struct stat st;
@ -347,8 +347,8 @@ test_fstat ()
stop (); stop ();
} }
int void
test_isatty () test_isatty (void)
{ {
int fd; int fd;
@ -377,8 +377,8 @@ test_isatty ()
char sys[1512]; char sys[1512];
int void
test_system () test_system (void)
{ {
/* /*
* Requires test framework to switch on "set remote system-call-allowed 1" * Requires test framework to switch on "set remote system-call-allowed 1"
@ -409,8 +409,8 @@ test_system ()
stop (); stop ();
} }
int void
test_rename () test_rename (void)
{ {
int ret; int ret;
struct stat st; struct stat st;
@ -464,8 +464,8 @@ test_rename ()
char name[1256]; char name[1256];
int void
test_unlink () test_unlink (void)
{ {
int ret; int ret;
@ -504,8 +504,8 @@ test_unlink ()
stop (); stop ();
} }
int void
test_time () test_time (void)
{ {
time_t ret, t; time_t ret, t;

View file

@ -69,7 +69,7 @@ if ![runto_main] then {
gdb_test "break stop" "Breakpoint .*$srcfile.*" gdb_test "break stop" "Breakpoint .*$srcfile.*"
set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(\\) {}.*" set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(void\\) {}.*"
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 1:.*OK$stop_msg" \ "Continuing\\..*open 1:.*OK$stop_msg" \