[PATCH] aarch64: Ensure const and sign correctness

2023-09-14 Thread Pekka Seppänen
Be const and sign correct by using a matching CIE augmentation type.
Use a builtin instead of relying  being included.

libgcc/ChangeLog:

* config/aarch64/aarch64-unwind.h (aarch64_cie_signed_with_b_key):
Use const unsigned type and a builtin.

Signed-off-by: Pekka Seppänen 
---
 libgcc/config/aarch64/aarch64-unwind.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libgcc/config/aarch64/aarch64-unwind.h 
b/libgcc/config/aarch64/aarch64-unwind.h
index 3ad2f8239ed..d669edd671b 100644
--- a/libgcc/config/aarch64/aarch64-unwind.h
+++ b/libgcc/config/aarch64/aarch64-unwind.h
@@ -40,8 +40,9 @@ aarch64_cie_signed_with_b_key (struct _Unwind_Context 
*context)
   const struct dwarf_cie *cie = get_cie (fde);
   if (cie != NULL)
{
- char *aug_str = cie->augmentation;
- return strchr (aug_str, 'B') == NULL ? 0 : 1;
+ const unsigned char *aug_str = cie->augmentation;
+ return __builtin_strchr ((const char *) aug_str,
+  'B') == NULL ? 0 : 1;
}
 }
   return 0;
-- 
2.34.1



[PATCH v2] libstdc++: Fix -Wunused-parameter warnings

2023-09-07 Thread Pekka Seppänen
On 7.9.2023 19:40, Jonathan Wakely wrote:
> On 29/08/23 15:04 +0300, Pekka Seppänen wrote:
>> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
>> not defined.
>>
>> libstdc++-v3/ChangeLog:
>>
>> * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
>> * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
>> * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
>> ---
>>  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
>>  libstdc++-v3/src/c++17/fs_path.cc | 2 +-
>>  libstdc++-v3/src/filesystem/path.cc   | 2 +-
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> mbstate_t>>(__loc);
>>
>> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
>> b/libstdc++-v3/src/c++11/cow-locale_init.cc
>> index 85277763427..9554ed1ebf9 100644
>> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
>> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
>> @@ -137,8 +137,8 @@ namespace
>>    }
>>
>>    void
>> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
>> -   const char* __s, const char* __smon)
>> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
>> clocm,
>> +   const char* __s, [[maybe_unused]] const char* __smon)
> 
> This line should be split to keepo it below 80 columns.
> 

Done, v2 follows.

> Otherwise the patch looks good, but please CC the libstdc++ list for
> libstdc++ patches. Otherwise I won't see them, and they won't be
> reviewed.
> 

My bad, I wasn't aware of this.

> Do you have a GCC copyright assignment on file? If not, please add a
> sign-off to confirm you can submit this under the DCO terms:
> https://gcc.gnu.org/dco.html
> 

Will add.

> 
>>    {
>>  auto& __cloc = *static_cast<__c_locale*>(cloc);
>>
>> diff --git a/libstdc++-v3/src/c++17/fs_path.cc
>> b/libstdc++-v3/src/c++17/fs_path.cc
>> index aaea7d2725d..d65b5482e8b 100644
>> --- a/libstdc++-v3/src/c++17/fs_path.cc
>> +++ b/libstdc++-v3/src/c++17/fs_path.cc
>> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
>>
>>  path::string_type
>>  path::_S_convert_loc(const char* __first, const char* __last,
>> - const std::locale& __loc)
>> + [[maybe_unused]] const std::locale& __loc)
>>  {
>>  #if _GLIBCXX_USE_WCHAR_T
>>    auto& __cvt = std::use_facet> mbstate_t>>(__loc);
>> diff --git a/libstdc++-v3/src/filesystem/path.cc
>> b/libstdc++-v3/src/filesystem/path.cc
>> index 4c218bdae49..d04ba6d465d 100644
>> --- a/libstdc++-v3/src/filesystem/path.cc
>> +++ b/libstdc++-v3/src/filesystem/path.cc
>> @@ -498,7 +498,7 @@ path::_M_trim()
>>
>>  path::string_type
>>  path::_S_convert_loc(const char* __first, const char* __last,
>> - const std::locale& __loc)
>> + [[maybe_unused]] const std::locale& __loc)
>>  {
>>  #if _GLIBCXX_USE_WCHAR_T
>>    auto& __cvt = std::use_facet 
> 

-- >8 --
libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
not defined.

libstdc++-v3/ChangeLog:

* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
* src/filesystem/path.cc (path::_S_convert_loc): Likewise.

Signed-off-by: Pekka Seppänen 
---
 libstdc++-v3/src/c++11/cow-locale_init.cc | 5 +++--
 libstdc++-v3/src/c++17/fs_path.cc | 2 +-
 libstdc++-v3/src/filesystem/path.cc   | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc 
b/libstdc++-v3/src/c++11/cow-locale_init.cc
index 85277763427..f48561f5b12 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -137,8 +137,9 @@ namespace
   }
 
   void
-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
-   const char* __s, const char* __smon)
+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* clocm,
+  const char* __s,
+  [[maybe_unused]] const char* __smon)
   {
 auto& __cloc = *static_cast<__c_locale*>(cloc);
 
diff --git a/libstdc++-v3/src/c++17/fs_path.cc 
b/libstdc++-v3/src/c++17/fs_path.cc
index aaea7d2725d..d65b5482e8b 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
 
 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-const std::locale& __loc)
