-
Notifications
You must be signed in to change notification settings - Fork 52
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
Visual Studio 2017 warning #28
Comments
Interesting, thank you for filing this instead of just ignoring it or fixing it locally. I'll have to get a VS2017 (and VS2019) build going on AppVeyor. My guess is that this is due to the namespaced Another possibility could be to just disable the warning which something like #define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) \
HEDLEY_DIAGNOSTIC_PUSH \
__pragma(disable:2512) \
__has_cpp_attribute(attribute) \
HEDLEY_DIAGNOSTIC_POP Although IIRC that won't work for PGI. |
It is an IntelliSense error only, right? |
Yes, you are right. But it's annoying nevertheless.. |
Oh, I didn't realize it was an IntelliSense thing. I'd still like to fix it, but do you know if there is a way to reproduce it from the CLI so we can test in CI? I'd like to make sure it doesn't happen again, but nothing is showing up in CI. |
This is not a intellisense thing. I do see the warning here with VS2017 as well if I use the default C++ language standard flag. If i use C++17 (/std:c++17) the warning is gone. VS also supports namespaced attributes, see https://docs.microsoft.com/de-de/cpp/cpp/attributes?view=vs-2019 and look for gsl::suppress. IMHO the check for clang::fallthrough should only be done for clang or? @nemequ Are you compiling on CI on windows with |
With 2017 and no language version specified, it seems to be working in CI. It also seems to work on godbolt 19.20+ (which is, I think, VS 2019). On VS 2017 (19.10+, godbolt has 19.14 - 19.16)
As a rule I'd like to avoid that if possible since compilers other than clang may implement clang-namespaced attributes in the future (look at what has happened with -webkit-* in CSS), but that may be the best option here. CI is running with |
I've found https://forum.qt.io/topic/93711/problem-with-new-visual-studio-update-2017-version-15-8-0-and-qt-5-9-5/28 and they have basically the same problem. I'm running VS 2017 15.9.16. |
How about doing the following: $ git diff .
diff --git a/hedley.h b/hedley.h
index 282a6c0..af91948 100644
--- a/hedley.h
+++ b/hedley.h
@@ -1168,10 +1168,12 @@ HEDLEY_DIAGNOSTIC_POP
(__cplusplus >= 201703L) || \
((__cplusplus >= 201103L) && HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough))
# define HEDLEY_FALL_THROUGH [[fallthrough]]
-# elif (__cplusplus >= 201103L) && HEDLEY_HAS_CPP_ATTRIBUTE(clang::fallthrough)
-# define HEDLEY_FALL_THROUGH [[clang::fallthrough]]
-# elif (__cplusplus >= 201103L) && HEDLEY_GCC_VERSION_CHECK(7,0,0)
-# define HEDLEY_FALL_THROUGH [[gnu::fallthrough]]
+# elif !defined(HEDLEY_MSVC_VERSION)
+# if (__cplusplus >= 201103L) && HEDLEY_HAS_CPP_ATTRIBUTE(clang::fallthrough)
+# define HEDLEY_FALL_THROUGH [[clang::fallthrough]]
+# elif (__cplusplus >= 201103L) && HEDLEY_GCC_VERSION_CHECK(7,0,0)
+# define HEDLEY_FALL_THROUGH [[gnu::fallthrough]]
+# endif
# endif
#endif
#if !defined(HEDLEY_FALL_THROUGH)
(base) |
I was thinking about something like that—though probably IIRC the only reason that check for PGI is in the outer check is also the namespaced attributes, so that should probably be moved to where you have the MSVC check too. I'll push something this weekend, one way or the other. This is pretty annoying for people using MSVC 2017, which is a pretty large number of people, so I'd like to release v10 soon too… maybe Tuesday or Wednesday. |
Unfortunately, I do not use your library directly, but as a part of |
Here is a quick fork with the updated version: https://github.com/nemequ/json/ If you just want the relevant commit, it's https://github.com/nemequ/json/commit/b47d866afa8d1696f39d7f71a2f22857101338e6 |
I've tested it with your fork and it seems that it resolves the problem! Thanks! |
@petko Nice! Could you create a pull request for the json project using https://github.com/nemequ/json/commit/b47d866afa8d1696f39d7f71a2f22857101338e6? |
@petko, awesome, thanks! @t-b, that's the version from dev at the time, which isn't quite what will appear in the release. If you want I can update it after the release (probably in a couple hours) and submit a PR using that. FWIW, after the release it's just a |
That would be awesome! |
Just released v11, this fix is included. |
I love to see that this issue is fixed!!! |
In VS2017 (15.9.16), when used as part of
nlohmann/json
, I get the following error when using the library in my tests (it is reported as error, but the project builds OK):This corresponds to LINE 1171 in your library:
hedley/hedley.h
Lines 1166 to 1176 in c395642
I hope it's not a duplicate, but haven't found it reported..
The text was updated successfully, but these errors were encountered: