Use Clang Static Analyzer to analyze C & C++ code

Clang includes a promising open source static analyzer to analyze C, C++ and Objective-C source code. Once you compile it from Clang source, it is very easy to use.

  • Implemented as a C++ library and can be used by third party programs
  • Can run as a standalone program or within Xcode (specific to Mac OS X development).
  • Open source
Current Limitations
  • It is a work-in-progress so expect lack of precision and reduced scope of analysis
  • Static analysis does a deeper code analysis and takes longer than normal compilation
  • False positives may show up in the results as with any other static analysis too
  • There is scope for adding more checks or analysis points
  • To use it, you have to get the Git source of LLVM and Clang and compile them first. Follow the instructions here.
  • The static analysis tools scan-build and scan-view are not compiled by default. You need to compile them separately using Clang. Follow the instructions here.

Usage is very simple. Once scan-build is compiled, invoke it along with your program’s normal make process:

$ scan-build --use-analyzer=/usr/local/bin/clang++ make

1. Using Clang’s static analyzer to analyze your project
2. Clang Static Analyzer
3. Obtaining the Static Analyzer (Other Platforms)
4. Getting Started: Building and Running Clang

Useful tools on Ubuntu (I)

ubuntu_logo_81x81This post covers the utilities those start with I. Part of the  series.

  1. i7z(-gui) (System Administration) : Reports Intel Core i7, i5, i3 CPU information about Turbo Boost, frequencies, multipliers etc. and comes with a top-like display showing per core the current frequency, temperature and times spent in the C0/C1/C3/C6/C7 states. Includes an i7z_rw_registers script that allows toggling Turbo mode or set multipliers.
  2. iat (Cross Platform) : Iso9660 Analyzer Tool is a tool for detecting the structure of many types of CD-ROM image file formats, such as BIN, MDF, PDI, CDI, NRG, and B5I, and  converting them into ISO-9660.
  3. ibam (Utilities) : Advanced battery monitor for laptops, which uses statistical and adaptive linear methods to provide accurate estimations of minutes of battery left or of the time needed until full recharge. This software relies on either APM, ACPI, SYSFS or PMU kernel support to access the battery status.
  4. icecast2 (Multimedia) : A versatile multimedia streaming server which can create (for instance) a private jukebox or “Internet radio station”. It supports Ogg streaming using the Vorbis and Theora codecs, as well as other formats such as MP3, AAC, or NSV, and is compatible with most media players.
  5. icecream (Networking) : A non-interactive stream download utility written in Perl. It connects to icecast and shoutcast servers or direct stream URLs, and redirects all fetched content to stdout and/or to media files on your disk. Other features:
    • Listen to the stream piping the output to a stdin-capable media player.
    • Save the stream to a named file or split it into different tracks.
    • It is possible to redirect the stream and save it to disk at the same time.
  6. icheck (Development) : A tool for statically checking C interfaces for API and ABI changes. All changes to type declarations that can cause ABI changes should be detected, along with most API changes. icheck is intended for use with libraries, as a method of preventing ABI drift.
  7. icmptx (Networking) : A program that allows a user with root privileges to create a virtual network link between two computers, encapsulating data inside of ICMP packets.
  8. id3/id3ren/id3tool/id3v2 (Multimedia) : Tools to edit ID3 tags of music files and rename.
  9. idjc (Miscellaneous  – Graphical) : Graphical shoutcast/icecast client.
  10. ifetch-tools (World Wide Web) : Collect images from IP based cameras, monitor the collection process, and provide an interface to view the collected history.
  11. ifstat (Networking) : A tool to report network interfaces bandwidth just like vmstat/iostat do for other system counters. It can monitor local interfaces by polling the kernel counters, or remote hosts interfaces using SNMP.
  12. iftop (Networking) : Displays bandwidth usage information on an network interface.
  13. igal2/imageindex (World Wide Web) : Program that can generate HTML picture galleries.
  14. iipimage-server (World Wide Web) : Web-based streamed viewing and zooming of ultra high-resolution images.
  15. ike(-qtgui) (Networking) :  The Shrew Soft VPN client is a free IPsec VPN Client for FreeBSD, NetBSD, Linux and Windows operating systems. This product can be used to communicate with Open Source VPN servers (e.g. ipsec-tools) as well as some commercial VPN servers.
  16. ilohamail (World Wide Web) : IlohaMail is a PHP based lightweight full featured multilingual webmail program with IMAP and POP3 support. IlohaMail also includes a full-featured contacts manager, bookmarks manager, and scheduler.
  17. indent (Development) : C language source code formatting program.
  18. inoticoming (Utilities) : A daemon to watch a directory with Linux’s inotify framework and trigger actions once files with specific names are placed in there.
  19. iwatch (System Administration) : A realtime filesystem monitoring program. It’s a simple perl script to monitor changes in specific directories/files and send email notification immediately.
  20. iwyu (Development) : Analyze #includes in C and C++ source files to include only what you use.

Gliffy: diagrams and flowcharts online

How many times have you searched for the right platform-independent program to create diagrams and flowcharts? If you are a developer, the answer will be countless times. Gliffy makes the job easier because you can use it online any time. It also has a commercial plugin named Confluence. Gliffy is very powerful and supports the following:

  • Flowcharts
  • Org charts
  • UML diagrams
  • Network diagrams
  • Wireframes
  • Technical drawings

Webpage: Gliffy

Jaatishwar [The Reincarnated] (2014)

Jaatiswar is a Bengali movie which recently won 4 National Film Awards (2014) in India. After watching the movie I decided to write about it mainly because of two reasons – awesome music and a nice touch of history. Jaatiswar is a musical and the music director is none other than Kabir Suman. If you are a music lover you are in for a surprise. The music is very different from the commercial mainstream music in India in recent times. The movie is on the life of Anthony Firingee, a Portuguese who became famous in Bengal as a folk-poet pictured in a modern day context. The story is well known in the Bengali community due to another old and popular film covering the topic but Jaatiswar touches history with a beautiful finesse and a clever twist in the end. Prasenjit Chatterjee (playing Anthony Firingee) delivers a commendable performance.

There are drawbacks as well. The folk poem lyrics are well written but the dialogues fail to make a mark in most cases. The use of Computer graphics and (poorly) written introduction to characters are used in all the wrong places in the movie. It is evident that today’s so called prominent Bengali film directors didn’t learn much from the films of the world class Bengali director Satyajit Ray (who was a master in using silence vivid with expressions and symbolism). Following an interesting chapter in the cultural history of Bengal, the director Srijit Mukhopadhyay should also have avoided cheap gimmicks like a daughter smoking on the rooftop while conversing with her mother. It clearly shows the lack of focus in the right direction. Speaking of class, the film does not deliver other than the music.

Axel: algebraic geometric modeling

Though it is a namesake of the popular Linux download manager, Axel does something entirely different. Axel is a suite providing algebraic modeling tools (includes a main application and several plugins) for the manipulation and computation with curves, surfaces or volumes described by semi-algebraic representations. It also provides algorithms to compute intersection points of curves, singularities of algebraic curves or surfaces,  certified topology of curves and surfaces, etc. It is a feature rich software to visualize, manipulate and compute 3D objects. Features:

  • The main application. Provides atomic data, atomic process, a viewer and a GUI.
  • Plugin based model. Provides more data and processes. Includes plugins like SemiAlgebraicTools and BSplineTools and . Developers can contribute plugins too.
  • Extensive documentation along with some tutorials.
  • Multiplatform. Supports Linux, Windows and Mac.
  • Open source.

Webpage: Axel


Get every new post delivered to your Inbox.

Join 236 other followers