Skip to content

Commit

Permalink
8325932: Replace ATTRIBUTE_NORETURN with direct [[noreturn]]
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, dholmes
  • Loading branch information
TheShermanTanker committed May 15, 2024
1 parent 0bb5ae6 commit 7b4ba7f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 73 deletions.
12 changes: 6 additions & 6 deletions src/hotspot/share/runtime/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class os: AllStatic {
// multiple calls to naked_short_sleep. Only for use by non-JavaThreads.
static void naked_sleep(jlong millis);
// Never returns, use with CAUTION
ATTRIBUTE_NORETURN static void infinite_sleep();
[[noreturn]] static void infinite_sleep();
static void naked_yield () ;
static OSReturn set_priority(Thread* thread, ThreadPriority priority);
static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
Expand All @@ -630,26 +630,26 @@ class os: AllStatic {
static int fork_and_exec(const char *cmd);

// Call ::exit() on all platforms
ATTRIBUTE_NORETURN static void exit(int num);
[[noreturn]] static void exit(int num);

// Call ::_exit() on all platforms. Similar semantics to die() except we never
// want a core dump.
ATTRIBUTE_NORETURN static void _exit(int num);
[[noreturn]] static void _exit(int num);

// Terminate the VM, but don't exit the process
static void shutdown();

// Terminate with an error. Default is to generate a core file on platforms
// that support such things. This calls shutdown() and then aborts.
ATTRIBUTE_NORETURN static void abort(bool dump_core, void *siginfo, const void *context);
ATTRIBUTE_NORETURN static void abort(bool dump_core = true);
[[noreturn]] static void abort(bool dump_core, void *siginfo, const void *context);
[[noreturn]] static void abort(bool dump_core = true);

// Die immediately, no exit hook, no abort hook, no cleanup.
// Dump a core file, if possible, for debugging. os::abort() is the
// preferred means to abort the VM on error. os::die() should only
// be called if something has gone badly wrong. CreateCoredumpOnCrash
// is intentionally not honored by this function.
ATTRIBUTE_NORETURN static void die();
[[noreturn]] static void die();

// File i/o operations
static int open(const char *path, int oflag, int mode);
Expand Down
50 changes: 0 additions & 50 deletions src/hotspot/share/utilities/attributeNoreturn.hpp

This file was deleted.

19 changes: 9 additions & 10 deletions src/hotspot/share/utilities/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SHARE_UTILITIES_DEBUG_HPP
#define SHARE_UTILITIES_DEBUG_HPP

#include "utilities/attributeNoreturn.hpp"
#include "utilities/breakpoint.hpp"
#include "utilities/compilerWarnings.hpp"
#include "utilities/macros.hpp"
Expand Down Expand Up @@ -254,32 +253,32 @@ enum VMErrorType : unsigned int {
};

// error reporting helper functions
ATTRIBUTE_NORETURN
[[noreturn]]
void report_vm_error(const char* file, int line, const char* error_msg);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(4, 5)
void report_vm_error(const char* file, int line, const char* error_msg,
const char* detail_fmt, ...);

ATTRIBUTE_NORETURN
[[noreturn]]
void report_vm_status_error(const char* file, int line, const char* error_msg,
int status, const char* detail);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(4, 5)
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(5, 6)
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
const char* detail_fmt, ...);

ATTRIBUTE_NORETURN void report_should_not_call(const char* file, int line);
ATTRIBUTE_NORETURN void report_should_not_reach_here(const char* file, int line);
ATTRIBUTE_NORETURN void report_unimplemented(const char* file, int line);
[[noreturn]] void report_should_not_call(const char* file, int line);
[[noreturn]] void report_should_not_reach_here(const char* file, int line);
[[noreturn]] void report_unimplemented(const char* file, int line);

// NOT ATTRIBUTE_NORETURN
// NOT [[noreturn]]
void report_untested(const char* file, int line, const char* message);

ATTRIBUTE_PRINTF(1, 2)
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/utilities/globalDefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SHARE_UTILITIES_GLOBALDEFINITIONS_HPP
#define SHARE_UTILITIES_GLOBALDEFINITIONS_HPP

#include "utilities/attributeNoreturn.hpp"
#include "utilities/compilerWarnings.hpp"
#include "utilities/debug.hpp"
#include "utilities/macros.hpp"
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/utilities/vmError.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@ class VMError : public AllStatic {
static void print_vm_info(outputStream* st);

// main error reporting function
ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(6, 7)
static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
void* context, const char* detail_fmt, ...);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(6, 7)
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
const char* detail_fmt, ...);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(3, 0)
static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args,
Thread* thread, address pc, void* siginfo, void* context,
const char* filename, int lineno, size_t size);

ATTRIBUTE_NORETURN
[[noreturn]]
static void report_and_die(Thread* thread, unsigned int sig, address pc,
void* siginfo, void* context);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(6, 0)
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
const char* detail_fmt, va_list detail_args);

ATTRIBUTE_NORETURN
[[noreturn]]
ATTRIBUTE_PRINTF(6, 0)
static void report_and_die(Thread* thread, const char* filename, int lineno, size_t size,
VMErrorType vm_err_type, const char* detail_fmt,
Expand Down

1 comment on commit 7b4ba7f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.