Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deprecated attribute to ACE_Copy_Disabled #2324

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

jwillemsen
Copy link
Member

@jwillemsen jwillemsen commented Feb 5, 2025

* ACE/ace/Copy_Disabled.h:

Summary by CodeRabbit

  • Refactor
    • Added a deprecation notice to a core copy prevention component, signaling its planned removal in future releases.
    • Updated the default constructor to be explicitly defined.
    • Removed the implementation file associated with the copy prevention component, streamlining the project structure.
    • Updated project configurations to reflect the removal of the implementation file while retaining the header file.

    * ACE/ace/Copy_Disabled.h:
Copy link

coderabbitai bot commented Feb 5, 2025

Walkthrough

The change introduces a deprecation notice to the ACE_Copy_Disabled class by adding the [[deprecated]] attribute in ACE/ace/Copy_Disabled.h. It also updates the documentation to recommend users delete copy operations in their classes instead of inheriting from ACE_Copy_Disabled. Additionally, the default constructor is explicitly defined as = default. The implementation file Copy_Disabled.cpp has been removed, and the project configuration files have been updated to reflect these changes.

Changes

File(s) Change Summary
ACE/.../Copy_Disabled.h Added [[deprecated]] attribute to ACE_Copy_Disabled class; modified default constructor to = default.
ACE/.../Copy_Disabled.cpp Removed the entire file, eliminating the implementation of the ACE_Copy_Disabled class.
ACE/.../ace.mpc Removed Copy_Disabled.cpp from Source_Files; added Copy_Disabled.h to Header_Files.
ACE/.../ace_for_tao.mpc Removed Copy_Disabled.cpp from Source_Files(ACE_COMPONENTS); added Copy_Disabled.h to Header_Files.

Poem

I'm a little rabbit, hopping through code,
Seeing deprecation signs on every road.
With a twitch of my whiskers and a joyful cheer,
I celebrate small changes that now appear.
Hoppy changes ahead in our coding abode!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6a1599 and afe6592.

📒 Files selected for processing (4)
  • ACE/ace/Copy_Disabled.cpp (0 hunks)
  • ACE/ace/Copy_Disabled.h (2 hunks)
  • ACE/ace/ace.mpc (1 hunks)
  • ACE/ace/ace_for_tao.mpc (1 hunks)
💤 Files with no reviewable changes (1)
  • ACE/ace/Copy_Disabled.cpp
⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: ubuntu-22.04 clang++-15
  • GitHub Check: macos-13-C++
  • GitHub Check: ubuntu-22.04 clang++-14
  • GitHub Check: ubuntu-20.04 clang++-13
  • GitHub Check: ubuntu-20.04 clang++-12
  • GitHub Check: ubuntu-20.04 clang++-11
  • GitHub Check: ubuntu-20.04 clang++-10
  • GitHub Check: ubuntu-20.04 clang++-6.0
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2019Debug64Cxx20
  • GitHub Check: VS2019Debug64Cxx17
  • GitHub Check: VS2019Release32
  • GitHub Check: VS2019Debug32
  • GitHub Check: VS2019Release64
  • GitHub Check: VS2019Debug64
  • GitHub Check: VS2019WChar
  • GitHub Check: MINGW64-gcc
  • GitHub Check: alpine-3.18
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (5)
ACE/ace/Copy_Disabled.h (3)

46-57: LGTM! Documentation is clear and helpful.

The deprecation notice and example code provide clear guidance for users on how to migrate away from this class.


58-58: Add a deprecation message to guide users.

While marking the class as deprecated is good, it would be more helpful to provide a deprecation message explaining why it's deprecated and what users should use instead.

Apply this diff:

-class [[deprecated]] ACE_Copy_Disabled
+class [[deprecated("Use =delete directly in your class to disable copying. Example: MyClass(const MyClass&)=delete;")]] ACE_Copy_Disabled

62-62: LGTM! Good use of =default.

Using = default is more explicit and follows modern C++ practices.

ACE/ace/ace_for_tao.mpc (1)

309-309: LGTM! Build configuration updated correctly.

Adding Copy_Disabled.h to the Header_Files section is consistent with deprecating the class while keeping the header available for existing users.

ACE/ace/ace.mpc (1)

402-402: LGTM! Build configuration updated correctly.

Adding Copy_Disabled.h to the Header_Files section is consistent with deprecating the class while keeping the header available for existing users.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
ACE/ace/Copy_Disabled.h (1)

24-45: Consider updating class documentation with migration instructions.

Since this class is now deprecated, it would be helpful to update the class documentation to:

  1. Mention that it's deprecated
  2. Provide a migration path for users
  3. Explain why direct usage of =delete is preferred

Add migration guidance to the documentation:

 * To use this class simply use private inheritance:
 *
 * class Foo : private ACE_Copy_Disabled
 * {
 * // code here
 * };
+ *
+ * @deprecated This class is deprecated. Instead of using inheritance,
+ * directly delete copy operations in your class:
+ *
+ * class Foo {
+ * public:
+ *   Foo() = default;
+ *   Foo(const Foo&) = delete;
+ *   Foo(Foo&&) = delete;
+ *   Foo& operator=(const Foo&) = delete;
+ *   Foo& operator=(Foo&&) = delete;
+ * };
 */

Also applies to: 46-57

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6a1599 and 2923fc9.

📒 Files selected for processing (1)
  • ACE/ace/Copy_Disabled.h (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: ubuntu-20.04 g++-10 CodeQL
  • GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
  • GitHub Check: ubuntu-20.04 g++-10 CORBA/e micro
  • GitHub Check: ubuntu-22.04 clang++-16
  • GitHub Check: ubuntu-22.04 clang++-15
  • GitHub Check: ubuntu-22.04 clang++-14
  • GitHub Check: ubuntu-20.04 clang++-13
  • GitHub Check: ubuntu-20.04 clang++-12
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: ubuntu-20.04 clang++-11
  • GitHub Check: ubuntu-20.04 clang++-10
  • GitHub Check: ubuntu-20.04 clang++-9
  • GitHub Check: ubuntu-20.04 clang++-8
  • GitHub Check: ubuntu-20.04 clang++-7
  • GitHub Check: ubuntu-20.04 clang++-6.0
  • GitHub Check: ubuntu-24.04 g++-13
  • GitHub Check: ubuntu-22.04 g++-12
  • GitHub Check: ubuntu-22.04 g++-11
  • GitHub Check: ubuntu-20.04 g++-10
  • GitHub Check: windows-2019 vs2019
  • GitHub Check: alpine-3.18
🔇 Additional comments (1)
ACE/ace/Copy_Disabled.h (1)

46-57: Verify impact on existing codebase.

Since this is a helper class that's used through inheritance, we should verify the impact of deprecation on the codebase.

Let's search for classes inheriting from ACE_Copy_Disabled:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for classes inheriting from ACE_Copy_Disabled
rg -l ":\s*(private|protected|public)\s+ACE_Copy_Disabled"

Length of output: 115


Reviewing ACE_Copy_Disabled deprecation impact

  • The only occurrences matching an inheritance pattern were in ACE/ace/Copy_Disabled.h itself and in the changelog (ACE/ChangeLogs/ChangeLog-2002a), which is merely documentation and not active code.
  • No actual class in the codebase inherits from ACE_Copy_Disabled, indicating that the deprecation has no runtime impact on current functionality.

ACE/ace/Copy_Disabled.h Outdated Show resolved Hide resolved
    * ACE/ace/Copy_Disabled.h:
    * ACE/ace/Copy_Disabled.cpp:
      Deleted.

    * ACE/ace/Copy_Disabled.h:
    * ACE/ace/ace.mpc:
    * ACE/ace/ace_for_tao.mpc:
    * ACE/ace/Copy_Disabled.h:
@jwillemsen
Copy link
Member Author

@coderabbitai full review

Copy link

coderabbitai bot commented Feb 5, 2025

✅ Actions performed

Full review triggered.

@jwillemsen
Copy link
Member Author

@coderabbitai full review

Copy link

coderabbitai bot commented Feb 5, 2025

✅ Actions performed

Full review triggered.

@jwillemsen jwillemsen changed the title Added deprecated attribute Added deprecated attribute to ACE_Copy_Disabled Feb 5, 2025
@jwillemsen jwillemsen merged commit 0718af0 into DOCGroup:master Feb 5, 2025
45 checks passed
@jwillemsen jwillemsen deleted the jwi-depcopydisabled branch February 5, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant