Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
resolve unused variable warning on newer gcc
  • Loading branch information
frankmorgner committed Apr 28, 2020
1 parent bb47c1a commit 7936bde
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tools/opensc-notify.c
Expand Up @@ -189,7 +189,10 @@ static int cancellation_fd[] = {-1, -1};

void sig_handler(int sig) {
run_daemon = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
(void)write(cancellation_fd[1], &sig, sizeof sig);
#pragma GCC diagnostic pop
}

static void *cancellation_proc(void *arg)
Expand Down

2 comments on commit 7936bde

@lsteube
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankmorgner Thx, but unfortunately the "wrong" error is being ignored.
It needs to be

diff --git a/src/tools/opensc-notify.c b/src/tools/opensc-notify.c
index 3b61c498f5f4..c67212b3189e 100644
--- a/src/tools/opensc-notify.c
+++ b/src/tools/opensc-notify.c
@@ -190,7 +190,7 @@ static int cancellation_fd[] = {-1, -1};
 void sig_handler(int sig) {
        run_daemon = 0;
 #pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wunused-result"
        (void)write(cancellation_fd[1], &sig, sizeof sig);
 #pragma GCC diagnostic pop
 }

@frankmorgner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.