enable -werror by default

This commit is contained in:
liqingqing_1229 2022-07-06 15:32:10 +08:00
parent 81b4bec2f6
commit a27663f288
2 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,36 @@
From 5e89ed42fd8997414732525c9460878d65363b3f Mon Sep 17 00:00:00 2001
From: Yang Yanchao <yangyanchao6@huawei.com>
Date: Fri, 15 Apr 2022 17:25:05 +0800
Subject: [PATCH] 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.
---
elf/cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/elf/cache.c b/elf/cache.c
index abe2e49..3d7d3a6 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);
}
--
1.8.3.1

View File

@ -29,7 +29,7 @@
%bcond_without testsuite %bcond_without testsuite
%bcond_with benchtests %bcond_with benchtests
%bcond_with bootstrap %bcond_with bootstrap
%bcond_with werror %bcond_without werror
%bcond_without docs %bcond_without docs
%ifarch x86_64 aarch64 %ifarch x86_64 aarch64
%bcond_with compat_2_17 %bcond_with compat_2_17
@ -65,7 +65,7 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.35 Version: 2.35
Release: 14 Release: 15
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
@ -84,6 +84,7 @@ Source8: testsuite_whitelist.%{_target_cpu}
%endif %endif
Patch0: glibc-1070416.patch Patch0: glibc-1070416.patch
Patch1: elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch
#Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch #Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
#Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch #Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
@ -1257,6 +1258,9 @@ fi
%endif %endif
%changelog %changelog
* Wed Jul 7 2022 Qingqing Li <liqingqing3@huawei.com> - 2.35-15
- enable -werror by default
* Tue Jul 5 2022 Yang Yanchao <yangyanchao6@huawei.com> - 2.35-14 * Tue Jul 5 2022 Yang Yanchao <yangyanchao6@huawei.com> - 2.35-14
- add libpthread_nonshared.a in glibc-compat-2.17 for old applications - add libpthread_nonshared.a in glibc-compat-2.17 for old applications