From 29152cbf74ed5505d2d6c5f52cf5ef176cfaf38e Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 26 Feb 1990 11:35:15 +0000 Subject: [PATCH] two fixes to the lint part: unsigned constant compares, and initializations in switch headers --- lang/cem/cemcom/Makefile | 2 ++ lang/cem/cemcom/domacro.c | 2 +- lang/cem/cemcom/l_misc.c | 2 +- lang/cem/cemcom/switch.c | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/cem/cemcom/Makefile b/lang/cem/cemcom/Makefile index b34a4987c..9b34a124b 100644 --- a/lang/cem/cemcom/Makefile +++ b/lang/cem/cemcom/Makefile @@ -394,6 +394,7 @@ expr.o: sizes.h expr.o: spec_arith.h expr.o: target_sizes.h expr.o: type.h +expr.o: use_tmp.h ch7.o: Lpars.h ch7.o: arith.h ch7.o: assert.h @@ -743,6 +744,7 @@ switch.o: density.h switch.o: expr.h switch.o: idf.h switch.o: label.h +switch.o: lint.h switch.o: noRoption.h switch.o: nobitfield.h switch.o: nofloat.h diff --git a/lang/cem/cemcom/domacro.c b/lang/cem/cemcom/domacro.c index 0f17f8389..7c2006d3c 100644 --- a/lang/cem/cemcom/domacro.c +++ b/lang/cem/cemcom/domacro.c @@ -571,7 +571,7 @@ get_text(formals, length) LoadChar(c); if (c == '*') { skipcomment(); - text[pos++] = ' '; + /* text[pos++] = ' '; ??? Why ??? */ LoadChar(c); } else diff --git a/lang/cem/cemcom/l_misc.c b/lang/cem/cemcom/l_misc.c index 6117832b3..22947d27b 100644 --- a/lang/cem/cemcom/l_misc.c +++ b/lang/cem/cemcom/l_misc.c @@ -362,7 +362,7 @@ lint_relop(left, right, oper) && right->ex_class == Value && right->VL_CLASS == Const ) { - if (right->VL_VALUE < 0) { + if (!right->ex_type->tp_unsigned && right->VL_VALUE < 0) { warning("unsigned compared to negative constant"); } if (right->VL_VALUE == 0) { diff --git a/lang/cem/cemcom/switch.c b/lang/cem/cemcom/switch.c index 859766ce0..f534118ee 100644 --- a/lang/cem/cemcom/switch.c +++ b/lang/cem/cemcom/switch.c @@ -21,6 +21,7 @@ #include "expr.h" #include "type.h" #include "noRoption.h" +#include "lint.h" extern char options[]; @@ -80,6 +81,9 @@ code_startswitch(expp) sh->sh_lowerbd = sh->sh_upperbd = (arith)0; /* immaterial ??? */ sh->sh_entries = (struct case_entry *) 0; /* case-entry list */ sh->sh_expr = *expp; +#ifdef LINT + code_expr(sh->sh_expr, RVAL, TRUE, NO_LABEL, NO_LABEL); +#endif sh->next = switch_stack; /* push onto switch-stack */ switch_stack = sh; C_bra(l_table); /* goto start of switch_table */ @@ -96,7 +100,9 @@ code_endswitch() C_bra(sh->sh_break); /* skip the switch table now */ C_df_ilb(sh->sh_table); /* switch table entry */ /* evaluate the switch expr. */ +#ifndef LINT code_expr(sh->sh_expr, RVAL, TRUE, NO_LABEL, NO_LABEL); +#endif tablabel = data_label(); /* the rom must have a label */ C_df_dlb(tablabel); C_rom_ilb(sh->sh_default); -- 2.34.1