public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] Fix cygming-crtend.c build warning due to -Wprio-ctor-dtor
@ 2021-08-25 16:46 Jonathan Yong
  2021-08-25 23:06 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Yong @ 2021-08-25 16:46 UTC (permalink / raw)
  To: Gcc Patch List


[-- Attachment #1.1.1: Type: text/plain, Size: 414 bytes --]

Attached patches OK?

     cygming-crtend.c: fix build warnings

     libgcc/Changelog:
             * config/i386/cygming-crtend.c: Fix register_frame_ctor
             and register_frame_dtor warnings.


     extend.texi: add note about reserved ctor/dtor priorities

     gcc/Changelog:
             * doc/extend.texi: Add note about reserved priorities
             to the constructor attribute.

[-- Attachment #1.1.2: 0001-cygming-crtend.c-fix-build-warnings.patch --]
[-- Type: text/x-patch, Size: 1413 bytes --]

From e9758ef8c03e617eafe13ca6512fd7cd0256abc7 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Wed, 25 Aug 2021 16:33:36 +0000
Subject: [PATCH 1/2] cygming-crtend.c: fix build warnings

libgcc/Changelog:

	* config/i386/cygming-crtend.c: Fix register_frame_ctor
	and register_frame_dtor warnings.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
---
 libgcc/config/i386/cygming-crtend.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libgcc/config/i386/cygming-crtend.c b/libgcc/config/i386/cygming-crtend.c
index c7ba109a04a..4ab63427ee2 100644
--- a/libgcc/config/i386/cygming-crtend.c
+++ b/libgcc/config/i386/cygming-crtend.c
@@ -56,7 +56,10 @@ static EH_FRAME_SECTION_CONST int __FRAME_END__[]
 extern void __gcc_register_frame (void); 
 extern void __gcc_deregister_frame (void);
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
 static void register_frame_ctor (void) __attribute__ ((constructor (0)));
+#pragma GCC diagnostic pop
 
 static void
 register_frame_ctor (void)
@@ -65,7 +68,10 @@ register_frame_ctor (void)
 }
 
 #if !DEFAULT_USE_CXA_ATEXIT
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
 static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
+#pragma GCC diagnostic pop
 
 static void
 deregister_frame_dtor (void)
-- 
2.33.0


[-- Attachment #1.1.3: 0002-extend.texi-add-note-about-reserved-ctor-dtor-priori.patch --]
[-- Type: text/x-patch, Size: 2484 bytes --]

From 12b18651af252fb111e1a7375fe09fbc69987922 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Wed, 25 Aug 2021 16:36:14 +0000
Subject: [PATCH 2/2] extend.texi: add note about reserved ctor/dtor priorities

gcc/Changelog:

	* doc/extend.texi: Add note about reserved priorities
	to the constructor attribute.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
---
 gcc/doc/extend.texi | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 49df8e6dc38..251a10302b4 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2787,16 +2787,16 @@ On some targets the attributes also accept an integer argument to
 specify a priority to control the order in which constructor and
 destructor functions are run.  A constructor
 with a smaller priority number runs before a constructor with a larger
-priority number; the opposite relationship holds for destructors.  So,
-if you have a constructor that allocates a resource and a destructor
-that deallocates the same resource, both functions typically have the
-same priority.  The priorities for constructor and destructor
-functions are the same as those specified for namespace-scope C++
-objects (@pxref{C++ Attributes}).  However, at present, the order in which
-constructors for C++ objects with static storage duration and functions
-decorated with attribute @code{constructor} are invoked is unspecified.
-In mixed declarations, attribute @code{init_priority} can be used to
-impose a specific ordering.
+priority number; the opposite relationship holds for destructors.  Note
+that priorities 0-100 are reserved.  So, if you have a constructor that
+allocates a resource and a destructor that deallocates the same
+resource, both functions typically have the same priority.  The
+priorities for constructor and destructor functions are the same as
+those specified for namespace-scope C++ objects (@pxref{C++ Attributes}).
+However, at present, the order in which constructors for C++ objects
+with static storage duration and functions decorated with attribute
+@code{constructor} are invoked is unspecified. In mixed declarations,
+attribute @code{init_priority} can be used to impose a specific ordering.
 
 Using the argument forms of the @code{constructor} and @code{destructor}
 attributes on targets where the feature is not supported is rejected with
-- 
2.33.0


[-- Attachment #1.1.4: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 5627 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [Patch] Fix cygming-crtend.c build warning due to -Wprio-ctor-dtor
  2021-08-25 16:46 [Patch] Fix cygming-crtend.c build warning due to -Wprio-ctor-dtor Jonathan Yong
@ 2021-08-25 23:06 ` Jeff Law
  2021-08-26  1:33   ` Jonathan Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2021-08-25 23:06 UTC (permalink / raw)
  To: Jonathan Yong, Gcc Patch List



On 8/25/2021 10:46 AM, Jonathan Yong via Gcc-patches wrote:
> Attached patches OK?
>
>     cygming-crtend.c: fix build warnings
>
>     libgcc/Changelog:
>             * config/i386/cygming-crtend.c: Fix register_frame_ctor
>             and register_frame_dtor warnings.
>
>
>     extend.texi: add note about reserved ctor/dtor priorities
>
>     gcc/Changelog:
>             * doc/extend.texi: Add note about reserved priorities
>             to the constructor attribute.
Yes.  Both are OK.

jeff


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

* Re: [Patch] Fix cygming-crtend.c build warning due to -Wprio-ctor-dtor
  2021-08-25 23:06 ` Jeff Law
@ 2021-08-26  1:33   ` Jonathan Yong
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Yong @ 2021-08-26  1:33 UTC (permalink / raw)
  To: Gcc Patch List


[-- Attachment #1.1.1: Type: text/plain, Size: 682 bytes --]

On 8/25/21 11:06 PM, Jeff Law wrote:
> 
> 
> On 8/25/2021 10:46 AM, Jonathan Yong via Gcc-patches wrote:
>> Attached patches OK?
>>
>>     cygming-crtend.c: fix build warnings
>>
>>     libgcc/Changelog:
>>             * config/i386/cygming-crtend.c: Fix register_frame_ctor
>>             and register_frame_dtor warnings.
>>
>>
>>     extend.texi: add note about reserved ctor/dtor priorities
>>
>>     gcc/Changelog:
>>             * doc/extend.texi: Add note about reserved priorities
>>             to the constructor attribute.
> Yes.  Both are OK.
> 
> jeff
> 

Done, pushed to master, thanks.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 5627 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

end of thread, other threads:[~2021-08-26  1:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 16:46 [Patch] Fix cygming-crtend.c build warning due to -Wprio-ctor-dtor Jonathan Yong
2021-08-25 23:06 ` Jeff Law
2021-08-26  1:33   ` Jonathan Yong

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).