Skip to content

Tracker Strict Flags#1185

Open
ltalarcz wants to merge 4 commits intomainfrom
tracker-strict-flags
Open

Tracker Strict Flags#1185
ltalarcz wants to merge 4 commits intomainfrom
tracker-strict-flags

Conversation

@ltalarcz
Copy link
Contributor

📝 Description

This pull request introduces several improvements focused on code quality, build configuration, and minor refactoring for clarity and maintainability. The most notable changes include enforcing stricter compiler flags, improving third-party include handling, and making minor code cleanups and type corrections.

Build configuration improvements:

  • Added strict compiler flags (e.g., -Wall, -Wextra, -Werror, -fcf-protection=full, -Wconversion, -Wimplicit-fallthrough) to the tracker target to enforce higher code quality and catch more issues at compile time. Also, treated RobotVision headers as system includes to suppress third-party warnings. (tracker/CMakeLists.txt)

Code cleanup and minor refactoring:

  • Removed the unused clearEmptyProxyVars function and its associated comments, cleaning up the codebase. (tracker/src/mqtt_client.cpp)
  • Updated the signal handler to avoid unused parameter warnings by removing the parameter name. (tracker/src/main.cpp)
  • Marked the payload parameter as [[maybe_unused]] in handleDatabaseUpdateMessage to suppress unused parameter warnings and clarify intent. (tracker/src/message_handler.cpp)
  • Changed the loop variable type in require_array3 from size_t to rapidjson::SizeType for better compatibility with RapidJSON API. (tracker/inc/scene_parser.hpp)

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests
  • 🚂 CI

🧪 Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • ✅ Tested manually
  • 🤖 Ran automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

@ltalarcz ltalarcz requested a review from Copilot March 18, 2026 08:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the tracker build configuration with stricter compiler warnings/errors and applies small code cleanups to reduce warning noise and improve type/API compatibility.

Changes:

  • Add stricter compile flags to the tracker target and treat RobotVision includes as system includes.
  • Remove the clearEmptyProxyVars workaround and apply small warning-suppression refactors ([[maybe_unused]], unnamed params).
  • Align RapidJSON array indexing type with RapidJSON’s SizeType.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tracker/CMakeLists.txt Adds strict compile flags and marks RobotVision include dirs as SYSTEM to reduce third-party warnings.
tracker/src/mqtt_client.cpp Removes the proxy-env workaround helper and its documentation block.
tracker/src/message_handler.cpp Marks an intentionally-unused parameter as [[maybe_unused]].
tracker/src/main.cpp Silences unused signal handler parameter warnings by omitting the name.
tracker/inc/scene_parser.hpp Uses rapidjson::SizeType for indexing to match RapidJSON APIs.

Comment on lines +115 to +120
# Apply strict compiler flags only to the tracker target
target_compile_options(${PROJECT_NAME}
PRIVATE
-Wall -Wextra -Werror -fcf-protection=full -Wconversion -Wimplicit-fallthrough
-Wno-missing-field-initializers
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't bother about MSVC compatibility, it is out of scope.

However, I suggest to probe with check_cxx_compiler_flag only for -fcf-protection=full flag, which seems to be compiler and HW-specific, like this:

check_cxx_compiler_flag("-fcf-protection=full" COMPILER_SUPPORTS_CF_PROTECTION)

# Apply strict compiler flags only to the tracker target
target_compile_options(${PROJECT_NAME}
  PRIVATE
    -Wall -Wextra -Werror -Wconversion -Wimplicit-fallthrough
    -Wno-missing-field-initializers
    $<$<BOOL:${COMPILER_SUPPORTS_CF_PROTECTION}>:-fcf-protection=full>
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed: 43255b6

* Solution: Detect empty proxy vars and unset them entirely, while
* preserving real proxy URLs for production environments that need them.
*/
void clearEmptyProxyVars() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct change to remove it as redundant, since clearEmptyProxyEnvVars is implemented in tracker/src/proxy_utils.cpp and used in MqttClient::MqttClient.

However, I suggest to update the comment to use the name of actually used function (clearEmptyProxyEnvVars)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed: 43255b6

Comment on lines +115 to +120
# Apply strict compiler flags only to the tracker target
target_compile_options(${PROJECT_NAME}
PRIVATE
-Wall -Wextra -Werror -fcf-protection=full -Wconversion -Wimplicit-fallthrough
-Wno-missing-field-initializers
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't bother about MSVC compatibility, it is out of scope.

However, I suggest to probe with check_cxx_compiler_flag only for -fcf-protection=full flag, which seems to be compiler and HW-specific, like this:

check_cxx_compiler_flag("-fcf-protection=full" COMPILER_SUPPORTS_CF_PROTECTION)

# Apply strict compiler flags only to the tracker target
target_compile_options(${PROJECT_NAME}
  PRIVATE
    -Wall -Wextra -Werror -Wconversion -Wimplicit-fallthrough
    -Wno-missing-field-initializers
    $<$<BOOL:${COMPILER_SUPPORTS_CF_PROTECTION}>:-fcf-protection=full>
)

- Probe -fcf-protection=full via check_cxx_compiler_flag before use
- Guard RobotVision SYSTEM include with if(TARGET RobotVision)
- Fix stale function reference in docker-compose comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants