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

Code Checking Warnings from json.hpp on VS2017 Community #821

Closed
AraHaan opened this issue Nov 6, 2017 · 17 comments
Closed

Code Checking Warnings from json.hpp on VS2017 Community #821

AraHaan opened this issue Nov 6, 2017 · 17 comments
Labels

Comments

@AraHaan
Copy link

AraHaan commented Nov 6, 2017

Bug Report

  • What is the issue you have?
    A lot of warnings from code checking in Visual Studio 2017.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

  • What is the expected behavior?
    No annoying warnigns from json.hpp

  • And what is the actual behavior instead?
    Warnings right after another on json.hpp.

  • Which compiler and operating system are you using? Is it a supported compiler?
    The latest Visual Studio 2017 Community compiler.

  • Did you use a released version of the library or the version from the develop branch?
    Release I think of version 2.0.7

  • If you experience a compilation error: can you compile and run the unit tests?

Here are the warnings that are emmited on json.hpp when including and using it:

j:\14.4 gb usb\vbtrpdet\libs\json.hpp(10768): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(2204): warning C26409: Avoid calling new and delete explicitly, use std::make_unique<T> instead. (r.11 http://go.microsoft.com/fwlink/?linkid=845485)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(2223): warning C26424: Failing to delete or assign ownership of allocation at line 2204.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6883): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6877): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6846): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6840): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6398): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6400): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(843): warning C26495: Variable 'nlohmann::basic_json<std::map,std::vector,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,bool,__int64,unsigned __int64,double,std::allocator>::json_value::object' is uninitialized. Always initialize a member variable. (type.6: http://go.microsoft.com/fwlink/p/?LinkID=620422)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6326): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6327): warning C26412: Do not dereference a invalid pointer (lifetimes rule 1). '<range>$L1' was invalidated by 'end of scope for allotemp.2, allotemp.3'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(5938): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(785): warning C26412: Do not dereference a invalid pointer (lifetimes rule 1). 'return of create' was invalidated by 'end of scope for allotemp.2'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9167): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7614): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9065): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9074): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9055): warning C26494: Variable 'max' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9058): warning C26494: Variable 'type' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8862): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8862): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8868): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8918): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8925): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8925): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8925): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8931): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8935): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8947): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8862): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8957): warning C26412: Do not dereference an invalid pointer (lifetimes rule 1). 'i' was invalidated at line 8862 by 'no initialization'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8918): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8931): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8793): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7842): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7966): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7972): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7953): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7981): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8140): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8208): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8214): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8463): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8577): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8631): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8672): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8309): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8341): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8357): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8373): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8389): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8325): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8293): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8133): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8000): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8006): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8022): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8048): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8054): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8405): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8499): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8416): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8530): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8540): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8079): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8085): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8091): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8098): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8442): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8556): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8612): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8666): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8106): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8449): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8563): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8619): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8114): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8456): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8570): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8625): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8121): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8127): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7959): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7841): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7971): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7981): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8219): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8468): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8582): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8636): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8677): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8314): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8346): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8362): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8378): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8394): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8330): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8298): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8138): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8022): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8053): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8504): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8545): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8098): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8106): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8114): warning C26413: Do not dereference nullptr (lifetimes rule 2). '*this' was pointed to nullptr at line 7792.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7800): warning C26494: Variable 'yych' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9001): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8758): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8784): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8785): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8786): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8754): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8781): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(9182): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)

For some reason it looks like in a few places it does not like the use of reinterpret_cast even when things like const_cast, static_cast, or dynamic_cast does not compile or fails.

Not sure if a newer version has the warnings fixed or not so made this issue in case they have not been addressed (or suppressed).

Edit: After updating to latest release the warnings increased as well as these while processing my code that includes this before the Code Check:

1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6683): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6689): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6695): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6701): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6715): warning C4003: not enough actual parameters for macro 'min'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6715): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6721): warning C4003: not enough actual parameters for macro 'min'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6721): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6727): warning C4003: not enough actual parameters for macro 'min'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6727): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6733): warning C4003: not enough actual parameters for macro 'min'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6733): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6750): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6756): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6762): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6768): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6925): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6931): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6937): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6959): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6965): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(6971): warning C4003: not enough actual parameters for macro 'max'
1>J:\14.4 GB USB\vbtrpdet\libs\json.hpp(7184): warning C4003: not enough actual parameters for macro 'max'
@nlohmann
Copy link
Owner

nlohmann commented Nov 7, 2017

After closing #822, is there anything we can do here?

@AraHaan
Copy link
Author

AraHaan commented Nov 8, 2017

Well, I think for MSVC at beginning of file we can disable these warnings temporarily and then renable them at end of the file.

#elif defined(_MSC_VER)
    #define JSON_DEPRECATED __declspec(deprecated)
+    #include <CppCoreCheck\Warnings.h>
+    #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
#else
    #define JSON_DEPRECATED
#endif

// end of file

