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

few warnings/errors in copy assignment #2167

Closed
1 of 3 tasks
richardlalancetteyoui opened this issue Jun 4, 2020 · 9 comments
Closed
1 of 3 tasks

few warnings/errors in copy assignment #2167

richardlalancetteyoui opened this issue Jun 4, 2020 · 9 comments
Labels
kind: question state: needs more info the author of the issue needs to provide more details

Comments

@richardlalancetteyoui
Copy link

richardlalancetteyoui commented Jun 4, 2020

Hi!
I have integrated your library in our code.
Can you advise regarding the following 3 problems?

Static analysis found 3 issues in your PR (xcode 11's clang-analyzer):
• Use of identical expressions in json.hpp:17964 (in function operator=)
• Use of identical expressions in json.hpp:21647 (in function swap)
• Use of identical expressions in json.hpp:24444 (in function swap)

What do you want to achieve?

Integration without warning or issue if possible.

What have you tried?

I'm starting to investigation removing the warnings in our own copy of the code.

Which compiler and operating system are you using?

Model Identifier: iMac14,2
Processor Speed: 3.70 GHz
Number of Processors: 1
Total Number of Cores: 6
Memory: 64 GB

  • Compiler: xcode
  • Operating system: 10.13.6

Which version of the library did you use?

  • latest release version 3.7.3
  • other release - please state the version: ___
  • the develop branch
    commit 9212590
@nlohmann
Copy link
Owner

nlohmann commented Jun 5, 2020

These are the lines in question:

17964 std::is_nothrow_move_constructible<value_t>::value
21647 std::is_nothrow_move_constructible<value_t>::value
24444 is_nothrow_move_constructible<nlohmann::json>::value

I am not sure what this warning means. Can you describe how you executed the static anaylsis?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Jun 5, 2020
@richardlalancetteyoui
Copy link
Author

This is part of our build system on jenkins.
Let me dig the tool that generated this.

@richardlalancetteyoui
Copy link
Author

That's odd.
AppCode also sees an issue. But, might be red herrings.

image

@richardlalancetteyoui
Copy link
Author

Unless you see an issue in that code. I am not familiar with noexcept.

@richardlalancetteyoui
Copy link
Author

richardlalancetteyoui commented Jun 5, 2020

Analyser used is xcode 11's clang-analyzer

https://clang-analyzer.llvm.org/xcode.html ?

@richardlalancetteyoui
Copy link
Author

Got it to show up in xcode as well.
image

@FrancoisChabot
Copy link
Contributor

The only way this warning can make any sense at all would be if the static analyzer has reached the conclusion that value_t and json_value are 100% guaranteed to be the same type in every template instantiation.

@richardlalancetteyoui
Copy link
Author

The quality of those analyzers may vary for sure!

I'm wrapping up this code with preprocessor for now.

Feel free to close this issue.

@nlohmann
Copy link
Owner

nlohmann commented Jun 6, 2020

I think this is a false positive. Closing.

@nlohmann nlohmann closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

3 participants