Author Topic: Static Code Analysis: Valve Style  (Read 1959 times)

0 Members and 1 Guest are viewing this topic.

Offline niffiwan

  • 211
  • Eluder Class
Static Code Analysis: Valve Style
This is an interesting read that I stumbled across today, there's some tips in there for VS, gcc & clang.

http://randomascii.wordpress.com/2013/06/24/two-years-and-thousands-of-bugs-of-static-analysis/
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Static Code Analysis: Valve Style
well, i've ran fso antipodes r9580 debug build compilation through it. have fun with the results: download

beware, the uncompressed folder is 844MB

for the record my system is 3.8.13-gentoo, x64, running on a core i7 860, 8 gigs of ram, and this is my trivial compile script

Code: [Select]
#!/bin/bash
CC="clang"
CXX="clang++"
CFLAGS="-march=native -pipe"
CXXFLAGS="${CFLAGS}"
cd ~/dev/FSO_Antipodes

make clean
scan-build -v -o ~/temp/clangOut ./configure CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" --enable-debug #CC=${CC} CXX=${CXX}
scan-build -v -o ~/temp/clangOut make -j8

also, FSO compiles fine with clang, but i havent tried running anything with it yet.

(if its useful to anyone, yay, if not, oh well)

[edit] running a recompile now, since i missed nice little detail about the compile script which resulted in CXXFLAGS not being applied at all. if my explicit declaration of -std=c++0x is slightly retarded, call me out on it.
[edit 2]yeah, it doesnt compile with the -std=c++0x, and i'm not about to go debug it specifically. the stuff that i linked for download should be accurate for a normal compile without the -std=c++0x option.
[edit 3]fixed the download so that it actually works.
« Last Edit: July 12, 2013, 09:04:12 am by pecenipicek »
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 
Re: Static Code Analysis: Valve Style
the things people will do to avoid using a language with a proper type system
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Static Code Analysis: Valve Style
the things people will do to avoid using a language with a proper type system

Please elaborate. C/C++ seem to have a rather solid type system already (unlike, say, Lua).
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Static Code Analysis: Valve Style
Here's a proper package containing the analysis for trunk r9720.

I should've looked at the latest commit log for antipodes... :p
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

  
Re: Static Code Analysis: Valve Style
the things people will do to avoid using a language with a proper type system

Please elaborate. C/C++ seem to have a rather solid type system already (unlike, say, Lua).

By which you mean they have an (explicit) type system; which, as far as the programming mainstream goes, is about the furthest you'll go. But if you look at something like e.g. Haskell's type system, it's worlds ahead of C's crude byte-counter, and there's stuff that's even more sophisticated still, and in which something as primitive as printf would be completely crazy.
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.