better error reporting
This commit is contained in:
		
							parent
							
								
									53fe78afae
								
							
						
					
					
						commit
						d75369dd40
					
				
					 5 changed files with 35 additions and 13 deletions
				
			
		| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
#	M A K E F I L E   F O R   L P A S S 2
 | 
					#	M A K E F I L E   F O R   L P A S S 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Machine and environ dependent definitions
 | 
					# Machine and environ dependent definitions
 | 
				
			||||||
EMHOME =	/usr/em
 | 
					EMHOME =	/usr/proj/em/Work
 | 
				
			||||||
LPASS1 =	$(EMHOME)/lang/cem/cemcom
 | 
					LPASS1 =	$(EMHOME)/lang/cem/cemcom
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Libraries and EM interface definitions
 | 
					# Libraries and EM interface definitions
 | 
				
			||||||
| 
						 | 
					@ -28,8 +28,8 @@ SRC =	lpass2.c checkargs.c read.c report.c class.c l_print3ack.c
 | 
				
			||||||
OBJ =	lpass2.o checkargs.o read.o report.o class.o l_print3ack.o
 | 
					OBJ =	lpass2.o checkargs.o read.o report.o class.o l_print3ack.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test:	lpass2
 | 
					test:	lpass2
 | 
				
			||||||
	lpass2 -xh <.i
 | 
						make lint.test
 | 
				
			||||||
#	make lint.test
 | 
					#	lpass2 -xh <.i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lpass2:	$(OBJ) Makefile next.o
 | 
					lpass2:	$(OBJ) Makefile next.o
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ PRIVATE char formatargs[1000];		/* the definitions */
 | 
				
			||||||
PRIVATE chk_argtps();
 | 
					PRIVATE chk_argtps();
 | 
				
			||||||
PRIVATE char *next_atype();
 | 
					PRIVATE char *next_atype();
 | 
				
			||||||
PRIVATE int type_match();
 | 
					PRIVATE int type_match();
 | 
				
			||||||
 | 
					PRIVATE form_type();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
type_equal(act, form)
 | 
					type_equal(act, form)
 | 
				
			||||||
| 
						 | 
					@ -78,8 +79,14 @@ PRIVATE chk_argtps(id, def, nrargs, act_tp, form_tp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		(*nrargs)++;
 | 
							(*nrargs)++;
 | 
				
			||||||
		if (!type_match(id, act_start, form_start)) {
 | 
							if (!type_match(id, act_start, form_start)) {
 | 
				
			||||||
			report("%L: arg %d of %s differs from that in %L",
 | 
								char act_form[100];
 | 
				
			||||||
				id, *nrargs, id->id_name, def);
 | 
								char form_form[100];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								form_type(act_form, act_start);
 | 
				
			||||||
 | 
								form_type(form_form, form_start);
 | 
				
			||||||
 | 
								report("%L: arg %d of %s (%s) differs from that in %L (%s)",
 | 
				
			||||||
 | 
									id, *nrargs, id->id_name,
 | 
				
			||||||
 | 
									act_form, def, form_form);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		act_tp[-1] = ':';
 | 
							act_tp[-1] = ':';
 | 
				
			||||||
		form_tp[-1] = ':';
 | 
							form_tp[-1] = ':';
 | 
				
			||||||
| 
						 | 
					@ -246,3 +253,19 @@ PRIVATE conv_format(id, act, form)
 | 
				
			||||||
	*fmt++ = '\0';
 | 
						*fmt++ = '\0';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PRIVATE form_type(buff, tp)
 | 
				
			||||||
 | 
						char buff[];
 | 
				
			||||||
 | 
						char *tp;
 | 
				
			||||||
 | 
					{	/*	store a formatted version of tp in buff
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 | 
						if (tp[0] == '"') {
 | 
				
			||||||
 | 
							strcpy(buff, "char*");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (tp[0] == '+') {
 | 
				
			||||||
 | 
							sprintf(buff, "[unsigned] %s", &tp[1]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
 | 
							strcpy(buff, tp);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PATH=/bin:/usr/bin
 | 
					PATH=/bin:/usr/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EMLINT=/usr/dick/lint
 | 
					EMLINT=/home/top/dick/lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LPASS1="$EMLINT/lpass1/lnt -Dmc68000"	# pass 1 program
 | 
					LPASS1="$EMLINT/lpass1/lnt -Dmc68000"	# pass 1 program
 | 
				
			||||||
LPASS2="$EMLINT/lpass2/lpass2"		# pass 2 program
 | 
					LPASS2="$EMLINT/lpass2/lpass2"		# pass 2 program
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ PRIVATE init(argc, argv)
 | 
				
			||||||
			switch (ch) {
 | 
								switch (ch) {
 | 
				
			||||||
			case 'u':
 | 
								case 'u':
 | 
				
			||||||
				/*	don't report situations like
 | 
									/*	don't report situations like
 | 
				
			||||||
					"defined/declared but not used"
 | 
										"not used anywhere"
 | 
				
			||||||
				*/
 | 
									*/
 | 
				
			||||||
			case 'X':	/* ??? prints incoming inpdefs */
 | 
								case 'X':	/* ??? prints incoming inpdefs */
 | 
				
			||||||
			default:	/* and any other */
 | 
								default:	/* and any other */
 | 
				
			||||||
| 
						 | 
					@ -145,7 +145,7 @@ PRIVATE ext_def()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (same_obj(0) && is_class(dot, CL_EXT|CL_DEF)) {
 | 
						if (same_obj(0) && is_class(dot, CL_EXT|CL_DEF)) {
 | 
				
			||||||
		if (lib) {
 | 
							if (lib) {
 | 
				
			||||||
			report("%L: %s %s also defined in library %L",
 | 
								report("%L: %s %s also defined in %L",
 | 
				
			||||||
				dot, funvar(dot), dot->id_name, lib);
 | 
									dot, funvar(dot), dot->id_name, lib);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ext = dot;
 | 
							ext = dot;
 | 
				
			||||||
| 
						 | 
					@ -335,7 +335,7 @@ PRIVATE stat_def(stnr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (same_obj(stnr) && is_class(dot, CL_STAT|CL_DEF)) {
 | 
						if (same_obj(stnr) && is_class(dot, CL_STAT|CL_DEF)) {
 | 
				
			||||||
		if (lib) {
 | 
							if (lib) {
 | 
				
			||||||
			report("%L: %s %s also defined in library %L",
 | 
								report("%L: %s %s also defined in %L",
 | 
				
			||||||
				dot, funvar(dot), dot->id_name, lib);
 | 
									dot, funvar(dot), dot->id_name, lib);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (ext) {
 | 
							if (ext) {
 | 
				
			||||||
| 
						 | 
					@ -372,9 +372,8 @@ PRIVATE chk_def(def)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			if (!loptions['u']) {
 | 
								if (!loptions['u']) {
 | 
				
			||||||
				report("%L: %s %s %s but not used",
 | 
									report("%L: %s %s not used anywhere",
 | 
				
			||||||
					def, funvar(def), def->id_name,
 | 
										def, funvar(def), def->id_name);
 | 
				
			||||||
					defdec(def));
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@ rep_loc(id)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	if (is_class(id, CL_LIB)) {
 | 
						if (is_class(id, CL_LIB)) {
 | 
				
			||||||
		fprint(MSGOUT, "library file %s", id->id_file);
 | 
							fprint(MSGOUT, "library");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		fprint(MSGOUT, "\"%s\", line %d",
 | 
							fprint(MSGOUT, "\"%s\", line %d",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue