chiark / gitweb /
util-lib: mark variable with _unused_ to silence clang warning
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 1 Nov 2017 22:01:24 +0000 (23:01 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 1 Nov 2017 22:01:24 +0000 (23:01 +0100)
_unused_ means "the variable is meant to be possible unused and gcc
will not generate a warning about it", which is exactly what we need here,
since we're only declaring it for the side effect of _cleanup_.

src/basic/fileio.c

index 46b8b4a698e46c71da4558679f4e3f1f7a6dc05f..6800b9297723f6bae906030256490a54531a6e12 100644 (file)
@@ -1568,7 +1568,7 @@ int read_line(FILE *f, size_t limit, char **ret) {
         }
 
         {
-                _cleanup_(funlockfilep) FILE *flocked = f;
+                _unused_ _cleanup_(funlockfilep) FILE *flocked = f;
                 flockfile(f);
 
                 for (;;) {