#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include "file-handle-def.h"
#include "file-name.h"
return make_any_reader (SCRATCH_FILE,
scratch_reader_open (handle, dict));
}
- abort ();
+ NOT_REACHED ();
}
/* Reads a single case from READER into C.
case SCRATCH_FILE:
return scratch_reader_read_case (reader->private, c);
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if an I/O error has occurred on READER, false
case SCRATCH_FILE:
return scratch_reader_error (reader->private);
}
- abort ();
+ NOT_REACHED ();
}
/* Closes READER. */
break;
default:
- abort ();
+ NOT_REACHED ();
}
free (reader);
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include "file-handle-def.h"
#include "file-name.h"
dict));
}
- abort ();
+ NOT_REACHED ();
}
/* If PRIVATE is non-null, creates and returns a new any_writer,
case SCRATCH_FILE:
return scratch_writer_write_case (writer->private, c);
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if an I/O error has occurred on WRITER, false
case SCRATCH_FILE:
return scratch_writer_error (writer->private);
}
- abort ();
+ NOT_REACHED ();
}
/* Closes WRITER.
break;
default:
- abort ();
+ NOT_REACHED ();
}
free (writer);
'cat_var'.
*/
#include <config.h>
+
+#include "category.h"
+
+#include <assert.h>
#include <stdlib.h>
+#include <string.h>
+
#include <libpspp/alloc.h>
#include <libpspp/message.h>
-#include "category.h"
#include "cat-routines.h"
-#include <string.h>
#include "variable.h"
#define N_INITIAL_CATEGORIES 1
#define CAT_H
#define CAT_VALUE_NOT_FOUND -2
#include <stdbool.h>
-
+#include <stddef.h>
union value;
struct variable ;
#include <stdlib.h>
#include <time.h>
#include "calendar.h"
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include "format.h"
#include <libpspp/magic.h>
break;
case FMT_A:
- assert (0);
- abort ();
+ NOT_REACHED ();
case FMT_AHEX:
- assert (0);
- abort ();
+ NOT_REACHED ();
case FMT_IB:
ok = convert_IB (s, fp, number);
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
}
else
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
}
}
break;
default:
- assert (0);
+ NOT_REACHED ();
}
if (buf[0] == 0)
02110-1301, USA. */
#include <config.h>
+
#include "file-handle-def.h"
-#include <libpspp/message.h>
+
+#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+
#include <libpspp/alloc.h>
#include <libpspp/compiler.h>
-#include "file-name.h"
-#include <libpspp/message.h>
#include <libpspp/magic.h>
+#include <libpspp/message.h>
+#include "file-name.h"
#include "variable.h"
#include "scratch-handle.h"
#include <config.h>
#include "format.h"
#include <ctype.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <stdlib.h>
#include <libpspp/compiler.h>
case FMT_CCC:
case FMT_CCD:
case FMT_CCE:
- assert (0);
+ NOT_REACHED ();
case FMT_Z:
case FMT_A:
/* nothing is necessary */
/* nothing is necessary */
break;
default:
- assert (0);
+ NOT_REACHED ();
}
assert (check_output_specifier (output, 0));
#include "missing-values.h"
#include <assert.h>
#include <stdlib.h>
+#include <libpspp/assertion.h>
#include <libpspp/str.h>
case MV_RANGE_1:
return false;
}
- abort ();
+ NOT_REACHED ();
}
/* Attempts to add S to the set of string missing values MV. S
case MV_RANGE_1:
return false;
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if MV contains an individual value,
case MV_RANGE:
return false;
}
- abort ();
+ NOT_REACHED ();
}
/* Removes one individual value from MV and stores it in *V.
case MV_3:
return false;
}
- abort ();
+ NOT_REACHED ();
}
/* Removes the numeric range from MV and stores it in *LOW and
case MV_RANGE_1:
return true;
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if S contains only spaces between indexes
case MV_RANGE_1:
return v[0].f == d || (v[1].f <= d && d <= v[2].f);
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if S[] is a missing value in MV, false otherwise.
|| !memcmp (v[2].s, s, mv->width));
case MV_RANGE:
case MV_RANGE_1:
- abort ();
+ NOT_REACHED ();
}
- abort ();
+ NOT_REACHED ();
}
/* Returns true if MV is a set of numeric missing values and V is
#include <minmax.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/compiler.h>
#include <libpspp/magic.h>
p = r->x;
}
- abort ();
+ NOT_REACHED ();
success:
/* We have filled up an entire record. Update state and return
#include <config.h>
#include "variable.h"
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <stdlib.h>
#include <libpspp/alloc.h>
case DC_SCRATCH:
return _("scratch");
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
}
#include <language/lexer/lexer.h>
#include <language/line-buffer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
for (cmd = commands; cmd < commands + command_cnt; cmd++)
if (!strcmp (cmd->name, name))
return cmd;
- abort ();
+ NOT_REACHED ();
}
/* Frees the WORD_CNT words in WORDS. */
else if (allowed_cnt == 3)
s = xasprintf (_("%s, %s, or %s"), allowed[0], allowed[1], allowed[2]);
else
- abort ();
+ NOT_REACHED ();
msg (SE, _("%s is allowed only %s."), command->name, s);
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
retval = read_from_data_list_list (dls, c);
break;
default:
- abort ();
+ NOT_REACHED ();
}
dfm_pop (dls->reader);
#include <language/lexer/lexer.h>
#include <language/line-buffer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
}
}
else
- abort ();
+ NOT_REACHED ();
r->where.line_number++;
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/line-buffer.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/magic.h>
#include <libpspp/str.h>
properties.record_width = cmd.n_lrecl[0];
break;
default:
- assert (0);
+ NOT_REACHED ();
}
if (cmd.mode != FH_SCRATCH)
case FH_REF_SCRATCH:
return _("scratch file");
default:
- abort ();
+ NOT_REACHED ();
}
}
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/message.h>
saw_table = true;
}
else
- assert (0);
+ NOT_REACHED ();
lex_match ('=');
file->by = NULL;
if (iter->handle == NULL)
{
if (!mtf_delete_file_in_place (mtf, &iter))
- abort ();
+ NOT_REACHED ();
break;
}
#include <language/expressions/public.h>
#include <language/lexer/lexer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
memset (case_data_rw (c, i)->s, ' ', sizeof case_data_rw (c, i)->s);
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
memset (case_data_rw (c, i)->s, ' ', sizeof case_data_rw (c, i)->s);
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
fputs (" </TR>\n", x->file);
}
else
- assert (0);
+ NOT_REACHED ();
}
}
}
}
else
- assert (0);
+ NOT_REACHED ();
free (cmd.v_variables);
}
fputs (" </TR>\n", x->file);
}
else
- assert (0);
+ NOT_REACHED ();
return true;
}
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
#include <libpspp/array.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
printf (" '%.*s'", token->length, token->string);
break;
default:
- assert (0);
+ NOT_REACHED ();
}
fflush (stdout);
}
n_cols = mx->n_continuous;
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
break;
case 2:
n_cols = 1;
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
{
n_cols = mx->n_continuous;
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
c->n_rows[wr->content]++;
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
case PRT_SPACE:
break;
case PRT_ERROR:
- assert (0);
+ NOT_REACHED ();
}
if (fh != NULL)
break;
case PRT_ERROR:
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
if (pot_w > w)
w = pot_w;
break;
case PRT_ERROR:
- assert (0);
- break;
+ NOT_REACHED ();
}
if (t->writer != NULL && dfm_write_error (t->writer))
/* nothing to do */
break;
case PRT_ERROR:
- assert (0);
- break;
+ NOT_REACHED ();
}
n = i->next;
free (i);
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/array.h>
#include <libpspp/bit-vector.h>
#include <libpspp/compiler.h>
compare_variables_given_ordering,
&forward_positional_ordering)
!= drop_cnt)
- assert (0);
+ NOT_REACHED ();
free (keep_vars);
free (all_vars);
keep_vars,
compare_variables_given_ordering,
&forward_positional_ordering) != keep_cnt)
- assert (0);
+ NOT_REACHED ();
/* Copy variables into var_renaming array. */
var_renaming = xnmalloc (keep_cnt, sizeof *var_renaming);
/* Do renaming. */
if (dict_rename_vars (d, rename_vars, rename_new_names, rename_cnt,
NULL) == 0)
- assert (0);
+ NOT_REACHED ();
/* Clean up. */
for (i = 0; i < vm->rename_cnt; i++)
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
-#include <libpspp/message.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
width = f.w / 2;
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
/* Create each variable. */
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/str.h>
v[i] = dict_create_var_assert (default_dict, name, 0);
}
if (!dict_create_vector (default_dict, cp, v, nv))
- assert (0);
+ NOT_REACHED ();
cp += strlen (cp) + 1;
}
free (v);
#include <ctype.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include "helpers.h"
#include "evaluate.h"
#include "evaluate.inc"
default:
- abort ();
+ NOT_REACHED ();
}
}
}
}
default:
- assert (0);
+ NOT_REACHED ();
}
expr_free (expr);
fprintf (stderr, "i<%d>", op->integer);
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
fprintf (stderr, "\n");
if ($op->{UNIMPLEMENTED}) {
print "case $opname:\n";
- print " abort ();\n\n";
+ print " NOT_REACHED ();\n\n";
next;
}
#include <errno.h>
#include <stdlib.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <data/calendar.h>
#include <data/data-in.h>
#include <libpspp/message.h>
#include "optimize.inc"
default:
- assert (0);
+ NOT_REACHED ();
}
- /* Not reached. */
- assert (0);
- abort ();
+ NOT_REACHED ();
}
static double
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
else if (is_composite (n->type))
flatten_composite (n, e);
else
- abort ();
+ NOT_REACHED ();
}
static union operation_data *
if (!$op->{OPTIMIZABLE} || $op->{UNIMPLEMENTED}) {
print "case $opname:\n";
- print " abort ();\n\n";
+ print " NOT_REACHED ();\n\n";
next;
}
#include "helpers.h"
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
+#include <libpspp/assertion.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
#include <data/settings.h>
return ¬_on_stack;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
default:
- abort ();
+ NOT_REACHED ();
}
return true;
break;
case OP_format:
- abort ();
+ NOT_REACHED ();
case OP_ni_format:
if ((*node)->type == OP_format
break;
default:
- abort ();
+ NOT_REACHED ();
}
if (do_coercion)
else if (is_composite (n->type))
return operations[n->type].returns;
else
- abort ();
+ NOT_REACHED ();
}
static const char *
#include <stdarg.h>
#include <stdlib.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <language/command.h>
#include <libpspp/message.h>
#include <language/line-buffer.h>
}
}
- assert (0);
+ NOT_REACHED ();
}
\f
/* Really weird functions. */
chars_per_byte = 2;
break;
default:
- abort ();
+ NOT_REACHED ();
}
byte_cnt = ds_length (&tokstr) / chars_per_byte;
#include <time.h>
#include <errno.h>
#include <unistd.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/str.h>
#include "exit.h"
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
}
dump (0, "goto lossage;");
dump (-1, "default:");
indent ();
- dump (0, "assert (0);");
+ dump (0, "NOT_REACHED ();");
dump (-1, "}");
outdent ();
}
dump (0, "break;");
dump (-1, "default:");
indent ();
- dump (0, "assert (0);");
+ dump (0, "NOT_REACHED ();");
dump (-1, "}");
outdent ();
}
dump (0, "#include <stdlib.h>");
dump (0, "#include <libpspp/alloc.h>");
+ dump (0, "#include <libpspp/assertion.h>");
dump (0, "#include <libpspp/message.h>");
dump (0, "#include <language/lexer/lexer.h>");
dump (0, "#include <language/lexer/variable-parser.h>");
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
return s->u.interactive (line, get_prompt_style ());
}
- abort ();
+ NOT_REACHED ();
}
/* Reads a single line into LINE.
#include <language/lexer/variable-parser.h>
#include <language/stats/sort-criteria.h>
#include <libpspp/alloc.h>
-#include <libpspp/message.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
caught earlier. Nothing to do. */
break;
default:
- assert (0);
+ NOT_REACHED ();
}
} else {
switch (iter->function)
iter->int1++;
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
}
v->f = i->int1;
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
}
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
#include <libpspp/array.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/magic.h>
* (1. - col_tot[c] / W)));
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
format_cell_entry (table, c, i, v, suffix, mark_missing);
v = 0.;
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
format_cell_entry (table, n_cols, 0, v, suffix, mark_missing);
case CRS_CL_ASRESIDUAL:
continue;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
format_cell_entry (table, c, i, v, suffix, mark_missing);
#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
#include <libpspp/array.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
else if (feof (flip->file))
msg (SE, _("Unexpected end of file reading FLIP temporary file."));
else
- abort ();
+ NOT_REACHED ();
ok = false;
break;
}
ft->out_of_range += weight;
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
return true;
dump_full (v);
break;
default:
- assert (0);
+ NOT_REACHED ();
}
else
dumped_freq_tab = 0;
case FRQ_AFREQ | (ALPHA << 16): return compare_freq_alpha_a;
case FRQ_DFREQ | (NUMERIC << 16): return compare_freq_numeric_d;
case FRQ_DFREQ | (ALPHA << 16): return compare_freq_alpha_d;
- default: assert (0);
+ default: NOT_REACHED ();
}
return 0;
#include <language/dictionary/split-file.h>
#include <language/lexer/lexer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/magic.h>
ssbox_paired_init(ssb,cmd);
break;
default:
- assert(0);
+ NOT_REACHED ();
}
}
trbox_paired_init(trb,cmd);
break;
default:
- assert(0);
+ NOT_REACHED ();
}
}
flag = which_group(g,p);
}
else
- assert(0);
+ NOT_REACHED ();
return flag;
}
xsort=xsort:yes/no.
*/
+/* (headers) */
+
/* (declarations) */
/* (_functions) */
#include <language/lexer/variable-parser.h>
#include <language/lexer/range-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/magic.h>
#include <libpspp/message.h>
match = true;
break;
default:
- abort ();
+ NOT_REACHED ();
}
if (match)
break;
}
default:
- abort ();
+ NOT_REACHED ();
}
if (match)
+Fri Jul 7 20:01:26 2006 Ben Pfaff <blp@gnu.org>
+
+ * automake.mk: (src_libpspp_libpspp_a_SOURCES) Add assertion.h.
+
+ * assertion.h: New file. Replaced usage of assert(0) and abort()
+ with NOT_REACHED() from this file throughout the source tree.
+
+ * message.c: (request_bug_report_and_abort) Revise message printed
+ to include request to include lines above the message, which
+ should include an assertion failure message in many cases.
+ (msg_assert_fail) Removed.
+
+ * message.h: (assert) Removed.
+ (request_bug_report_and_abort) Mark NO_RETURN.
+
Mon Jul 3 09:36:42 WST 2006 John Darrington <john@darrington.wattle.id.au>
* i18n.c: Made character conversion tolerant of failure to create the
#include <stdlib.h>
#include <string.h>
#include "alloc.h"
+#include <libpspp/assertion.h>
-/* Some of the assertions in this file are very expensive. We
- don't use them by default. */
-#ifdef EXTRA_CHECKS
-#define expensive_assert(X) assert(X)
-#else
-#define expensive_assert(X) ((void) 0)
-#endif
#include "message.h"
\f
/* Finds an element in ARRAY, which contains COUNT elements of
--- /dev/null
+/* PSPP - computes sample statistics.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ Written by John Darrington <john@darrington.wattle.id.au>
+ and Ben Pfaff <blp@gnu.org>.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+#ifndef __PSPP_ASSERT_H
+#define __PSPP_ASSERT_H
+
+#include <stdlib.h>
+#include "compiler.h"
+
+#define NOT_REACHED() do { assert (0); abort (); } while (0)
+
+#endif
+
+#include <assert.h>
+
+#ifndef ASSERT_LEVEL
+#define ASSERT_LEVEL 2
+#endif
+
+#undef expensive_assert
+#if ASSERT_LEVEL >= 5
+#define expensive_assert(EXPR) assert (EXPR)
+#else
+#define expensive_assert(EXPR) ((void) 0)
+#endif
src_libpspp_libpspp_a_SOURCES = \
src/libpspp/array.c \
src/libpspp/array.h \
+ src/libpspp/assertion.h \
src/libpspp/alloc.c \
src/libpspp/alloc.h \
src/libpspp/bit-vector.h \
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <libpspp/alloc.h>
#include <libpspp/version.h>
}
void
-request_bug_report_and_abort(const char *msg )
+request_bug_report_and_abort (const char *msg)
{
- fprintf(stderr,
- "******************************************************************\n"
- "You have discovered a bug in PSPP.\n\n"
- " Please report this, by sending "
- "an email to " PACKAGE_BUGREPORT ",\n"
- "explaining what you were doing when this happened, and including\n"
- "a sample of your input file which caused it.\n");
-
- fprintf(stderr,
- "Also, please copy the following lines into your bug report:\n\n"
- "bare_version: %s\n"
- "version: %s\n"
- "stat_version: %s\n"
- "host_system: %s\n"
- "build_system: %s\n"
- "default_config_path: %s\n"
- "include_path: %s\n"
- "locale_dir: %s\n"
- "compiler version: %s\n"
- ,
-
- bare_version,
- version,
- stat_version,
- host_system,
- build_system,
- default_config_path,
- include_path,
- locale_dir,
+ fprintf (stderr, "******************************************************\n");
+ fprintf (stderr, "You have discovered a bug in PSPP. Please report this\n");
+ fprintf (stderr, "to " PACKAGE_BUGREPORT ". Please include this entire\n");
+ fprintf (stderr, "message, *plus* several lines of output just above it.\n");
+ fprintf (stderr, "For the best chance at having the bug fixed, also\n");
+ fprintf (stderr, "include the syntax file that triggered it and a sample\n");
+ fprintf (stderr, "of any data file used for input.\n");
+ fprintf (stderr, "proximate cause: %s\n", msg);
+ fprintf (stderr, "version: %s\n", stat_version);
+ fprintf (stderr, "host_system: %s\n", host_system);
+ fprintf (stderr, "build_system: %s\n", build_system);
+ fprintf (stderr, "default_config_path: %s\n", default_config_path);
+ fprintf (stderr, "include_path: %s\n", include_path);
+ fprintf (stderr, "locale_dir: %s\n", locale_dir);
+ fprintf (stderr, "compiler version: %s\n",
#ifdef __VERSION__
- __VERSION__
+ __VERSION__
#else
- "Unknown"
+ "Unknown"
#endif
- );
+ );
+ fprintf (stderr, "******************************************************\n");
- if ( msg )
- fprintf(stderr,"Diagnosis: %s\n",msg);
-
- fprintf(stderr,
- "******************************************************************\n");
-
- abort();
+ _exit (EXIT_FAILURE);
}
-
-void
-msg_assert_fail(const char *expr, const char *file, int line)
-{
- char msg[256];
- snprintf(msg,256,"Assertion failed: %s:%d; (%s)",file,line,expr);
- request_bug_report_and_abort( msg );
-}
-
/* Used in panic situations only. */
-void request_bug_report_and_abort (const char *msg);
-
-void msg_assert_fail (const char *expr, const char *file, int line);
-
-#undef __STRING
-#define __STRING(x) #x
-#undef assert
-
-#define assert(expr) ( (void) ( expr ? (void) 0 : \
- msg_assert_fail(__STRING(expr), __FILE__, __LINE__)) )
+void request_bug_report_and_abort (const char *msg) NO_RETURN;
#endif /* message.h */
#include "pool.h"
#include <stdlib.h>
#include "alloc.h"
+#include <libpspp/assertion.h>
#include "message.h"
#include "size_max.h"
#include "str.h"
gizmo->p.registered.free (gizmo->p.registered.p);
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
Create design matrices for procedures that need them.
*/
#include <config.h>
+
+#include "design-matrix.h"
+
+#include <assert.h>
+#include <math.h>
#include <stdlib.h>
+#include <string.h>
+
#include <libpspp/alloc.h>
#include <libpspp/message.h>
#include <data/variable.h>
#include <data/category.h>
-#include "design-matrix.h"
-#include <string.h>
-#include <math.h>
+
#include <gsl/gsl_machine.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <language/expressions/public.h>
#include <libpspp/alloc.h>
#include <libpspp/array.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
{
bool ok = casereader_read_xfer (reader, &cases[i].c);
if (!ok)
- abort ();
+ NOT_REACHED ();
cases[i].idx = i;
}
for (i = 0; i < case_cnt; i++)
casefile_append_xfer (dst, &cases[i].c);
if (casefile_error (dst))
- abort ();
+ NOT_REACHED ();
free (cases);
}
#include <setjmp.h>
#include "error.h"
#include "minmax.h"
+#include <libpspp/assertion.h>
#include <libpspp/pool.h>
#include <libpspp/str.h>
break;
default:
- abort ();
+ NOT_REACHED ();
}
binary_finish (&e);
}
#include <data/file-name.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/pool.h>
#include <libpspp/start-date.h>
this->width = arg;
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
x->tab_width = arg;
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
x->squeeze_blank_lines = setting;
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
default:
- abort ();
+ NOT_REACHED ();
}
return true;
x += width - length;
break;
default:
- abort ();
+ NOT_REACHED ();
}
if (y >= this->length || x >= this->width)
#include <libpspp/str.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <output/manager.h>
#include <output/output.h>
else if (orientation == TICK_ORDINATE )
pl_flinerel_r(chart->lp, 0, position, -tickSize, position);
else
- assert(0);
+ NOT_REACHED ();
if ( label ) {
char buf[10];
#include <unistd.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <data/file-name.h>
#include "error.h"
error (0, 0, _("`chart-files' value must contain `#'"));
break;
default:
- abort ();
+ NOT_REACHED ();
}
break;
default:
- abort ();
+ NOT_REACHED ();
}
return true;
link_image (x->file, ((struct chart *)s->ext)->file_name);
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
#include "manager.h"
#include <stdio.h>
#include <stdlib.h>
+#include <libpspp/assertion.h>
#include "output.h"
/* Table. */
{
printf ("headers: (l,r)=(%d,%d), (t,b)=(%d,%d) in table size (%d,%d)\n",
hl, hr, ht, hb, nc, nr);
- abort ();
+ NOT_REACHED ();
}
else if (hl + hr == nc)
printf ("warning: headers (l,r)=(%d,%d) in table width %d\n", hl, hr, nc);
#include <unistd.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/bit-vector.h>
#include <libpspp/compiler.h>
#include <libpspp/freaderror.h>
this->font_height = arg;
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
x->line_width = dimension;
break;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
}
break;
default:
- abort ();
+ NOT_REACHED ();
}
return true;
case SOM_CHART:
break;
default:
- abort ();
- break;
+ NOT_REACHED ();
}
}
\f
#include <limits.h>
#include <stdlib.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <data/format.h>
#include <libpspp/magic.h>
x2, t->col_ofs, x2 + t->col_ofs,
y2, t->row_ofs, y2 + t->row_ofs,
t->nc, t->nr);
- abort ();
+ NOT_REACHED ();
}
#endif
if (row < -1 || row >= t->nr)
{
printf ("tab_offset(): row=%d in %d-row table\n", row, t->nr);
- abort ();
+ NOT_REACHED ();
}
if (col < -1 || col >= t->nc)
{
printf ("tab_offset(): col=%d in %d-column table\n", col, t->nc);
- abort ();
+ NOT_REACHED ();
}
#endif
case TAL_2:
return OUTP_L_DOUBLE;
default:
- abort ();
+ NOT_REACHED ();
}
}
case TAB_CENTER:
return OUTP_CENTER;
default:
- abort ();
+ NOT_REACHED ();
}
}
case TAL_2:
return OUTP_L_DOUBLE;
default:
- abort ();
+ NOT_REACHED ();
}
}
+Fri Jul 7 20:03:42 2006 Ben Pfaff <blp@gnu.org>
+
+ * main.c: (main) Register SIGABRT with bug_handler also.
+ (bug_handler) Handle SIGABRT also.
+
Tue Jun 27 22:44:56 2006 Ben Pfaff <blp@gnu.org>
Fix regression in command name completion reported by John
#include <getopt.h>
#include <stdlib.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/copyleft.h>
#include <libpspp/message.h>
#include <language/line-buffer.h>
case 0:
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
int
main (int argc, char **argv)
{
+ signal (SIGABRT, bug_handler);
signal (SIGSEGV, bug_handler);
signal (SIGFPE, bug_handler);
signal (SIGINT, interrupt_handler);
{
switch (sig)
{
+ case SIGABRT:
+ request_bug_report_and_abort("Assertion Failure/Abort");
case SIGFPE:
request_bug_report_and_abort("Floating Point Exception");
- break;
case SIGSEGV:
request_bug_report_and_abort("Segmentation Violation");
- break;
default:
- request_bug_report_and_abort("");
- break;
+ request_bug_report_and_abort("Unknown");
}
}