byzhang / rapidjson

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

RapidJson fails to build if building with -Werror on Ubuntu 13 #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As a matter of practice, we don't allow warnings in our code, so we build with 
-Wall -Wextra -Werror.  Then, have the person who introduced the warning fix it 
before they can check in (or even get building).

Now, I am trying to add rapidjson to our project.  I copied the include 
directory, in it's entirety (so I get document.h and all it includes), and 
include "rapidjson/document.h".  For the purpose of this bug, a test class's 
constructor simply includes the example code from the wiki.

This gives 400+ lines of compiler warnings, all in rapidjson header files.

For example, The rapidjson.h line 115 gets the following error block (this was 
built without -Werror for the time being):
In file included from ../Json/rapidjson/reader.h:7:0,
                 from ../Json/rapidjson/document.h:4,
                 from ../ConfigurationMgr/CfgMgr.h:5,
                 from ProjectX.cpp:6:
../Json/rapidjson/encodings.h: In static member function ‘static CharType 
rapidjson::UTF8<CharType>::TakeBOM(InputByteStream&)’:
../Json/rapidjson/rapidjson.h:115:17: warning: typedef 
‘StaticAssertTypedef170’ locally defined but not used 
[-Wunused-local-typedefs]
  RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__)
                 ^
../Json/rapidjson/rapidjson.h:111:34: note: in definition of macro 
‘RAPIDJSON_DO_JOIN2’
 #define RAPIDJSON_DO_JOIN2(X, Y) X##Y
                                  ^
../Json/rapidjson/rapidjson.h:109:30: note: in expansion of macro 
‘RAPIDJSON_DO_JOIN’
 #define RAPIDJSON_JOIN(X, Y) RAPIDJSON_DO_JOIN(X, Y)
                              ^
../Json/rapidjson/rapidjson.h:115:2: note: in expansion of macro 
‘RAPIDJSON_JOIN’
  RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__)
  ^
../Json/rapidjson/encodings.h:170:3: note: in expansion of macro 
‘RAPIDJSON_STATIC_ASSERT’
   RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
   ^

What is the expected output? What do you see instead?

I would expect that the code would compile cleanly, without warnings.

What version of the product are you using? On what operating system?

Version was checked out yesterday from the repository.  Not sure the exact 
version.  Ubuntu Linux 13.10 32-bit.

Original issue reported on code.google.com by bckdrmn....@gmail.com on 26 Feb 2014 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by milo...@gmail.com on 20 Jun 2014 at 11:22

GoogleCodeExporter commented 9 years ago
These lines of code should have silent this warning.
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/rapidjson.h#L
129

Original comment by milo...@gmail.com on 30 Jun 2014 at 5:12