Small patch: fix a lot of warnings by scan-build on FreeBSD

Hello

(I'm new to LLVM project and I'm not yet familiar with local patch
submission process. So please forgive me if I had to use pull requests
on GitHub or something else instead. BTW link to the HowTo will be
appreciated.)

I'm LLVM/Clang 3.8 user and I discovered that there is a bug in
ccc-analyzer script. Here is a patch that fixes it (see attachment).
Without this patch running scan-build on FreeBSD gives a lot of
warnings like this:

Argument "FreeBSD" isn't numeric in numeric eq (==)
at /usr/local/llvm38/bin/../libexec/ccc-analyzer line 84.

Argument "FreeBSD\n" isn't numeric in numeric eq (==)
at /usr/local/llvm38/bin/../libexec/ccc-analyzer line 84.

Besides newline character is missing in "FreeBSD" string. Patch fixes
this too.

ccc-analyzer-3.8.diff (88 Bytes)

Aleksander Alekseev via llvm-dev <llvm-dev@lists.llvm.org> writes:

Hello

(I'm new to LLVM project and I'm not yet familiar with local patch
submission process. So please forgive me if I had to use pull requests
on GitHub or something else instead. BTW link to the HowTo will be
appreciated.)

Generally patches go to the relevant -commits list. Since this is in the
clang project, that would be cfe-commits. Patches should also use `diff
-u` format, which includes a bit more context. Docs are here:

http://llvm.org/docs/DeveloperPolicy.html#one-off-patches

I'm LLVM/Clang 3.8 user and I discovered that there is a bug in
ccc-analyzer script. Here is a patch that fixes it (see attachment).
Without this patch running scan-build on FreeBSD gives a lot of
warnings like this:

Argument "FreeBSD" isn't numeric in numeric eq (==)
at /usr/local/llvm38/bin/../libexec/ccc-analyzer line 84.

Argument "FreeBSD\n" isn't numeric in numeric eq (==)
at /usr/local/llvm38/bin/../libexec/ccc-analyzer line 84.

Besides newline character is missing in "FreeBSD" string. Patch fixes
this too.

84c84
< } elsif (`uname -s` == "FreeBSD") {
---
> } elsif (`uname -s` eq "FreeBSD\n") {

I'm confused. The "before" line doesn't seem to exist in clang 3.8 (or
in trunk). Line 84 in 3.8 looks like this:

  http://llvm.org/klaus/clang/blob/da7388af1fe5c6329bdd1ab2912daee82d65f421/tools/scan-build/libexec/ccc-analyzer#L-84

Where did you get your sources from?

Hello, Justin

Thanks for your reply.

Where did you get your sources from?

Oops. It's possible there is a bug in FreeBSD port of clang. Its pretty
late here in UTC+3 now, so I will take a closer look on this problem
tomorrow.

> Where did you get your sources from?

Oops. It's possible there is a bug in FreeBSD port of clang. Its
pretty late here in UTC+3 now, so I will take a closer look on this
problem tomorrow.

OK, I filed a bug in FreeBSD's Bugzilla:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208052

Still I wonder maybe FreeBSD patches should be ported to LLVM project
itself? If LLVM requires some patches to work correctly on FreeBSD it
means there is a portability problem in LLVM, right?