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 # We will do compilations that create dependency files.
47 include $(DEPTH
)/config
/autoconf.mk
49 FINAL_FAILURE_TESTCASES
= \
51 TestFinalTemplate.
cpp \
54 STACK_FAILURE_TESTCASES
= \
56 TestStackTemplate.
cpp \
57 StackNoConstructor.
cpp \
59 StackConditional.
cpp \
63 STACK_PASS_TESTCASES
= \
64 StackPlacementNewOK.
cpp \
67 OUTPARAMS_WARNING_TESTCASES
= \
80 OUTPARAMS_NS_FAILED_TESTCASES
= \
85 OUTPARAMS_PASS_TESTCASES
= \
106 FLOW_PASS_TESTCASES
= \
107 flow_through_pass.
cpp
109 FLOW_FAILURE_TESTCASES
= \
110 flow_through_fail.
cpp
112 STATIC_FAILURE_TESTCASES
= \
113 $(FINAL_FAILURE_TESTCASES
) \
114 $(FLOW_FAILURE_TESTCASES
)
117 STATIC_WARNING_TESTCASES
= \
118 $(OUTPARAMS_WARNING_TESTCASES
) \
119 $(STACK_FAILURE_TESTCASES
) \
122 STATIC_PASS_TESTCASES
= \
123 $(OUTPARAMS_NS_FAILED_TESTCASES
) \
124 $(OUTPARAMS_PASS_TESTCASES
) \
125 $(STACK_PASS_TESTCASES
) \
126 $(FLOW_PASS_TESTCASES
) \
131 include $(topsrcdir
)/config
/rules.mk
133 # We want to compile each file and invert the result to ensure that
134 # compilation failed.
136 $(STATIC_FAILURE_TESTCASES
:.
cpp=.s-fail
) \
137 $(STATIC_WARNING_TESTCASES
:.
cpp=.s-warn
) \
138 $(STATIC_PASS_TESTCASES
:.
cpp=.s-pass
)
140 %.s-fail
: %.
cpp $(GLOBAL_DEPS
) $(DEHYDRA_SCRIPTS
)
141 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
142 @if
$(CCC
) $(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
143 printf
"fail:\nerror: compilation of $(<F) succeeded. It shouldn't have!\n"; \
149 %.s-warn
: %.
cpp $(GLOBAL_DEPS
) $(DEHYDRA_SCRIPTS
)
150 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
151 @if
$(CCC
) -Werror
$(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
152 printf
"fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n"; \
155 @if
$(CCC
) $(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).werrlog
2>&1; then \
158 printf
"fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n"; \
162 %.s-pass
: %.
cpp $(GLOBAL_DEPS
) $(DEHYDRA_SCRIPTS
)
163 @printf
"Compiling $(<F) to check that the static-analysis script is checking properly..."
164 @if
$(CCC
) -Werror
$(OUTOPTION
)/dev
/null
-S
$(COMPILE_CXXFLAGS
) $(_VPATH_SRCS
) >$(*F
).errlog
2>&1; then \
167 printf
"fail:\nerror: compilation of $(<F) failed. It shouldn't have!\n"; \