Skip to content

Commit 9d3be92

Browse files
committed
Increase compiler warning level
...and fix the resulting warnings.
1 parent 5a05941 commit 9d3be92

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
CFLAGS ?= -std=c99 -Wall -O2 -fomit-frame-pointer
1+
CFLAGS = -std=c99 -O2 -fomit-frame-pointer
2+
CFLAGS += -Wall -Wextra -Wundef -Wold-style-definition
23
LDFLAGS = -s -static
34

45
BINARIES = mininit-initramfs mininit-syspart splashkill

initramfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static int multi_mount(
5353
return -1;
5454
}
5555

56-
const char *mount_boot()
56+
const char *mount_boot(void)
5757
{
5858
/* Create boot and root mount points.
5959
* Failure is most likely fatal, but perhaps mkdir on a usable mount point
@@ -77,7 +77,7 @@ const char *mount_boot()
7777
return boot_mount;
7878
}
7979

80-
int open_dir_to_clean()
80+
int open_dir_to_clean(void)
8181
{
8282
int fd = open("/", O_PATH | O_DIRECTORY);
8383
if (fd < 0) {
@@ -86,7 +86,7 @@ int open_dir_to_clean()
8686
return fd;
8787
}
8888

89-
int switch_root()
89+
int switch_root(void)
9090
{
9191
DEBUG("Switching root\n");
9292

loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "loop.h"
1010

1111

12-
int logetfree()
12+
int logetfree(void)
1313
{
1414
int fd = open("/dev/loop-control", O_RDWR);
1515
if (fd < 0) {

loop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Find or allocate a free loop device.
66
* Returns the minor block device number (0-255), or -1 on errors.
77
*/
8-
int logetfree();
8+
int logetfree(void);
99

1010
/**
1111
* Set the given file as a backing file for the given loop device.

mininit.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ int create_mount_point(const char *path);
1414
* is mounted.
1515
* Returns the mount point of the boot partition on success and NULL on errors.
1616
*/
17-
const char *mount_boot();
17+
const char *mount_boot(void);
1818

1919
/**
2020
* Returns a file descriptor for the directory to be cleaned up before we exec.
2121
* If there is nothing to clean up, return -1.
2222
* If there was an error opening the directory, return -1 as well.
2323
*/
24-
int open_dir_to_clean();
24+
int open_dir_to_clean(void);
2525

2626
/**
2727
* Make the current directory the root directory and preserve the boot partition
2828
* in the "boot" subdirectory of the current directory.
2929
* Returns 0 on success and -1 on errors.
3030
*/
31-
int switch_root();
31+
int switch_root(void);

splashkill.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void quit_hdl(int err)
3131
exit(err);
3232
}
3333

34-
static int waitForEnter()
34+
static int waitForEnter(void)
3535
{
3636
fd = open(event_fn, O_RDONLY);
3737
if (fd < 0) {
@@ -60,6 +60,7 @@ int main(int argc, char **argv)
6060
if (fork())
6161
execl(init_fn, "/init", NULL);
6262

63+
(void)argc;
6364
strlcpy(argv[0], process_name, strlen(argv[0]));
6465

6566
int res = waitForEnter();

syspart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
#include "mininit.h"
1111

1212

13-
const char *mount_boot()
13+
const char *mount_boot(void)
1414
{
1515
return "/";
1616
}
1717

18-
int open_dir_to_clean()
18+
int open_dir_to_clean(void)
1919
{
2020
return -1;
2121
}
2222

23-
int switch_root()
23+
int switch_root(void)
2424
{
2525
DEBUG("Pivoting root\n");
2626
if (syscall(SYS_pivot_root, ".", "boot")) {

0 commit comments

Comments
 (0)