[gcc r12-6431] Improve sequence logic in cxx_init_decl_processing

Olivier Hainque hainque@gcc.gnu.org
Tue Jan 11 08:44:29 GMT 2022


https://gcc.gnu.org/g:14cb768ef32ab978a0f5ce2485fa4213c5167fb6

commit r12-6431-g14cb768ef32ab978a0f5ce2485fa4213c5167fb6
Author: Olivier Hainque <hainque@adacore.com>
Date:   Thu Dec 30 20:47:31 2021 +0000

    Improve sequence logic in cxx_init_decl_processing
    
    Checking for one_only/weak support is better done
    before deciding to turn references to __cxa_pure_virtual weak.
    
    This helps at least on VxWorks where one_only / weak support
    varies between kernel and rtp modes as well as across VxWorks
    versions.
    
    2021-12-30  Olivier Hainque  <hainque@adacore.com>
    
    gcc/cp/
            * decl.c (cxx_init_decl_processing): Move code possibly
            altering flag_weak before code testing it.

Diff:
---
 gcc/cp/decl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5fe341e0b75..0e37f1a59bc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4718,6 +4718,9 @@ cxx_init_decl_processing (void)
     nullptr_node = build_int_cst (nullptr_type_node, 0);
   }
 
+  if (! supports_one_only ())
+    flag_weak = 0;
+
   abort_fndecl
     = build_library_fn_ptr ("__cxa_pure_virtual", void_ftype,
 			    ECF_NORETURN | ECF_NOTHROW | ECF_COLD);
@@ -4733,9 +4736,6 @@ cxx_init_decl_processing (void)
   if (flag_exceptions)
     init_exception_processing ();
 
-  if (! supports_one_only ())
-    flag_weak = 0;
-
   if (modules_p ())
     init_modules (parse_in);


More information about the Gcc-cvs mailing list