+[[maybe_unused

[PATCH] libstdc++: Fix -Wunused-parameter warnings

2023-08-29 Thread Pekka Seppänen

libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
not defined.

libstdc++-v3/ChangeLog:

* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
* src/filesystem/path.cc (path::_S_convert_loc): Likewise.
---
 libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
 libstdc++-v3/src/c++17/fs_path.cc | 2 +-
 libstdc++-v3/src/filesystem/path.cc   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc 
b/libstdc++-v3/src/c++11/cow-locale_init.cc

index 85277763427..9554ed1ebf9 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -137,8 +137,8 @@ namespace
   }

   void
-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
-   const char* __s, const char* __smon)
+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* 
clocm,

+  const char* __s, [[maybe_unused]] const char* 
__smon)
   {
 auto& __cloc = *static_cast<__c_locale*>(cloc);

diff --git a/libstdc++-v3/src/c++17/fs_path.cc 
b/libstdc++-v3/src/c++17/fs_path.cc

index aaea7d2725d..d65b5482e8b 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()

 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-const std::locale& __loc)
+[[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facetmbstate_t>>(__loc);
diff --git a/libstdc++-v3/src/filesystem/path.cc 
b/libstdc++-v3/src/filesystem/path.cc

index 4c218bdae49..d04ba6d465d 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -498,7 +498,7 @@ path::_M_trim()

 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-const std::locale& __loc)
+[[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facetmbstate_t>>(__loc);

--
2.34.1


[PATCH] Use expandargv on gcc-ar [PR77576]

2023-05-24 Thread Pekka Seppänen

Call expandargv prior attempting to prepend a dash to the first
argument.  When using response files the first character is never a dash
but an at-sign.

PR gcc/77576

gcc/ChangeLog:

* gcc-ar.cc (main): Call expandargv.
---
 gcc/gcc-ar.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/gcc-ar.cc b/gcc/gcc-ar.cc
index 5e5b63e1988..2a1e99cace7 100644
--- a/gcc/gcc-ar.cc
+++ b/gcc/gcc-ar.cc
@@ -136,6 +136,8 @@ main (int ac, char **av)
   int exit_code = FATAL_EXIT_CODE;
   int i;

+  expandargv(, );
+
   setup_prefixes (av[0]);

   /* Not using getopt for now.  */
--
2.34.1


[PATCH] lto: pass -pthread to AM_LDFLAGS [PR 106118]

2022-06-28 Thread Pekka Seppänen
Move -pthread from configure.ac to Makefile.in so that it is passed to 
AM_LDFLAGS.


lto-plugin/ChangeLog:

* configure.ac: Move -pthread from here...
* Makefile.am: ...to here.
* configure: Regenerate.
* Makefile.in: Likewise.
---
 lto-plugin/Makefile.am  | 3 ++-
 lto-plugin/configure.ac | 3 ---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index a96acc87ee2..81362eafc36 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -9,7 +9,8 @@ libexecsubdir := 
$(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(a


 AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@ $(CET_HOST_FLAGS)
-AM_LDFLAGS = @ac_lto_plugin_ldflags@
+# The plug-in depends on pthreads.
+AM_LDFLAGS = -pthread @ac_lto_plugin_ldflags@
 AM_LIBTOOLFLAGS = --tag=disable-static
 override CFLAGS := $(filter-out -fsanitize=address 
-fsanitize=hwaddress,$(CFLAGS))
 override LDFLAGS := $(filter-out -fsanitize=address 
-fsanitize=hwaddress,$(LDFLAGS))

diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 75cf46ac5c7..c2ec512880f 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -13,9 +13,6 @@ AC_PROG_CC
 AC_SYS_LARGEFILE
 ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_lto_plugin_warn_cflags])

-# The plug-in depends on pthreads
-LDFLAGS="-pthread"
-
 # Check whether -static-libgcc is supported.
 saved_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS -static-libgcc"
--
2.34.1


[PATCH] Adjust CPP_FOR_BUILD

2021-11-11 Thread Pekka Seppänen

Hi.

CPP/CPPFLAGS were changed by commit 
84401ce5fb4ecab55decb472b168100e7593e01f.  That commit uses CPP as a 
default for CPP_FOR_BUILD.  Unless CPP is defined, GNU make defaults CPP 
as `$(CC) -E'.  Given the context, this is now incorrect, since 
CC_FOR_BUILD should be used.


Fixes PR103011.

-- Pekka


gcc/Changelog:

  * configure: Regenerate.
  * configure.ac: For CPP_FOR_BUILD use $(CC_FOR_BUILD) -E instead of 
$(CPP).


---
 configure| 2 +-
 configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 58979d6e3b1..a5eca91fb2a 100755
--- a/configure
+++ b/configure
@@ -4092,7 +4092,7 @@ if test "${build}" != "${host}" ; then
   AR_FOR_BUILD=${AR_FOR_BUILD-ar}
   AS_FOR_BUILD=${AS_FOR_BUILD-as}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
-  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
+  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
   CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
   DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
   GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
diff --git a/configure.ac b/configure.ac
index 550e6993b59..b8055dad573 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1334,7 +1334,7 @@ if test "${build}" != "${host}" ; then
   AR_FOR_BUILD=${AR_FOR_BUILD-ar}
   AS_FOR_BUILD=${AS_FOR_BUILD-as}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
-  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
+  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
   CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
   DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
   GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}