Skip to content

Commit f434cb0

Browse files
committed
ifx: allocatable string checks
1 parent b0b6d63 commit f434cb0

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/fpm/manifest/library.f90

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ elemental logical function shared(self)
6363
!> Instance of the library configuration
6464
class(library_config_t), intent(in) :: self
6565

66-
shared = self%lib_type == "shared"
66+
if (allocated(self%lib_type)) then
67+
shared = self%lib_type == "shared"
68+
else
69+
shared = .false.
70+
endif
71+
6772
end function shared
6873

6974

@@ -73,7 +78,11 @@ elemental logical function static(self)
7378
!> Instance of the library configuration
7479
class(library_config_t), intent(in) :: self
7580

76-
static = self%lib_type == "static"
81+
if (allocated(self%lib_type)) then
82+
static = self%lib_type == "static"
83+
else
84+
static = .false.
85+
endif
7786
end function static
7887

7988

@@ -109,18 +118,18 @@ subroutine new_library(self, table, error)
109118
return
110119
end if
111120

121+
if (has_list(table, "type")) then
122+
call syntax_error(error, "Manifest key [library.type] does not allow list input")
123+
return
124+
end if
125+
112126
call get_value(table, "source-dir", self%source_dir, "src")
113127
call get_value(table, "build-script", self%build_script)
114128

115129
call get_list(table, "include-dir", self%include_dir, error)
116130
if (allocated(error)) return
117131

118-
call get_value(table, "type", self%lib_type, "monolithic", stat=stat)
119-
120-
if (stat /= toml_stat%success) then
121-
call fatal_error(error,"Error while reading value for 'source-form' in fpm.toml, expecting logical")
122-
return
123-
end if
132+
call get_value(table, "type", self%lib_type, "monolithic")
124133

125134
select case(self%lib_type)
126135
case("shared","static","monolithic")
@@ -135,6 +144,10 @@ subroutine new_library(self, table, error)
135144
if (.not.allocated(self%include_dir)) then
136145
self%include_dir = [string_t("include")]
137146
end if
147+
148+
if (.not.allocated(self%lib_type)) then
149+
self%lib_type = "monolithic"
150+
end if
138151

139152
end subroutine new_library
140153

0 commit comments

Comments
 (0)