Skip to content

Commit 25eab8b

Browse files
committed
Fix is_same checks for ifx
1 parent e4a65fa commit 25eab8b

File tree

8 files changed

+147
-47
lines changed

8 files changed

+147
-47
lines changed

src/fpm/dependency.f90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,10 @@ logical function dependency_tree_is_same(this,that)
14161416

14171417
if (.not.(this%unit==other%unit)) return
14181418
if (.not.(this%verbosity==other%verbosity)) return
1419-
if (.not.(this%dep_dir==other%dep_dir)) return
1419+
if (allocated(this%dep_dir) .neqv. allocated(other%dep_dir)) return
1420+
if (allocated(this%dep_dir)) then
1421+
if (.not.(this%dep_dir==other%dep_dir)) return
1422+
endif
14201423
if (.not.(this%ndep==other%ndep)) return
14211424
if (.not.(allocated(this%dep).eqv.allocated(other%dep))) return
14221425
if (allocated(this%dep)) then
@@ -1425,7 +1428,10 @@ logical function dependency_tree_is_same(this,that)
14251428
if (.not.(this%dep(ii)==other%dep(ii))) return
14261429
end do
14271430
endif
1428-
if (.not.(this%cache==other%cache)) return
1431+
if (allocated(this%cache) .neqv. allocated(other%cache)) return
1432+
if (allocated(this%cache)) then
1433+
if (.not.(this%cache==other%cache)) return
1434+
endif
14291435

14301436
class default
14311437
! Not the same type

src/fpm/git.f90

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,15 @@ logical function git_is_same(this,that)
149149

150150
select type (other=>that)
151151
type is (git_target_t)
152-
if (.not. allocated(this%url) .or. .not. allocated(other%url) .or. &
153-
.not. allocated(this%object) .or. .not. allocated(other%object)) return
154-
155152
if (.not.(this%descriptor==other%descriptor)) return
156-
if (.not.(this%url==other%url)) return
157-
if (.not.(this%object==other%object)) return
158-
153+
if (allocated(this%url) .neqv. allocated(other%url)) return
154+
if (allocated(this%url) .and. allocated(other%url)) then
155+
if (.not.(this%url==other%url)) return
156+
end if
157+
if (allocated(this%object) .neqv. allocated(other%object)) return
158+
if (allocated(this%object) .and. allocated(other%object)) then
159+
if (.not.(this%object==other%object)) return
160+
end if
159161
class default
160162
! Not the same type
161163
return

src/fpm/manifest/executable.f90

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,17 @@ logical function exe_is_same(this,that)
207207
type is (executable_config_t)
208208
if (.not.this%link==other%link) return
209209
if (.not.allocated(this%name).eqv.allocated(other%name)) return
210-
if (.not.this%name==other%name) return
210+
if (allocated(this%name).and.allocated(other%name)) then
211+
if (.not.this%name==other%name) return
212+
end if
211213
if (.not.allocated(this%source_dir).eqv.allocated(other%source_dir)) return
212-
if (.not.this%source_dir==other%source_dir) return
214+
if (allocated(this%source_dir).and.allocated(other%source_dir)) then
215+
if (.not.this%source_dir==other%source_dir) return
216+
end if
213217
if (.not.allocated(this%main).eqv.allocated(other%main)) return
214-
if (.not.this%main==other%main) return
218+
if (allocated(this%main).and.allocated(other%main)) then
219+
if (.not.this%main==other%main) return
220+
end if
215221
if (.not.allocated(this%dependency).eqv.allocated(other%dependency)) return
216222
if (allocated(this%dependency)) then
217223
if (.not.(size(this%dependency)==size(other%dependency))) return

src/fpm/manifest/fortran.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ logical function fortran_is_same(this,that)
123123
if (this%implicit_typing.neqv.other%implicit_typing) return
124124
if (this%implicit_external.neqv.other%implicit_external) return
125125
if (.not.allocated(this%source_form).eqv.allocated(other%source_form)) return
126-
if (.not.this%source_form==other%source_form) return
126+
if (allocated(this%source_form).and.allocated(other%source_form)) then
127+
if (.not.this%source_form==other%source_form) return
128+
end if
127129
class default
128130
! Not the same type
129131
return

