google-code-export / protobuf

Automatically exported from code.google.com/p/protobuf
Other
1 stars 1 forks source link

clan "scan-build" analysis of generated protobuf code produces warnings. #693

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. generate some c++ code with protobuf
2. use clang "scan-build" to analyse generated code. 

What is the expected output? What do you see instead?
Expect to see no issues. 
clang scan-build reports issues. 

What version of the product are you using? On what operating system?
protobuf 2.4.1
RHEL6 linux. 

Please provide any additional information below.

errors like the following are seen:

  AA71ParameterPayload_descriptor_ = file->message_type(0);
                                    ^~~~~~~~~~~~~~~~~~~~~
       warning: Called C++ object pointer is null

./aa71fw.pb.cc:1061:69: warning: Returning null reference
  if (default_instance_ == NULL) protobuf_AddDesc_aa71fw_2eproto();  return *default_instance_;
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
./aa71fw.pb.cc:1379:69: warning: Returning null reference
  if (default_instance_ == NULL) protobuf_AddDesc_aa71fw_2eproto();  return *default_instance_;
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~

Original issue reported on code.google.com by gahan.ro...@gmail.com on 10 Mar 2015 at 6:30