scan-build throws error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

scan-build throws error

Vassil Vassilev via cfe-dev
hi,
I used clang(v-8.0) scan-build to build a real OC project, which contains c/cpp/oc code files. Command is "scan-build xcodebuild -workspace .... " , and an error occurs when build cpp files. Here is the error message:

/**a.cpp**/
struct person{
    char name;
    char tel;
    .....
}
....
....
person p ={..}
p.name = ...
p.tel = ...
/**a.cpp**/

  error: no member named 'name' in 'person'
  error: no member named 'tel' in 'person'
  ......
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  Command AnalyzeShallow failed with a nonzero exit code

and build failed.  I tried to use -ferror-limit=0 to no limit errors, but it still build failed with many such errors.
What's the problem? And how to solve it?
Thanks.



_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: scan-build throws error

Vassil Vassilev via cfe-dev
This is a fairly normal compiler error and you should investigate it as such.

It might be caused by clang being passed incorrect flags from scan-build. It may also be caused by clang you're using for analysis being too old.

Does the project build fine without scan-build? I.e., just "xcodebuild ...".

What's the first reported error?

Also note that xcodebuild prints all compile commands to standard output. This means that you can easily investigate this compile error in isolation from scan-build.

On 6/27/20 8:13 PM, 1789955632 via cfe-dev wrote:
hi,
I used clang(v-8.0) scan-build to build a real OC project, which contains c/cpp/oc code files. Command is "scan-build xcodebuild -workspace .... " , and an error occurs when build cpp files. Here is the error message:

/**a.cpp**/
struct person{
    char name;
    char tel;
    .....
}
....
....
person p ={..}
p.name = ...
p.tel = ...
/**a.cpp**/

  error: no member named 'name' in 'person'
  error: no member named 'tel' in 'person'
  ......
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  Command AnalyzeShallow failed with a nonzero exit code

and build failed.  I tried to use -ferror-limit=0 to no limit errors, but it still build failed with many such errors.
What's the problem? And how to solve it?
Thanks.



_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev