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

gcc-4.9.0 compile warnings #111

Open
GoogleCodeExporter opened this issue May 17, 2015 · 1 comment
Open

gcc-4.9.0 compile warnings #111

GoogleCodeExporter opened this issue May 17, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I am getting compiler warnings, see below.
rev.132.

----
/opt/rapidjson-read-only/include/rapidjson/encodings.h: In static member 
function ‘static CharType 
rapidjson::UTF8<CharType>::TakeBOM(InputByteStream&)’:
/opt/rapidjson-read-only/include/rapidjson/rapidjson.h:115:17: warning: typedef 
‘StaticAssertTypedef170’ locally defined but not used 
[-Wunused-local-typedefs]
  RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__)^M
                 ^
/opt/rapidjson-read-only/include/rapidjson/rapidjson.h:111:34: note: in 
definition of macro ‘RAPIDJSON_DO_JOIN2’
 #define RAPIDJSON_DO_JOIN2(X, Y) X##Y^M
                                  ^
/opt/rapidjson-read-only/include/rapidjson/rapidjson.h:109:30: note: in 
expansion of macro ‘RAPIDJSON_DO_JOIN’
 #define RAPIDJSON_JOIN(X, Y) RAPIDJSON_DO_JOIN(X, Y)^M
                              ^
/opt/rapidjson-read-only/include/rapidjson/rapidjson.h:115:2: note: in 
expansion of macro ‘RAPIDJSON_JOIN’
  RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__)^M
  ^
/opt/rapidjson-read-only/include/rapidjson/encodings.h:170:3: note: in 
expansion of macro ‘RAPIDJSON_STATIC_ASSERT’
   RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);^M
   ^
/opt/rapidjson-read-only/include/rapidjson/encodings.h: In static member 
function ‘static 
rapidjson::UTF8<CharType>::Chrapidjson::UTF8<CharType>::Take(InputByteStream&)��
�:

/opt/rapidjson-read-only/include/rapidjson/writer.h:228:42: warning: suggest 
braces around empty body in an ‘if’ statement [-Wempty-body]
     RAPIDJSON_ASSERT(type == kStringType);  // if it's in object, then even number should be a name^M
                                          ^
/opt/rapidjson-read-only/include/rapidjson/writer.h:232:63: warning: suggest 
braces around empty body in an ‘else’ statement [-Wempty-body]
    RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);^M
                                                               ^
/opt/rapidjson-read-only/include/rapidjson/prettywriter.h: In member function 
‘void rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding, 
Allocator>::PrettyPrefix(rapidjson::Type)’:
/opt/rapidjson-read-only/include/rapidjson/prettywriter.h:142:42: warning: 
suggest braces around empty body in an ‘if’ statement [-Wempty-body]
     RAPIDJSON_ASSERT(type == kStringType);  // if it's in object, then even number should be a name^M
                                          ^
/opt/rapidjson-read-only/include/rapidjson/prettywriter.h:146:63: warning: 
suggest braces around empty body in an ‘else’ statement [-Wempty-body]
    RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);^M
                                                               ^
/opt/rapidjson-read-only/include/rapidjson/encodings.h: In static member 
function ‘static 
CharTyperapidjson::UTF8<CharType>::TakeBOM(InputByteStream&)’:

Original issue reported on code.google.com by [email protected] on 1 Jul 2014 at 9:28

@GoogleCodeExporter
Copy link
Author

The first one -Wunused-local-typedefs should have been fixed in 

https://github.com/miloyip/rapidjson/commit/1eb62770d33ed00a4ba1d5048b616e4831ee
603a

For the second one -Wempty-body,

I cannot reproduce it in gcc 4.8.x, can you propose a fix method?

For example, 

if (!level->inArray && level->valueCount % 2 == 0)
    RAPIDJSON_ASSERT(type == kStringType);  // if it's in object, then even number should be a name

change to 

if (!level->inArray && level->valueCount % 2 == 0) {
    RAPIDJSON_ASSERT(type == kStringType);  // if it's in object, then even number 
    (void)type;
}

Will this work?

Besides, please note that the repository has been moved to 
https://github.com/miloyip/rapidjson/

Original comment by [email protected] on 2 Jul 2014 at 1:29

  • Changed state: Accepted

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

No branches or pull requests

1 participant