public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libstdc++ PATCH to harmonize noexcept
@ 2017-11-14 19:04 Jason Merrill
  2017-11-15  0:42 ` Jonathan Wakely
  2017-12-01 15:33 ` Jonathan Wakely
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Merrill @ 2017-11-14 19:04 UTC (permalink / raw)
  To: gcc-patches List; +Cc: libstdc++

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

While working on an unrelated issue I noticed that the compiler didn't
like some of these declarations after preprocessing, when they aren't
protected by system-header permissiveness.

I thought about limiting the permissiveness to only extern "C"
functions, but I believe that system headers are adding more C++
declarations, so we'd likely run into this issue again.

Shouldn't we build libstdc++ with -Wsystem-headers?  Maybe along with
-Wno-error=system-headers?

Jonathan approved these changes elsewhere.

Jason

[-- Attachment #2: fs-nx.diff --]
[-- Type: text/plain, Size: 2708 bytes --]

commit abe66184d116f85f10108191b081f48dd0cfe3aa
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Nov 14 13:48:57 2017 -0500

            Correct noexcept mismatch in declarations.
    
            * include/bits/fs_ops.h (permissions): Add noexcept.
            * include/bits/fs_fwd.h (copy, copy_file): Remove noexcept.
            (permissions): Add noexcept.
            * include/std/string_view (find_first_of): Add noexcept.

diff --git a/libstdc++-v3/include/bits/fs_fwd.h b/libstdc++-v3/include/bits/fs_fwd.h
index f408a39b974..66b0d20f027 100644
--- a/libstdc++-v3/include/bits/fs_fwd.h
+++ b/libstdc++-v3/include/bits/fs_fwd.h
@@ -300,11 +300,11 @@ _GLIBCXX_END_NAMESPACE_CXX11
 
   void copy(const path& __from, const path& __to, copy_options __options);
   void copy(const path& __from, const path& __to, copy_options __options,
-	    error_code&) noexcept;
+	    error_code&);
 
   bool copy_file(const path& __from, const path& __to, copy_options __option);
   bool copy_file(const path& __from, const path& __to, copy_options __option,
-		 error_code&) noexcept;
+		 error_code&);
 
   path current_path();
 
@@ -319,7 +319,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
   file_time_type last_write_time(const path&);
   file_time_type last_write_time(const path&, error_code&) noexcept;
 
-  void permissions(const path&, perms, perm_options, error_code&);
+  void permissions(const path&, perms, perm_options, error_code&) noexcept;
 
   path proximate(const path& __p, const path& __base, error_code& __ec);
   path proximate(const path& __p, const path& __base, error_code& __ec);
diff --git a/libstdc++-v3/include/bits/fs_ops.h b/libstdc++-v3/include/bits/fs_ops.h
index 075d61e2a63..22422bd1f4d 100644
--- a/libstdc++-v3/include/bits/fs_ops.h
+++ b/libstdc++-v3/include/bits/fs_ops.h
@@ -253,7 +253,7 @@ namespace filesystem
 
   void
   permissions(const path& __p, perms __prms, perm_options __opts,
-	      error_code& __ec);
+	      error_code& __ec) noexcept;
 
   inline path proximate(const path& __p, error_code& __ec)
   { return proximate(__p, current_path(), __ec); }
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 1900b867841..49b6c378370 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -323,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { return this->find(__c, __pos); }
 
       constexpr size_type
-      find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
+      find_first_of(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
 
       constexpr size_type
       find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++ PATCH to harmonize noexcept
  2017-11-14 19:04 libstdc++ PATCH to harmonize noexcept Jason Merrill
@ 2017-11-15  0:42 ` Jonathan Wakely
  2017-12-01 15:33 ` Jonathan Wakely
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2017-11-15  0:42 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, libstdc++

On 14/11/17 13:56 -0500, Jason Merrill wrote:
>While working on an unrelated issue I noticed that the compiler didn't
>like some of these declarations after preprocessing, when they aren't
>protected by system-header permissiveness.
>
>I thought about limiting the permissiveness to only extern "C"
>functions, but I believe that system headers are adding more C++
>declarations, so we'd likely run into this issue again.
>
>Shouldn't we build libstdc++ with -Wsystem-headers?  Maybe along with
>-Wno-error=system-headers?

It's been suggested before:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50871


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++ PATCH to harmonize noexcept
  2017-11-14 19:04 libstdc++ PATCH to harmonize noexcept Jason Merrill
  2017-11-15  0:42 ` Jonathan Wakely
@ 2017-12-01 15:33 ` Jonathan Wakely
  2017-12-05 15:23   ` Jonathan Wakely
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-01 15:33 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, libstdc++

On 14/11/17 13:56 -0500, Jason Merrill wrote:
>While working on an unrelated issue I noticed that the compiler didn't
>like some of these declarations after preprocessing, when they aren't
>protected by system-header permissiveness.
>
>I thought about limiting the permissiveness to only extern "C"
>functions, but I believe that system headers are adding more C++
>declarations, so we'd likely run into this issue again.
>
>Shouldn't we build libstdc++ with -Wsystem-headers?  Maybe along with
>-Wno-error=system-headers?
>
>Jonathan approved these changes elsewhere.
>
>Jason

>commit abe66184d116f85f10108191b081f48dd0cfe3aa
>Author: Jason Merrill <jason@redhat.com>
>Date:   Tue Nov 14 13:48:57 2017 -0500
>
>            Correct noexcept mismatch in declarations.
>
>            * include/bits/fs_ops.h (permissions): Add noexcept.
>            * include/bits/fs_fwd.h (copy, copy_file): Remove noexcept.
>            (permissions): Add noexcept.
>            * include/std/string_view (find_first_of): Add noexcept.
>

There's another one needed too:

--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -53,8 +53,10 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
 }
 
 extern "C" __cxa_refcounted_exception*
-__cxxabiv1::__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
-                                         void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
+__cxxabiv1::
+__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
+                            void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
+_GLIBCXX_NOTHROW
 {
   __cxa_refcounted_exception *header
     = __get_refcounted_exception_header_from_obj (obj);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++ PATCH to harmonize noexcept
  2017-12-01 15:33 ` Jonathan Wakely
@ 2017-12-05 15:23   ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-05 15:23 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, libstdc++

[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]

On 01/12/17 15:32 +0000, Jonathan Wakely wrote:
>On 14/11/17 13:56 -0500, Jason Merrill wrote:
>>While working on an unrelated issue I noticed that the compiler didn't
>>like some of these declarations after preprocessing, when they aren't
>>protected by system-header permissiveness.
>>
>>I thought about limiting the permissiveness to only extern "C"
>>functions, but I believe that system headers are adding more C++
>>declarations, so we'd likely run into this issue again.
>>
>>Shouldn't we build libstdc++ with -Wsystem-headers?  Maybe along with
>>-Wno-error=system-headers?
>>
>>Jonathan approved these changes elsewhere.
>>
>>Jason
>
>>commit abe66184d116f85f10108191b081f48dd0cfe3aa
>>Author: Jason Merrill <jason@redhat.com>
>>Date:   Tue Nov 14 13:48:57 2017 -0500
>>
>>           Correct noexcept mismatch in declarations.
>>
>>           * include/bits/fs_ops.h (permissions): Add noexcept.
>>           * include/bits/fs_fwd.h (copy, copy_file): Remove noexcept.
>>           (permissions): Add noexcept.
>>           * include/std/string_view (find_first_of): Add noexcept.
>>
>
>There's another one needed too:
>
>--- a/libstdc++-v3/libsupc++/eh_throw.cc
>+++ b/libstdc++-v3/libsupc++/eh_throw.cc
>@@ -53,8 +53,10 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
>}
>
>extern "C" __cxa_refcounted_exception*
>-__cxxabiv1::__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
>-                                         void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
>+__cxxabiv1::
>+__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
>+                            void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
>+_GLIBCXX_NOTHROW
>{
>  __cxa_refcounted_exception *header
>    = __get_refcounted_exception_header_from_obj (obj);

Tested powerpc64le-linux and committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 2987 bytes --]

commit ce8d32a9d091879df6b3435a8c2ba83cea2dd47e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Dec 5 14:50:52 2017 +0000

    Correct noexcept mismatch in declarations.
    
    2017-12-05  Jason Merrill  <jason@redhat.com>
                Jonathan Wakely  <jwakely@redhat.com>
    
            * include/bits/fs_fwd.h (copy, copy_file): Remove noexcept.
            (permissions): Add noexcept.
            * include/bits/fs_ops.h (permissions): Add noexcept.
            * libsupc++/eh_throw.cc (__cxa_init_primary_exception): Add
            _GLIBCXX_NOTHROW.

diff --git a/libstdc++-v3/include/bits/fs_fwd.h b/libstdc++-v3/include/bits/fs_fwd.h
index f408a39b974..66b0d20f027 100644
--- a/libstdc++-v3/include/bits/fs_fwd.h
+++ b/libstdc++-v3/include/bits/fs_fwd.h
@@ -300,11 +300,11 @@ _GLIBCXX_END_NAMESPACE_CXX11
 
   void copy(const path& __from, const path& __to, copy_options __options);
   void copy(const path& __from, const path& __to, copy_options __options,
-	    error_code&) noexcept;
+	    error_code&);
 
   bool copy_file(const path& __from, const path& __to, copy_options __option);
   bool copy_file(const path& __from, const path& __to, copy_options __option,
-		 error_code&) noexcept;
+		 error_code&);
 
   path current_path();
 
@@ -319,7 +319,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
   file_time_type last_write_time(const path&);
   file_time_type last_write_time(const path&, error_code&) noexcept;
 
-  void permissions(const path&, perms, perm_options, error_code&);
+  void permissions(const path&, perms, perm_options, error_code&) noexcept;
 
   path proximate(const path& __p, const path& __base, error_code& __ec);
   path proximate(const path& __p, const path& __base, error_code& __ec);
diff --git a/libstdc++-v3/include/bits/fs_ops.h b/libstdc++-v3/include/bits/fs_ops.h
index 075d61e2a63..22422bd1f4d 100644
--- a/libstdc++-v3/include/bits/fs_ops.h
+++ b/libstdc++-v3/include/bits/fs_ops.h
@@ -253,7 +253,7 @@ namespace filesystem
 
   void
   permissions(const path& __p, perms __prms, perm_options __opts,
-	      error_code& __ec);
+	      error_code& __ec) noexcept;
 
   inline path proximate(const path& __p, error_code& __ec)
   { return proximate(__p, current_path(), __ec); }
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index 13428d92da7..daf134993d3 100644
--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -53,8 +53,10 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
 }
 
 extern "C" __cxa_refcounted_exception*
-__cxxabiv1::__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
-                                         void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
+__cxxabiv1::
+__cxa_init_primary_exception(void *obj, std::type_info *tinfo,
+			     void (_GLIBCXX_CDTOR_CALLABI *dest) (void *))
+_GLIBCXX_NOTHROW
 {
   __cxa_refcounted_exception *header
     = __get_refcounted_exception_header_from_obj (obj);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-05 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 19:04 libstdc++ PATCH to harmonize noexcept Jason Merrill
2017-11-15  0:42 ` Jonathan Wakely
2017-12-01 15:33 ` Jonathan Wakely
2017-12-05 15:23   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).