Skip to content

Commit 1a3a7e4

Browse files
committed
configury: check for modern type(*), dimension(..) syntax
First try if "type(*), dimension(..) :: foo" works as-is (e.g. without any pragma/directive). Thanks Chris Parrott for bringing this to our attention Refs. open-mpi#11582 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent ca8da54 commit 1a3a7e4

File tree

1 file changed

+39
-15
lines changed

1 file changed

+39
-15
lines changed

config/ompi_fortran_check_ignore_tkr.m4

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
1414
dnl reserved.
1515
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
1616
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
17+
dnl Copyright (c) 2013 Research Organization for Information Science
18+
dnl and Technology (RIST). All rights reserved.
1719
dnl $COPYRIGHT$
1820
dnl
1921
dnl Additional copyrights may follow
@@ -70,42 +72,48 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
7072
ompi_fortran_ignore_tkr_predecl=!
7173
ompi_fortran_ignore_tkr_type=real
7274

73-
# Vendor-neutral, TYPE(*) syntax
75+
# Vendor-neutral, TYPE(*), DIMENSION(..) syntax
7476
OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
75-
[!], [type(*)],
76-
[TYPE(*), DIMENSION(*)],
77+
[!], [type(*), DIMENSION(..)],[, ASYNCHRONOUS],
78+
[TYPE(*), DIMENSION(..)],
7779
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])
80+
# Vendor-neutral, TYPE(*), DIMENSION(*) syntax
81+
AS_IF([test $internal_ignore_tkr_happy -eq 0],
82+
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
83+
[!], [type(*), DIMENSION(*)],[],
84+
[TYPE(*), DIMENSION(*)],
85+
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
7886

7987
# GCC compilers
8088
AS_IF([test $internal_ignore_tkr_happy -eq 0],
8189
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
82-
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],
90+
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],[],
8391
[!GCC\$ ATTRIBUTES NO_ARG_CHECK],
8492
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
8593
# Intel compilers
8694
AS_IF([test $internal_ignore_tkr_happy -eq 0],
8795
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
88-
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],
96+
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],[],
8997
[!DEC\$ ATTRIBUTES NO_ARG_CHECK],
9098
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
9199
# Solaris Studio compilers
92100
# Note that due to a compiler bug, we have been advised by Oracle to
93101
# use the "character(*)" type
94102
AS_IF([test $internal_ignore_tkr_happy -eq 0],
95103
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
96-
[!\$PRAGMA IGNORE_TKR], [character(*)],
104+
[!\$PRAGMA IGNORE_TKR], [character(*)],[],
97105
[!\$PRAGMA IGNORE_TKR],
98106
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
99107
# Cray compilers
100108
AS_IF([test $internal_ignore_tkr_happy -eq 0],
101109
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
102-
[!DIR\$ IGNORE_TKR], [real, dimension(*)],
110+
[!DIR\$ IGNORE_TKR], [real, dimension(*)],[],
103111
[!DIR\$ IGNORE_TKR],
104112
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
105113
# IBM compilers
106114
AS_IF([test $internal_ignore_tkr_happy -eq 0],
107115
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
108-
[!IBM* IGNORE_TKR], [real, dimension(*)],
116+
[!IBM* IGNORE_TKR], [real, dimension(*)],[],
109117
[!IBM* IGNORE_TKR],
110118
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
111119

@@ -124,13 +132,14 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
124132
# functionality
125133
# $1: pre-decl qualifier line -- likely a compiler directive
126134
# $2: parameter type
127-
# $3: message for AC-MSG-CHECKING
128-
# $4: action to take if the test passes
129-
# $5: action to take if the test fails
135+
# $3: asynchronous keyword
136+
# $4: message for AC-MSG-CHECKING
137+
# $5: action to take if the test passes
138+
# $6: action to take if the test fails
130139
AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
131140
OPAL_VAR_SCOPE_PUSH(msg)
132141
AC_LANG_PUSH([Fortran])
133-
AC_MSG_CHECKING([for Fortran compiler support of $3])
142+
AC_MSG_CHECKING([for Fortran compiler support of $4])
134143
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[!
135144
! Autoconf puts "program main" at the top
136145

@@ -184,20 +193,35 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
184193
end program
185194

186195
subroutine force_assumed_shape(a, count)
196+
implicit none
187197
integer :: count
188198
real, dimension(:,:) :: a
189199
call foo(a, count)
190200
end subroutine force_assumed_shape
191201

202+
module mod
203+
interface
204+
subroutine bar(buffer, count)
205+
$2, intent(in)$3 :: buffer
206+
integer, intent(in) :: count
207+
end subroutine bar
208+
end interface
209+
end module
210+
211+
subroutine bogus(buffer, count)
212+
use mod, only : bar
213+
implicit none
214+
$2, intent(in)$3 :: buffer
215+
integer, intent(in) :: count
216+
call bar(buffer, count)
192217
! Autoconf puts "end" after the last line
193-
subroutine bogus
194218
]]),
195219
[msg=yes
196220
ompi_fortran_ignore_tkr_predecl="$1"
197221
ompi_fortran_ignore_tkr_type="$2"
198-
$4],
222+
$5],
199223
[msg=no
200-
$5])
224+
$6])
201225
AC_MSG_RESULT($msg)
202226
AC_LANG_POP([Fortran])
203227
OPAL_VAR_SCOPE_POP

0 commit comments

Comments
 (0)