+#if defined(_MSC_VER)
+    #pragma warning(default: CPPCORECHECK_CONST_WARNINGS)
+#endif

Maybe something like this might work. Although it would be nice to know if the CppCoreCheck is really enabled or not.

@gregmarr
Copy link
Contributor

gregmarr commented Nov 8, 2017

If we're going to do that, it would be better to use push and pop. However, I'm not sure we need to worry about the core guidelines checker, as the user can do this to ignore the header's directory

set caexcludepath=%include%
It is highly recommended to disable warnings that fire on standard headers. This setting does exactly that. You can add more paths, e.g. the path to the common headers in your project.

@gregmarr
Copy link
Contributor

gregmarr commented Nov 8, 2017

Having said that, it would be good to actually fix these things where possible. Some of them are not possible, such as using make_unique, as it doesn't exist in C++11.

@AraHaan
Copy link
Author

AraHaan commented Nov 8, 2017

Ah, I see.

@gregmarr
Copy link
Contributor

gregmarr commented Nov 8, 2017

2.0.7 is over a year old. If you could do this same analysis on the develop branch, then we can look at those and see what still needs to be addressed.

@AraHaan
Copy link
Author

AraHaan commented Nov 8, 2017

Alright, I will check and see.

Edit: This seems to be the results.

j:\14.4 gb usb\vbtrpdet\libs\json.hpp(209): warning C26412: Do not dereference an invalid pointer (lifetimes rule 1). 'return of what' was invalidated at line 208 by '(unknown)'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(555): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1444): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1506): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1509): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1509): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1509): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1511): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1523): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1533): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(14683): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6150): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6152): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6161): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6163): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6178): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6180): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6188): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6190): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6093): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6094): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8001): warning C26495: Variable 'nlohmann::basic_json<std::map,std::vector,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,bool,__int64,unsigned __int64,double,std::allocator,nlohmann::adl_serializer>::json_value::object' is uninitialized. Always initialize a member variable. (type.6: http://go.microsoft.com/fwlink/p/?LinkID=620422)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3771): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3765): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3734): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3728): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1744): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1742): warning C26496: Value pointed to by 'loc' is assigned only once, mark it as a pointer to const. (con.4: https://go.microsoft.com/fwlink/p/?LinkID=784969)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6452): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6453): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6454): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6455): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6465): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6466): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6467): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6468): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6471): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6472): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6473): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6474): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(2670): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1911): warning C26494: Variable 'codepoint' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1816): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1813): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1582): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1581): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7943): warning C26412: Do not dereference a invalid pointer (lifetimes rule 1). 'return of create' was invalidated by 'end of scope for allotemp.2'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6676): warning C28020: The expression '0<=_Param_(1)&&_Param_(1)<=64-1' is not true at this call.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6668): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6676): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1611): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)

@tlanc007
Copy link

tlanc007 commented Nov 8, 2017

make_unique consists of a number of templates. So a check could be made for if a C++11 compiler was being used and those templates could be made available. I could give it a go if desired.

Having said that, it would be good to actually fix these things where possible. Some of them are not possible, such as using make_unique as it doesn't exist in C++11.

@gregmarr
Copy link
Contributor

gregmarr commented Nov 8, 2017

@AraHaan Thanks for that. My thoughts after looking at those warnings are below.

@tlanc007 That warning no longer exists in the develop branch.

I've stripped out most of these bits from each line, leaving just the line and warning numbers:
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(8001): warning C26495:

Things that we probably can do something about
==============================================

 8001 C26495: Variable 'nlohmann::basic_json<std::map,std::vector,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,bool,__int64,unsigned __int64,double,std::allocator,nlohmann::adl_serializer>::json_value::object' is uninitialized. Always initialize a member variable. (type.6: http://go.microsoft.com/fwlink/p/?LinkID=620422)

No member of the `union json_value` is initialized if `t` is `value_t::null`.

  555 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)

Might be able to add some range checks here to silence this issue.

 1744 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 6093 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 6094 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)

This could be changed from `loc->decimal_point[0]` to `*loc->decimal_point`.

Things that we may be able to do something about
================================================

 6452 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6453 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6454 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6455 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6465 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6466 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6467 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6468 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6471 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6472 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6473 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6474 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)

The only thing I can see that we could do here is instead of having dump_escaped size the string up front, reserve the size and use push_back instead.  There may be a performance reason for the current method.

 6668 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6676 C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
 6676 C28020: The expression '0<=_Param_(1)&&_Param_(1)<=64-1' is not true at this call.

As above.  However, the 6676 warning is concerning.  I'd like to know what value would be passed here that would overflow a 64 character array.

Things that we probably can't do anything about
===============================================

  209 C26412: Do not dereference an invalid pointer (lifetimes rule 1). 'return of what' was invalidated at line 208 by '(unknown)'.

Nothing we can do here, just passing through to the standard library object.

 1444 C26499: Could not find any lifetime tracking information for '**this'
 3728 C26499: Could not find any lifetime tracking information for '**this'
 3734 C26499: Could not find any lifetime tracking information for '**this'
 3765 C26499: Could not find any lifetime tracking information for '**this'
 3771 C26499: Could not find any lifetime tracking information for '**this'
 6150 C26499: Could not find any lifetime tracking information for '*return of ->'
 6152 C26499: Could not find any lifetime tracking information for '*return of ->'
 6161 C26499: Could not find any lifetime tracking information for '*return of ->'
 6163 C26499: Could not find any lifetime tracking information for '*return of ->'
 6178 C26499: Could not find any lifetime tracking information for '*return of ->'
 6180 C26499: Could not find any lifetime tracking information for '*return of ->'
 6188 C26499: Could not find any lifetime tracking information for '*return of ->'
 6190 C26499: Could not find any lifetime tracking information for '*return of ->'

Don't see anything wrong here, looks to be an issue with the tool itself.

 1506 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1509 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1509 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1509 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1511 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1523 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1533 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1813 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 1816 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
 2670 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
14683 C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)

This recommends using a GSL type.  I'm not sure this library should add that dependency.

 1581 C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
 1582 C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
 1611 C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)

I don't think we can use anything different here.
 
 1742 C26496: Value pointed to by 'loc' is assigned only once, mark it as a pointer to const. (con.4: https://go.microsoft.com/fwlink/p/?LinkID=784969)

We're using `const auto`, not sure what this is asking for.

 1911 C26494: Variable 'codepoint' is uninitialized. Always initialize an object. (type.5: http://go.microsoft.com/fwlink/p/?LinkID=620421)

All paths through this function initialize this variable, no error here currently.

 7943 C26412: Do not dereference a invalid pointer (lifetimes rule 1). 'return of create' was invalidated by 'end of scope for allotemp.2'.

This looks okay.

nlohmann added a commit that referenced this issue Nov 25, 2017
@nlohmann
Copy link
Owner

@AraHaan Thanks for reporting. I addressed some of the warnings. Could you please rerun the checks on the develop branch (430f035) and post the results here.

@gregmarr Thanks for your evaluation. This really helped!

@AraHaan
Copy link
Author

AraHaan commented Nov 29, 2017

I will see if I can reenable them now and recheck them for json.hpp.

@nlohmann
Copy link
Owner

nlohmann commented Dec 6, 2017

@AraHaan Any news on this?

@AraHaan
Copy link
Author

AraHaan commented Dec 6, 2017

Currently trying to fix something on Windows itself right now that makes Visual Studio 2017 now crash due to OOM and I think it has something to do with wmpnetwk.exe using half of my availible memory on this thing. 🤔 Anyway going to terminate that program so Windows can free that memory and reexecute it so I can properly run Visual Studio.

Will comment back if I find anything on the recheck.

Edit: Here is the current result.

j:\14.4 gb usb\vbtrpdet\libs\json.hpp(209): warning C26412: Do not dereference an invalid pointer (lifetimes rule 1). 'return of what' was invalidated at line 208 by '(unknown)'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(556): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1458): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1520): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1523): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1523): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1523): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1525): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1537): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1547): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(14700): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6162): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6164): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6173): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6175): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6190): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6192): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6200): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6202): warning C26499: Could not find any lifetime tracking information for '*return of ->'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3783): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3777): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3746): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(3740): warning C26499: Could not find any lifetime tracking information for '**this'
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1756): warning C26496: Value pointed to by 'loc' is assigned only once, mark it as a pointer to const. (con.4: https://go.microsoft.com/fwlink/p/?LinkID=784969)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6464): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6465): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6466): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6467): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6477): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6478): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6479): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6480): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6483): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6484): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6485): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6486): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(2682): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1830): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1827): warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1596): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1595): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(7958): warning C26412: Do not dereference a invalid pointer (lifetimes rule 1). 'return of create' was invalidated by 'end of scope for allotemp.2'.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6688): warning C28020: The expression '0<=_Param_(1)&&_Param_(1)<=64-1' is not true at this call.
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6680): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(6688): warning C26482: Only index into arrays using constant expressions. (bounds.2: http://go.microsoft.com/fwlink/p/?LinkID=620414)
j:\14.4 gb usb\vbtrpdet\libs\json.hpp(1625): warning C26490: Don't use reinterpret_cast. (type.1: http://go.microsoft.com/fwlink/p/?LinkID=620417)

@nlohmann
Copy link
Owner

Thanks! I see if I can do anything about this.

@nlohmann
Copy link
Owner

It seems that only those warnings are left which @gregmarr already stated that there is little we can do about.

@AraHaan
Copy link
Author

AraHaan commented Dec 12, 2017

yeah, I agree with that. The best interest is putting json.hpp in an folder that is then excluded from that code check.

@nlohmann
Copy link
Owner

Thanks a lot for reporting. I think we can close this issue as fixing the remaining warnings is not really worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants