1 Dehydra is a tool that allows custom static analysis of C++ code, with analysis code written in JavaScript, running as a GCC plugin.
3 This directory has some analysis scripts. The setup is a bit ad hoc and not well tested or integrated into the build system or anything, so use at your own risk.
5 General usage instructions:
7 * Run Linux. (It might work on OS X too.)
9 * Install Dehydra, as per https://developer.mozilla.org/En/Dehydra/Installing_Dehydra
11 * Build 0 A.D. from build/workspaces/gcc:
12 export CXX="$HOME/gcc-dehydra/installed/bin/g++ -fplugin=$HOME/gcc-dehydra/dehydra/gcc_treehydra.so -fplugin-arg-gcc_treehydra-script=../../dehydra/printf-type-check.js -DCONFIG_DEHYDRA=1"
14 # (or "make test -j3 -k" to build the engine and tests and to do 3 files in parallel and continue past errors, etc)
16 * Wait (it's quite slow) and look for the new compiler warnings/errors.
18 The "tests" directory doesn't actually contain any proper tests, just some example files and expected outputs for rough sanity checking.
21 Some Dehydra fixes might be needed, depending on what version you use, like:
23 diff -r 9871caaedb8f dehydra.c
24 --- a/dehydra.c Sat Mar 12 13:55:41 2011 -0500
25 +++ b/dehydra.c Wed May 18 19:27:23 2011 +0100
29 this->fndeclMap = pointer_map_create ();
30 - this->rt = JS_NewRuntime (0x32L * 1024L * 1024L);
31 + this->rt = JS_NewRuntime (0x128L * 1024L * 1024L);
35 diff -r 9871caaedb8f libs/treehydra.js
36 --- a/libs/treehydra.js Sat Mar 12 13:55:41 2011 -0500
37 +++ b/libs/treehydra.js Wed May 18 19:27:23 2011 +0100
39 walk_tree (i.stmt (), func, guard, stack);
43 + walk_tree (TREE_OPERAND(t, 0), func, guard, stack);
45 case TEMPLATE_PARM_INDEX: