From c5cee4587f7028f2aff15e05b67dcc6c46816402 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Tue, 26 Mar 2024 08:31:32 +0100 Subject: [PATCH 1/3] remove `private` attribute from `deferred` procedure decl --- src/fpm/toml.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fpm/toml.f90 b/src/fpm/toml.f90 index cdade643c0..6cebb263d8 100644 --- a/src/fpm/toml.f90 +++ b/src/fpm/toml.f90 @@ -36,19 +36,19 @@ module fpm_toml contains !> Dump to TOML table, unit, file - procedure(to_toml), deferred, private :: dump_to_toml + procedure(to_toml), deferred :: dump_to_toml procedure, non_overridable, private :: dump_to_file procedure, non_overridable, private :: dump_to_unit generic :: dump => dump_to_toml, dump_to_file, dump_to_unit !> Load from TOML table, unit, file - procedure(from_toml), deferred, private :: load_from_toml + procedure(from_toml), deferred :: load_from_toml procedure, non_overridable, private :: load_from_file procedure, non_overridable, private :: load_from_unit generic :: load => load_from_toml, load_from_file, load_from_unit !> Serializable entities need a way to check that they're equal - procedure(is_equal), deferred, private :: serializable_is_same + procedure(is_equal), deferred :: serializable_is_same generic :: operator(==) => serializable_is_same !> Test load/write roundtrip From 64093b1e60e3237ef87b6c5e4df5b7f7dea89127 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Tue, 26 Mar 2024 08:34:05 +0100 Subject: [PATCH 2/3] remove duplicate `operator(==)` for `git_target_t` --- src/fpm/dependency.f90 | 3 +-- src/fpm/git.f90 | 17 ----------------- src/fpm/manifest/dependency.f90 | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/fpm/dependency.f90 b/src/fpm/dependency.f90 index 28472cb739..6cc87e4212 100644 --- a/src/fpm/dependency.f90 +++ b/src/fpm/dependency.f90 @@ -60,8 +60,7 @@ module fpm_dependency use fpm_error, only: error_t, fatal_error use fpm_filesystem, only: exists, join_path, mkdir, canon_path, windows_path, list_files, is_dir, basename, & os_delete_dir, get_temp_filename - use fpm_git, only: git_target_revision, git_target_default, git_revision, operator(==), & - serializable_t + use fpm_git, only: git_target_revision, git_target_default, git_revision, serializable_t use fpm_manifest, only: package_config_t, dependency_config_t, get_package_data use fpm_manifest_dependency, only: manifest_has_changed, dependency_destroy use fpm_manifest_preprocess, only: operator(==) diff --git a/src/fpm/git.f90 b/src/fpm/git.f90 index 22b4179553..13ef0e2496 100644 --- a/src/fpm/git.f90 +++ b/src/fpm/git.f90 @@ -62,11 +62,6 @@ module fpm_git end type git_target_t - - interface operator(==) - module procedure git_target_eq - end interface - !> Common output format for writing to the command line character(len=*), parameter :: out_fmt = '("#", *(1x, g0))' @@ -144,18 +139,6 @@ function git_target_tag(url, tag) result(self) end function git_target_tag - !> Check that two git targets are equal - logical function git_target_eq(this,that) result(is_equal) - - !> Two input git targets - type(git_target_t), intent(in) :: this,that - - is_equal = this%descriptor == that%descriptor .and. & - this%url == that%url .and. & - this%object == that%object - - end function git_target_eq - !> Check that two git targets are equal logical function git_is_same(this,that) class(git_target_t), intent(in) :: this diff --git a/src/fpm/manifest/dependency.f90 b/src/fpm/manifest/dependency.f90 index 3ebbad7de6..10fd791297 100644 --- a/src/fpm/manifest/dependency.f90 +++ b/src/fpm/manifest/dependency.f90 @@ -25,7 +25,7 @@ module fpm_manifest_dependency use fpm_error, only: error_t, syntax_error, fatal_error use fpm_git, only: git_target_t, git_target_tag, git_target_branch, & - & git_target_revision, git_target_default, operator(==), git_matches_manifest + & git_target_revision, git_target_default, git_matches_manifest use fpm_toml, only: toml_table, toml_key, toml_stat, get_value, check_keys, serializable_t, add_table, & & set_value, set_string use fpm_filesystem, only: windows_path, join_path From d5f9b462845158a25eb86a2c0a354d1888b03a17 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Tue, 26 Mar 2024 08:43:24 +0100 Subject: [PATCH 3/3] toml `set_character` interface: work with allocatable and non-allocatable input strings --- src/fpm/toml.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fpm/toml.f90 b/src/fpm/toml.f90 index 6cebb263d8..1bbcfe9886 100644 --- a/src/fpm/toml.f90 +++ b/src/fpm/toml.f90 @@ -454,7 +454,7 @@ subroutine set_character(table, key, var, error, whereAt) character(len=*), intent(in) :: key !> The character variable - character(len=:), allocatable, intent(in) :: var + character(len=*), optional, intent(in) :: var !> Error handling type(error_t), allocatable, intent(out) :: error @@ -471,7 +471,7 @@ subroutine set_character(table, key, var, error, whereAt) return end if - if (allocated(var)) then + if (present(var)) then call set_value(table, key, var, ierr) if (ierr/=toml_stat%success) then call fatal_error(error,'cannot set character key <'//key//'> in TOML table')