Repository navigation
Build error: keyword is hidden by macro definition! #1985
Description
Activity
There are more Warnings with Clang 9.0.0
[58/85] Building CXX object test/CMakeFiles/test-noexcept.dir/src/unit-noexcept.o /Users/clausklein/Workspace/cpp/json/test/src/unit-noexcept.cpp:45:6: warning: function 'to_json' is not needed and will not be emitted [-Wunneeded-internal-declaration] void to_json(json&, pod) noexcept; ^ /Users/clausklein/Workspace/cpp/json/test/src/unit-noexcept.cpp:46:6: warning: function 'to_json' is not needed and will not be emitted [-Wunneeded-internal-declaration] void to_json(json&, pod_bis); ^ /Users/clausklein/Workspace/cpp/json/test/src/unit-noexcept.cpp:47:6: warning: function 'from_json' is not needed and will not be emitted [-Wunneeded-internal-declaration] void from_json(const json&, pod) noexcept; ^ /Users/clausklein/Workspace/cpp/json/test/src/unit-noexcept.cpp:48:6: warning: function 'from_json' is not needed and will not be emitted [-Wunneeded-internal-declaration] void from_json(const json&, pod_bis); ^ 4 warnings generated.
The bad code style is not in productive code, but in the test suite, which needs access to private members to achieve 100% code coverage. I would be happy to use a different approach (without refactoring the library).
The
-Wunneeded-internal-declarationwarnings could be resolved by removing the declaration, but then GCC will warn about missing declarations. I am not sure what do do about that.Any suggestions?
If all you are doing it being a consumer of the library and not a developer of it you an allway disable the build of the with this cmake flag
JSON_BuildTests.That should get rid of most of those warnings
- May be this a solution? http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html and see too Uses and Abuses of Access Rights #4 http://www.gotw.ca/gotw/076.htm…Am 14.03.2020 um 10:49 schrieb Niels Lohmann ***@***.***>: The bad code style is not in productive code, but in the test suite, which needs access to private members to achieve 100% code coverage. I would be happy to use a different approach (without refactoring the library). The -Wunneeded-internal-declaration warnings could be resolved by removing the declaration, but then GCC will warn about missing declarations. I am not sure what do do about that. Any suggestions? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1985 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAN7QWS6BBJ6FLUB5SJBJMDRHNHMNANCNFSM4LHGV5NA>.Reacted by Alexander Enaldiev
Hm. I read about this once, but never followed up. Interesting! I'll see if I can make this work.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
- addedstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
on Apr 18, 2020 I am not sure whether it is worth investing time to get rid of warnings in the test suite. PRs welcome, though.
- removedstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
on Apr 19, 2020 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
- addedstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
on May 19, 2020 - addedsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmationand removedstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
on Aug 12, 2020
This is BAD code style: