viggox / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

Bunch of (harmless) warnings when building on Linux #65

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When building the code on Linux, the output is littered with high number of 
harmless warnings that should be easy to fix.
IMO it is important to make this go away, because the sheer number of the 
warnings (multiplied per each file where this library is used) brings much 
noise in the error reporting.

Thanks for the great library.

./src/sync/../../lib/rapidjson/internal/stack.h:14:7: warning: ‘class 
rapidjson::internal::Stack<rapidjson::CrtAllocator>’ has pointer data members 
[-Weffc++]
./src/sync/../../lib/rapidjson/internal/stack.h:14:7: warning:   but does not 
override ‘rapidjson::internal::Stack<rapidjson::CrtAllocator>(const 
rapidjson::internal::Stack<rapidjson::CrtAllocator>&)’ [-Weffc++]
./src/sync/../../lib/rapidjson/internal/stack.h:14:7: warning:   or 
‘operator=(const rapidjson::internal::Stack<rapidjson::CrtAllocator>&)’ 
[-Weffc++]

./src/sync/../../lib/rapidjson/document.h:702:7: warning: base class ‘class 
rapidjson::GenericValue<rapidjson::UTF8<> >’ has a non-virtual destructor 
[-Weffc++]
./src/sync/../../lib/rapidjson/document.h:702:7: warning: ‘class 
rapidjson::GenericDocument<rapidjson::UTF8<> >’ has pointer data members 
[-Weffc++]
./src/sync/../../lib/rapidjson/document.h:702:7: warning:   but does not 
override ‘rapidjson::GenericDocument<rapidjson::UTF8<> >(const 
rapidjson::GenericDocument<rapidjson::UTF8<> >&)’ [-Weffc++]

./src/sync/../../lib/rapidjson/allocators.h:76:7: warning: ‘class 
rapidjson::MemoryPoolAllocator<>’ has pointer data members [-Weffc++]
./src/sync/../../lib/rapidjson/allocators.h:76:7: warning:   but does not 
override ‘rapidjson::MemoryPoolAllocator<>(const 
rapidjson::MemoryPoolAllocator<>&)’ [-Weffc++]
./src/sync/../../lib/rapidjson/allocators.h:76:7: warning:   or 
‘operator=(const rapidjson::MemoryPoolAllocator<>&)’ [-Weffc++]

./src/sync/../../lib/rapidjson/document.h: In destructor 
‘rapidjson::GenericValue<Encoding, Allocator>::~GenericValue() [with Encoding 
= rapidjson::UTF8<>, Allocator = rapidjson::MemoryPoolAllocator<>]’:
./src/sync/../../lib/rapidjson/document.h:702:7:   instantiated from here
./src/sync/../../lib/rapidjson/document.h:140:4: warning: switch missing 
default case [-Wswitch-default]

./src/sync/../../lib/rapidjson/document.h: In member function ‘const 
rapidjson::GenericValue<Encoding, Allocator>& rapidjson::GenericValue<Encoding, 
Allocator>::Accept(Handler&) const [with Handler = 
rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >, 
Encoding = rapidjson::UTF8<>, Allocator = rapidjson::MemoryPoolAllocator<>, 
rapidjson::GenericValue<Encoding, Allocator> = 
rapidjson::GenericValue<rapidjson::UTF8<> >]’:
./src/sync/../../lib/rapidjson/document.h:522:3: warning: switch missing 
default case [-Wswitch-default]

./src/sync/../../lib/rapidjson/document.h:77:2: warning: 
‘rapidjson::GenericValue<rapidjson::UTF8<> >::data_’ should be initialized 
in the member initialization list [-Weffc++]

./src/sync/../../lib/rapidjson/reader.h:205:7: warning: ‘class 
rapidjson::GenericReader<rapidjson::UTF8<>, rapidjson::UTF8<> >’ has pointer 
data members [-Weffc++]
./src/sync/../../lib/rapidjson/reader.h:205:7: warning:   but does not override 
‘rapidjson::GenericReader<rapidjson::UTF8<>, rapidjson::UTF8<> >(const 
rapidjson::GenericReader<rapidjson::UTF8<>, rapidjson::UTF8<> >&)’ [-Weffc++]
./src/sync/../../lib/rapidjson/reader.h:205:7: warning:   or ‘operator=(const 
rapidjson::GenericReader<rapidjson::UTF8<>, rapidjson::UTF8<> >&)’ [-Weffc++]

./src/sync/../../lib/rapidjson/document.h:130:2: warning: 
‘rapidjson::GenericValue<rapidjson::UTF8<> >::data_’ should be initialized 
in the member initialization list [-Weffc++]
./src/sync/../../lib/rapidjson/document.h:130:2: warning: 
‘rapidjson::GenericValue<rapidjson::UTF8<> >::flags_’ should be initialized 
in the member initialization list [-Weffc++]

./src/sync/../../lib/rapidjson/document.h:84:2: warning: 
‘rapidjson::GenericValue<rapidjson::UTF8<> >::data_’ should be initialized 
in the member initialization list [-Weffc++]

./src/sync/../../lib/rapidjson/writer.h:167:5: warning: "_MSC_VER" is not 
defined [-Wundef]

Original issue reported on code.google.com by helix.sp...@gmail.com on 11 Apr 2013 at 9:50

GoogleCodeExporter commented 8 years ago
Few more from Solaris:
./src/sync/../../lib/rapidjson/document.h:28: warning: #pragma pack(push[, id], 
<n>) is not supported on this target
./src/sync/../../lib/rapidjson/document.h:687: warning: #pragma pack(pop[, id], 
<n>) is not supported on this target

Original comment by helix.sp...@gmail.com on 3 May 2013 at 7:51

GoogleCodeExporter commented 8 years ago
It seems that SunStudio 12.3 compiler (installed and run on Linux) handles the 
code pretty bad:

"./src/sync/../../lib/rapidjson/encodings.h", line 452: Warning: Identifier 
expected instead of "}".
"./src/sync/../../lib/rapidjson/rapidjson.h", line 252: Warning: Identifier 
expected instead of "}".
"./src/sync/../../lib/rapidjson/reader.h", line 43: Warning: Identifier 
expected instead of "}".
"./src/sync/../../lib/rapidjson/document.h", line 28: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 28: Error: Missing ')' in 
#pragma.
"./src/sync/../../lib/rapidjson/document.h", line 28: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 687: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 687: Error: Missing ')' in 
#pragma.
"./src/sync/../../lib/rapidjson/document.h", line 687: Error: Syntax error in 
pragma. 

Original comment by helix.sp...@gmail.com on 9 May 2013 at 6:44

GoogleCodeExporter commented 8 years ago
Recently some gcc/clang warnings have been resolved.
Can you download a latest version at https://github.com/miloyip/rapidjson and 
verify it on your platforms?
Thank you very much.

Original comment by milo...@gmail.com on 30 Jun 2014 at 6:53

GoogleCodeExporter commented 8 years ago
Unfortunately, the warnings are still numerous (I've used latest master as of 
today, downloaded as .zip file).

Attached is the latest log from Linux build (gcc 4.8.1).
Note that there may be lots of duplicated reports in the log.

Original comment by helix.sp...@gmail.com on 2 Jul 2014 at 11:13

Attachments:

GoogleCodeExporter commented 8 years ago
https://github.com/miloyip/rapidjson/pull/40

The fixes has been merged 8 hours ago (while I saw you commented 13 hours) from 
now.
Currently, -Werror -Wall -Wextra -Weffc++ is turned on.

From the continuous integration, it has no warnings. 
https://travis-ci.org/miloyip/rapidjson/builds/28986504

Hopefully this works.

Original comment by milo...@gmail.com on 3 Jul 2014 at 1:14

GoogleCodeExporter commented 8 years ago
Great! 
Just fetched and tried the latest code, practically all issues seems to be 
solved except these two:

