initial small modifications for lint
This commit is contained in:
parent
e8730266e5
commit
1a6665e21d
19 changed files with 94 additions and 62 deletions
|
@ -52,8 +52,6 @@ PushLex()
|
|||
ASSERT(LexSP < 2);
|
||||
ASSERT(ASIDE == 0); /* ASIDE = 0; */
|
||||
GetToken(&ahead);
|
||||
ahead.tk_line = LineNumber;
|
||||
ahead.tk_file = FileName;
|
||||
LexStack[LexSP++] = dot;
|
||||
}
|
||||
|
||||
|
@ -87,9 +85,6 @@ LLlex()
|
|||
else
|
||||
DOT = EOF;
|
||||
}
|
||||
/* keep track of the place of the token in the file */
|
||||
ahead.tk_file = FileName;
|
||||
ahead.tk_line = LineNumber;
|
||||
return DOT;
|
||||
}
|
||||
|
||||
|
@ -111,6 +106,7 @@ GetToken(ptok)
|
|||
File_Inserted = 0;
|
||||
goto firstline;
|
||||
}
|
||||
|
||||
again: /* rescan the input after an error or replacement */
|
||||
#ifndef NOPP
|
||||
if (Unstacked) EnableMacros();
|
||||
|
@ -119,10 +115,16 @@ again: /* rescan the input after an error or replacement */
|
|||
go_on: /* rescan, the following character has been read */
|
||||
if ((ch & 0200) && ch != EOI) /* stop on non-ascii character */
|
||||
fatal("non-ascii '\\%03o' read", ch & 0377);
|
||||
/* keep track of the place of the token in the file */
|
||||
ptok->tk_file = FileName;
|
||||
ptok->tk_line = LineNumber;
|
||||
|
||||
switch (class(ch)) { /* detect character class */
|
||||
case STNL: /* newline, vertical space or formfeed */
|
||||
firstline:
|
||||
LineNumber++; /* also at vs and ff */
|
||||
ptok->tk_file = FileName;
|
||||
ptok->tk_line = LineNumber;
|
||||
if (EoiForNewline) /* called in control line */
|
||||
/* a newline in a control line indicates the
|
||||
end-of-information of the line.
|
||||
|
|
|
@ -160,3 +160,4 @@ copy_loop(sz, src, dst)
|
|||
C_asp(word_size);
|
||||
}
|
||||
#endif STB
|
||||
|
||||
|
|
|
@ -464,11 +464,11 @@ loc_init(expr, id)
|
|||
|
||||
ch7cast(&expr, '=', tp); /* may modify expr */
|
||||
EVAL(expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
|
||||
free_expression(expr);
|
||||
vl.vl_class = Name;
|
||||
vl.vl_data.vl_idf = id;
|
||||
vl.vl_value = (arith)0;
|
||||
store_val(&vl, tp);
|
||||
free_expression(expr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ conversion(from_type, to_type)
|
|||
signed, unsigned or floating
|
||||
*/
|
||||
int
|
||||
fundamental(tp)
|
||||
fundamental(tp)/* bad name ???*/
|
||||
register struct type *tp;
|
||||
{
|
||||
switch (tp->tp_fund) {
|
||||
|
@ -146,3 +146,4 @@ fundamental(tp)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "debug.h"
|
||||
#include "arith.h"
|
||||
#include "LLlex.h"
|
||||
#include "label.h"
|
||||
#include "code.h"
|
||||
#include "idf.h"
|
||||
#include "type.h"
|
||||
#include "struct.h"
|
||||
|
@ -126,10 +128,10 @@ single_type_specifier(register struct decspecs *ds;):
|
|||
IDENTIFIER
|
||||
{
|
||||
error("%s is not a type identifier", dot.tk_idf->id_text);
|
||||
ds->ds_type = error_type;
|
||||
ds->ds_type = error_type;
|
||||
if (dot.tk_idf->id_def) {
|
||||
dot.tk_idf->id_def->df_type = error_type;
|
||||
dot.tk_idf->id_def->df_sc = TYPEDEF;
|
||||
dot.tk_idf->id_def->df_type = error_type;
|
||||
dot.tk_idf->id_def->df_sc = TYPEDEF;
|
||||
}
|
||||
}
|
||||
|
|
||||
|
@ -164,7 +166,9 @@ init_declarator(register struct decspecs *ds;)
|
|||
{ code_declaration(Dc.dc_idf, (struct expr *) 0, level, ds->ds_sc); }
|
||||
]
|
||||
]
|
||||
{remove_declarator(&Dc);}
|
||||
{
|
||||
remove_declarator(&Dc);
|
||||
}
|
||||
;
|
||||
|
||||
/* 8.6: initializer */
|
||||
|
@ -189,10 +193,11 @@ initializer(struct idf *idf; int sc;)
|
|||
external_definition, q.v.
|
||||
*/
|
||||
]
|
||||
{ if (globalflag) {
|
||||
{
|
||||
if (globalflag) {
|
||||
struct expr ex;
|
||||
code_declaration(idf, &ex, level, sc);
|
||||
}
|
||||
}
|
||||
}
|
||||
initial_value(globalflag ? &(idf->id_def->df_type) : (struct type **)0,
|
||||
&expr)
|
||||
|
@ -205,8 +210,8 @@ initializer(struct idf *idf; int sc;)
|
|||
print_expr("initializer-expression", expr);
|
||||
#endif DEBUG
|
||||
code_declaration(idf, expr, level, sc);
|
||||
}
|
||||
init_idf(idf);
|
||||
}
|
||||
init_idf(idf);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
/* $Header$ */
|
||||
/* IDENTIFIER DEFINITION DESCRIPTOR */
|
||||
|
||||
|
||||
struct def { /* for ordinary tags */
|
||||
struct def *next;
|
||||
int df_level;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "arith.h"
|
||||
#include "label.h"
|
||||
#include "expr.h"
|
||||
#include "def.h"
|
||||
#include "LLlex.h"
|
||||
|
||||
/* This file contains the error-message and diagnostic
|
||||
|
@ -36,6 +37,7 @@ int err_occurred = 0;
|
|||
|
||||
extern char *symbol2str();
|
||||
extern char options[];
|
||||
extern char loptions[];
|
||||
|
||||
/* There are three general error-message functions:
|
||||
lexerror() lexical and pre-processor error messages
|
||||
|
@ -48,8 +50,8 @@ extern char options[];
|
|||
expression, whereas other errors use the information in the token.
|
||||
*/
|
||||
|
||||
/*VARARGS1*/
|
||||
error(va_alist)
|
||||
/*VARARGS*/
|
||||
error(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -61,8 +63,8 @@ error(va_alist)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
/*VARARGS2*/
|
||||
expr_error(va_alist)
|
||||
/*VARARGS*/
|
||||
expr_error(va_alist) /* expr, fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -80,8 +82,8 @@ expr_error(va_alist)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
warning(va_alist)
|
||||
/*VARARGS*/
|
||||
warning(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -93,8 +95,8 @@ warning(va_alist)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
/*VARARGS2*/
|
||||
expr_warning(va_alist)
|
||||
/*VARARGS*/
|
||||
expr_warning(va_alist) /* expr, fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -111,8 +113,8 @@ expr_warning(va_alist)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
lexerror(va_alist)
|
||||
/*VARARGS*/
|
||||
lexerror(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -125,8 +127,8 @@ lexerror(va_alist)
|
|||
}
|
||||
|
||||
#ifndef NOPP
|
||||
/*VARARGS1*/
|
||||
lexwarning(va_alist)
|
||||
/*VARARGS*/
|
||||
lexwarning(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -139,8 +141,8 @@ lexwarning(va_alist)
|
|||
}
|
||||
#endif NOPP
|
||||
|
||||
/*VARARGS1*/
|
||||
crash(va_alist)
|
||||
/*VARARGS*/
|
||||
crash(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -157,10 +159,11 @@ crash(va_alist)
|
|||
#else DEBUG
|
||||
sys_stop(S_EXIT);
|
||||
#endif DEBUG
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
fatal(va_alist)
|
||||
/*VARARGS*/
|
||||
fatal(va_alist) /* fmt, args */
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
|
|
|
@ -355,8 +355,7 @@ EVAL(expr, val, code, true_label, false_label)
|
|||
store_block(tp->tp_size, tp->tp_align);
|
||||
}
|
||||
else if (newcode)
|
||||
store_val(&(left->ex_object.ex_value),
|
||||
left->ex_type);
|
||||
store_val(&(left->EX_VALUE), left->ex_type);
|
||||
}
|
||||
break;
|
||||
case PLUSAB:
|
||||
|
@ -416,7 +415,7 @@ EVAL(expr, val, code, true_label, false_label)
|
|||
assop(tp, oper);
|
||||
conversion(tp, left->ex_type);
|
||||
if (compl == 0) {
|
||||
store_val(&(left->ex_object.ex_value),
|
||||
store_val(&(left->EX_VALUE),
|
||||
left->ex_type);
|
||||
if (dupval) load_val(left, RVAL);
|
||||
}
|
||||
|
@ -968,3 +967,4 @@ load_cst(val, siz)
|
|||
C_loi(siz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,10 +74,11 @@ struct expr {
|
|||
};
|
||||
|
||||
/* some abbreviated selections */
|
||||
#define VL_CLASS ex_object.ex_value.vl_class
|
||||
#define VL_VALUE ex_object.ex_value.vl_value
|
||||
#define VL_IDF ex_object.ex_value.vl_data.vl_idf
|
||||
#define VL_LBL ex_object.ex_value.vl_data.vl_lbl
|
||||
#define EX_VALUE ex_object.ex_value
|
||||
#define VL_CLASS EX_VALUE.vl_class
|
||||
#define VL_VALUE EX_VALUE.vl_value
|
||||
#define VL_IDF EX_VALUE.vl_data.vl_idf
|
||||
#define VL_LBL EX_VALUE.vl_data.vl_lbl
|
||||
#define SG_VALUE ex_object.ex_string.sg_value
|
||||
#define SG_LEN ex_object.ex_string.sg_len
|
||||
#define SG_DATLAB ex_object.ex_string.sg_datlab
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "idf.h"
|
||||
#include "label.h"
|
||||
#include "expr.h"
|
||||
#include "code.h"
|
||||
#include "noRoption.h"
|
||||
|
||||
extern char options[];
|
||||
|
@ -337,5 +338,7 @@ identifier(struct idf **idfp;) :
|
|||
|
|
||||
TYPE_IDENTIFIER
|
||||
]
|
||||
{*idfp = dot.tk_idf;}
|
||||
{
|
||||
*idfp = dot.tk_idf;
|
||||
}
|
||||
;
|
||||
|
|
|
@ -74,7 +74,7 @@ eval_field(expr, code)
|
|||
load_val(leftop, RVAL);
|
||||
C_and(asize);
|
||||
C_ior(asize);
|
||||
store_val(&(leftop->ex_object.ex_value), atype);
|
||||
store_val(&(leftop->EX_VALUE), atype);
|
||||
}
|
||||
else { /* complex case */
|
||||
tmpvar = NewLocal(pointer_size, pointer_align,
|
||||
|
@ -144,7 +144,7 @@ eval_field(expr, code)
|
|||
load_val(leftop, RVAL);
|
||||
C_and(asize);
|
||||
C_ior(asize);
|
||||
store_val(&(leftop->ex_object.ex_value), atype);
|
||||
store_val(&(leftop->EX_VALUE), atype);
|
||||
}
|
||||
else {
|
||||
LoadLocal(tmpvar, pointer_size);
|
||||
|
@ -173,3 +173,4 @@ eval_field(expr, code)
|
|||
}
|
||||
}
|
||||
#endif NOBITFIELD
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ declare_idf(ds, dc, lvl)
|
|||
warning("redeclaring reserved word %s", idf->id_text);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (def &&
|
||||
( def->df_level == lvl ||
|
||||
( lvl != L_GLOBAL && def->df_level > lvl )
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* $Header$ */
|
||||
/* IDENTIFIER DESCRIPTOR */
|
||||
|
||||
#include "nopp.h"
|
||||
#include "nopp.h"
|
||||
|
||||
/* Since the % operation in the calculation of the hash function
|
||||
turns out to be expensive, it is replaced by the cheaper XOR (^).
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "LLlex.h"
|
||||
#include "noRoption.h"
|
||||
#include "estack.h"
|
||||
#include "code.h"
|
||||
|
||||
#define con_nullbyte() C_con_ucon("0", (arith)1)
|
||||
#define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)
|
||||
|
@ -47,14 +48,15 @@ initial_value(register struct type **tpp; register struct expr **expp;) :
|
|||
{ if (tpp) gen_tpcheck(tpp, 0); }
|
||||
[
|
||||
assignment_expression(expp)
|
||||
{ if ((*expp)->ex_type->tp_fund == ARRAY)
|
||||
{
|
||||
if ((*expp)->ex_type->tp_fund == ARRAY)
|
||||
array2pointer(*expp);
|
||||
if (tpp) {
|
||||
if (tpp) {
|
||||
gen_simple_exp(tpp, expp);
|
||||
free_expression(*expp);
|
||||
*expp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
||||
initial_value_pack(tpp, expp)
|
||||
]
|
||||
|
|
|
@ -175,7 +175,7 @@ compile(argc, argv)
|
|||
#ifndef NOPP
|
||||
WorkingDir = getwdir(source);
|
||||
#endif NOPP
|
||||
PushLex();
|
||||
PushLex(); /* initialize lex machine */
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifndef NOPP
|
||||
|
|
|
@ -40,40 +40,40 @@ do_option(text)
|
|||
|
||||
default:
|
||||
fatal("illegal option: %c", *--text);
|
||||
|
||||
break;
|
||||
case '-':
|
||||
options[*text] = 1; /* flags, debug options etc. */
|
||||
break;
|
||||
|
||||
#ifdef DATAFLOW
|
||||
#ifdef DATAFLOW
|
||||
case 'd':
|
||||
#endif DATAFLOW
|
||||
#endif DATAFLOW
|
||||
case 'p': /* procentry/procexit */
|
||||
case 'L' : /* no fil/lin */
|
||||
case 'n': /* use no registers */
|
||||
case 'w': /* no warnings will be given */
|
||||
#ifndef NOROPTION
|
||||
#ifndef NOROPTION
|
||||
case 'R': /* strict version */
|
||||
#endif
|
||||
options[*(text-1)] = 1;
|
||||
break;
|
||||
#ifdef NOROPTION
|
||||
#ifdef NOROPTION
|
||||
case 'R':
|
||||
warning("-R option not implemented");
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ___XXX___
|
||||
#ifdef ___XXX___
|
||||
deleted, is now a debug-flag
|
||||
case 'C' : /* E option + comment output */
|
||||
#ifndef NOPP
|
||||
#ifndef NOPP
|
||||
options['E'] = 1;
|
||||
warning("-C: comment is not output");
|
||||
#else NOPP
|
||||
warning("-C option ignored");
|
||||
#endif NOPP
|
||||
#endif NOPP
|
||||
break;
|
||||
#endif ___XXX___
|
||||
#endif ___XXX___
|
||||
|
||||
case 'D' : { /* -Dname : predefine name */
|
||||
#ifndef NOPP
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
extern arith ifval;
|
||||
#endif NOPP
|
||||
|
||||
/*VARARGS*/
|
||||
extern error();
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,9 @@ external_definition
|
|||
ext_decl_specifiers(&Ds)
|
||||
[
|
||||
declarator(&Dc)
|
||||
{declare_idf(&Ds, &Dc, level);}
|
||||
{
|
||||
declare_idf(&Ds, &Dc, level);
|
||||
}
|
||||
[%if (Dc.dc_idf->id_def->df_type->tp_fund == FUNCTION)
|
||||
/* int i (1) {2, 3}
|
||||
is a function, not an old-fashioned
|
||||
|
@ -155,6 +156,8 @@ non_function(register struct decspecs *ds; register struct declarator *dc;)
|
|||
|
|
||||
{ code_declaration(dc->dc_idf, (struct expr *) 0, level, ds->ds_sc); }
|
||||
]
|
||||
{
|
||||
}
|
||||
[
|
||||
','
|
||||
init_declarator(ds)
|
||||
|
@ -169,7 +172,6 @@ function(struct declarator *dc;)
|
|||
}
|
||||
:
|
||||
{ register struct idf *idf = dc->dc_idf;
|
||||
|
||||
init_idf(idf);
|
||||
stack_level(); /* L_FORMAL1 declarations */
|
||||
declare_params(dc);
|
||||
|
|
|
@ -31,6 +31,8 @@ extern int level;
|
|||
|
||||
/* 9 */
|
||||
statement
|
||||
{
|
||||
}
|
||||
:
|
||||
%if (AHEAD != ':')
|
||||
expression_statement
|
||||
|
@ -54,11 +56,15 @@ statement
|
|||
default_statement
|
||||
|
|
||||
BREAK
|
||||
{code_break();}
|
||||
{
|
||||
code_break();
|
||||
}
|
||||
';'
|
||||
|
|
||||
CONTINUE
|
||||
{code_continue();}
|
||||
{
|
||||
code_continue();
|
||||
}
|
||||
';'
|
||||
|
|
||||
return_statement
|
||||
|
@ -261,6 +267,8 @@ for_statement
|
|||
';'
|
||||
expression(&e_incr)?
|
||||
')'
|
||||
{
|
||||
}
|
||||
statement
|
||||
{
|
||||
C_df_ilb(l_continue);
|
||||
|
@ -388,3 +396,4 @@ asm_statement
|
|||
{ code_asm(asm_bts, asm_len);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
/* $Header$ */
|
||||
/* TYPE DESCRIPTOR */
|
||||
|
||||
#include "nofloat.h"
|
||||
#include "nobitfield.h"
|
||||
#include "nofloat.h"
|
||||
#include "nobitfield.h"
|
||||
|
||||
struct type {
|
||||
struct type *next; /* used only with ARRAY */
|
||||
|
|
Loading…
Reference in a new issue