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

Fix MSVC warning C4067 (unexpected tokens following preprocessor directive - expected a newline) #3871

Merged
merged 1 commit into from
Apr 12, 2020

Conversation

SunBlack
Copy link
Contributor

@SunBlack SunBlack commented Apr 6, 2020

Since #3634 I'm getting a C4067 warning (see Windows Azure builds):

pcl_macros.h(88): warning C4067: unexpected tokens following preprocessor directive - expected a newline

This is caused due to this bug.

Now I played a bit with godbolt and saw that #3634 even destroyed the deprecated warning for MSVC 2015 & 2017, as __has_cpp_attribute is only supportd since MSVC 2019. You can try it here (MSVC 19.1X => 2017, 19.2X => 2019).

As @taketwo mentioned here MSVC 2015 is the base line is not MSVC 2013 and MSVC 2015 (19.0) already supports [[deprecated]] see here I solved it by always using [[deprecated]] for MSVC.

Even I could not reproduce the issue from @office-florian-hubner with CUDA 10.2 on my MSVC 2017 (15.9.21) machine, I added the check again with __CUDACC__ (@office-florian-hubner If you see this: which environment you are using?)

@kunaltyagi kunaltyagi self-requested a review April 6, 2020 16:37
@kunaltyagi kunaltyagi added changelog: fix Meta-information for changelog generation module: common platform: windows labels Apr 6, 2020
@SergioRAgostinho SergioRAgostinho self-requested a review April 6, 2020 19:48
@flowvision
Copy link
Contributor

I'm using CUDA 10.1 and MSVC 2017. At the moment I use version 15.9.20 of MSVC 2017 but I think I updated it since I did #3634.

The problem for me was the nvcc on Windows neither recognized [[deprecated]] nor __declspec(deprecated). I would get the following error

error: attribute does not apply to any entity

I found some other projects which also added macros to handle the mess with the attributes. See
https://github.com/pytorch/pytorch/blob/master/c10/util/Deprecated.h
There is a comment on line 64 where they describe the same problem I had.

I wonder if they fixed this in CUDA 10.2 as you can't reproduce the problems I had.

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.

Proper deprecation is already a headache. Why do compilers have to make it even more troublesome?

@SergioRAgostinho SergioRAgostinho merged commit 2ae6094 into PointCloudLibrary:master Apr 12, 2020
@SunBlack SunBlack deleted the fix_C4067 branch April 12, 2020 10:49
@taketwo taketwo changed the title Fix warning C4067: unexpected tokens following preprocessor directive- expected a newline Fix MSVC warning C4067 (unexpected tokens following preprocessor directive - expected a newline) May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation module: common platform: windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants