From 93ee588232877485535f40e56014eb0e12e3fa32 Mon Sep 17 00:00:00 2001 From: Peter Steinfeld Date: Tue, 1 Feb 2022 07:38:10 -0800 Subject: [PATCH] [flang] Rename the runtime routine that reports a fatal user error As per Steve Scalpone's suggestion, I've renamed the runtime routine to better evoke its purpose. I implemented a routine called "Crash" and added a test. Differential Revision: https://reviews.llvm.org/D118703 --- flang/include/flang/Runtime/stop.h | 3 ++- flang/runtime/stop.cpp | 2 +- flang/unittests/Runtime/Stop.cpp | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flang/include/flang/Runtime/stop.h b/flang/include/flang/Runtime/stop.h index b129734..cf5ee7b 100644 --- a/flang/include/flang/Runtime/stop.h +++ b/flang/include/flang/Runtime/stop.h @@ -32,7 +32,8 @@ NORETURN void RTNAME(Abort)(NO_ARGUMENTS); // Crash with an error message when the program dynamically violates a Fortran // constraint. -NORETURN void RTNAME(Crash)(const char *message, const char *source, int line); +NORETURN void RTNAME(ReportFatalUserError)( + const char *message, const char *source, int line); FORTRAN_EXTERN_C_END diff --git a/flang/runtime/stop.cpp b/flang/runtime/stop.cpp index 8d43ad8..7bbbf90 100644 --- a/flang/runtime/stop.cpp +++ b/flang/runtime/stop.cpp @@ -144,7 +144,7 @@ void RTNAME(PauseStatementText)(const char *code, std::size_t length) { [[noreturn]] void RTNAME(Abort)() { std::abort(); } -[[noreturn]] void RTNAME(Crash)( +[[noreturn]] void RTNAME(ReportFatalUserError)( const char *message, const char *source, int line) { Fortran::runtime::Terminator{source, line}.Crash(message); } diff --git a/flang/unittests/Runtime/Stop.cpp b/flang/unittests/Runtime/Stop.cpp index ace69bf..9d962bf 100644 --- a/flang/unittests/Runtime/Stop.cpp +++ b/flang/unittests/Runtime/Stop.cpp @@ -91,6 +91,7 @@ TEST(TestProgramEnd, CrashTest) { static const std::string tailMessage{":343\\): "}; static const std::string fullMessage{ headMessage + fileName + tailMessage + crashMessage}; - EXPECT_DEATH(RTNAME(Crash)(crashMessage.c_str(), fileName.c_str(), 343), + EXPECT_DEATH( + RTNAME(ReportFatalUserError)(crashMessage.c_str(), fileName.c_str(), 343), fullMessage.c_str()); } -- 2.7.4