Skip to content

Commit cf0f1e1

Browse files
authored
Merge pull request #128 from Goddard-Fortran-Ecosystem/develop
Develop
2 parents f717668 + 0284c1f commit cf0f1e1

File tree

6 files changed

+57
-15
lines changed

6 files changed

+57
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
22

33
project (FARGPARSE
44

5-
VERSION 1.4.2
5+
VERSION 1.5.0
66
LANGUAGES Fortran)
77

88
# Most users of this software do not (should not?) have permissions to

ChangeLog.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,32 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
9+
## Unreleased
10+
11+
## [1.5.0] - 2023-04-13
12+
13+
### Added
14+
15+
- Added `IntelLLVM.cmake` file as a copy of `Intel.cmake` to support the LLVM Intel compiler frontends
16+
17+
### Changed
18+
19+
- Updated submodules for gFTL-shared (v1.6.0)
20+
21+
### Fixed
22+
23+
- implemented workaround for GFortran which was not correctly handling
24+
deferred-length allocatable string arrays. Used StringVector instead.
25+
826
## [1.4.2] - 2023-01-23
927

1028
### Fixed
1129

1230
- Fixes for GNU Make builds
1331
- Update gFTL-shared submodule to v1.5.1
1432

33+
1534
## [1.4.1] 2022-11-07
1635

1736
### Fixed

cmake/IntelLLVM.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Compiler specific flags for Intel Fortran compiler
2+
3+
if(WIN32)
4+
set(no_optimize "-Od")
5+
set(check_all "-check:all")
6+
else()
7+
set(no_optimize "-O0")
8+
set(check_all "-check all")
9+
endif()
10+
11+
12+
set(disable_warning_for_long_names "-diag-disable 5462")
13+
set(traceback "-traceback")
14+
set(cpp "-cpp")
15+
16+
17+
set(CMAKE_Fortran_FLAGS_DEBUG "${no_optimize}")
18+
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
19+
set(CMAKE_Fortran_FLAGS "-g ${cpp} ${traceback} ${check_all} ${disable_warning_for_long_names} -save-temps")
20+
21+
add_definitions(-D_INTEL)
22+
add_definitions(-D__ifort_18)

src/ArgParser.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ subroutine handle_option(this, action, argument, iter, end, embedded_value, args
367367
type(RealVector) :: real_list
368368
type(StringVector) :: string_list
369369
integer :: i
370-
character(:), pointer :: choices(:)
370+
type(StringVector), pointer :: choices
371371

372372
integer :: arg_value_int
373373
real :: arg_value_real
@@ -516,8 +516,9 @@ subroutine handle_option(this, action, argument, iter, end, embedded_value, args
516516
end select
517517

518518
choices => action%get_choices()
519-
if (associated(choices)) then
520-
if (.not. any(choices == argument)) then
519+
520+
if (choices%size() > 0) then
521+
if (find(choices%begin(),choices%end(), argument) == choices%end()) then ! not found
521522
error stop 'invalid choice for argument'
522523
end if
523524
end if

src/BaseAction.F90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ module fp_BaseAction
1313
type, extends(AbstractAction) :: BaseAction
1414
private
1515
character(:), allocatable :: destination
16-
type (StringVector) :: option_strings
16+
type(StringVector) :: option_strings
1717
character(:), allocatable :: type
1818
class(*), allocatable :: const
1919
class(*), allocatable :: default
2020
character(:), allocatable :: help
2121
class(*), allocatable :: n_arguments ! string or integer
2222
logical :: positional = .false.
23-
character(len=:), allocatable :: choices(:)
23+
type(StringVector) :: choices
2424
contains
2525
procedure :: initialize
2626
procedure :: get_destination
@@ -68,8 +68,9 @@ subroutine initialize(this, &
6868
character(len=*), optional, intent(in) :: choices(:)
6969
character(len=*), optional, intent(in) :: help
7070

71-
type (StringVectorIterator) :: iter
71+
type(StringVectorIterator) :: iter
7272
character(:), pointer :: opt_string
73+
integer :: i
7374

7475
_UNUSED_DUMMY(unused)
7576

@@ -138,7 +139,9 @@ subroutine initialize(this, &
138139
end if
139140

140141
if (present(choices)) then
141-
this%choices = choices
142+
do i = 1, size(choices)
143+
call this%choices%push_back(choices(i))
144+
end do
142145
end if
143146
end subroutine initialize
144147

@@ -318,14 +321,11 @@ function get_n_arguments(this) result(n_arguments)
318321
end function get_n_arguments
319322

320323
function get_choices(this) result(choices)
321-
character(:), pointer :: choices(:)
324+
type(StringVector), pointer :: choices
322325
class(BaseAction), target, intent(in) :: this
323326

324-
if (allocated(this%choices)) then
325-
choices => this%choices
326-
else
327-
choices => null()
328-
end if
327+
choices => this%choices
328+
329329
end function get_choices
330330

331331
end module fp_BaseAction

0 commit comments

Comments
 (0)