Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247869: Change NONCOPYABLE to delete the operations
Reviewed-by: kbarrett, dholmes
  • Loading branch information
Harold Seigel committed Mar 10, 2021
1 parent c0542ed commit fab567666ebb9cafbd86b536eb43164dde75579f
Showing with 7 additions and 13 deletions.
  1. +7 −13 src/hotspot/share/utilities/globalDefinitions.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,18 +73,12 @@
// This file holds all globally used constants & types, class (forward)
// declarations and a few frequently used utility functions.

// Declare the named class to be noncopyable. This macro must be used in
// a private part of the class's definition, followed by a semi-colon.
// Doing so provides private declarations for the class's copy constructor
// and assignment operator. Because these operations are private, most
// potential callers will fail to compile because they are inaccessible.
// The operations intentionally lack a definition, to provoke link-time
// failures for calls from contexts where they are accessible, e.g. from
// within the class or from a friend of the class.
// Note: The lack of definitions is still not completely bullet-proof, as
// an apparent call might be optimized away by copy elision.
// For C++11 the declarations should be changed to deleted definitions.
#define NONCOPYABLE(C) C(C const&); C& operator=(C const&) /* next token must be ; */
// Declare the named class to be noncopyable. This macro must be followed by
// a semi-colon. The macro provides deleted declarations for the class's copy
// constructor and assignment operator. Because these operations are deleted,
// they cannot be defined and potential callers will fail to compile.
#define NONCOPYABLE(C) C(C const&) = delete; C& operator=(C const&) = delete /* next token must be ; */


//----------------------------------------------------------------------------------------------------
// Printf-style formatters for fixed- and variable-width types as pointers and

0 comments on commit fab5676

Please sign in to comment.