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

Use uniform initialization #2331

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Use uniform initialization #2331

merged 1 commit into from
Feb 12, 2025

Conversation

jwillemsen
Copy link
Member

@jwillemsen jwillemsen commented Feb 12, 2025

* TAO/docs/tutorials/Quoter/Event_Service/Stock_Consumer.cpp:
* TAO/docs/tutorials/Quoter/Event_Service/index.html:
* TAO/docs/tutorials/Quoter/RT_Event_Service/Stock_Consumer.cpp:
* TAO/docs/tutorials/Quoter/RT_Event_Service/index.html:
* TAO/examples/Simulator/Event_Supplier/Event_Con.cpp:
* TAO/interop-tests/wchar/client.cpp:
* TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp:
* TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp:
* TAO/orbsvcs/orbsvcs/CosEvent/CEC_DynamicImplementation.cpp:
* TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientPolicy_i.cpp:
* TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FTEC_Event_Channel_Impl.cpp:
* TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Request_Context_Repository.cpp:
* TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.cpp:
* TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp:
* TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h:
* TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp:
* TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp:
* TAO/tao/Messaging/ExceptionHolder_i.cpp:

Summary by CodeRabbit

  • Chores
    • Modernized pointer initialization across multiple components for improved clarity and safety, ensuring a consistent default state.
    • These internal updates reinforce code robustness while maintaining all existing functionality without impacting user experience.

    * TAO/docs/tutorials/Quoter/Event_Service/Stock_Consumer.cpp:
    * TAO/docs/tutorials/Quoter/Event_Service/index.html:
    * TAO/docs/tutorials/Quoter/RT_Event_Service/Stock_Consumer.cpp:
    * TAO/docs/tutorials/Quoter/RT_Event_Service/index.html:
    * TAO/examples/Simulator/Event_Supplier/Event_Con.cpp:
    * TAO/interop-tests/wchar/client.cpp:
    * TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp:
    * TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp:
    * TAO/orbsvcs/orbsvcs/CosEvent/CEC_DynamicImplementation.cpp:
    * TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientPolicy_i.cpp:
    * TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FTEC_Event_Channel_Impl.cpp:
    * TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Request_Context_Repository.cpp:
    * TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.cpp:
    * TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp:
    * TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h:
    * TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp:
    * TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp:
    * TAO/tao/Messaging/ExceptionHolder_i.cpp:
Copy link
Contributor

coderabbitai bot commented Feb 12, 2025

Walkthrough

This pull request updates pointer initializations across various modules. Many instances of pointers being set to 0 or left uninitialized have been modernized to use the empty brace initializer ({}). In some cases, null comparisons have been updated to use nullptr. Additionally, there is a minor formatting adjustment in an exception assignment. The overall control flow and functionality remain unchanged.

Changes

File(s) Change Summary
TAO/docs/tutorials/Quoter/Event_Service/Stock_Consumer.cpp
TAO/docs/tutorials/Quoter/Event_Service/index.html
TAO/docs/tutorials/Quoter/RT_Event_Service/Stock_Consumer.cpp
TAO/docs/tutorials/Quoter/RT_Event_Service/index.html
Changed pointer initialization for Quoter::Event in Stock_Consumer::push from = 0/uninitialized to {}.
TAO/examples/Simulator/.../Event_Con.cpp Updated initialization of pointers for Navigation and Weapons from = 0 to {}.
TAO/interop-tests/wchar/client.cpp Modified the ws pointer initialization from uninitialized to {} to ensure an explicit null state.
TAO/orbsvcs/DevGuideExamples/.../consumer.cpp Changed initialization of MyEvent* vt from uninitialized to {} in the push method.
TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp Modernized pointer initialization (from 0 to {}) and updated null checks to use nullptr.
TAO/orbsvcs/orbsvcs/CosEvent/CEC_DynamicImplementation.cpp Updated initialization of const char* value from = 0 to {} in the is_a method.
TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientPolicy_i.cpp Modified pointer initialization for value in TAO_FT_Heart_Beat_Policy::create from = 0 to {}.
TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/... Uniformly updated several pointer initializations (e.g., oid, result, retval, object_id, scp, and pointers in Request_Context_Repository) from 0 to {}.
TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp Changed initialization of extract_type from = 0 to {} in the property setter.
TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h Altered pointer initialization for any from nullptr to {} in the find template.
TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp Updated the data pointer in get_credentials from = 0 to {}.
TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp Initialized eventData with {} instead of leaving it uninitialized.
TAO/tao/Messaging/ExceptionHolder_i.cpp Adjusted formatting of the exception assignment for consistency; no change to logic.

Sequence Diagram(s)

(No sequence diagrams provided as the changes are purely syntactical and do not alter control flow.)

Possibly related PRs

Poem

I'm a little rabbit hopping through code,
Leaving old zeros behind on the road.
With {} in my paws, my pointers now gleam,
Modern and neat, just like a dream!
Hooray for these tweaks that lighten our load! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 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
Contributor

@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: 0

🧹 Nitpick comments (2)
TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp (1)

50-50: Consider using nullptr for consistency.

For consistency with the other modernized null checks in this file, consider updating this comparison as well.

-  if (any_ptr == 0)
+  if (any_ptr == nullptr)
TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp (1)

118-118: Consider modernizing the null check and simplifying the condition.

The condition can be modernized and simplified for better readability.

-      if ((value >>= extract_type)  && extract_type != 0) // make sure we get something valid.
+      if ((value >>= extract_type)  && extract_type != nullptr) // make sure we get something valid.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 279244f and 2b381a9.

📒 Files selected for processing (18)
  • TAO/docs/tutorials/Quoter/Event_Service/Stock_Consumer.cpp (1 hunks)
  • TAO/docs/tutorials/Quoter/Event_Service/index.html (1 hunks)
  • TAO/docs/tutorials/Quoter/RT_Event_Service/Stock_Consumer.cpp (1 hunks)
  • TAO/docs/tutorials/Quoter/RT_Event_Service/index.html (1 hunks)
  • TAO/examples/Simulator/Event_Supplier/Event_Con.cpp (2 hunks)
  • TAO/interop-tests/wchar/client.cpp (2 hunks)
  • TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp (1 hunks)
  • TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/CosEvent/CEC_DynamicImplementation.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientPolicy_i.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FTEC_Event_Channel_Impl.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Request_Context_Repository.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h (1 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp (1 hunks)
  • TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp (1 hunks)
  • TAO/tao/Messaging/ExceptionHolder_i.cpp (1 hunks)
✅ Files skipped from review due to trivial changes (7)
  • TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h
  • TAO/tao/Messaging/ExceptionHolder_i.cpp
  • TAO/examples/Simulator/Event_Supplier/Event_Con.cpp
  • TAO/docs/tutorials/Quoter/Event_Service/Stock_Consumer.cpp
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.cpp
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FTEC_Event_Channel_Impl.cpp
  • TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Request_Context_Repository.cpp
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
  • GitHub Check: ubuntu-22.04 clang++-14
  • GitHub Check: ubuntu-20.04 clang++-12
  • GitHub Check: ubuntu-20.04 clang++-11
  • GitHub Check: ubuntu-20.04 clang++-10
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2019Debug64Cxx20
  • GitHub Check: VS2019Debug64Cxx17
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: VS2019Release32
  • GitHub Check: VS2019Debug32
  • GitHub Check: VS2019Release64
  • GitHub Check: VS2019Debug64
  • GitHub Check: VS2019WChar
  • GitHub Check: macos-14-C++
  • GitHub Check: MINGW64-gcc
  • GitHub Check: macos-13-C++
  • GitHub Check: ubuntu-20.04 g++-10
🔇 Additional comments (11)
TAO/docs/tutorials/Quoter/RT_Event_Service/Stock_Consumer.cpp (1)

38-38: LGTM! Modern pointer initialization.

The change from 0 to {} for pointer initialization aligns with modern C++ practices while maintaining the same semantics.

TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp (1)

26-26: LGTM! Explicit pointer initialization.

Adding explicit initialization with {} improves code safety by ensuring the pointer starts in a known state.

TAO/orbsvcs/LifeCycle_Service/Criteria_Evaluator.cpp (1)

29-29: LGTM! Modern pointer handling.

The changes to use {} for initialization and nullptr for comparison align with modern C++ practices.

Also applies to: 34-34

TAO/orbsvcs/orbsvcs/Notify/Property_T.cpp (1)

116-116: LGTM! Modern pointer initialization.

The change to use {} for pointer initialization aligns with modern C++ practices.

TAO/orbsvcs/orbsvcs/CosEvent/CEC_DynamicImplementation.cpp (1)

91-91: LGTM! Modern initialization style.

The change to use uniform initialization with {} is a good modernization that maintains the same behavior while being more explicit about the initialization intent.

TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientPolicy_i.cpp (1)

105-105: LGTM! Safe policy value initialization.

The uniform initialization style is appropriate here, as the code properly validates the pointer immediately after initialization and handles failure cases.

TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp (1)

121-121: LGTM! Consistent event pointer initialization.

The uniform initialization aligns with modern C++ practices and maintains the safety of the event handling code.

TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp (1)

129-129: LGTM! Secure credentials data initialization.

The uniform initialization is appropriate for security-sensitive code, maintaining explicit initialization while ensuring proper validation of the credentials data.

TAO/interop-tests/wchar/client.cpp (1)

162-162: LGTM! Modernized pointer initialization.

The changes improve code safety by using uniform initialization syntax to explicitly initialize pointers to null.

Also applies to: 175-175

TAO/docs/tutorials/Quoter/RT_Event_Service/index.html (1)

77-77: LGTM! Modernized pointer initialization.

The change improves code safety by using uniform initialization syntax to explicitly initialize the pointer to null.

TAO/docs/tutorials/Quoter/Event_Service/index.html (1)

80-80: LGTM! Modernized pointer initialization.

The change improves code safety by using uniform initialization syntax to explicitly initialize the pointer to null.

@jwillemsen jwillemsen merged commit 94721e3 into DOCGroup:master Feb 12, 2025
45 of 46 checks passed
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