[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:f61dfe4d403a58e4f1fc0b205056e2d5bb771142 commit f61dfe4d403a58e4f1fc0b205056e2d5bb771142 Author: Mikael Morin <[email protected]> Date: Mon Aug 10 22:21:00 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. Diff: --- gcc/fortran/trans-descriptor.cc | 10 +--------- gcc/fortran/trans-descriptor.h | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 8c959ed0852b..35293c8848f7 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -868,19 +868,11 @@ gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr, tree scalar, } -void -gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr, tree scalar) -{ - gfc_set_descriptor_from_scalar (block, descr, scalar, NULL_TREE, NULL_TREE); -} - - void gfc_set_descriptor_from_scalar_class (stmtblock_t *block, tree descr, tree scalar) { - tree tmp = gfc_class_data_get (scalar); - gfc_set_descriptor_from_scalar (block, descr, tmp, NULL_TREE, NULL_TREE); + gfc_set_descriptor_from_scalar (block, descr, gfc_class_data_get (scalar)); } diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h index 9ccae12e11c6..a8eb3a6a207a 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, tree); -void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree); +void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree, + tree = NULL_TREE, tree = NULL_TREE); void gfc_set_descriptor_from_scalar_class (stmtblock_t *, tree, tree); tree gfc_conv_descriptor_size (tree, int);