aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorYang Yanchao <yangyanchao6@huawei.com>2022-04-15 17:25:05 +0800
committerFlorian Weimer <fweimer@redhat.com>2022-06-28 10:28:48 +0200
commit5e89ed42fd8997414732525c9460878d65363b3f (patch)
treea28e4e4a09ecef3257f56fdc54d531dd1f2f70a5 /elf
parentcfdc4df66ce1464611e1b508f7a5a8f38afd5337 (diff)
downloadglibc-5e89ed42fd8997414732525c9460878d65363b3f.tar
glibc-5e89ed42fd8997414732525c9460878d65363b3f.tar.gz
glibc-5e89ed42fd8997414732525c9460878d65363b3f.tar.bz2
glibc-5e89ed42fd8997414732525c9460878d65363b3f.zip
elf: Fix compile error with -Werror and -DNDEBUG
Using -Werror and -DNDEBUG at the same time will trigger the following compiler error: cache.c: In function 'save_cache': cache.c:758:15: error: unused variable 'old_offset' [-Werror=unused-variable] 758 | off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET); | ^~~~~~~~~~ -DNDEBUG disables the assertion, making old_offset unused. Use __attribute__ ((unused)) to disable this warning.
Diffstat (limited to 'elf')
-rw-r--r--elf/cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/elf/cache.c b/elf/cache.c
index abe2e49a66..3d7d3a67bf 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -727,7 +727,8 @@ save_cache (const char *cache_name)
if (opt_format != opt_format_old)
{
/* Align file position to 4. */
- off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET);
+ __attribute__ ((unused)) off64_t old_offset
+ = lseek64 (fd, extension_offset, SEEK_SET);
assert ((unsigned long long int) (extension_offset - old_offset) < 4);
write_extensions (fd, str_offset, extension_offset);
}