Skip to content

Commit ceac5e9

Browse files
committed
more code clean up
1 parent da6089d commit ceac5e9

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

flang/runtime/execute.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,4 @@ void RTNAME(ExecuteCommandLine)(const Descriptor &command, bool wait,
204204
}
205205
}
206206

207-
void RTNAME(System)(const Descriptor &command, const Descriptor *exitstat,
208-
const char *sourceFile, int line) {
209-
Terminator terminator{sourceFile, line};
210-
211-
char *newCmd{EnsureNullTerminated(
212-
command.OffsetElement(), command.ElementBytes(), terminator)};
213-
int status{std::system(newCmd)};
214-
215-
if (exitstat) {
216-
RUNTIME_CHECK(terminator, IsValidIntDescriptor(exitstat));
217-
#ifdef _WIN32
218-
StoreIntToDescriptor(exitstat, status, terminator);
219-
#else
220-
int exitstatVal{WEXITSTATUS(status)};
221-
StoreIntToDescriptor(exitstat, exitstatVal, terminator);
222-
#endif
223-
}
224-
// Deallocate memory if EnsureNullTerminated dynamically allocated memory
225-
if (newCmd != command.OffsetElement()) {
226-
FreeMemory(static_cast<char *>(newCmd));
227-
}
228-
}
229-
230207
} // namespace Fortran::runtime

flang/unittests/Runtime/CommandTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ TEST_F(ZeroArguments, ECLValidCommandAndExitStatNoChangeAndCMDStatusSetAsync) {
386386
RTNAME(ExecuteCommandLine)
387387
(*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
388388

389-
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 404);
390-
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
389+
CheckDescriptorEqInt(exitStat.get(), 404);
390+
CheckDescriptorEqInt(cmdStat.get(), 0);
391391
CheckDescriptorEqStr(cmdMsg.get(), "No change");
392392
}
393393

@@ -400,7 +400,7 @@ TEST_F(ZeroArguments, ECLInvalidCommandParentNotTerminatedAsync) {
400400
EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
401401
*command.get(), wait, exitStat.get(), nullptr, cmdMsg.get()));
402402

403-
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 404);
403+
CheckDescriptorEqInt(exitStat.get(), 404);
404404
CheckDescriptorEqStr(cmdMsg.get(), "No change");
405405
}
406406

0 commit comments

Comments
 (0)