浏览代码

clean-up code generation suppression for lint

dick 34 年之前
父节点
当前提交
2a4d8e0a25

+ 1 - 1
lang/cem/cemcom/.distr

@@ -36,6 +36,7 @@ decspecs.str
 def.str
 domacro.c
 dumpidf.c
+em_lint.h
 error.c
 estack.str
 eval.c
@@ -56,7 +57,6 @@ l_brace.str
 l_class.h
 l_comment.h
 l_comment.c
-l_dummy.c
 l_ev_ord.c
 l_lint.c
 l_lint.h

+ 11 - 7
lang/cem/cemcom/Makefile

@@ -81,7 +81,7 @@ CSRC =	main.c idf.c declarator.c decspecs.c struct.c \
 	scan.c skip.c stack.c type.c ch7mon.c label.c eval.c \
 	switch.c conversion.c util.c \
 	blocks.c dataflow.c Version.c \
-	l_lint.c l_states.c l_misc.c l_ev_ord.c l_outdef.c l_comment.c l_dummy.c
+	l_lint.c l_states.c l_misc.c l_ev_ord.c l_outdef.c l_comment.c
 COBJ =	main.o idf.o declarator.o decspecs.o struct.o \
 	expr.o ch7.o ch7bin.o cstoper.o arith.o \
 	asm.o code.o dumpidf.o error.o field.o\
@@ -90,7 +90,7 @@ COBJ =	main.o idf.o declarator.o decspecs.o struct.o \
 	scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \
 	switch.o conversion.o util.o \
 	blocks.o dataflow.o Version.o \
-	l_lint.o l_states.o l_misc.o l_ev_ord.o l_outdef.o l_comment.o l_dummy.o
+	l_lint.o l_states.o l_misc.o l_ev_ord.o l_outdef.o l_comment.o
 
 # Objects of other generated C files
 GCSRC =	char.c symbol2str.c next.c
@@ -121,7 +121,7 @@ GHSRC =	botch_free.h dataflow.h debug.h density.h errout.h \
 
 HSRC = LLlex.h align.h arith.h assert.h atw.h class.h \
 	 input.h interface.h label.h level.h mes.h sizes.h specials.h \
-	 file_info.h tokenname.h l_lint.h
+	 file_info.h tokenname.h em_lint.h l_lint.h
 
 HFILES = $(HSRC) $(GHSRC) $(GHSTRSRC)
 
@@ -272,6 +272,7 @@ main.o: LLlex.h
 main.o: Lpars.h
 main.o: align.h
 main.o: arith.h
+main.o: assert.h
 main.o: debug.h
 main.o: declar.h
 main.o: file_info.h
@@ -465,6 +466,7 @@ code.o: debug.h
 code.o: declar.h
 code.o: decspecs.h
 code.o: def.h
+code.o: em_lint.h
 code.o: expr.h
 code.o: file_info.h
 code.o: idf.h
@@ -506,6 +508,7 @@ error.o: LLlex.h
 error.o: arith.h
 error.o: debug.h
 error.o: def.h
+error.o: em_lint.h
 error.o: errout.h
 error.o: expr.h
 error.o: file_info.h
@@ -657,6 +660,7 @@ stack.o: arith.h
 stack.o: botch_free.h
 stack.o: debug.h
 stack.o: def.h
+stack.o: em_lint.h
 stack.o: idf.h
 stack.o: level.h
 stack.o: lint.h
@@ -742,6 +746,7 @@ switch.o: botch_free.h
 switch.o: code.h
 switch.o: debug.h
 switch.o: density.h
+switch.o: em_lint.h
 switch.o: expr.h
 switch.o: idf.h
 switch.o: label.h
@@ -766,6 +771,7 @@ conversion.o: type.h
 util.o: Lpars.h
 util.o: align.h
 util.o: def.h
+util.o: em_lint.h
 util.o: lint.h
 util.o: nocross.h
 util.o: nofloat.h
@@ -909,10 +915,6 @@ l_comment.o: l_comment.h
 l_comment.o: l_state.h
 l_comment.o: lint.h
 l_comment.o: spec_arith.h
-l_dummy.o: arith.h
-l_dummy.o: label.h
-l_dummy.o: lint.h
-l_dummy.o: spec_arith.h
 tokenfile.o: Lpars.h
 declar.o: LLlex.h
 declar.o: Lpars.h
@@ -946,6 +948,7 @@ statement.o: botch_free.h
 statement.o: code.h
 statement.o: debug.h
 statement.o: def.h
+statement.o: em_lint.h
 statement.o: expr.h
 statement.o: file_info.h
 statement.o: idf.h
@@ -997,6 +1000,7 @@ ival.o: arith.h
 ival.o: assert.h
 ival.o: debug.h
 ival.o: def.h
+ival.o: em_lint.h
 ival.o: estack.h
 ival.o: expr.h
 ival.o: field.h

+ 7 - 3
lang/cem/cemcom/code.c

@@ -6,7 +6,12 @@
 /*	C O D E - G E N E R A T I N G   R O U T I N E S		*/
 
 #include	"lint.h"
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#include	"l_lint.h"
+#endif	LINT
 #include	"botch_free.h"
 #include	<alloc.h>
 #include	"dataflow.h"
@@ -30,9 +35,6 @@
 #include	"assert.h"
 #include	"noRoption.h"
 #include	"file_info.h"
-#ifdef	LINT
-#include	"l_lint.h"
-#endif	LINT
 
 label lab_count = 1;
 label datlab_count = 1;
@@ -104,6 +106,7 @@ def_strings(sc)
 	}
 }
 
+#ifndef	LINT
 end_code()
 {
 	/*	end_code() performs the actions to be taken when closing
@@ -120,6 +123,7 @@ end_code()
 	C_ms_src((int)(LineNumber - 2), FileName);
 	C_close();
 }
+#endif	LINT
 
 #ifdef	PREPEND_SCOPES
 prepend_scopes()

+ 71 - 0
lang/cem/cemcom/em_lint.h

@@ -0,0 +1,71 @@
+/*
+ * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+/*
+ * This file can be considered the em_code.h file of lint.
+ * Those code generating functions that are used by cem and that have not
+ * been defined away by #ifdef LINT, are defined away here. Note that this a
+ * fairly random collection. E.g. it does not include C_open(), since the
+ * standard C-open() C_close() sequence is protected by #ifdef LINT, but it
+ * does include C_close() since the latter is also called in other places,
+ * to terminate the compilation process.
+ */
+
+#define	C_asp(c)
+#define	C_bra(b)
+#define	C_cal(p)
+#define	C_csa(w)
+#define	C_csb(w)
+#define	C_fil_dlb(g,o)
+#define	C_lae_dlb(g,o)
+#define	C_lal(c)
+#define	C_lin(c)
+#define	C_loi(c)
+#define	C_lol(c)
+#define	C_sdl(c)
+#define	C_sti(c)
+#define	C_stl(c)
+
+#define	C_busy()	0
+#define	C_close()
+
+#define	C_df_dlb(l)
+#define	C_df_dnam(s)
+#define	C_df_ilb(l)
+
+#define	C_pro_narg(s)
+#define	C_end(l)
+
+#define	C_exa_dnam(s)
+#define	C_ina_dnam(s)
+#define	C_ina_dlb(l)
+#define	C_exp(s)
+#define	C_inp(s)
+
+#define	C_bss_cst(n,w,i)
+
+#define	C_con_cst(v)
+#define	C_con_icon(v,s)
+#define	C_con_ucon(v,s)
+#define	C_con_fcon(v,s)
+#define	C_con_scon(v,s)
+#define	C_con_dnam(v,s)
+#define	C_con_dlb(v,s)
+#define	C_con_pnam(v)
+
+#define	C_rom_cst(v)
+#define	C_rom_scon(v,s)
+#define	C_rom_ilb(v)
+
+#define	C_ldl(l)
+
+#define	C_mes_begin(ms)
+#define	C_mes_end()
+
+#define	C_ms_gto()
+#define	C_ms_par(b)
+#define	C_ms_reg(o,s,t,c)
+

+ 5 - 1
lang/cem/cemcom/error.c

@@ -5,11 +5,15 @@
 /* $Header$ */
 /*	E R R O R   A N D  D I A G N O S T I C   R O U T I N E S	*/
 
+#include	"lint.h"
 #include	<varargs.h>
 #include	<system.h>
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#endif	LINT
 
-#include	"lint.h"
 #include	"nopp.h"
 #include	"errout.h"
 #include	"debug.h"

+ 6 - 4
lang/cem/cemcom/ival.g

@@ -8,7 +8,12 @@
 {
 #include	"lint.h"
 #include	"nofloat.h"
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#include	"l_lint.h"
+#endif	LINT
 #include	"debug.h"
 #include	<alloc.h>
 #include	"nobitfield.h"
@@ -27,9 +32,6 @@
 #include	"LLlex.h"
 #include	"noRoption.h"
 #include	"estack.h"
-#ifdef	LINT
-#include	"l_lint.h"
-#endif	LINT
 
 #define con_nullbyte()	C_con_ucon("0", (arith)1)
 #define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)
@@ -564,7 +566,7 @@ ch_array(tpp, ex)
 	ASSERT(ex->ex_class == String);
 	if (tp->tp_size == (arith)-1) {
 		/* set the dimension	*/
-		tp = *tpp = construct_type(ARRAY, tp->tp_up, length);
+		tp = *tpp = construct_type(ARRAY, tp->tp_up, (arith)length);
 	}
 	else {
 		arith dim = tp->tp_size / tp->tp_up->tp_size;

+ 5 - 4
lang/cem/cemcom/main.c

@@ -180,7 +180,7 @@ char *source;
 add_dependency(s)
 char *s;
 {
-    register struct idf *p = str2idf(s, 0);
+    register struct idf *p = str2idf(s);
     
     if (! p->id_resmac) {
 	p->id_resmac = K_FILE;
@@ -281,15 +281,16 @@ compile(argc, argv)
 #ifndef	LINT
 		init_code(destination && strcmp(destination, "-") != 0 ?
 					destination : 0);
-#endif	LINT
-
 		/* compile the source text			*/
 		C_program();
-
 #ifdef PREPEND_SCOPES
 		prepend_scopes();
 #endif PREPEND_SCOPES
 		end_code();
+#else	LINT
+		/* lint the source text				*/
+		C_program();
+#endif	LINT
 
 #ifdef	DEBUG
 		if (options['u'])	{

+ 4 - 2
lang/cem/cemcom/stack.c

@@ -8,7 +8,11 @@
 #include	"lint.h"
 #include	"nofloat.h"
 #include	<system.h>
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#endif	LINT
 #include	"debug.h"
 #include	"botch_free.h"
 #include	<alloc.h>
@@ -23,8 +27,6 @@
 #include	"mes.h"
 #include	"noRoption.h"
 
-/* #include	<em_reg.h> */
-
 extern char options[];
 
 static struct stack_level UniversalLevel;

+ 6 - 4
lang/cem/cemcom/statement.g

@@ -6,9 +6,14 @@
 /*	STATEMENT SYNTAX PARSER	*/
 
 {
+#include	"lint.h"
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#include	"l_lint.h"
+#endif	LINT
 
-#include	"lint.h"
 #include	"debug.h"
 #include	"botch_free.h"
 
@@ -21,9 +26,6 @@
 #include	"code.h"
 #include	"stack.h"
 #include	"def.h"
-#ifdef	LINT
-#include	"l_lint.h"
-#endif	LINT
 
 extern int level;
 }

+ 5 - 1
lang/cem/cemcom/switch.c

@@ -5,8 +5,13 @@
 /* $Header$ */
 /*	S W I T C H - S T A T E M E N T  A D M I N I S T R A T I O N	*/
 
+#include	"lint.h"
 #include	"nofloat.h"
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#endif	LINT
 #include	"debug.h"
 #include	"botch_free.h"
 #include	<alloc.h>
@@ -21,7 +26,6 @@
 #include	"expr.h"
 #include	"type.h"
 #include	"noRoption.h"
-#include	"lint.h"
 
 extern char options[];
 

+ 6 - 1
lang/cem/cemcom/util.c

@@ -11,12 +11,17 @@
 	allowing re-use.
 */
 
+#include	"lint.h"
+#ifndef	LINT
 #include	<em.h>
+#else
+#include	"em_lint.h"
+#endif	LINT
+#include	<em_arith.h>
 #include	<em_reg.h>
 #include	<alloc.h>
 #include	<em_mes.h>
 
-#include	"lint.h"
 #include	"util.h"
 #include	"use_tmp.h"
 #include	"regcount.h"