adapted to integration into cemcom.ansi
authordick <none@none>
Thu, 6 Dec 1990 14:56:42 +0000 (14:56 +0000)
committerdick <none@none>
Thu, 6 Dec 1990 14:56:42 +0000 (14:56 +0000)
17 files changed:
lang/cem/cemcom/.distr
lang/cem/cemcom/Makefile
lang/cem/cemcom/code.c
lang/cem/cemcom/error.c
lang/cem/cemcom/idf.c
lang/cem/cemcom/ival.g
lang/cem/cemcom/l_em.h [new file with mode: 0644]
lang/cem/cemcom/l_ev_ord.c
lang/cem/cemcom/l_lint.c
lang/cem/cemcom/l_misc.c
lang/cem/cemcom/l_outdef.c
lang/cem/cemcom/l_states.c
lang/cem/cemcom/program.g
lang/cem/cemcom/stack.c
lang/cem/cemcom/statement.g
lang/cem/cemcom/switch.c
lang/cem/cemcom/util.c

index 013f3ab..cd6f503 100644 (file)
@@ -36,7 +36,6 @@ decspecs.str
 def.str
 domacro.c
 dumpidf.c
-em_lint.h
 error.c
 estack.str
 eval.c
@@ -57,6 +56,7 @@ l_brace.str
 l_class.h
 l_comment.h
 l_comment.c
+l_em.h
 l_ev_ord.c
 l_lint.c
 l_lint.h
index b9421a2..a85a9fa 100644 (file)
@@ -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 em_lint.h l_lint.h
+        file_info.h tokenname.h l_em.h l_lint.h
 
 HFILES = $(HSRC) $(GHSRC) $(GHSTRSRC)
 
@@ -466,7 +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: l_em.h
 code.o: expr.h
 code.o: file_info.h
 code.o: idf.h
@@ -508,7 +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: l_em.h
 error.o: errout.h
 error.o: expr.h
 error.o: file_info.h
@@ -660,7 +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: l_em.h
 stack.o: idf.h
 stack.o: level.h
 stack.o: lint.h
@@ -746,7 +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: l_em.h
 switch.o: expr.h
 switch.o: idf.h
 switch.o: label.h
@@ -771,7 +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: l_em.h
 util.o: lint.h
 util.o: nocross.h
 util.o: nofloat.h
@@ -948,7 +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: l_em.h
 statement.o: expr.h
 statement.o: file_info.h
 statement.o: idf.h
@@ -1000,7 +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: l_em.h
 ival.o: estack.h
 ival.o: expr.h
 ival.o: field.h
index 20ffff5..6f03dd3 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #include       "l_lint.h"
 #endif LINT
 #include       "botch_free.h"
index f2a27d9..756fc21 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #endif LINT
 
 #include       "nopp.h"
index 64d4abb..7dbf175 100644 (file)
@@ -273,23 +273,7 @@ declare_idf(ds, dc, lvl)
 #endif
 
 #ifdef LINT
-       if (    def && def->df_level < lvl
-       &&      !(      lvl == L_FORMAL2
-               ||      def->df_level == L_UNIVERSAL
-               ||      sc == GLOBAL
-               ||      sc == EXTERN
-               )
-       ) {
-               /*      there is already a definition for this non-extern name
-                       on a more global level
-               */
-               warning("%s is already defined as a %s",
-                       idf->id_text,
-                       def->df_level == L_GLOBAL ? "global" :
-                       def->df_level == L_FORMAL2 ? "formal" :
-                               "more global local"
-               );
-       }
+       check_hiding(idf, lvl, sc);     /* of some idf by this idf */
 #endif LINT
 
        if (def && 
@@ -490,7 +474,8 @@ global_redecl(idf, new_sc, tp)
                                error("cannot redeclare %s to static",
                                        idf->id_text);
                        else    {
-#ifdef LINT                    /* warn unconditionally */
+#ifdef LINT
+                               /* warn unconditionally */
                                warning("%s redeclared to static",
                                                idf->id_text);
 #else  LINT
index a3e30b1..f13b89a 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #include       "l_lint.h"
 #endif LINT
 #include       "debug.h"
diff --git a/lang/cem/cemcom/l_em.h b/lang/cem/cemcom/l_em.h
new file mode 100644 (file)
index 0000000..f59e218
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * (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        store_block(sz, al)
+#define        load_block(sz, al)
+
+#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_icon(v,s)
+#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)
+
index c0cfe4c..be44675 100644 (file)
@@ -12,6 +12,9 @@
 #include       <alloc.h>       /* for st_free */
 #include       "interface.h"
 #include       "assert.h"
+#ifdef ANSI
+#include       <flt_arith.h>
+#endif ANSI
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
@@ -23,7 +26,6 @@
 #include       "stack.h"
 #include       "type.h"
 #include       "level.h"
-#include       "nofloat.h"
 #include       "l_lint.h"
 #include       "l_state.h"
 
index cc0c855..73adf19 100644 (file)
@@ -13,6 +13,9 @@
 #include       "debug.h"
 #include       "interface.h"
 #include       "assert.h"
+#ifdef ANSI
+#include       <flt_arith.h>
+#endif ANSI
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
@@ -24,7 +27,6 @@
 #include       "stack.h"
 #include       "type.h"
 #include       "level.h"
-#include       "nofloat.h"
 #include       "l_lint.h"
 #include       "l_state.h"
 #include       "l_outdef.h"
index 22947d2..d0213ca 100644 (file)
@@ -11,6 +11,9 @@
 
 #include       <alloc.h>       /* for st_free */
 #include       "interface.h"
+#ifdef ANSI
+#include       <flt_arith.h>
+#endif ANSI
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
@@ -22,7 +25,6 @@
 #include       "stack.h"
 #include       "type.h"
 #include       "level.h"
-#include       "nofloat.h"
 #include       "l_state.h"
 
 extern char *symbol2str();
@@ -32,6 +34,32 @@ PRIVATE lint_enum_arith();
 PRIVATE lint_conversion();
 PRIVATE int numsize();
 
+check_hiding(idf, lvl, sc)
+       struct idf *idf;
+       int lvl;
+       int sc;
+{
+       /*      Checks if there is already a definition for this non-extern
+               name on a more global level.
+       */
+       struct def *def = idf->id_def;
+       
+       if (    def && def->df_level < lvl
+       &&      ! (     lvl == L_FORMAL2
+               ||      def->df_level == L_UNIVERSAL
+               ||      sc == GLOBAL
+               ||      sc == EXTERN
+               )
+       ) {
+               warning("%s is already defined as a %s",
+                       idf->id_text,
+                       def->df_level == L_GLOBAL ? "global" :
+                       def->df_level == L_FORMAL2 ? "formal" :
+                               "more global local"
+               );
+       }
+}
+
 lint_new_oper(expr)
        struct expr *expr;
 {
index 273e7e7..fd3a31a 100644 (file)
 
 #include       <alloc.h>
 #include       "interface.h"
+#ifdef ANSI
+#include       <flt_arith.h>
+#endif ANSI
 #include       "arith.h"
 #include       "assert.h"
 #include       "type.h"
+#include       "declar.h"
+#include       "decspecs.h"
 #include       "LLlex.h"
 #include       "Lpars.h"
 #include       "stack.h"
@@ -45,7 +50,6 @@ PRIVATE outargs();
 PRIVATE outarg();
 PRIVATE outargstring();
 PRIVATE outargtype();
-PRIVATE implicit_func_decl();
 PRIVATE fill_arg();
 
 lint_declare_idf(idf, sc)
@@ -68,6 +72,19 @@ lint_declare_idf(idf, sc)
        }
 }
 
+lint_non_function_decl(ds, dc)
+       struct decspecs *ds;
+       struct declarator *dc;
+{
+       register struct def *def = dc->dc_idf->id_def;
+       register int is_function = def->df_type->tp_fund == FUNCTION;
+
+       if (is_function)
+               def2decl(ds->ds_sc);
+       if (def->df_sc != TYPEDEF)
+               outdef();
+}
+
 lint_ext_def(idf, sc)
        struct idf *idf;
 {
@@ -466,6 +483,7 @@ outargtype(tp)
        }
 }
 
+#ifdef IMPLICIT
 PRIVATE
 implicit_func_decl(idf, file, line)
        struct idf *idf;
@@ -483,6 +501,7 @@ implicit_func_decl(idf, file, line)
        output_def(&od);
        /* The other fields are not used for this class. */
 }
+#endif IMPLICIT
 
 fill_outcall(ex, used)
        struct expr *ex;
@@ -491,10 +510,12 @@ fill_outcall(ex, used)
        register struct idf *idf = ex->OP_LEFT->VL_IDF;
        register struct def *def = idf->id_def;
 
+#ifdef IMPLICIT
        if (def->df_sc == IMPLICIT && !idf->id_def->df_used) {
                /* IFDC, first time */
                implicit_func_decl(idf, ex->ex_file, ex->ex_line);
        }
+#endif IMPLICIT
 
        OutCall.od_type = def->df_type->tp_up;
        OutCall.od_statnr = (def->df_sc == STATIC ? stat_number : 0);
index 58adbf7..b7f87fb 100644 (file)
@@ -13,6 +13,9 @@
 #include       "interface.h"
 #include       "assert.h"
 #include       "debug.h"
+#ifdef ANSI
+#include       <flt_arith.h>
+#endif ANSI
 #include       "arith.h"
 #include       "label.h"
 #include       "expr.h"
@@ -24,7 +27,6 @@
 #include       "stack.h"
 #include       "type.h"
 #include       "level.h"
-#include       "nofloat.h"
 #include       "l_lint.h"
 #include       "l_brace.h"
 #include       "l_state.h"
@@ -201,7 +203,9 @@ lint_1_global(idf, def)
        case STATIC:
        case EXTERN:
        case GLOBAL:
+#ifdef IMPLICIT
        case IMPLICIT:
+#endif IMPLICIT
                if (fund == ERRONEOUS)
                        break;
 
index ac9f4e0..66c2cad 100644 (file)
@@ -161,10 +161,7 @@ non_function(register struct decspecs *ds; register struct declarator *dc;)
        ]
        {
 #ifdef LINT
-               if (dc->dc_idf->id_def->df_type->tp_fund == FUNCTION)
-                       def2decl(ds->ds_sc);
-               if (dc->dc_idf->id_def->df_sc != TYPEDEF)
-                       outdef();
+               lint_non_function_decl(ds, dc);
 #endif LINT
        }
        [
index 41a233a..c09a670 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #endif LINT
 #include       "debug.h"
 #include       "botch_free.h"
index 9469f2c..5016f85 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #include       "l_lint.h"
 #endif LINT
 
index 396fa4d..27ea92a 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #endif LINT
 #include       "debug.h"
 #include       "botch_free.h"
index 2566e05..5e859a4 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef        LINT
 #include       <em.h>
 #else
-#include       "em_lint.h"
+#include       "l_em.h"
 #endif LINT
 #include       <em_arith.h>
 #include       <em_reg.h>