@@ -220,7 +220,11 @@ ExternalIoStatementBase::ExternalIoStatementBase(
220220
221221MutableModes &ExternalIoStatementBase::mutableModes () {
222222 if (const ChildIo * child{unit_.GetChildIo ()}) {
223+ #if !defined(RT_DEVICE_AVOID_RECURSION)
223224 return child->parent ().mutableModes ();
225+ #else
226+ ReportUnsupportedChildIo ();
227+ #endif
224228 }
225229 return unit_.modes ;
226230}
@@ -891,17 +895,29 @@ ChildIoStatementState<DIR>::ChildIoStatementState(
891895
892896template <Direction DIR>
893897MutableModes &ChildIoStatementState<DIR>::mutableModes() {
898+ #if !defined(RT_DEVICE_AVOID_RECURSION)
894899 return child_.parent ().mutableModes ();
900+ #else
901+ ReportUnsupportedChildIo ();
902+ #endif
895903}
896904
897905template <Direction DIR>
898906ConnectionState &ChildIoStatementState<DIR>::GetConnectionState() {
907+ #if !defined(RT_DEVICE_AVOID_RECURSION)
899908 return child_.parent ().GetConnectionState ();
909+ #else
910+ ReportUnsupportedChildIo ();
911+ #endif
900912}
901913
902914template <Direction DIR>
903915ExternalFileUnit *ChildIoStatementState<DIR>::GetExternalFileUnit() const {
916+ #if !defined(RT_DEVICE_AVOID_RECURSION)
904917 return child_.parent ().GetExternalFileUnit ();
918+ #else
919+ ReportUnsupportedChildIo ();
920+ #endif
905921}
906922
907923template <Direction DIR> int ChildIoStatementState<DIR>::EndIoStatement() {
@@ -914,22 +930,38 @@ template <Direction DIR> int ChildIoStatementState<DIR>::EndIoStatement() {
914930template <Direction DIR>
915931bool ChildIoStatementState<DIR>::Emit(
916932 const char *data, std::size_t bytes, std::size_t elementBytes) {
933+ #if !defined(RT_DEVICE_AVOID_RECURSION)
917934 return child_.parent ().Emit (data, bytes, elementBytes);
935+ #else
936+ ReportUnsupportedChildIo ();
937+ #endif
918938}
919939
920940template <Direction DIR>
921941std::size_t ChildIoStatementState<DIR>::GetNextInputBytes(const char *&p) {
942+ #if !defined(RT_DEVICE_AVOID_RECURSION)
922943 return child_.parent ().GetNextInputBytes (p);
944+ #else
945+ ReportUnsupportedChildIo ();
946+ #endif
923947}
924948
925949template <Direction DIR>
926950void ChildIoStatementState<DIR>::HandleAbsolutePosition(std::int64_t n) {
951+ #if !defined(RT_DEVICE_AVOID_RECURSION)
927952 return child_.parent ().HandleAbsolutePosition (n);
953+ #else
954+ ReportUnsupportedChildIo ();
955+ #endif
928956}
929957
930958template <Direction DIR>
931959void ChildIoStatementState<DIR>::HandleRelativePosition(std::int64_t n) {
960+ #if !defined(RT_DEVICE_AVOID_RECURSION)
932961 return child_.parent ().HandleRelativePosition (n);
962+ #else
963+ ReportUnsupportedChildIo ();
964+ #endif
933965}
934966
935967template <Direction DIR, typename CHAR>
@@ -957,13 +989,21 @@ int ChildFormattedIoStatementState<DIR, CHAR>::EndIoStatement() {
957989
958990template <Direction DIR, typename CHAR>
959991bool ChildFormattedIoStatementState<DIR, CHAR>::AdvanceRecord(int n) {
992+ #if !defined(RT_DEVICE_AVOID_RECURSION)
960993 return this ->child ().parent ().AdvanceRecord (n);
994+ #else
995+ this ->ReportUnsupportedChildIo ();
996+ #endif
961997}
962998
963999template <Direction DIR>
9641000bool ChildUnformattedIoStatementState<DIR>::Receive(
9651001 char *data, std::size_t bytes, std::size_t elementBytes) {
1002+ #if !defined(RT_DEVICE_AVOID_RECURSION)
9661003 return this ->child ().parent ().Receive (data, bytes, elementBytes);
1004+ #else
1005+ this ->ReportUnsupportedChildIo ();
1006+ #endif
9671007}
9681008
9691009template <Direction DIR> int ChildListIoStatementState<DIR>::EndIoStatement() {
0 commit comments