Bug 838029 - Add --with-sixgill option and Makefile for static analysis. r=ted,reluctantly
authorSteve Fink <sfink@mozilla.com>
Mon, 28 Jan 2013 13:43:54 -0800
changeset 131903 5d18c9bfd37b81e9c620be2be88733aea791a03e
parent 131902 ae7e4da31bd7beae97d229039b63b2caea61af43
child 131904 c132f3957827d443698dbd9bf722e4baa0897a87
push idunknown
push userunknown
push dateunknown
reviewersted, reluctantly
bugs838029
milestone22.0a1
Bug 838029 - Add --with-sixgill option and Makefile for static analysis. r=ted,reluctantly
js/src/configure.in
js/src/devtools/rootAnalysis/Makefile.in
js/src/moz.build
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3757,16 +3757,33 @@ if test -n "$DEHYDRA_PATH"; then
     if test ! -f "$DEHYDRA_PATH"; then
         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
     fi
     AC_DEFINE(NS_STATIC_CHECKING)
 fi
 AC_SUBST(DEHYDRA_PATH)
 
 dnl ========================================================
+dnl = Enable static checking using sixgill
+dnl ========================================================
+
+MOZ_ARG_WITH_STRING(sixgill,
+[  --with-sixgill=path/to/sixgill
+                          Enable static checking of code using sixgill],
+    SIXGILL_PATH=$withval,
+    SIXGILL_PATH= )
+
+if test -n "$SIXGILL_PATH"; then
+    if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then
+        AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.])
+    fi
+fi
+AC_SUBST(SIXGILL_PATH)
+
+dnl ========================================================
 dnl = Enable stripping of libs & executables
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(strip,
 [  --enable-strip          Enable stripping of libs & executables ],
     ENABLE_STRIP=1,
     ENABLE_STRIP= )
 
 dnl ========================================================
new file mode 100644
--- /dev/null
+++ b/js/src/devtools/rootAnalysis/Makefile.in
@@ -0,0 +1,43 @@
+# -*- Mode: makefile -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This Makefile is used to kick off a static rooting analysis. This Makefile is
+# NOT intended for use as part of the standard Mozilla build. Instead, this
+# Makefile will use $PATH to subvert compiler invocations to add in the sixgill
+# plugin, and then do a regular build of whatever portion of the tree you are
+# analyzing. The plugins will dump out several xdb database files. Various
+# analysis scripts, written in JS, will run over those database files to
+# produce the final analysis output.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+VPATH += $(srcdir)
+
+# Tree to build and analyze, defaulting to the current tree
+TARGET_JSOBJDIR ?= $(MOZ_BUILD_ROOT)
+
+# Path to a JS binary to use to run the analysis. You really want this to be an
+# optimized build.
+JS ?= $(MOZ_BUILD_ROOT)/shell/js
+
+# Path to an xgill checkout containing the GCC plugin, xdb-processing binaries,
+# and compiler wrapper scripts used to automatically integrate into an existing
+# build system.
+SIXGILL ?= @SIXGILL_PATH@
+
+# Path to the JS scripts that will perform the analysis, defaulting to the same
+# place as this Makefile.in, which is probably what you want.
+ANALYSIS_SCRIPT_DIR ?= $(srcdir)
+
+# Number of simultanous analyzeRoots.js scripts to run.
+JOBS ?= 6
+
+all: ; true
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -15,8 +15,10 @@ if CONFIG['JS_NATIVE_EDITLINE']:
 if not CONFIG['JS_DISABLE_SHELL']:
     DIRS += ['shell']
 
 # FIXME: bug 530688 covers getting these working on Android
 if CONFIG['OS_ARCH'] != 'ANDROID':
     TEST_DIRS += ['jsapi-tests']
 
 TEST_DIRS += ['tests', 'gdb']
+
+CONFIGURE_SUBST_FILES += ['devtools/rootAnalysis/Makefile']