1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
14 # The Original Code is Mozilla 2.
16 # The Initial Developer of the Original Code is
17 # the Mozilla Foundation <http://www.mozilla.org>.
19 # Portions created by the Initial Developer are Copyright (C) 2008
20 # the Initial Developer. All Rights Reserved.
23 # Benjamin Smedberg <benjamin@smedbergs.us> (Author)
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
40 topsrcdir
= @top_srcdir@
44 # MAKE_DIRS: List of directories to build while looping over directories.
45 MAKE_DIRS
+= $(MDDEPDIR
)
46 GARBAGE_DIRS
+= $(MDDEPDIR
)
48 include $(DEPTH
)/config
/autoconf.mk
50 FINAL_FAILURE_TESTCASES
= \
52 TestFinalTemplate.
cpp \
55 STACK_FAILURE_TESTCASES
= \
57 TestStackTemplate.
cpp \
58 StackNoConstructor.
cpp \
60 StackConditional.
cpp \
63 STACK_PASS_TESTCASES
= \
64 StackPlacementNewOK.
cpp \
67 OUTPARAMS_WARNING_TESTCASES
= \
82 OUTPARAMS_PASS_TESTCASES
= \
103 FLOW_PASS_TESTCASES
= \
104 flow_through_pass.
cpp
106 FLOW_FAILURE_TESTCASES
= \
107 flow_through_fail.
cpp
109 STATIC_FAILURE_TESTCASES
= \
110 $(FINAL_FAILURE_TESTCASES
) \
111 $(STACK_FAILURE_TESTCASES
) \
112 $(FLOW_FAILURE_TESTCASES
)
115 STATIC_WARNING_TESTCASES
= \
116 $(OUTPARAMS_WARNING_TESTCASES
) \
119 STATIC_PASS_TESTCASES
= \
120 $(OUTPARAMS_PASS_TESTCASES
) \
121 $(STACK_PASS_TESTCASES
) \
122 $(FLOW_PASS_TESTCASES
) \
125 include $(topsrcdir
)/config
/rules.mk
127 # We want to compile each file and invert the result to ensure that
128 # compilation failed.
130 $(STATIC_FAILURE_TESTCASES
:.
cpp=.s-fail
) \
131 $(STATIC_WARNING_TESTCASES
:.
cpp=.s-warn
) \
132 $(STATIC_PASS_TESTCASES
:.
cpp=.s-pass
)
134 %.s-fail
: %.
cpp Makefile Makefile.in
$(DEHYDRA_SCRIPTS
)
135 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
136 @if
$(CCC
) $(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
137 printf
"fail:\nerror: compilation of $(<F) succeeded. It shouldn't have!\n"; \
143 %.s-warn
: %.
cpp Makefile Makefile.in
$(DEHYDRA_SCRIPTS
)
144 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
145 @if
$(CCC
) -Werror
$(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
146 printf
"fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n" \
149 @if
$(CCC
) $(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).werrlog
2>&1; then \
152 printf
"fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n" \
156 %.s-pass
: %.
cpp Makefile Makefile.in
$(DEHYDRA_SCRIPTS
)
157 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
158 @if
$(CCC
) -Werror
$(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
161 printf
"fail:\nerror: compilation of $(<F) failed. It shouldn't have!\n"; \