[gcc(refs/users/mikael/heads/refactor_descriptor_v206.01)] fortran: array descriptor: Use default arguments instead of overloads [PR122521]

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:b798a3d19afd8aa180d2895a0d75371fbd71981f

commit b798a3d19afd8aa180d2895a0d75371fbd71981f
Author: Mikael Morin <[email protected]>
Date:   Thu Aug 20 21:00:02 2026 +0200

    fortran: array descriptor: Use default arguments instead of overloads [PR122521]
    
    Fortran-tested on aarch64-unknown-linux-gnu.  OK for mainline?
    
    -- >8 --
    
    There are two gfc_set_descriptor_from_scalar overloads, the second one
    forwarding to the first with default argument values.  Add default arguments
    to the first one and remove the second.
    
    gcc/fortran/ChangeLog:
    
            * trans-descriptor.h (gfc_set_descriptor_from_scalar): Add
            default argument values, and remove overload declaration.
            * trans-descriptor.cc (gfc_set_descriptor_from_scalar): Remove
            overload.
            (gfc_set_descriptor_from_scalar_class): Skip argument values
            matching the default ones.
    
    Revert partiel "fortran: array descriptor: Use default arguments instead of overloads [PR122521]"
    
    This reverts commit 3a1afed1934b21a32e9a6f2dcfd38613ab828a16.
    
    Suppression function
    
    Revert "Correction compil'"
    
    This reverts commit f2e36d64e823069c4185a4aee82979632b11d445.

Diff:
---
 gcc/fortran/trans-descriptor.cc | 12 ------------
 gcc/fortran/trans-descriptor.h  |  4 ++--
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 4ae10af9f5ce..47a84c764b3a 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -884,18 +884,6 @@ gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr,
 }
 
 
-/* Add code to BLOCK initializing the scalar descriptor DESCR, so that it
-   represents the same data as the scalar expression SCALAR.  This is used to
-   implement the argument association between the actual argument SCALAR_EXPR
-   and an assumed-rank dummy argument.  */
-
-void
-gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr, tree scalar)
-{
-  gfc_set_descriptor_from_scalar (block, descr, scalar, NULL_TREE);
-}
-
-
 /* Return true if TYPE is the type of a class container, or the pointer to such
    a type.  Otherwise return false.  If CLASS_TYPE is not nullptr, set its
    target to the class descriptor type in the true case, and leave it unmodified
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 8b342dd7c010..5397ef52e9e4 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -73,8 +73,8 @@ tree gfc_create_unallocated_library_result_descriptor (stmtblock_t *, tree,
 tree gfc_create_null_actual_descriptor (stmtblock_t *, gfc_typespec *,
 					symbol_attribute, int);
 
-void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree, tree);
-void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree);
+void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree,
+				     tree = NULL_TREE);
 void gfc_set_descriptor_from_scalar_class (stmtblock_t *, tree, tree);
 
 tree gfc_conv_descriptor_size (tree, int);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.