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

[21358] Increase the warning level for Ubuntu CI's compilation #5067

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Tempate
Copy link
Contributor

@Tempate Tempate commented Jul 12, 2024

Description

The compilation in Windows is usually more restrictive than the compilation in Ubuntu. This is in part because the compilation warning-flags in Windows and Ubuntu are different.

  • Windows: -DCMAKE_CXX_FLAGS="/WX /MP"
  • Ubuntu: -DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual"

The problem with Windows being more restrictive than Ubuntu is that many errors cannot be found and solved until the CI runs on Windows, which usually takes a long time. To find and solve errors faster, we have included the following compilation warning-flags to Ubuntu's CI:

  • -Wsign-compare
  • -Wcast-align
  • -Wlogical-op
  • -Wduplicated-cond
  • -Wrestrict
  • -Wnull-dereference
  • -Wpointer-arith
  • -Wwrite-strings
  • -Wunreachable-code

According to ChatGPT, the following flags should be added to make Ubuntu's CI as restrictive as Window's:

  • -Wconversion
  • -Wshadow
  • -Wsign-conversion
  • -Wold-style-cast
  • -Wuseless-cast
  • -Wformat=2
  • -Wmissing-include-dirs
  • -Wredundant-decls
  • -Wstrict-overflow=5
  • -Wswitch-enum
  • -Wdouble-promotion
  • -Wduplicated-branches

According to StackOverflow, the following flags could also be useful:

  • -Wfloat-equal
  • -Wundef
  • -Waggregate-return
  • -Wcast-qual
  • -Wswitch-default
  • -Wstrict-prototypes

Both ChatGPT's and StackOverflow's suggestions are left out from this first attempt.

Contributor Checklist

  • Commit messages follow the project guidelines.
  • N/A The code follows the style guidelines of this project.
  • N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • New feature has been added to the versions.md file (if applicable).
  • New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@EduPonz EduPonz added this to the v3.0.0 milestone Jul 12, 2024
@Tempate Tempate force-pushed the hotfix/ubuntu-ci-restrictive-tags branch from 5872494 to b44ce57 Compare July 15, 2024 06:55
@Tempate Tempate marked this pull request as ready for review July 15, 2024 14:22
@github-actions github-actions bot added the ci-pending PR which CI is running label Jul 15, 2024
@elianalf elianalf added the needs-review PR that is ready to be reviewed label Jul 18, 2024
@EduPonz EduPonz modified the milestones: v3.0.0, v3.0.1 Jul 19, 2024
@@ -55,7 +55,7 @@ on:

env:
security-cmake-flag: ${{ inputs.security == true && '-DSECURITY=ON' || '-DSECURITY=OFF' }}
colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual"'
colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual -Wsign-compare -Wcast-align -Wlogical-op -Wduplicated-cond -Wrestrict -Wnull-dereference -Wpointer-arith -Wwrite-strings -Wunreachable-code"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual -Wsign-compare -Wcast-align -Wlogical-op -Wduplicated-cond -Wrestrict -Wnull-dereference -Wpointer-arith -Wwrite-strings -Wunreachable-code"'
colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual -Wsign-compare -Wcast-align -Wlogical-op -Wduplicated-cond -Wrestrict -Wnull-dereference -Wpointer-arith -Wwrite-strings -Wunreachable-code -Wunused-private-field"'

@rsanchez15 rsanchez15 modified the milestones: v3.0.1, v3.0.2 Sep 4, 2024
@MiguelCompany MiguelCompany added needs rebase and removed ci-pending PR which CI is running needs-review PR that is ready to be reviewed labels Oct 2, 2024
@MiguelCompany MiguelCompany modified the milestones: v3.0.2, v3.1.0 Oct 2, 2024
@rsanchez15 rsanchez15 modified the milestones: v3.1.0, v3.1.1 Oct 3, 2024
@JesusPoderoso JesusPoderoso modified the milestones: v3.1.1, v3.2.0 Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants