Skip to content

Commit

Permalink
Move getTextContent_len towards the top of the file
Browse files Browse the repository at this point in the history
Some versions of gfortran ICE with the function in
the body of the file. Defining it first seems to be
fine and should be valid Fortran 2008.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85138
and #57

Do the actual move in the m4 and rebuild (we comit the
resulting F90 files so users don't need an m4 implementation
to build FoX). At the same time propogate a couple of changes
from the F90 back into other m4 files so we don't loose those
changes.
  • Loading branch information
andreww committed Mar 4, 2021
1 parent 6739255 commit 881e668
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
25 changes: 13 additions & 12 deletions dom/m_dom_dom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,18 @@ function getnodeName(np, ex)result(c)
end function getnodeName


pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

pure function getNodeValue_len(np, p) result(n)
type(Node), intent(in) :: np
logical, intent(in) :: p
Expand Down Expand Up @@ -4053,18 +4065,6 @@ subroutine updateTextContentLength(np, n)
endif
end subroutine updateTextContentLength

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

function getTextContent(arg, ex)result(c)
type(DOMException), intent(out), optional :: ex
type(Node), pointer :: arg
Expand Down Expand Up @@ -5847,6 +5847,7 @@ subroutine destroyDocument(arg, ex)

! Switch off all GC - since this is GC!
call setGCstate(arg, .false., ex)

if (arg%nodeType/=DOCUMENT_NODE) then
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
call throw_exception(FoX_INVALID_NODE, "destroyDocument", ex)
Expand Down
3 changes: 2 additions & 1 deletion dom/m_dom_element.m4
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ TOHW_m_dom_get(DOMString, tagName, np%nodeName, (ELEMENT_NODE))
endif
endif

! FIXME what if namespace is undeclared? Throw an error *only* if FoX_errors is on, otherwise its taken care of by namespace fixup on serialization
! FIXME what if namespace is undeclared? Throw an error *only* if FoX_errors is
! on, otherwise its taken care of by namespace fixup on serialization

quickFix = getGCstate(getOwnerDocument(arg)) &
.and. arg%inDocument
Expand Down
24 changes: 12 additions & 12 deletions dom/m_dom_node.m4
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ TOHW_m_dom_contents(`

TOHW_m_dom_get(DOMString, nodeName, np%nodeName)

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

pure function getNodeValue_len(np, p) result(n)
type(Node), intent(in) :: np
logical, intent(in) :: p
Expand Down Expand Up @@ -1332,18 +1344,6 @@ TOHW_m_dom_treewalk(`
endif
end subroutine updateTextContentLength

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

TOHW_function(getTextContent, (arg), c)
type(Node), pointer :: arg
#ifdef RESTRICTED_ASSOCIATED_BUG
Expand Down
6 changes: 3 additions & 3 deletions dom/m_dom_types.m4
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ TOHW_m_dom_contents(`

select case(np%nodeType)
case (ELEMENT_NODE, ATTRIBUTE_NODE, XPATH_NAMESPACE_NODE)
call destroyElementOrAttribute(np,ex)
call destroyElementOrAttribute(np, ex)
case (DOCUMENT_TYPE_NODE)
call destroyDocumentType(np,ex)
call destroyDocumentType(np, ex)
case (ENTITY_NODE, NOTATION_NODE)
call destroyEntityOrNotation(np,ex)
call destroyEntityOrNotation(np, ex)
case (DOCUMENT_NODE)
call destroyDocument(np,ex)
end select
Expand Down

0 comments on commit 881e668

Please sign in to comment.