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

Suppress Nurbs warnings #3345

Merged
merged 14 commits into from
Oct 30, 2019

Conversation

SergioRAgostinho
Copy link
Member

@SergioRAgostinho SergioRAgostinho commented Sep 15, 2019

While preparing to work on the release items, I noticed nurbs was spewing out an impressive number of warnings. I decided to finally clean it up. There's only a deprecation warning missing.

Situations in which I commented variables instead of simply deleting them are usually a sign that there is commented code in the function's body which originally intended to use them.

Most if not all, ctor base class initializations that I added to suppress the compiler warnings are actually no-ops. Probably the reason they were not being invoked in the first place.

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

This was a huge one, thanks for the effort.

surface/src/3rdparty/opennurbs/opennurbs_bezier.cpp Outdated Show resolved Hide resolved
@SergioRAgostinho
Copy link
Member Author

Sorry for the early force push. I forgot about it.

@taketwo
Copy link
Member

taketwo commented Sep 17, 2019

There are a few more sign-compare warnings left in Nurbs, see lines 3716-3806 in Ubuntu CI log, would you mind adding a commit for them as well?

@SergioRAgostinho
Copy link
Member Author

SergioRAgostinho commented Sep 17, 2019

Small heads-up. I found it strange that I was not seeing those sign-compare warnings during my build. I'm using g++ 7.4 on a Ubuntu distro. I double checked my CMAKE_CXX_FLAGS and they're empty (only on the ncurses ccmake window, probably because the variable is no longer a CACHE variable). I'm gonna dig around this new issue before proceeding with the last commit on this PR.

@SergioRAgostinho
Copy link
Member Author

The ci job reports using gcc 5.4.

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0

I manually compiled gcc 5.5.0 (could not get 5.4.0 to compile) and gave it a try at compiling pcl_surfaceand it's not outputting the sign-compare warnings.

Is the build outputting anything in your environment?

@taketwo
Copy link
Member

taketwo commented Sep 17, 2019

I have GCC 5.5 on my Ubuntu 16 machine and it also does not output sign warnings.

I'm puzzled why did CI job report GCC 5.4 though. It's running on a Ubuntu 16 based container which I re-created just a few days ago, so it should also have GCC 5.5. I will investigate tomorrow. Indeed, the container has 5.4. Also starting from a fresh ubuntu:16.04 container and installing gcc gives me version 5.4.

By the way, here is how you can quickly reproduce a CI run using docker. First, get the image:

docker pull pointcloudlibrary/env:16.04

Second, run the image mapping PCL source directory into it. Assuming you are in the repository root:

docker run --rm -v $PWD:/code -it pointcloudlibrary/env:16.04 /bin/bash

This will get you into a Docker container. Create a build directory:

mkdir /tmp/build && cd /tmp/build

Configure and make:

cmake /code && make

@taketwo taketwo added the needs: more work Specify why not closed/merged yet label Sep 24, 2019
@kunaltyagi kunaltyagi mentioned this pull request Sep 27, 2019
22 tasks
@taketwo
Copy link
Member

taketwo commented Sep 27, 2019

I implemented the changes needed to suppress -Wsign-compare and took the liberty to commit them to your branch. Ubuntu 16.04 job on CI runs clean from NURBS warnings, so I think this is ready to be merged.

@taketwo taketwo removed the needs: more work Specify why not closed/merged yet label Sep 27, 2019
@taketwo taketwo requested a review from kunaltyagi September 27, 2019 10:46
@kunaltyagi
Copy link
Member

Also starting from a fresh ubuntu:16.04 container and installing gcc gives me version 5.4

It might be because the image is cached and you need to pull the base image too. Use --pull in your docker build command to make docker check for a newer base image. (I'm sorry, I haven't built the docker image myself to confirm my hunch)

@taketwo
Copy link
Member

taketwo commented Sep 27, 2019

I tried to docker build --pull the Dockerfile that we have in the repository, but the compiler is still the same, GCC 5.4.0.

Edit: though I can confirm that this pulled a new Ubuntu 16.04 image (that was created just eight days ago).

Copy link
Member

@kunaltyagi kunaltyagi left a comment

Choose a reason for hiding this comment

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

If any of these should be a new PR, please create a new issue (most look like good-to-start).

Otherwise, LGTM. A big changset though, wonderfully organized 😃

surface/src/3rdparty/opennurbs/opennurbs_archive.cpp Outdated Show resolved Hide resolved
surface/src/3rdparty/opennurbs/opennurbs_archive.cpp Outdated Show resolved Hide resolved
@@ -1046,7 +1046,7 @@ FittingCurve2dAPDM::findClosestElementMidPoint (const ON_NurbsCurve &nurbs, cons
double &xi1 = elements[i + 1];
double dxi = xi1 - xi0;

for (unsigned j = 0; j < nurbs.Order (); j++)
for (unsigned j = 0; j < static_cast<unsigned int>(nurbs.Order ()); j++)
Copy link
Member

Choose a reason for hiding this comment

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

The casts are all over the place. (to unsigned int, size_t). Maybe only one is required and not all (for nurbs.Order()) variants

@SergioRAgostinho
Copy link
Member Author

Sorry for the absence. In situations like this feel free both of you to push stuff to my PR branches whenever required.

@SergioRAgostinho SergioRAgostinho mentioned this pull request Oct 19, 2019
11 tasks
@SergioRAgostinho
Copy link
Member Author

Oops. Forgot about addressing your comments. The changes LGTM.

I would personally not deprecate or make any other changes considered to be stricly required to 3rd party code but there's indeed the "risk" someone is using directly the OpenNurbs version we're packaging.

@SergioRAgostinho
Copy link
Member Author

I just rebased this branch on top the current master and there still a number of size_t occurrences present in the code. 😕

@SergioRAgostinho SergioRAgostinho force-pushed the nurbs-warnings branch 2 times, most recently from 78694f4 to a26f471 Compare October 22, 2019 07:55
Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

The compilation output on CI is clean, so I guess this one is ready. Thanks for all the effort!

@kunaltyagi kunaltyagi merged commit 8d5fa69 into PointCloudLibrary:master Oct 30, 2019
@SergioRAgostinho SergioRAgostinho deleted the nurbs-warnings branch November 13, 2019 07:21
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.

3 participants