Commit 58c11bca authored by spiiroin's avatar spiiroin

[compilation] Remove -pedantic compiler option

Unless the code base is actively used with other than gcc compilers, use
of -pedantic just denies use of handy gcc extensions like use of "%m"
format parameter instead of non-thread-safe strerror().

Drop the '-pedantic' option and replace all strerror() calls with "%m".
Signed-off-by: spiiroin's avatarSimo Piiroinen <>
parent 2bb04f4b
......@@ -22,7 +22,7 @@ test_gcc_flag() {
# We use gnu99 instead of c99 because many have interpreted the standard
# in a way that int64_t isn't defined on non-64 bit platforms.
CFLAGS="-Os -std=gnu99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -finline-small-functions -Wno-unused-result -fstack-protector -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fPIE -fpie -pie"
CFLAGS="-Os -std=gnu99 -Wall -W -Wextra -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -finline-small-functions -Wno-unused-result -fstack-protector -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fPIE -fpie -pie"
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Enable debug @<:@default=false@:>@]),
[case "${enableval}" in
......@@ -61,9 +61,7 @@ int write_to_file(const char *path, const char *text)
/* no O_CREAT -> writes only to already existing files */
if( (fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY))) == -1 )
/* gcc -pedantic does not like "%m"
log_warning("open(%s): %m", path); */
log_warning("open(%s): %s", path, strerror(errno));
log_warning("open(%s): %m", path);
goto cleanup;
......@@ -72,7 +70,7 @@ int write_to_file(const char *path, const char *text)
ssize_t n = TEMP_FAILURE_RETRY(write(fd, text, todo));
if( n < 0 )
log_warning("write(%s): %s", path, strerror(errno));
log_warning("write(%s): %m", path);
goto cleanup;
todo -= n;
......@@ -400,7 +400,7 @@ static int write_udhcpd_conf(struct ipforward_data *ipforward, struct mode_list_
log_debug("Error creating link "UDHCP_CONFIG_LINK" -> "UDHCP_CONFIG_PATH": %s\n", strerror(errno));
log_debug("Error creating link "UDHCP_CONFIG_LINK" -> "UDHCP_CONFIG_PATH": %m\n");
......@@ -938,14 +938,13 @@ static void write_to_sysfs_file(const char *path, const char *text)
if ((fd = open(path, O_WRONLY)) == -1) {
if (errno != ENOENT) {
log_warning("%s: open for writing failed: %s",
path, strerror(errno));
log_warning("%s: open for writing failed: %m", path);
goto EXIT;
if (write(fd, text, strlen(text)) == -1) {
log_warning("%s: write failed : %s", path, strerror(errno));
log_warning("%s: write failed : %m", path);
goto EXIT;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment