Skip to content

Fixed warnings#2395

Merged
mitza-oci merged 4 commits into
DOCGroup:masterfrom
mitza-oci:warnings
Jun 9, 2025
Merged

Fixed warnings#2395
mitza-oci merged 4 commits into
DOCGroup:masterfrom
mitza-oci:warnings

Conversation

@mitza-oci
Copy link
Copy Markdown
Member

@mitza-oci mitza-oci commented Jun 6, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Suppressed misleading indentation warnings when compiling with GCC, improving build log clarity.
  • Other Improvements
    • Adjusted internal calculations for random extension generation, potentially affecting the distribution of generated values.
    • Updated internal type casting for message queue counts to improve code consistency.
    • Modified source line mappings in generated lexer code for more accurate debugging and error reporting.
    • Enhanced type safety and clarity in SSLIOP components through explicit casts and modernized boolean logic.
    • Simplified password handling and certificate file checks in SSLIOP for cleaner code flow.
    • Removed redundant code and improved pointer usage for better maintainability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 6, 2025

Walkthrough

This update refines internal type casting and code clarity across multiple components, including message queue casting, random coefficient calculation, pragma additions to suppress compiler warnings, and explicit type casts in SSLIOP modules. It also removes redundant code and improves const-correctness without changing public interfaces or control flow.

Changes

Files/Areas Change Summary
ACE/ace/Message_Queue_T.cpp Replaced ACE_Utils::truncate_cast<int> with static_cast<int> for internal count conversions.
TAO/TAO_IDL/be/be_codegen.cpp Changed constant coefficient calculation in make_rand_extension from MAX_VAL/(RAND_MAX+1.0f) to (MAX_VAL/RAND_MAX)+1.0f.
TAO/TAO_IDL/fe/idl.ll
TAO/TAO_IDL/fe/idl.yy.cpp
Added GCC pragma to suppress "-Wmisleading-indentation" warning; updated #line directives in lexer output.
TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_*.cpp (multiple files) Added explicit static_casts for CORBA types and chars; replaced raw pointers with nullptr; removed redundant checks; improved const-correctness; removed unreachable code; renamed variables to avoid shadowing; improved boolean logic.

Suggested reviewers

  • jwillemsen
  • iguessthislldo

Poem

A hop, a skip, a cast anew,
With pragmas shielding warnings through,
The random seeds now grow with care,
While lexers prance without a scare.
Casts made clear, no shadows fall,
The code now hops, robust and tall!
🐇✨


📜 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 d5c6462 and 2d0c5bd.

📒 Files selected for processing (7)
  • TAO/TAO_IDL/be/be_codegen.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp (3 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp (1 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Endpoint.cpp (2 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp (4 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp (4 hunks)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Util.cpp (0 hunks)
💤 Files with no reviewable changes (1)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Util.cpp
✅ Files skipped from review due to trivial changes (4)
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.cpp
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp
  • TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • TAO/TAO_IDL/be/be_codegen.cpp
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: ubuntu-24.04 clang++-15
  • GitHub Check: ubuntu-22.04 g++-9
  • GitHub Check: alpine-3.18
🔇 Additional comments (6)
TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Endpoint.cpp (6)

136-138: LGTM: Improved const-correctness with local variable declarations.

The addition of const qualifiers to local variables endpt and endpoint improves const-correctness and makes the code intent clearer.


140-141: LGTM: Modernized null pointer check with explicit boolean return.

The change from an implicit integer comparison to an explicit boolean check (!endpoint) and returning false instead of an integer value improves code clarity and follows modern C++ practices.


143-143: LGTM: Enhanced const-correctness in variable declaration.

Adding const to the ::Security::EstablishTrust variable declaration improves const-correctness since the variable is not modified after initialization.


163-164: LGTM: Modernized null pointer checks using nullptr.

The replacement of == 0 with == nullptr for pointer comparisons follows modern C++ best practices and improves code readability while maintaining the same logic.


166-168: LGTM: Consistent explicit boolean return pattern.

The explicit return false statement maintains consistency with the modernized boolean return pattern throughout the method.


170-170: LGTM: Explicit boolean return for success case.

The explicit return true completes the modernization of the method to use explicit boolean returns instead of integer values, improving code clarity.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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
Copy Markdown
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: 1

🧹 Nitpick comments (2)
TAO/TAO_IDL/fe/idl.ll (1)

117-119: Suppress misleading indentation warnings for GCC

The added #pragma GCC diagnostic ignored "-Wmisleading-indentation" inside the __GNUC__ guard correctly silences the unwanted indentation warnings in this lexer block.

Optional: Scope the suppression to this block only by bracketing it with push/pop:

 #ifdef __GNUC__
-#  pragma GCC diagnostic ignored "-Wmisleading-indentation"
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wmisleading-indentation"
 #endif
%}
+#ifdef __GNUC__
+#  pragma GCC diagnostic pop
+#endif
TAO/TAO_IDL/fe/idl.yy.cpp (1)

1464-1467: Suppress GCC misleading-indentation warnings
Adding a conditional #pragma GCC diagnostic ignored "-Wmisleading-indentation" correctly silences spurious warnings in generated lexer code. To localize the suppression and avoid impacting other code, consider bracketing this with #pragma GCC diagnostic push before and #pragma GCC diagnostic pop after the generated region.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4918f and d5c6462.

📒 Files selected for processing (4)
  • ACE/ace/Message_Queue_T.cpp (7 hunks)
  • TAO/TAO_IDL/be/be_codegen.cpp (1 hunks)
  • TAO/TAO_IDL/fe/idl.ll (1 hunks)
  • TAO/TAO_IDL/fe/idl.yy.cpp (17 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: macos-13-C++
🔇 Additional comments (7)
ACE/ace/Message_Queue_T.cpp (6)

1332-1332: Simplify cast in enqueue_head_i
Direct static_cast<int> replaces the previous ACE_Utils::truncate_cast<int>, improving readability and performance. cur_count_ remains within int range in normal use.


1523-1523: Use static_cast for dequeue_head_i return
Swapping out truncate_cast for static_cast<int> here is consistent and safe, given the bounded nature of cur_count_.


1599-1599: Replace truncate_cast with static_cast in dequeue_prio_i
The direct static_cast<int> is clearer and incurs no extra overhead; overflow is not a concern for cur_count_.


1648-1648: Simplify cast in dequeue_tail_i
Switching to static_cast<int> maintains behavior while removing the dependency on ACE_Utils::truncate_cast.


1726-1726: Use static_cast in peek_dequeue_head
Applying static_cast<int> is appropriate for converting cur_count_ here and aligns with other methods.


2443-2443: Consistent static_cast in ACE_Dynamic_Message_Queue::enqueue_i
The change to static_cast<int> matches the pattern used elsewhere and is efficient for this internal conversion.

TAO/TAO_IDL/fe/idl.yy.cpp (1)

1468-1470: Update #line directives for correct debug mapping
The new #line 1471 and #line 1473 directives shift the source‐level mappings by four lines. Please verify that all corresponding #line markers throughout the generated sections have been adjusted consistently to ensure accurate debugging and error reporting.

Comment thread TAO/TAO_IDL/be/be_codegen.cpp Outdated
@mitza-oci mitza-oci requested review from jrw972 and sonndinh June 9, 2025 13:30
@mitza-oci mitza-oci merged commit 9aec033 into DOCGroup:master Jun 9, 2025
36 checks passed
@mitza-oci mitza-oci deleted the warnings branch June 9, 2025 19:40
mitza-oci added a commit to mitza-oci/ACE_TAO that referenced this pull request Jun 9, 2025
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.

3 participants