From: Ben Pfaff Date: Fri, 12 Dec 2003 21:39:53 +0000 (+0000) Subject: * All source files: Get rid of nasty special cases for X-Git-Tag: v0.4.0~464 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb4033020c8a24d573814e6ac9192046bffdccac;p=pspp-builds.git * All source files: Get rid of nasty special cases for Checker, which is pretty obsolete now. --- diff --git a/src/ChangeLog b/src/ChangeLog index dca50453..d4898d32 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Fri Dec 12 13:31:58 2003 Ben Pfaff + + * All source files: Get rid of nasty special cases for Checker, + which is pretty obsolete now. Thu Dec 11 21:38:24 WST 2003 John Darrington diff --git a/src/alloc.c b/src/alloc.c index 763dab3d..0dc815f7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -112,11 +112,6 @@ xstrdup (const char *s) static void out_of_memory (void) { -#if __CHECKER__ - fprintf (stderr, "Out of memory: inducing segfault\n"); - *((int *) 0) = 0; -#else fprintf (stderr, "virtual memory exhausted\n"); exit (EXIT_FAILURE); -#endif } diff --git a/src/autorecode.c b/src/autorecode.c index 5ae1e7f6..a682b30d 100644 --- a/src/autorecode.c +++ b/src/autorecode.c @@ -330,9 +330,6 @@ autorecode_proc_func (struct ccase * c) if (NULL == *vpp) { vp = pool_alloc (hash_pool, sizeof (union value)); -#if __CHECKER__ - memset (vp, 0, sizeof (union value)); -#endif vp->c = pool_strdup (hash_pool, v.c); *vpp = vp; } diff --git a/src/data-in.c b/src/data-in.c index 9bdda48c..dc2e707d 100644 --- a/src/data-in.c +++ b/src/data-in.c @@ -574,11 +574,6 @@ parse_A (struct data_in *i) memset (i->v->s + len, ' ', i->format.w - len); } -#if __CHECKER__ - memset (i->v->s + i->format.w, '%', - REM_RND_UP (i->format.w, MAX_SHORT_STRING)); -#endif - return 1; } @@ -613,11 +608,6 @@ parse_AHEX (struct data_in *i) memset (i->v->s + (i->e - i->s) / 2, ' ', (i->format.w - (i->e - i->s)) / 2); } -#if __CHECKER__ - memset (i->v->s + i->format.w / 2, '%', - REM_RND_UP (i->format.w / 2, MAX_SHORT_STRING)); -#endif - return 1; } @@ -1497,13 +1487,7 @@ default_result (struct data_in *i) /* Default to SYSMIS or blanks. */ if (fmt->cat & FCAT_STRING) - { -#if __CHECKER__ - memset (i->v->s, ' ', ROUND_UP (i->format.w, MAX_SHORT_STRING)); -#else - memset (i->v->s, ' ', i->format.w); -#endif - } + memset (i->v->s, ' ', i->format.w); else i->v->f = set_blanks; } diff --git a/src/data-list.c b/src/data-list.c index c775c8da..7c411e17 100644 --- a/src/data-list.c +++ b/src/data-list.c @@ -276,10 +276,6 @@ append_var_spec (struct dls_var_spec *spec) else next = next->next = xmalloc (sizeof *spec); -#if __CHECKER__ - spec->type = ROUND_UP (spec->type, 8); -#endif - memcpy (next, spec, sizeof *spec); next->next = NULL; } @@ -783,9 +779,6 @@ parse_free (void) int i; int type; -#if __CHECKER__ - memset (&spec, 0, sizeof spec); -#endif lex_get (); while (token != '.') { @@ -1034,9 +1027,6 @@ do_reading (int flag) break; } fh_close_handle (dlsp->handle); -#if __CHECKER__ - code = 0; /* prevent error at `return code;' */ -#endif } dfm_pop (dlsp->handle); diff --git a/src/data-out.c b/src/data-out.c index e5a42d57..d54ebd1f 100644 --- a/src/data-out.c +++ b/src/data-out.c @@ -751,10 +751,6 @@ convert_date (char *dst, const struct fmt_spec *fp, const union value *v) } } break; -#if __CHECKER__ - case 42000: - assert (0); -#endif default: assert (0); } diff --git a/src/dfm.c b/src/dfm.c index 9e9d080c..21b2b5ac 100644 --- a/src/dfm.c +++ b/src/dfm.c @@ -108,9 +108,6 @@ open_inline_file (struct dfm_fhuser_ext *ext) { /* We want to indicate that the file is open, that we are not at eof, and that another line needs to be read in. */ -#if __CHECKER__ - memset (&ext->file, 0, sizeof ext->file); -#endif ext->file.file = NULL; ext->line = xmalloc (128); #if !PRODUCTION diff --git a/src/error.c b/src/error.c index 1983df4d..803cdc71 100644 --- a/src/error.c +++ b/src/error.c @@ -217,10 +217,6 @@ err_check_count (void) getl_close_all (); } -#if __CHECKER__ -static void induce_segfault (void); -#endif - /* Some machines are broken. Compensate. */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 @@ -244,11 +240,6 @@ err_hcf (int success) outp_done (); -#if __CHECKER__ - if (!success) - induce_segfault (); -#endif - exit (success ? EXIT_SUCCESS : EXIT_FAILURE); } @@ -499,19 +490,3 @@ dump_message (char *msg, unsigned indent, void (*func) (const char *), local_free (buf); } - -#if __CHECKER__ -/* Causes a segfault in order to force Checker to print a stack - backtrace. */ -static void -induce_segfault (void) -{ - fputs (_("\n" - "\t*********************\n" - "\t* INDUCING SEGFAULT *\n" - "\t*********************\n"), stdout); - fflush (stdout); - fflush (stderr); - abort (); -} -#endif diff --git a/src/expr-evl.c b/src/expr-evl.c index 75ae6d4e..dc017a59 100644 --- a/src/expr-evl.c +++ b/src/expr-evl.c @@ -1352,12 +1352,6 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) case OP_SENTINEL: goto finished; -#if __CHECKER__ - /* This case prevents Checker from choking. */ - case 42000: - assert (0); -#endif - default: #if GLOBAL_DEBUGGING printf (_("evaluate_expression(): not implemented: %s\n"), diff --git a/src/expr-opt.c b/src/expr-opt.c index e221d4e2..8724b9e0 100644 --- a/src/expr-opt.c +++ b/src/expr-opt.c @@ -884,12 +884,6 @@ evaluate_tree (struct nonterm_node * n) } rnc (n0); break; - -#if __CHECKER__ - /* This case prevents Checker from choking. */ - case 42000: - assert (0); -#endif } return n; } diff --git a/src/expr-prs.c b/src/expr-prs.c index d447afdf..1a040202 100644 --- a/src/expr-prs.c +++ b/src/expr-prs.c @@ -1468,10 +1468,8 @@ expr_type_name (int type) default: assert (0); + return 0; } -#if __GNUC__ || __BORLANDC__ - return 0; -#endif } static const char * @@ -1485,10 +1483,8 @@ type_name (int type) return _("string"); default: assert (0); + return 0; } -#if __GNUC__ || __BORLANDC__ - return 0; -#endif } static void diff --git a/src/file-type.c b/src/file-type.c index 3400c8a0..b0ed4607 100644 --- a/src/file-type.c +++ b/src/file-type.c @@ -405,11 +405,6 @@ internal_cmd_record_type (void) rct.ft = n_trns; if (fty.case_sbc.name[0]) rct.case_sbc = fty.case_sbc; -#if __CHECKER__ - else - memset (&rct.case_sbc, 0, sizeof rct.case_sbc); - rct.lt = -1; -#endif /* Make sure we're inside a FILE TYPE structure. */ if (pgm_state != STATE_INPUT || vfm_source != &file_type_source) diff --git a/src/filename.c b/src/filename.c index 4aaf7d17..ac4815ed 100644 --- a/src/filename.c +++ b/src/filename.c @@ -373,16 +373,10 @@ fn_normalize (const char *filename) else { errno = 0; -#if __CHECKER__ - memset (dest, 0, maxlen); -#endif while (getcwd (dest, maxlen - (dest - fn2)) == NULL && errno == ERANGE) { maxlen *= 2; dest = fn2 = xrealloc (fn2, maxlen + 1); -#if __CHECKER__ - memset (dest, 0, maxlen); -#endif errno = 0; } if (errno) diff --git a/src/get.c b/src/get.c index 8f4a05f3..eb1c1c04 100644 --- a/src/get.c +++ b/src/get.c @@ -1253,11 +1253,6 @@ mtf_processing (struct ccase *c unused) assert (v->type == ALPHA); memcpy (compaction_case->data[v->p.mtf.master->fv].s, iter->input[v->fv].s, v->width); -#if __CHECKER__ - memset (&compaction_case - ->data[v->p.mtf.master->fv].s[v->width], - 0, REM_RND_UP (v->width, MAX_SHORT_STRING)); -#endif } } } @@ -1286,15 +1281,8 @@ mtf_processing (struct ccase *c unused) if (v->type == NUMERIC) compaction_case->data[v->p.mtf.master->fv].f = SYSMIS; else - { - memset (compaction_case->data[v->p.mtf.master->fv].s, ' ', - v->width); -#if __CHECKER__ - memset (&compaction_case - ->data[v->p.mtf.master->fv].s[v->width], - 0, REM_RND_UP (v->width, MAX_SHORT_STRING)); -#endif - } + memset (compaction_case->data[v->p.mtf.master->fv].s, ' ', + v->width); } if (iter->handle == NULL) diff --git a/src/glob.c b/src/glob.c index 235399c0..a4b5bf7a 100644 --- a/src/glob.c +++ b/src/glob.c @@ -124,7 +124,7 @@ int logging; static void get_date (void); -#if HAVE_LIBTERMCAP && !__CHECKER__ +#if HAVE_LIBTERMCAP static char *term_buffer; #endif @@ -273,20 +273,11 @@ init_glob (int argc unused, char **argv) int success; /* This code stolen from termcap.info, though modified. */ -#if !__CHECKER__ - term_buffer = xmalloc (2048); -#endif - termtype = getenv ("TERM"); if (!termtype) msg (FE, _("Specify a terminal type with `setenv TERM '.")); -#if __CHECKER__ - success = tgetent (NULL, termtype); -#else success = tgetent (term_buffer, termtype); -#endif - if (success <= 0) { if (success < 0) diff --git a/src/html.c b/src/html.c index cb4ae056..42d818b5 100644 --- a/src/html.c +++ b/src/html.c @@ -174,10 +174,6 @@ html_option (struct outp_driver *this, const char *key, const struct string *val *dest = xstrdup (ds_value (val)); } break; -#if __CHECKER__ - case 42000: - assert (0); -#endif default: assert (0); } diff --git a/src/mis-val.c b/src/mis-val.c index a048e405..a11833d7 100644 --- a/src/mis-val.c +++ b/src/mis-val.c @@ -62,10 +62,6 @@ cmd_missing_values (void) lex_match_id ("VALUES"); while (token != '.') { -#if __CHECKER__ - memset (missing, 0, sizeof missing); -#endif - if (!parse_varnames ()) goto fail; diff --git a/src/pool.c b/src/pool.c index bfb93b4b..ca05039a 100644 --- a/src/pool.c +++ b/src/pool.c @@ -102,17 +102,15 @@ union align #define ALIGN_SIZE sizeof (union align) #endif -/* DISCRETE_BLOCKS may be declared as nonzero to prevent suballocation - of blocks. This is useful under memory debuggers like Checker - because it allows the source location of bugs to be more accurately - pinpointed. +/* DISCRETE_BLOCKS may be declared as nonzero to prevent + suballocation of blocks. This is useful under memory + debuggers like Checker or valgrind because it allows the + source location of bugs to be more accurately pinpointed. On the other hand, if we're testing the library, then we want to test the library's real functionality, not its crippled, slow, simplified functionality. */ -#if __CHECKER__ && !SELF_TEST -#define DISCRETE_BLOCKS 1 -#endif +/*#define DISCRETE_BLOCKS 1*/ /* Enable debug code if appropriate. */ #undef DEBUGGING diff --git a/src/postscript.c b/src/postscript.c index 8e6fa488..0e3f5b5b 100644 --- a/src/postscript.c +++ b/src/postscript.c @@ -811,10 +811,6 @@ ps_option (struct outp_driver *this, const char *key, const struct string *val) } } break; -#if __CHECKER__ - case 42000: - assert (0); -#endif default: assert (0); } @@ -2745,9 +2741,6 @@ text (struct outp_driver *this, struct outp_text *t, int draw) } x += kern_amt; -#if __CHECKER__ - memset (buf_loc, 0, sizeof *buf_loc); -#endif buf_loc->font = ext->current; buf_loc->size = ext->size; buf_loc->x = x; diff --git a/src/q2c.c b/src/q2c.c index 2098c9bd..87dcadb1 100644 --- a/src/q2c.c +++ b/src/q2c.c @@ -163,13 +163,7 @@ xmalloc (size_t size) vp = malloc (size); if (!vp) - { -#if DEBUGGING && __CHECKER__ - error ("xmalloc(%lu): Inducing segfault.", (unsigned long) size); - *((int *) 0) = 0; -#endif - fail ("xmalloc(%lu): %s", (unsigned long) size, VME); - } + fail ("xmalloc(%lu): %s", (unsigned long) size, VME); return vp; } diff --git a/src/temporary.c b/src/temporary.c index 316fd649..ed456da5 100644 --- a/src/temporary.c +++ b/src/temporary.c @@ -259,16 +259,6 @@ restore_dictionary (struct dictionary * d) free (default_dict.documents); /* 2. Copy dictionary D into the active file dictionary. */ -#if __CHECKER__ - { - size_t offset; - - offset = offsetof (struct dictionary, filter_var) + sizeof d->filter_var; - strncpy (d->weight_var, d->weight_var, 9); - strncpy (d->filter_var, d->filter_var, 9); - memset (&((char *) d)[offset], '*', sizeof *d - offset); - } -#endif default_dict = *d; if (!default_dict.var_by_name) { diff --git a/src/val-labs.c b/src/val-labs.c index ae9ac296..c36ff28b 100644 --- a/src/val-labs.c +++ b/src/val-labs.c @@ -173,9 +173,6 @@ get_label (void) /* Allocate label. */ label = xmalloc (sizeof *label); -#if __CHECKER__ - memset (&label->v, 0, sizeof label->v); -#endif label->ref_count = nv; /* Set label->v. */ diff --git a/src/vfm.c b/src/vfm.c index 333851d6..331f287f 100644 --- a/src/vfm.c +++ b/src/vfm.c @@ -358,23 +358,6 @@ make_temp_case (void) if (compaction_necessary) compaction_case = xmalloc (sizeof (struct ccase) + sizeof (union value) * (compaction_nval - 1)); - -#if __CHECKER__ - /* Initialize the unused trailing parts of string variables to avoid - spurious warnings from Checker. */ - { - int i; - - for (i = 0; i < default_dict.nvar; i++) - { - struct variable *v = default_dict.var[i]; - - if (v->type == ALPHA && v->width % 8 != 0) - memcpy (&temp_case->data[v->fv + v->nv - 1] - .s[v->width % 8], _("!ERROR!"), 8 - v->width % 8); - } - } -#endif } #if DEBUGGING