src/fpm/manifest/library.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ logical function library_is_same(this,that)
162162
type is (library_config_t)
163163
if (.not.this%include_dir==other%include_dir) return
164164
if (.not.allocated(this%source_dir).eqv.allocated(other%source_dir)) return
165-
if (.not.this%source_dir==other%source_dir) return
165+
if (allocated(this%source_dir).and.allocated(other%source_dir)) then
166+
if (.not.this%source_dir==other%source_dir) return
167+
end if
166168
if (.not.allocated(this%build_script).eqv.allocated(other%build_script)) return
167-
if (.not.this%build_script==other%build_script) return
169+
if (allocated(this%build_script).and.allocated(other%build_script)) then
170+
if (.not.this%build_script==other%build_script) return
171+
end if
168172
class default
169173
! Not the same type
170174
return

src/fpm/manifest/package.f90

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,16 +541,30 @@ logical function manifest_is_same(this,that)
541541

542542
select type (other=>that)
543543
type is (package_config_t)
544-
545-
if (.not.this%name==other%name) return
544+
if (allocated(this%name).neqv.allocated(other%name)) return
545+
if (allocated(this%name) .and. allocated(other%name)) then
546+
if (.not.this%name==other%name) return
547+
end if
546548
if (.not.this%version==other%version) return
547549
if (.not.this%build==other%build) return
548550
if (.not.this%install==other%install) return
549551
if (.not.this%fortran==other%fortran) return
550-
if (.not.this%license==other%license) return
551-
if (.not.this%author==other%author) return
552-
if (.not.this%maintainer==other%maintainer) return
553-
if (.not.this%copyright==other%copyright) return
552+
if (allocated(this%license).neqv.allocated(other%license)) return
553+
if (allocated(this%license) .and. allocated(other%license)) then
554+
if (.not.this%license==other%license) return
555+
end if
556+
if (allocated(this%author).neqv.allocated(other%author)) return
557+
if (allocated(this%author) .and. allocated(other%author)) then
558+
if (.not.this%author==other%author) return
559+
end if
560+
if (allocated(this%maintainer).neqv.allocated(other%maintainer)) return
561+
if (allocated(this%maintainer) .and. allocated(other%maintainer)) then
562+
if (.not.this%maintainer==other%maintainer) return
563+
end if
564+
if (allocated(this%copyright).neqv.allocated(other%copyright)) return
565+
if (allocated(this%copyright) .and. allocated(other%copyright)) then
566+
if (.not.this%copyright==other%copyright) return
567+
end if
554568
if (allocated(this%library).neqv.allocated(other%library)) return
555569
if (allocated(this%library)) then
556570
if (.not.this%library==other%library) return

src/fpm_compiler.F90

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,8 +1265,10 @@ logical function ar_is_same(this,that)
12651265

12661266
select type (other=>that)
12671267
type is (archiver_t)
1268-
1269-
if (.not.(this%ar==other%ar)) return
1268+
if (allocated(this%ar).neqv.allocated(other%ar)) return
1269+
if (allocated(this%ar)) then
1270+
if (.not.(this%ar==other%ar)) return
1271+
end if
12701272
if (.not.(this%use_response_file.eqv.other%use_response_file)) return
12711273
if (.not.(this%echo.eqv.other%echo)) return
12721274
if (.not.(this%verbose.eqv.other%verbose)) return
@@ -1339,9 +1341,18 @@ logical function compiler_is_same(this,that)
13391341
type is (compiler_t)
13401342

13411343
if (.not.(this%id==other%id)) return
1342-
if (.not.(this%fc==other%fc)) return
1343-
if (.not.(this%cc==other%cc)) return
1344-
if (.not.(this%cxx==other%cxx)) return
1344+
if (.not. allocated(this%fc).eqv.allocated(other%fc)) return
1345+
if (allocated(this%fc)) then
1346+
if (.not.(this%fc==other%fc)) return
1347+
end if
1348+
if (.not. allocated(this%cc).eqv.allocated(other%cc)) return
1349+
if (allocated(this%cc)) then
1350+
if (.not.(this%cc==other%cc)) return
1351+
end if
1352+
if (.not. allocated(this%cxx).eqv.allocated(other%cxx)) return
1353+
if (allocated(this%cxx)) then
1354+
if (.not.(this%cxx==other%cxx)) return
1355+
end if
13451356
if (.not.(this%echo.eqv.other%echo)) return
13461357
if (.not.(this%verbose.eqv.other%verbose)) return
13471358

src/fpm_model.f90

Lines changed: 77 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,36 @@ logical function srcfile_is_same(this,that)
481481

482482
select type (other=>that)
483483
type is (srcfile_t)
484-
485-
if (.not.(this%file_name==other%file_name)) return
486-
if (.not.(this%exe_name==other%exe_name)) return
484+
if (allocated(this%file_name).neqv.allocated(other%file_name)) return
485+
if (allocated(this%file_name).and.allocated(other%file_name)) then
486+
if (.not.(this%file_name==other%file_name)) return
487+
end if
488+
if (allocated(this%exe_name).neqv.allocated(other%exe_name)) return
489+
if (allocated(this%exe_name).and.allocated(other%exe_name)) then
490+
if (.not.(this%exe_name==other%exe_name)) return
491+
end if
487492
if (.not.(this%unit_scope==other%unit_scope)) return
488-
if (.not.(this%modules_provided==other%modules_provided)) return
493+
if (allocated(this%modules_provided).neqv.allocated(other%modules_provided)) return
494+
if (allocated(this%modules_provided).and.allocated(other%modules_provided)) then
495+
if (.not.(this%modules_provided==other%modules_provided)) return
496+
end if
489497
if (.not.(this%unit_type==other%unit_type)) return
490-
if (.not.(this%parent_modules==other%parent_modules)) return
491-
if (.not.(this%modules_used==other%modules_used)) return
492-
if (.not.(this%include_dependencies==other%include_dependencies)) return
493-
if (.not.(this%link_libraries==other%link_libraries)) return
498+
if (allocated(this%parent_modules).neqv.allocated(other%parent_modules)) return
499+
if (allocated(this%parent_modules).and.allocated(other%parent_modules)) then
500+
if (.not.(this%parent_modules==other%parent_modules)) return
501+
end if
502+
if (allocated(this%modules_used).neqv.allocated(other%modules_used)) return
503+
if (allocated(this%modules_used).and.allocated(other%modules_used)) then
504+
if (.not.(this%modules_used==other%modules_used)) return
505+
end if
506+
if (allocated(this%include_dependencies).neqv.allocated(other%include_dependencies)) return
507+
if (allocated(this%include_dependencies).and.allocated(other%include_dependencies)) then
508+
if (.not.(this%include_dependencies==other%include_dependencies)) return
509+
end if
510+
if (allocated(this%link_libraries).neqv.allocated(other%link_libraries)) return
511+
if (allocated(this%link_libraries).and.allocated(other%link_libraries)) then
512+
if (.not.(this%link_libraries==other%link_libraries)) return
513+
end if
494514
if (.not.(this%digest==other%digest)) return
495515

496516
class default
@@ -599,7 +619,10 @@ logical function fft_is_same(this,that)
599619

600620
if (.not.(this%implicit_typing.eqv.other%implicit_typing)) return
601621
if (.not.(this%implicit_external.eqv.other%implicit_external)) return
602-
if (.not.(this%source_form==other%source_form)) return
622+
if (allocated(this%source_form).neqv.allocated(other%source_form)) return
623+
if (allocated(this%source_form).and.allocated(other%source_form)) then
624+
if (.not.(this%source_form==other%source_form)) return
625+
end if
603626

604627
class default
605628
! Not the same type
@@ -666,9 +689,11 @@ logical function package_is_same(this,that)
666689

667690
select type (other=>that)
668691
type is (package_t)
669-
670-
if (.not.(this%name==other%name)) return
671-
if (.not.(allocated(this%sources).eqv.allocated(other%sources))) return
692+
if (allocated(this%name).neqv.allocated(other%name)) return
693+
if (allocated(this%name)) then
694+
if (.not.(this%name==other%name)) return
695+
end if
696+
if (allocated(this%sources).neqv.allocated(other%sources)) return
672697
if (allocated(this%sources)) then
673698
if (.not.(size(this%sources)==size(other%sources))) return
674699
do ii = 1, size(this%sources)
@@ -677,7 +702,10 @@ logical function package_is_same(this,that)
677702
end if
678703

679704
if (.not.(this%preprocess==other%preprocess)) return
680-
if (.not.(this%version==other%version)) return
705+
if (allocated(this%version).neqv.allocated(other%version)) return
706+
if (allocated(this%version)) then
707+
if (.not.(this%version==other%version)) return
708+
end if
681709

682710
!> Module naming
683711
if (.not.(this%enforce_module_names.eqv.other%enforce_module_names)) return
@@ -851,7 +879,10 @@ logical function model_is_same(this,that)
851879
select type (other=>that)
852880
type is (fpm_model_t)
853881

854-
if (.not.(this%package_name==other%package_name)) return
882+
if ((allocated(this%package_name).neqv.allocated(other%package_name))) return
883+
if (allocated(this%package_name).and.allocated(other%package_name)) then
884+
if (.not.(this%package_name==other%package_name)) return
885+
end if
855886
if (.not.(allocated(this%packages).eqv.allocated(other%packages))) return
856887
if (allocated(this%packages)) then
857888
if (.not.(size(this%packages)==size(other%packages))) return
@@ -862,14 +893,38 @@ logical function model_is_same(this,that)
862893

863894
if (.not.(this%compiler==other%compiler)) return
864895
if (.not.(this%archiver==other%archiver)) return
865-
if (.not.(this%fortran_compile_flags==other%fortran_compile_flags)) return
866-
if (.not.(this%c_compile_flags==other%c_compile_flags)) return
867-
if (.not.(this%cxx_compile_flags==other%cxx_compile_flags)) return
868-
if (.not.(this%link_flags==other%link_flags)) return
869-
if (.not.(this%build_prefix==other%build_prefix)) return
870-
if (.not.(this%include_dirs==other%include_dirs)) return
871-
if (.not.(this%link_libraries==other%link_libraries)) return
872-
if (.not.(this%external_modules==other%external_modules)) return
896+
if (allocated(this%fortran_compile_flags).neqv.allocated(other%fortran_compile_flags)) return
897+
if (allocated(this%fortran_compile_flags).and.allocated(other%fortran_compile_flags)) then
898+
if (.not.(this%fortran_compile_flags==other%fortran_compile_flags)) return
899+
end if
900+
if (allocated(this%c_compile_flags).neqv.allocated(other%c_compile_flags)) return
901+
if (allocated(this%c_compile_flags).and.allocated(other%c_compile_flags)) then
902+
if (.not.(this%c_compile_flags==other%c_compile_flags)) return
903+
end if
904+
if (allocated(this%cxx_compile_flags).neqv.allocated(other%cxx_compile_flags)) return
905+
if (allocated(this%cxx_compile_flags).and.allocated(other%cxx_compile_flags)) then
906+
if (.not.(this%cxx_compile_flags==other%cxx_compile_flags)) return
907+
end if
908+
if (allocated(this%link_flags).neqv.allocated(other%link_flags)) return
909+
if (allocated(this%link_flags).and.allocated(other%link_flags)) then
910+
if (.not.(this%link_flags==other%link_flags)) return
911+
end if
912+
if (allocated(this%build_prefix).neqv.allocated(other%build_prefix)) return
913+
if (allocated(this%build_prefix).and.allocated(other%build_prefix)) then
914+
if (.not.(this%build_prefix==other%build_prefix)) return
915+
end if
916+
if (allocated(this%include_dirs).neqv.allocated(other%include_dirs)) return
917+
if (allocated(this%include_dirs).and.allocated(other%include_dirs)) then
918+
if (.not.(this%include_dirs==other%include_dirs)) return
919+
end if
920+
if (allocated(this%link_libraries).neqv.allocated(other%link_libraries)) return
921+
if (allocated(this%link_libraries).and.allocated(other%link_libraries)) then
922+
if (.not.(this%link_libraries==other%link_libraries)) return
923+
end if
924+
if (allocated(this%external_modules).neqv.allocated(other%external_modules)) return
925+
if (allocated(this%external_modules).and.allocated(other%external_modules)) then
926+
if (.not.(this%external_modules==other%external_modules)) return
927+
end if
873928
if (.not.(this%deps==other%deps)) return
874929
if (.not.(this%include_tests.eqv.other%include_tests)) return
875930
if (.not.(this%enforce_module_names.eqv.other%enforce_module_names)) return

0 commit comments

Comments
 (0)