annotate gcc/testsuite/gcc.dg/guality/guality.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Infrastructure to test the quality of debug information.
kono
parents:
diff changeset
2 Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
kono
parents:
diff changeset
3 Contributed by Alexandre Oliva <aoliva@redhat.com>.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #include <stdio.h>
kono
parents:
diff changeset
22 #include <stdlib.h>
kono
parents:
diff changeset
23 #include <string.h>
kono
parents:
diff changeset
24 #include <stdint.h>
kono
parents:
diff changeset
25 #include <unistd.h>
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 /* This is a first cut at checking that debug information matches
kono
parents:
diff changeset
28 run-time. The idea is to annotate programs with GUALCHK* macros
kono
parents:
diff changeset
29 that guide the tests.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 In the current implementation, all of the macros expand to function
kono
parents:
diff changeset
32 calls. On the one hand, this interferes with optimizations; on the
kono
parents:
diff changeset
33 other hand, it establishes an optimization barrier and a clear
kono
parents:
diff changeset
34 inspection point, where previous operations (as in the abstract
kono
parents:
diff changeset
35 machine) should have been completed and have their effects visible,
kono
parents:
diff changeset
36 and future operations shouldn't have started yet.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 In the current implementation of guality_check(), we fork a child
kono
parents:
diff changeset
39 process that runs gdb, attaches to the parent process (the one that
kono
parents:
diff changeset
40 called guality_check), moves up one stack frame (to the caller of
kono
parents:
diff changeset
41 guality_check) and then examines the given expression.
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 If it matches the expected value, we have a PASS. If it differs,
kono
parents:
diff changeset
44 we have a FAILure. If it is missing, we'll have a FAIL or an
kono
parents:
diff changeset
45 UNRESOLVED depending on whether the variable or expression might be
kono
parents:
diff changeset
46 unavailable at that point, as indicated by the third argument.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 We envision a future alternate implementation with two compilation
kono
parents:
diff changeset
49 and execution cycles, say one that runs the program and uses the
kono
parents:
diff changeset
50 macros to log expressions and expected values, another in which the
kono
parents:
diff changeset
51 macros expand to nothing and the logs are used to guide a debug
kono
parents:
diff changeset
52 session that tests the values. How to identify the inspection
kono
parents:
diff changeset
53 points in the second case is yet to be determined. It is
kono
parents:
diff changeset
54 recommended that GUALCHK* macros be by themselves in source lines,
kono
parents:
diff changeset
55 so that __FILE__ and __LINE__ will be usable to identify them.
kono
parents:
diff changeset
56 */
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 #define GUALITY_TEST "guality/guality.h"
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 /* This is the type we use to pass values to guality_check. */
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 typedef intmax_t gualchk_t;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 /* Convert a pointer or integral type to the widest integral type,
kono
parents:
diff changeset
65 as expected by guality_check. */
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 #ifndef __cplusplus
kono
parents:
diff changeset
68 #define GUALCVT(val) \
kono
parents:
diff changeset
69 ((gualchk_t)__builtin_choose_expr \
kono
parents:
diff changeset
70 (__builtin_types_compatible_p (__typeof (val), gualchk_t), \
kono
parents:
diff changeset
71 (val), \
kono
parents:
diff changeset
72 __builtin_choose_expr \
kono
parents:
diff changeset
73 (__builtin_classify_type (val) \
kono
parents:
diff changeset
74 == __builtin_classify_type (&guality_skip), \
kono
parents:
diff changeset
75 (uintptr_t)(val),(intptr_t)(val))))
kono
parents:
diff changeset
76 #else
kono
parents:
diff changeset
77 template <typename T>
kono
parents:
diff changeset
78 inline __attribute__((always_inline)) gualchk_t
kono
parents:
diff changeset
79 gualcvt (T *val)
kono
parents:
diff changeset
80 {
kono
parents:
diff changeset
81 return (uintptr_t) val;
kono
parents:
diff changeset
82 }
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 template <typename T>
kono
parents:
diff changeset
85 inline __attribute__((always_inline)) gualchk_t
kono
parents:
diff changeset
86 gualcvt (T val)
kono
parents:
diff changeset
87 {
kono
parents:
diff changeset
88 return (intptr_t) val;
kono
parents:
diff changeset
89 }
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 template <>
kono
parents:
diff changeset
92 inline __attribute__((always_inline)) gualchk_t
kono
parents:
diff changeset
93 gualcvt<gualchk_t> (gualchk_t val)
kono
parents:
diff changeset
94 {
kono
parents:
diff changeset
95 return val;
kono
parents:
diff changeset
96 }
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 #define GUALCVT(val) gualcvt (val)
kono
parents:
diff changeset
99 #endif
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 /* Attach a debugger to the current process and verify that the string
kono
parents:
diff changeset
102 EXPR, evaluated by the debugger, yields the gualchk_t number VAL.
kono
parents:
diff changeset
103 If the debugger cannot compute the expression, say because the
kono
parents:
diff changeset
104 variable is unavailable, this will count as an error, unless unkok
kono
parents:
diff changeset
105 is nonzero. */
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 #define GUALCHKXPRVAL(expr, val, unkok) \
kono
parents:
diff changeset
108 guality_check ((expr), (val), (unkok))
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 /* Check that a debugger knows that EXPR evaluates to the run-time
kono
parents:
diff changeset
111 value of EXPR. Unknown values are marked as acceptable,
kono
parents:
diff changeset
112 considering that EXPR may die right after this call. This will
kono
parents:
diff changeset
113 affect the generated code in that EXPR will be evaluated and forced
kono
parents:
diff changeset
114 to remain live at least until right before the call to
kono
parents:
diff changeset
115 guality_check, although not necessarily after the call. */
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 #define GUALCHKXPR(expr) \
kono
parents:
diff changeset
118 GUALCHKXPRVAL (#expr, GUALCVT (expr), 1)
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 /* Same as GUALCHKXPR, but issue an error if the variable is optimized
kono
parents:
diff changeset
121 away. */
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 #define GUALCHKVAL(expr) \
kono
parents:
diff changeset
124 GUALCHKXPRVAL (#expr, GUALCVT (expr), 0)
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 /* Check that a debugger knows that EXPR evaluates to the run-time
kono
parents:
diff changeset
127 value of EXPR. Unknown values are marked as errors, because the
kono
parents:
diff changeset
128 value of EXPR is forced to be available right after the call, for a
kono
parents:
diff changeset
129 range of at least one instruction. This will affect the generated
kono
parents:
diff changeset
130 code, in that EXPR *will* be evaluated before and preserved until
kono
parents:
diff changeset
131 after the call to guality_check. */
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 #define GUALCHKFLA(expr) do { \
kono
parents:
diff changeset
134 __typeof(expr) volatile __preserve_after; \
kono
parents:
diff changeset
135 __typeof(expr) __preserve_before = (expr); \
kono
parents:
diff changeset
136 GUALCHKXPRVAL (#expr, GUALCVT (__preserve_before), 0); \
kono
parents:
diff changeset
137 __preserve_after = __preserve_before; \
kono
parents:
diff changeset
138 asm ("" : : "m" (__preserve_after)); \
kono
parents:
diff changeset
139 } while (0)
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 /* GUALCHK is the simplest way to assert that debug information for an
kono
parents:
diff changeset
142 expression matches its run-time value. Whether to force the
kono
parents:
diff changeset
143 expression live after the call, so as to flag incompleteness
kono
parents:
diff changeset
144 errors, can be disabled by defining GUALITY_DONT_FORCE_LIVE_AFTER.
kono
parents:
diff changeset
145 Setting it to -1, an error is issued for optimized out variables,
kono
parents:
diff changeset
146 even though they are not forced live. */
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 #if ! GUALITY_DONT_FORCE_LIVE_AFTER
kono
parents:
diff changeset
149 #define GUALCHK(var) GUALCHKFLA(var)
kono
parents:
diff changeset
150 #elif GUALITY_DONT_FORCE_LIVE_AFTER < 0
kono
parents:
diff changeset
151 #define GUALCHK(var) GUALCHKVAL(var)
kono
parents:
diff changeset
152 #else
kono
parents:
diff changeset
153 #define GUALCHK(var) GUALCHKXPR(var)
kono
parents:
diff changeset
154 #endif
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 /* The name of the GDB program, with arguments to make it quiet. This
kono
parents:
diff changeset
157 is GUALITY_GDB_DEFAULT GUALITY_GDB_ARGS by default, but it can be
kono
parents:
diff changeset
158 overridden by setting the GUALITY_GDB environment variable, whereas
kono
parents:
diff changeset
159 GUALITY_GDB_DEFAULT can be overridden by setting the
kono
parents:
diff changeset
160 GUALITY_GDB_NAME environment variable. */
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 static const char *guality_gdb_command;
kono
parents:
diff changeset
163 #define GUALITY_GDB_DEFAULT "gdb"
kono
parents:
diff changeset
164 #if defined(__unix)
kono
parents:
diff changeset
165 # define GUALITY_GDB_REDIRECT " > /dev/null 2>&1"
kono
parents:
diff changeset
166 #elif defined (_WIN32) || defined (MSDOS)
kono
parents:
diff changeset
167 # define GUALITY_GDB_REDIRECT " > nul"
kono
parents:
diff changeset
168 #else
kono
parents:
diff changeset
169 # define GUALITY_GDB_REDIRECT ""
kono
parents:
diff changeset
170 #endif
kono
parents:
diff changeset
171 #define GUALITY_GDB_ARGS " -nx -nw --quiet" GUALITY_GDB_REDIRECT
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 /* Kinds of results communicated as exit status from child process
kono
parents:
diff changeset
174 that runs gdb to the parent process that's being monitored. */
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 enum guality_counter { PASS, INCORRECT, INCOMPLETE };
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 /* Count of passes and errors. */
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 static int guality_count[INCOMPLETE+1];
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 /* If --guality-skip is given in the command line, all the monitoring,
kono
parents:
diff changeset
183 forking and debugger-attaching action will be disabled. This is
kono
parents:
diff changeset
184 useful to run the monitor program within a debugger. */
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 static int guality_skip;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 /* This is a file descriptor to which we'll issue gdb commands to
kono
parents:
diff changeset
189 probe and test. */
kono
parents:
diff changeset
190 FILE *guality_gdb_input;
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 /* This holds the line number where we're supposed to set a
kono
parents:
diff changeset
193 breakpoint. */
kono
parents:
diff changeset
194 int guality_breakpoint_line;
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 /* GDB should set this to true once it's connected. */
kono
parents:
diff changeset
197 int volatile guality_attached;
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 /* This function is the main guality program. It may actually be
kono
parents:
diff changeset
200 defined as main, because we #define main to it afterwards. Because
kono
parents:
diff changeset
201 of this wrapping, guality_main may not have an empty argument
kono
parents:
diff changeset
202 list. */
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 extern int guality_main (int argc, char *argv[]);
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 static void __attribute__((noinline))
kono
parents:
diff changeset
207 guality_check (const char *name, gualchk_t value, int unknown_ok);
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 /* Set things up, run guality_main, then print a summary and quit. */
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 int
kono
parents:
diff changeset
212 main (int argc, char *argv[])
kono
parents:
diff changeset
213 {
kono
parents:
diff changeset
214 int i;
kono
parents:
diff changeset
215 char *argv0 = argv[0];
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 guality_gdb_command = getenv ("GUALITY_GDB");
kono
parents:
diff changeset
218 if (!guality_gdb_command)
kono
parents:
diff changeset
219 {
kono
parents:
diff changeset
220 guality_gdb_command = getenv ("GUALITY_GDB_NAME");
kono
parents:
diff changeset
221 if (!guality_gdb_command)
kono
parents:
diff changeset
222 guality_gdb_command = GUALITY_GDB_DEFAULT GUALITY_GDB_ARGS;
kono
parents:
diff changeset
223 else
kono
parents:
diff changeset
224 {
kono
parents:
diff changeset
225 int len = strlen (guality_gdb_command) + sizeof (GUALITY_GDB_ARGS);
kono
parents:
diff changeset
226 char *buf = (char *) __builtin_alloca (len);
kono
parents:
diff changeset
227 strcpy (buf, guality_gdb_command);
kono
parents:
diff changeset
228 strcat (buf, GUALITY_GDB_ARGS);
kono
parents:
diff changeset
229 guality_gdb_command = buf;
kono
parents:
diff changeset
230 }
kono
parents:
diff changeset
231 }
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 if (argv[0])
kono
parents:
diff changeset
234 {
kono
parents:
diff changeset
235 int len = strlen (guality_gdb_command) + 1 + strlen (argv[0]);
kono
parents:
diff changeset
236 char *buf = (char *) __builtin_alloca (len);
kono
parents:
diff changeset
237 strcpy (buf, guality_gdb_command);
kono
parents:
diff changeset
238 strcat (buf, " ");
kono
parents:
diff changeset
239 strcat (buf, argv[0]);
kono
parents:
diff changeset
240 guality_gdb_command = buf;
kono
parents:
diff changeset
241 }
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 for (i = 1; i < argc; i++)
kono
parents:
diff changeset
244 if (strcmp (argv[i], "--guality-skip") == 0)
kono
parents:
diff changeset
245 guality_skip = 1;
kono
parents:
diff changeset
246 else
kono
parents:
diff changeset
247 break;
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 if (!guality_skip)
kono
parents:
diff changeset
250 {
kono
parents:
diff changeset
251 guality_gdb_input = popen (guality_gdb_command, "w");
kono
parents:
diff changeset
252 /* This call sets guality_breakpoint_line. */
kono
parents:
diff changeset
253 guality_check (NULL, 0, 0);
kono
parents:
diff changeset
254 if (!guality_gdb_input
kono
parents:
diff changeset
255 || fprintf (guality_gdb_input, "\
kono
parents:
diff changeset
256 set height 0\n\
kono
parents:
diff changeset
257 handle SIGINT pass nostop\n\
kono
parents:
diff changeset
258 handle SIGTERM pass nostop\n\
kono
parents:
diff changeset
259 handle SIGSEGV pass nostop\n\
kono
parents:
diff changeset
260 handle SIGBUS pass nostop\n\
kono
parents:
diff changeset
261 attach %i\n\
kono
parents:
diff changeset
262 set guality_attached = 1\n\
kono
parents:
diff changeset
263 b %i\n\
kono
parents:
diff changeset
264 continue\n\
kono
parents:
diff changeset
265 ", (int)getpid (), guality_breakpoint_line) <= 0
kono
parents:
diff changeset
266 || fflush (guality_gdb_input))
kono
parents:
diff changeset
267 {
kono
parents:
diff changeset
268 perror ("gdb");
kono
parents:
diff changeset
269 abort ();
kono
parents:
diff changeset
270 }
kono
parents:
diff changeset
271 }
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 argv[--i] = argv0;
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 guality_main (argc - i, argv + i);
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 i = guality_count[INCORRECT];
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 fprintf (stderr, "%s: " GUALITY_TEST ": %i PASS, %i FAIL, %i UNRESOLVED\n",
kono
parents:
diff changeset
280 i ? "FAIL" : "PASS",
kono
parents:
diff changeset
281 guality_count[PASS], guality_count[INCORRECT],
kono
parents:
diff changeset
282 guality_count[INCOMPLETE]);
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 return i;
kono
parents:
diff changeset
285 }
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 #define main guality_main
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 /* Tell the GDB child process to evaluate NAME in the caller. If it
kono
parents:
diff changeset
290 matches VALUE, we have a PASS; if it's unknown and UNKNOWN_OK, we
kono
parents:
diff changeset
291 have an UNRESOLVED. Otherwise, it's a FAIL. */
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 static void __attribute__((noinline))
kono
parents:
diff changeset
294 guality_check (const char *name, gualchk_t value, int unknown_ok)
kono
parents:
diff changeset
295 {
kono
parents:
diff changeset
296 int result;
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 if (guality_skip)
kono
parents:
diff changeset
299 return;
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 {
kono
parents:
diff changeset
302 volatile gualchk_t xvalue = -1;
kono
parents:
diff changeset
303 volatile int unavailable = 0;
kono
parents:
diff changeset
304 if (name)
kono
parents:
diff changeset
305 {
kono
parents:
diff changeset
306 /* The sequence below cannot distinguish an optimized away
kono
parents:
diff changeset
307 variable from one mapped to a non-lvalue zero. */
kono
parents:
diff changeset
308 if (fprintf (guality_gdb_input, "\
kono
parents:
diff changeset
309 up\n\
kono
parents:
diff changeset
310 set $value1 = 0\n\
kono
parents:
diff changeset
311 set $value1 = (%s)\n\
kono
parents:
diff changeset
312 set $value2 = -1\n\
kono
parents:
diff changeset
313 set $value2 = (%s)\n\
kono
parents:
diff changeset
314 set $value3 = $value1 - 1\n\
kono
parents:
diff changeset
315 set $value4 = $value1 + 1\n\
kono
parents:
diff changeset
316 set $value3 = (%s)++\n\
kono
parents:
diff changeset
317 set $value4 = --(%s)\n\
kono
parents:
diff changeset
318 down\n\
kono
parents:
diff changeset
319 set xvalue = $value1\n\
kono
parents:
diff changeset
320 set unavailable = $value1 != $value2 ? -1 : $value3 != $value4 ? 1 : 0\n\
kono
parents:
diff changeset
321 continue\n\
kono
parents:
diff changeset
322 ", name, name, name, name) <= 0
kono
parents:
diff changeset
323 || fflush (guality_gdb_input))
kono
parents:
diff changeset
324 {
kono
parents:
diff changeset
325 perror ("gdb");
kono
parents:
diff changeset
326 abort ();
kono
parents:
diff changeset
327 }
kono
parents:
diff changeset
328 else if (!guality_attached)
kono
parents:
diff changeset
329 {
kono
parents:
diff changeset
330 unsigned int timeout = 0;
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 /* Give GDB some more time to attach. Wrapping around a
kono
parents:
diff changeset
333 32-bit counter takes some seconds, it should be plenty
kono
parents:
diff changeset
334 of time for GDB to get a chance to start up and attach,
kono
parents:
diff changeset
335 but not long enough that, if GDB is unavailable or
kono
parents:
diff changeset
336 broken, we'll take far too long to give up. */
kono
parents:
diff changeset
337 while (--timeout && !guality_attached)
kono
parents:
diff changeset
338 ;
kono
parents:
diff changeset
339 if (!timeout && !guality_attached)
kono
parents:
diff changeset
340 {
kono
parents:
diff changeset
341 fprintf (stderr, "gdb: took too long to attach\n");
kono
parents:
diff changeset
342 abort ();
kono
parents:
diff changeset
343 }
kono
parents:
diff changeset
344 }
kono
parents:
diff changeset
345 }
kono
parents:
diff changeset
346 else
kono
parents:
diff changeset
347 {
kono
parents:
diff changeset
348 guality_breakpoint_line = __LINE__ + 5;
kono
parents:
diff changeset
349 return;
kono
parents:
diff changeset
350 }
kono
parents:
diff changeset
351 /* Do NOT add lines between the __LINE__ above and the line below,
kono
parents:
diff changeset
352 without also adjusting the added constant to match. */
kono
parents:
diff changeset
353 if (!unavailable || (unavailable > 0 && xvalue))
kono
parents:
diff changeset
354 {
kono
parents:
diff changeset
355 if (xvalue == value)
kono
parents:
diff changeset
356 result = PASS;
kono
parents:
diff changeset
357 else
kono
parents:
diff changeset
358 result = INCORRECT;
kono
parents:
diff changeset
359 }
kono
parents:
diff changeset
360 else
kono
parents:
diff changeset
361 result = INCOMPLETE;
kono
parents:
diff changeset
362 asm ("" : : "X" (name), "X" (value), "X" (unknown_ok), "m" (xvalue));
kono
parents:
diff changeset
363 switch (result)
kono
parents:
diff changeset
364 {
kono
parents:
diff changeset
365 case PASS:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
366 fprintf (stderr, "PASS: " GUALITY_TEST ": %s is %lli\n", name,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
367 (long long int) value);
111
kono
parents:
diff changeset
368 break;
kono
parents:
diff changeset
369 case INCORRECT:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
370 fprintf (stderr, "FAIL: " GUALITY_TEST ": %s is %lli, not %lli\n", name,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
371 (long long int) xvalue, (long long int) value);
111
kono
parents:
diff changeset
372 break;
kono
parents:
diff changeset
373 case INCOMPLETE:
kono
parents:
diff changeset
374 fprintf (stderr, "%s: " GUALITY_TEST ": %s is %s, expected %lli\n",
kono
parents:
diff changeset
375 unknown_ok ? "UNRESOLVED" : "FAIL", name,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
376 unavailable < 0 ? "not computable" : "optimized away",
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
377 (long long int) value);
111
kono
parents:
diff changeset
378 result = unknown_ok ? INCOMPLETE : INCORRECT;
kono
parents:
diff changeset
379 break;
kono
parents:
diff changeset
380 default:
kono
parents:
diff changeset
381 abort ();
kono
parents:
diff changeset
382 }
kono
parents:
diff changeset
383 }
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 switch (result)
kono
parents:
diff changeset
386 {
kono
parents:
diff changeset
387 case PASS:
kono
parents:
diff changeset
388 case INCORRECT:
kono
parents:
diff changeset
389 case INCOMPLETE:
kono
parents:
diff changeset
390 ++guality_count[result];
kono
parents:
diff changeset
391 break;
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 default:
kono
parents:
diff changeset
394 abort ();
kono
parents:
diff changeset
395 }
kono
parents:
diff changeset
396 }