[PATCH] libosmocore[master]: compiler warnings: take care of compiler warning "unused-res...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Thorsten Alteholz gerrit-no-reply at lists.osmocom.org
Mon Mar 13 18:41:53 UTC 2017


Review at  https://gerrit.osmocom.org/2045

compiler warnings: take care of compiler warning "unused-result"

Though it makes no sense to handle the return code of freopen() here,
the compiler complains about it. The #pragma statements take care of
that.

Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
---
M src/application.c
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/2045/1

diff --git a/src/application.c b/src/application.c
index 8a325c8..7750b41 100644
--- a/src/application.c
+++ b/src/application.c
@@ -156,9 +156,16 @@
 	/* Redirect stdio to /dev/null */
 /* since C89/C99 says stderr is a macro, we can safely do this! */
 #ifdef stderr
+/*
+ * it does not make sense to check the return code here, so we just
+ * ignore the compiler warning from gcc
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-result"
 	freopen("/dev/null", "r", stdin);
 	freopen("/dev/null", "w", stdout);
 	freopen("/dev/null", "w", stderr);
+#pragma GCC diagnostic pop
 #endif
 
 	return 0;

-- 
To view, visit https://gerrit.osmocom.org/2045
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Thorsten Alteholz <osmocom at alteholz.de>



More information about the gerrit-log mailing list