In file included from ./src/sync/SyncClientAdmin.cpp:3:0:
./src/sync/../../lib/rapidjson/document.h: In instantiation of 
‘rapidjson::GenericValue<Encoding, Allocator>::~GenericValue() [with Encoding 
= rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>]’:
./src/sync/../../lib/rapidjson/document.h:798:7:   required from here
./src/sync/../../lib/rapidjson/document.h:166:4: warning: switch missing 
default case [-Wswitch-default]
    switch(flags_) {
    ^
In file included from ./src/sync/SyncClientAdmin.cpp:3:0:
./src/sync/../../lib/rapidjson/document.h: In instantiation of ‘const 
rapidjson::GenericValue<Encoding, Allocator>& rapidjson::GenericValue<Encoding, 
Allocator>::Accept(Handler&) const [with Handler = 
rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >; 
Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>]’:
./src/sync/SyncClientAdmin.cpp:152:24:   required from here
./src/sync/../../lib/rapidjson/document.h:616:3: warning: switch missing 
default case [-Wswitch-default]
   switch(GetType()) {
   ^

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 7:28

GoogleCodeExporter commented 8 years ago
Bad news, FreeBSD 10 (clang v3.3) compilation fails with these errors:

In file included from ./src/sync/../../lib/rapidjson/document.h:4:
./src/sync/../../lib/rapidjson/reader.h:622:17: error: use of undeclared 
identifier 'UINT64_C'
                                        if (i64 >= UINT64_C(922337203685477580)) // 2^63 = 9223372036854775808
                                                   ^
./src/sync/../../lib/rapidjson/reader.h:623:18: error: use of undeclared 
identifier 'UINT64_C'
                                                if (i64 != UINT64_C(922337203685477580) || s.Peek() > '8') {
                                                           ^
./src/sync/../../lib/rapidjson/reader.h:631:17: error: use of undeclared 
identifier 'UINT64_C'
                                        if (i64 >= UINT64_C(1844674407370955161)) // 2^64 - 1 = 18446744073709551615
                                                   ^
./src/sync/../../lib/rapidjson/reader.h:632:18: error: use of undeclared 
identifier 'UINT64_C'
                                                if (i64 != UINT64_C(1844674407370955161) || s.Peek() > '5') {
                                                           ^
In file included from ./src/sync/SyncClientAdmin.cpp:3:
./src/sync/../../lib/rapidjson/document.h:121:39: error: use of undeclared 
identifier 'UINT64_C'
                        if (!(static_cast<uint64_t>(i64) & UINT64_C(0xFFFFFFFF00000000)))
                                                           ^
./src/sync/../../lib/rapidjson/document.h:123:39: error: use of undeclared 
identifier 'UINT64_C'
                        if (!(static_cast<uint64_t>(i64) & UINT64_C(0xFFFFFFFF80000000)))
                                                           ^
./src/sync/../../lib/rapidjson/document.h:126:19: error: use of undeclared 
identifier 'INT64_C'
                else if (i64 >= INT64_C(-2147483648))
                                ^
./src/sync/../../lib/rapidjson/document.h:133:15: error: use of undeclared 
identifier 'UINT64_C'
                if (!(u64 & UINT64_C(0x8000000000000000)))
                            ^
./src/sync/../../lib/rapidjson/document.h:135:15: error: use of undeclared 
identifier 'UINT64_C'
                if (!(u64 & UINT64_C(0xFFFFFFFF00000000)))
                            ^
./src/sync/../../lib/rapidjson/document.h:137:15: error: use of undeclared 
identifier 'UINT64_C'
                if (!(u64 & UINT64_C(0xFFFFFFFF80000000)))
                            ^

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 8:07

GoogleCodeExporter commented 8 years ago
UINT64_C needs this

// rapidjson.h

#  define __STDC_CONSTANT_MACROS 1 // required by C++ standard

// before
#include <intypes.h>

But some other headers before rapidjson.h may have directly/indirectly include 
intypes.h without defining __STDC_CONSTANT_MACROS.

You may try to define it in compiler option -D__STDC_CONSTANT_MACROS=1

It is so difficult to get the 64-bit constants correctly defined. Without using 
these macros different compilers generate different warnings.

If you know some better way, please tell.

Original comment by milo...@gmail.com on 3 Jul 2014 at 8:31

GoogleCodeExporter commented 8 years ago
Will test that tip, thanks.
In the meantime, here are the results from Solaris 11 (gcc 3.4.3):

../../src/sync/../../lib/rapidjson/encodings.h:7: warning: ignoring #pragma GCC 
diagnostic
../../src/sync/../../lib/rapidjson/encodings.h:8: warning: ignoring #pragma GCC 
diagnostic
../../src/sync/../../lib/rapidjson/encodings.h:533: warning: ignoring #pragma 
GCC diagnostic
In file included from ../../src/sync/SyncClientAdmin.cpp:3:
../../src/sync/../../lib/rapidjson/document.h:14: warning: ignoring #pragma GCC 
diagnostic
../../src/sync/../../lib/rapidjson/document.h:15: warning: ignoring #pragma GCC 
diagnostic
../../src/sync/../../lib/rapidjson/document.h:49: warning: #pragma pack(push[, 
id], <n>) is not supported on this target
../../src/sync/../../lib/rapidjson/document.h:783: warning: #pragma pack(pop[, 
id], <n>) is not supported on this target
../../src/sync/../../lib/rapidjson/document.h:971: warning: ignoring #pragma 
GCC diagnostic
In file included from ../../src/sync/SyncClientAdmin.cpp:4:
../../src/sync/../../lib/rapidjson/prettywriter.h:7: warning: ignoring #pragma 
GCC diagnostic
../../src/sync/../../lib/rapidjson/prettywriter.h:8: warning: ignoring #pragma 
GCC diagnostic
../../src/sync/../../lib/rapidjson/prettywriter.h:180: warning: ignoring 
#pragma GCC diagnostic
../../src/sync/../../lib/rapidjson/document.h: In instantiation of 
`rapidjson::GenericDocument<rapidjson::UTF8<char>, 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >':
../../src/sync/SyncClientAdmin.cpp:142:   instantiated from here
../../src/sync/../../lib/rapidjson/document.h:798: warning: base class `class 
rapidjson::GenericValue<rapidjson::UTF8<char>, 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >' has a non-virtual 
destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/al
locator.h: In instantiation of `std::allocator<UserInfo>':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79:   instantiated from `std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:110:   instantiated from `std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142:   instantiated from `std::vector<UserInfo, 
std::allocator<UserInfo> >'
../../src/sync/SyncClientAdmin.cpp:395:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/al
locator.h:81: warning: base class `class __gnu_cxx::new_allocator<UserInfo>' 
has a non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h: In instantiation of `std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:110:   instantiated from `std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142:   instantiated from `std::vector<UserInfo, 
std::allocator<UserInfo> >'
../../src/sync/SyncClientAdmin.cpp:395:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning: base class `class std::allocator<UserInfo>' has a 
non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning: `struct std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl' has pointer data members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning:   but does not override `std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl(const std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning:   or `operator=(const std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >::_Vector_impl&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h: In instantiation of `std::vector<UserInfo, std::allocator<UserInfo> 
>':
../../src/sync/SyncClientAdmin.cpp:395:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142: warning: base class `struct std::_Vector_base<UserInfo, 
std::allocator<UserInfo> >' has a non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/al
locator.h: In instantiation of `std::allocator<DocumentInfo>':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79:   instantiated from `std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >::_Vector_impl'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:110:   instantiated from `std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142:   instantiated from `std::vector<DocumentInfo, 
std::allocator<DocumentInfo> >'
../../src/sync/SyncClientAdmin.cpp:446:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/al
locator.h:81: warning: base class `class 
__gnu_cxx::new_allocator<DocumentInfo>' has a non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h: In instantiation of `std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >::_Vector_impl':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:110:   instantiated from `std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142:   instantiated from `std::vector<DocumentInfo, 
std::allocator<DocumentInfo> >'
../../src/sync/SyncClientAdmin.cpp:446:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning: base class `class std::allocator<DocumentInfo>' has a 
non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning: `struct std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >::_Vector_impl' has pointer data members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning:   but does not override 
`std::_Vector_base<DocumentInfo, std::allocator<DocumentInfo> 
>::_Vector_impl(const std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >::_Vector_impl&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:79: warning:   or `operator=(const std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >::_Vector_impl&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h: In instantiation of `std::vector<DocumentInfo, 
std::allocator<DocumentInfo> >':
../../src/sync/SyncClientAdmin.cpp:446:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:142: warning: base class `struct std::_Vector_base<DocumentInfo, 
std::allocator<DocumentInfo> >' has a non-virtual destructor
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h: In instantiation of `__gnu_cxx::__normal_iterator<UserInfo*, 
std::vector<UserInfo, std::allocator<UserInfo> > >':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:701:   instantiated from `void std::vector<_Tp, _Alloc>::clear() 
[with _Tp = UserInfo, _Alloc = std::allocator<UserInfo>]'
../../src/sync/SyncClientAdmin.cpp:395:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning: `class __gnu_cxx::__normal_iterator<UserInfo*, 
std::vector<UserInfo, std::allocator<UserInfo> > >' has pointer data members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   but does not override 
`__gnu_cxx::__normal_iterator<UserInfo*, std::vector<UserInfo, 
std::allocator<UserInfo> > >(const __gnu_cxx::__normal_iterator<UserInfo*, 
std::vector<UserInfo, std::allocator<UserInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   or `operator=(const 
__gnu_cxx::__normal_iterator<UserInfo*, std::vector<UserInfo, 
std::allocator<UserInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h: In instantiation of `__gnu_cxx::__normal_iterator<DocumentInfo*, 
std::vector<DocumentInfo, std::allocator<DocumentInfo> > >':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:701:   instantiated from `void std::vector<_Tp, _Alloc>::clear() 
[with _Tp = DocumentInfo, _Alloc = std::allocator<DocumentInfo>]'
../../src/sync/SyncClientAdmin.cpp:446:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning: `class __gnu_cxx::__normal_iterator<DocumentInfo*, 
std::vector<DocumentInfo, std::allocator<DocumentInfo> > >' has pointer data 
members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   but does not override 
`__gnu_cxx::__normal_iterator<DocumentInfo*, std::vector<DocumentInfo, 
std::allocator<DocumentInfo> > >(const 
__gnu_cxx::__normal_iterator<DocumentInfo*, std::vector<DocumentInfo, 
std::allocator<DocumentInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   or `operator=(const 
__gnu_cxx::__normal_iterator<DocumentInfo*, std::vector<DocumentInfo, 
std::allocator<DocumentInfo> > >&)'
../../src/sync/../../lib/rapidjson/rapidjson.h: In instantiation of 
`rapidjson::GenericStringStream<rapidjson::UTF8<char> >':
../../src/sync/../../lib/rapidjson/document.h:870:   instantiated from 
`rapidjson::GenericDocument<Encoding, Allocator>& 
rapidjson::GenericDocument<Encoding, Allocator>::Parse(const typename 
Encoding::Ch*) [with unsigned int parseFlags = 0u, SourceEncoding = 
rapidjson::UTF8<char>, Encoding = rapidjson::UTF8<char>, Allocator = 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>]'
../../src/sync/../../lib/rapidjson/document.h:876:   instantiated from 
`rapidjson::GenericDocument<Encoding, Allocator>& 
rapidjson::GenericDocument<Encoding, Allocator>::Parse(const typename 
Encoding::Ch*) [with unsigned int parseFlags = 0u, Encoding = 
rapidjson::UTF8<char>, Allocator = 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>]'
../../src/sync/SyncClientAdmin.cpp:254:   instantiated from here
../../src/sync/../../lib/rapidjson/rapidjson.h:226: warning: `struct 
rapidjson::GenericStringStream<rapidjson::UTF8<char> >' has pointer data members
../../src/sync/../../lib/rapidjson/rapidjson.h:226: warning:   but does not 
override `rapidjson::GenericStringStream<rapidjson::UTF8<char> >(const 
rapidjson::GenericStringStream<rapidjson::UTF8<char> >&)'
../../src/sync/../../lib/rapidjson/rapidjson.h:226: warning:   or 
`operator=(const rapidjson::GenericStringStream<rapidjson::UTF8<char> >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h: In instantiation of `__gnu_cxx::__normal_iterator<const 
UserInfo*, std::vector<UserInfo, std::allocator<UserInfo> > >':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:375:   instantiated from `size_t std::vector<_Tp, _Alloc>::size() 
const [with _Tp = UserInfo, _Alloc = std::allocator<UserInfo>]'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/ve
ctor.tcc:242:   instantiated from `void std::vector<_Tp, 
_Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, 
std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = UserInfo, _Alloc = 
std::allocator<UserInfo>]'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:564:   instantiated from `void std::vector<_Tp, 
_Alloc>::push_back(const _Tp&) [with _Tp = UserInfo, _Alloc = 
std::allocator<UserInfo>]'
../../src/sync/SyncClientAdmin.cpp:404:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning: `class __gnu_cxx::__normal_iterator<const UserInfo*, 
std::vector<UserInfo, std::allocator<UserInfo> > >' has pointer data members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   but does not override 
`__gnu_cxx::__normal_iterator<const UserInfo*, std::vector<UserInfo, 
std::allocator<UserInfo> > >(const __gnu_cxx::__normal_iterator<const 
UserInfo*, std::vector<UserInfo, std::allocator<UserInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   or `operator=(const 
__gnu_cxx::__normal_iterator<const UserInfo*, std::vector<UserInfo, 
std::allocator<UserInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h: In instantiation of `__gnu_cxx::__normal_iterator<const 
DocumentInfo*, std::vector<DocumentInfo, std::allocator<DocumentInfo> > >':
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:375:   instantiated from `size_t std::vector<_Tp, _Alloc>::size() 
const [with _Tp = DocumentInfo, _Alloc = std::allocator<DocumentInfo>]'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/ve
ctor.tcc:242:   instantiated from `void std::vector<_Tp, 
_Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, 
std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = DocumentInfo, _Alloc = 
std::allocator<DocumentInfo>]'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_vector.h:564:   instantiated from `void std::vector<_Tp, 
_Alloc>::push_back(const _Tp&) [with _Tp = DocumentInfo, _Alloc = 
std::allocator<DocumentInfo>]'
../../src/sync/SyncClientAdmin.cpp:461:   instantiated from here
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning: `class __gnu_cxx::__normal_iterator<const 
DocumentInfo*, std::vector<DocumentInfo, std::allocator<DocumentInfo> > >' has 
pointer data members
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   but does not override 
`__gnu_cxx::__normal_iterator<const DocumentInfo*, std::vector<DocumentInfo, 
std::allocator<DocumentInfo> > >(const __gnu_cxx::__normal_iterator<const 
DocumentInfo*, std::vector<DocumentInfo, std::allocator<DocumentInfo> > >&)'
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../../include/c++/3.4.3/bits/st
l_iterator.h:587: warning:   or `operator=(const 
__gnu_cxx::__normal_iterator<const DocumentInfo*, std::vector<DocumentInfo, 
std::allocator<DocumentInfo> > >&)'
../../src/sync/../../lib/rapidjson/document.h: In destructor 
`rapidjson::GenericValue<Encoding, Allocator>::~GenericValue() [with Encoding = 
rapidjson::UTF8<char>, Allocator = 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>]':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In constructor 
`rapidjson::GenericDocument<Encoding, Allocator>::GenericDocument(Allocator*, 
size_t) [with Encoding = rapidjson::UTF8<char>, Allocator = 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>]':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `const 
rapidjson::GenericValue<Encoding, Allocator>& rapidjson::GenericValue<Encoding, 
Allocator>::Accept(Handler&) const [with Handler = 
rapidjson::Writer<rapidjson::StringBuffer, rapidjson::UTF8<char>, 
rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> 
>, Encoding = rapidjson::UTF8<char>, Allocator = 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>]':
../../src/sync/../../lib/rapidjson/document.h:647: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::DownloadDocument(int, const char*, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::DeleteDocument(int, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::SetUserPassword(int, const char*, const char*, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::DeleteUser(int, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::Login(std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `int 
SyncClientAdmin::AddDocument(DocumentInfo&, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::ListDocuments(std::vector<DocumentInfo, 
std::allocator<DocumentInfo> >&, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `bool 
SyncClientAdmin::ListUsers(std::vector<UserInfo, std::allocator<UserInfo> >&, 
std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h: In member function `int 
SyncClientAdmin::CreateUser(const char*, const char*, std::string&)':
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case
../../src/sync/../../lib/rapidjson/document.h:183: warning: switch missing 
default case

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 9:35

GoogleCodeExporter commented 8 years ago
Sorry, some of the warnings unrelated to rapidjson slipped in the log above :(

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 9:54

GoogleCodeExporter commented 8 years ago
I can confirm that defining -D__STDC_CONSTANT_MACROS=1 solved the issue on 
FreeBSD 10. Thanks for the tip.

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 10:05

GoogleCodeExporter commented 8 years ago
SunStudio 12.3 compiler errors are still unresolved:
"./src/sync/../../lib/rapidjson/document.h", line 49: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 49: Error: Missing ')' in 
#pragma.
"./src/sync/../../lib/rapidjson/document.h", line 49: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 783: Error: Syntax error in 
pragma.
"./src/sync/../../lib/rapidjson/document.h", line 783: Error: Missing ')' in 
#pragma.
"./src/sync/../../lib/rapidjson/document.h", line 783: Error: Syntax error in 
pragma.

Original comment by helix.sp...@gmail.com on 3 Jul 2014 at 10:34

GoogleCodeExporter commented 8 years ago
Hopefully this may help as well. Here is a printout of cppcheck static analysis 
program when run on rapidjson (mostly suggestions to make some funcs const or 
static):

        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="220"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="224"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="220"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="239"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="220"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="257"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="257"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="258"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="349"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="353"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="349"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="360"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." verbose="The typedef 'StaticAssertTypedef__LINE__' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="349"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\encodings.h" line="368"/>
        </error>
        <error id="variableHidingTypedef" severity="style" msg="The typedef 'Ch' hides a typedef with the same name." verbose="The typedef 'Ch' hides a typedef with the same name." inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="279"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="472"/>
        </error>
        <error id="cstyleCast" severity="style" msg="C-style pointer casting" verbose="C-style pointer casting">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\allocators.h" line="199"/>
        </error>
        <error id="cstyleCast" severity="style" msg="C-style pointer casting" verbose="C-style pointer casting">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\document.h" line="504"/>
        </error>
        <error id="cstyleCast" severity="style" msg="C-style pointer casting" verbose="C-style pointer casting">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\document.h" line="742"/>
        </error>
        <error id="duplicateExpression" severity="style" msg="Same expression on both sides of '&&'." verbose="Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="420"/>
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="420"/>
        </error>
        <error id="functionConst" severity="style" msg="Technically the member function 'rapidjson::MemoryPoolAllocator::Capacity' can be const." verbose="The member function 'rapidjson::MemoryPoolAllocator::Capacity' can be made a const function. Making this function 'const' should not cause compiler errors. Even though the function can be made const function technically it may not make sense conceptually. Think about your design and the task of the function first - is it a function that must not change object internal state?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\allocators.h" line="133"/>
        </error>
        <error id="functionConst" severity="style" msg="Technically the member function 'rapidjson::MemoryPoolAllocator::Size' can be const." verbose="The member function 'rapidjson::MemoryPoolAllocator::Size' can be made a const function. Making this function 'const' should not cause compiler errors. Even though the function can be made const function technically it may not make sense conceptually. Think about your design and the task of the function first - is it a function that must not change object internal state?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\allocators.h" line="143"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::Peek' can be static." verbose="The member function 'rapidjson::GenericStringStream::Peek' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="231"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::Take' can be static." verbose="The member function 'rapidjson::GenericStringStream::Take' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="232"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::Tell' can be static." verbose="The member function 'rapidjson::GenericStringStream::Tell' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="233"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::Put' can be static." verbose="The member function 'rapidjson::GenericStringStream::Put' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="236"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::Flush' can be static." verbose="The member function 'rapidjson::GenericStringStream::Flush' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="237"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringStream::PutEnd' can be static." verbose="The member function 'rapidjson::GenericStringStream::PutEnd' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="238"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::Peek' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::Peek' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="265"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::Take' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::Take' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="266"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::Tell' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::Tell' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="267"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::Put' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::Put' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="271"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::Flush' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::Flush' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="272"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericInsituStringStream::PutEnd' can be static." verbose="The member function 'rapidjson::GenericInsituStringStream::PutEnd' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\rapidjson.h" line="273"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::BaseReaderHandler::Default' can be static." verbose="The member function 'rapidjson::BaseReaderHandler::Default' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="114"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericReader::ParseValue' can be static." verbose="The member function 'rapidjson::GenericReader::ParseValue' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\reader.h" line="739"/>
        </error>
        <error id="functionStatic" severity="performance" msg="Technically the member function 'rapidjson::GenericStringBuffer::Flush' can be static." verbose="The member function 'rapidjson::GenericStringBuffer::Flush' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
            <location file="c:\temp\notecase_pro-3.9.2\lib\rapidjson\stringbuffer.h" line="22"/>
        </error>

Original comment by helix.sp...@gmail.com on 4 Jul 2014 at 7:37

GoogleCodeExporter commented 8 years ago
Few tips by PVS-Studio static analysis (sorry, I don't own a license, so no 
line details):
V690 The 'StackStream' class implements the '=' operator, but lacks a copy 
constructor. It is dangerous to use such a class. TRIAL RESTRICTION 470
V690 The 'GenericDocument' class implements the '=' operator, but lacks a copy 
constructor. It is dangerous to use such a class. TRIAL RESTRICTION 798

Original comment by helix.sp...@gmail.com on 4 Jul 2014 at 8:51

GoogleCodeExporter commented 8 years ago

Original comment by milo...@gmail.com on 4 Jul 2014 at 9:12

GoogleCodeExporter commented 8 years ago
Fixed -Wswitch-default

https://github.com/miloyip/rapidjson/commit/e2cd486e6e0ea76cb39f2a322bcd12bcfb18
29fd

Original comment by milo...@gmail.com on 4 Jul 2014 at 9:32

GoogleCodeExporter commented 8 years ago
"The typedef 'Ch' hides a typedef with the same name.": wrong alarm, cannot 
fixed.

"The typedef 'Ch' hides a typedef with the same name.": wrong alarm, cannot be 
fixed.

"C-style pointer casting": fixed

"Same expression on both sides of '&&'.": wrong alarm, cannot be fixed.

"Technically the member function 'rapidjson::MemoryPoolAllocator::Capacity' can 
be const.": fixed

"Technically the member function 'rapidjson::MemoryPoolAllocator::Size' can be 
const.": fixed

"Technically the member function 'rapidjson::GenericStringStream::Peek' can be 
static." and similar ones: wrong alarm, cannot be fixed.

https://github.com/miloyip/rapidjson/commit/d9c02b5b7927f9a5ff45473644d535bd7883
cb5f

Original comment by milo...@gmail.com on 4 Jul 2014 at 11:57

GoogleCodeExporter commented 8 years ago
"V690 The 'StackStream' class implements the '=' operator, but lacks a copy 
constructor. It is dangerous to use such a class. TRIAL RESTRICTION 470" : Fixed

"V690 The 'GenericDocument' class implements the '=' operator, but lacks a copy 
constructor. It is dangerous to use such a class. TRIAL RESTRICTION 798" : 
Intended, not fixed.

https://github.com/miloyip/rapidjson/commit/96882f4977f2711c825c1b9b5426fd04aca5
fddd

Original comment by milo...@gmail.com on 4 Jul 2014 at 12:19

GoogleCodeExporter commented 8 years ago
For pragma issue, can you propose a working solution on your platforms?
Thanks.

Original comment by milo...@gmail.com on 4 Jul 2014 at 12:20

GoogleCodeExporter commented 8 years ago
Thanks, the new code fixes all Linux warnings for me (will report issues for 
other platforms if found later).

To fix the sunstudio compiler errors, you should enclose following pragma lines 
in document.h:
#pragma pack (push, 4)
#pragma pack (pop)

with this block:
#if !defined(__sun) && !defined(__SVR4) && !defined(__SUNPRO_CC)

#endif

Tested and it works fine here. Not that for this specific compiler it might be 
enough to use only __SUNPRO_CC, but in that case it might not work on other 
compilers for this platform.

Original comment by helix.sp...@gmail.com on 7 Jul 2014 at 7:57

GoogleCodeExporter commented 8 years ago
Tested the version from yesterday, and one behavior breaks my existing code.
The following line no longer compiles on Visual Studio 2008:

document.AddMember("note", szNoteID, document.GetAllocator());

error is:

error C2664: 'rapidjson::GenericValue<Encoding> 
&rapidjson::GenericValue<Encoding>::AddMember(rapidjson::GenericValue<Encoding> 
&,rapidjson::GenericValue<Encoding> &,Allocator &)' : cannot convert parameter 
1 from 'const char [5]' to 'rapidjson::GenericValue<Encoding> &'
1>        with
1>        [
1>            Encoding=rapidjson::UTF8<>,
1>            Allocator=rapidjson::MemoryPoolAllocator<>
1>        ]
1>        and
1>        [
1>            Encoding=rapidjson::UTF8<>
1>        ]

Original comment by helix.sp...@gmail.com on 28 Jul 2014 at 11:18

GoogleCodeExporter commented 8 years ago
The error is likely related to the refined (constant) string handling in recent 
versions of RapidJSON, see https://github.com/miloyip/rapidjson/pull/57

Assuming 'szNoteID' is a '(const) char*' with sufficient lifetime (won't be 
deallocated until 'document' is destroyed), you can mark the plain pointer as 
"constant string" by using the 'StringRef' function:

document.AddMember("note", rapidjson::StringRef(szNoteID), 
document.GetAllocator());

If you need to copy the string contents, use a temporary value instead:

document.AddMember("note", Value(szNoteID,document.GetAllocator()).Move(), 
document.GetAllocator());

See also http://miloyip.github.io/rapidjson/md_doc_tutorial.html#ModifyObject

hth,
Philipp

Original comment by philipp....@gmail.com on 28 Jul 2014 at 2:07

GoogleCodeExporter commented 8 years ago
Actually, the error refers to the 1st parameter, being "note".

IMO, a change like this can break quite a lot of existing code, so some 
specialized constructor to convert const char * to desired object should exist.

Original comment by helix.sp...@gmail.com on 29 Jul 2014 at 5:05

GoogleCodeExporter commented 8 years ago
I have just confirmed, that my suggestion works as expected.  Please give it a 
try.

  It's not my fault, that the compiler complains about the first AddMember(Value&,Value&) overload and doesn't mention the causes for why the other AddMember overloads are not considered.

String _literals_ ("note" in this case) are allowed.  Just plain _pointers_ are 
no longer accepted to avoid coding errors due to insufficient lifetime.

Original comment by philipp....@gmail.com on 29 Jul 2014 at 5:49

GoogleCodeExporter commented 8 years ago
You are right, changing the code for the 2nd parameter makes the warning about 
1st parameter go away. Strange!

Thanks for your help.

Original comment by helix.sp...@gmail.com on 29 Jul 2014 at 8:21