Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / analysis-tests / Makefile.in
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 #
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/
8 #
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
12 # License.
13 #
14 # The Original Code is Mozilla 2.
15 #
16 # The Initial Developer of the Original Code is
17 # the Mozilla Foundation <http://www.mozilla.org>.
18 #
19 # Portions created by the Initial Developer are Copyright (C) 2008
20 # the Initial Developer. All Rights Reserved.
21 #
22 # Contributor(s):
23 # Benjamin Smedberg <benjamin@smedbergs.us> (Author)
24 #
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.
36 #
37 # ***** END LICENSE BLOCK *****
38
39 DEPTH = ..
40 topsrcdir = @top_srcdir@
41 srcdir = @srcdir@
42 VPATH = @srcdir@
43
44 # we will do compilations that create dependency files.
45 NEED_MDDEPDIR = 1
46
47 include $(DEPTH)/config/autoconf.mk
48
49 REDGREEN_WARNING_TESTCASES = \
50   green-callred.cpp \
51   green-accessred.cpp \
52   green-tored-badpath.cpp \
53   misdeclared-red-funcptr.cpp \
54   misdeclared-red-funcptr2.cpp \
55   red-togreenptr.cpp \
56   red-togreenptr-return.cpp \
57   red-togreenptr-arg.cpp \
58   red-togreenptr-field.cpp \
59   red-togreenptr-initializer.cpp \
60   red-togreenptr-initializer-struct.cpp \
61   red-togreenptr-initializer-array.cpp \
62   red-togreenptr-initializer-nested.cpp \
63   red-togreenptr-initializer-cast.cpp \
64   green-callredptr.cpp \
65   $(NULL)
66
67 REDGREEN_SUCCESS_TESTCASES = \
68   red-callred.cpp \
69   red-callgreen.cpp \
70   red-accessred.cpp \
71   green-tored.cpp \
72   green-toredptr.cpp \
73   $(NULL)
74
75 STATIC_WARNING_TESTCASES = \
76   $(REDGREEN_WARNING_TESTCASES) \
77   $(NULL)
78
79 STATIC_PASS_TESTCASES = \
80   $(REDGREEN_SUCCESS_TESTCASES) \
81   $(NULL)
82
83 include $(topsrcdir)/config/rules.mk
84
85 LOCAL_INCLUDES += -I$(srcdir)/.. -I..
86
87 check:: \
88   $(STATIC_WARNING_TESTCASES:.cpp=.s-warn) \
89   $(STATIC_PASS_TESTCASES:.cpp=.s-pass) \
90   $(NULL)
91
92 # We want to compile each file and invert the result to ensure that
93 # compilation failed.
94 %.s-warn: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
95         @printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
96         @if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
97           printf "fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n"; \
98           exit 1; \
99         fi
100         @if $(CCC) $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).werrlog 2>&1; then \
101           printf "ok.\n"; \
102         else \
103           printf "fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n"; \
104           exit 1; \
105         fi
106
107 %.s-pass: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
108         @printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
109         @if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
110           printf "ok.\n"; \
111         else \
112           printf "fail:\nerror: compilation of $(<F) failed. It shouldn't have!\n"; \
113           exit 1; \
114         fi