Fix: tests: fix unused-but-set warning in test_fd_tracker.c
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 10 Nov 2021 13:42:25 +0000 (08:42 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 17 Dec 2021 04:46:04 +0000 (23:46 -0500)
When building with clang-14 on Ubuntu 20.04, I get:

      CC       test_fd_tracker.o
    /home/smarchi/src/lttng-tools/tests/unit/test_fd_tracker.c:169:15: error: variable 'fds_set_to_minus_1' set but not used [-Werror,-Wunused-but-set-variable]
            unsigned int fds_set_to_minus_1 = 0;
                         ^

The compiler seems right, so remove fds_set_to_minus_1.  It might be
that the intention was to assert something using this variable, but I
couldn't figure it out.

Change-Id: I12bfd07bca7829de8d5b85d375d9b52bd84d677a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/unit/test_fd_tracker.c

index d1414491314eb2fac0012174fd0fb1704d0e559c..de10f4fa5c2bad41f8723b3260b7c6259465b173 100644 (file)
@@ -160,7 +160,6 @@ void untrack_std_fds(struct fd_tracker *tracker)
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
        };
-       unsigned int fds_set_to_minus_1 = 0;
 
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
                int fd = files[i].fd;
@@ -169,7 +168,6 @@ void untrack_std_fds(struct fd_tracker *tracker)
 
                ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd,
                                files[i].name);
-               fds_set_to_minus_1 += (files[i].fd == -1);
        }
 }
 
This page took 0.027569 seconds and 4 git commands to generate.