de-linted somewhat
authorceriel <none@none>
Tue, 2 Oct 1990 17:13:40 +0000 (17:13 +0000)
committerceriel <none@none>
Tue, 2 Oct 1990 17:13:40 +0000 (17:13 +0000)
lang/cem/cemcom.ansi/code.c
lang/cem/cemcom.ansi/declar.g
lang/cem/cemcom.ansi/stab.c

index e771968..e519df2 100644 (file)
@@ -456,11 +456,6 @@ code_declaration(idf, expr, lvl, sc)
                        code_scope(idf->id_text, def);
 #endif PREPEND_SCOPES
                        def->df_alloc = ALLOC_DONE;
-#ifdef DBSYMTAB
-                       if (options['g']) {
-                               stb_string(def, sc, idf->id_text);
-                       }
-#endif /* DBSYMTAB */
                        C_df_dnam(idf->id_text);
                }
        }
@@ -477,7 +472,7 @@ code_declaration(idf, expr, lvl, sc)
                                integer label in EM.
                        */
 #ifdef DBSYMTAB
-                       if (options['g']) {
+                       if (options['g'] && ! expr) {
                                stb_string(def, sc, idf->id_text);
                        }
 #endif /* DBSYMTAB */
index 2eeb12f..07079b8 100644 (file)
@@ -268,6 +268,11 @@ initializer(struct idf *idf; int sc;)
                                loc_init((struct expr *) 0, idf);
                        else    code_declaration(idf, expr, level, sc);
                }
+#ifdef DBSYMTAB
+               if (options['g'] && globalflag) {
+                       stb_string(idf->id_def, sc, idf->id_text);
+               }
+#endif /* DBSYMTAB */
                init_idf(idf);
        }
 ;
index e208642..3e09b26 100644 (file)
@@ -134,7 +134,7 @@ stb_type(tp, assign_num)
                if (tp->tp_size > 0) {
                        adds_db_str("ar");
                        stb_type(int_type, 0);
-                       adds_db_str(sprint(buf, ";0;%ld;", tp->tp_size / tp->tp_up->tp_size));
+                       adds_db_str(sprint(buf, ";0;%ld;", tp->tp_size / tp->tp_up->tp_size - 1));
                        stb_type(tp->tp_up, 0);
                }
                break;
@@ -272,7 +272,7 @@ stb_string(df, kind, str)
                else if (df->df_sc != AUTO && df->df_sc != REGISTER) {
                                                /* global */
                        if (df->df_sc == STATIC) {
-                               if (df->df_level == L_LOCAL) {
+                               if (df->df_level >= L_LOCAL) {
                                        addc_db_str('V');
                                }
                                else {
@@ -284,7 +284,12 @@ stb_string(df, kind, str)
                        }
                        stb_type(tp, 0);
                        addc_db_str(';');
-                       C_ms_stb_dnam(db_str.base, N_LCSYM, 0, str, (arith) 0);
+                       if (df->df_sc == STATIC && df->df_level >= L_LOCAL) {
+                               C_ms_stb_dlb(db_str.base, N_LCSYM, 0, (label) df->df_address, (arith) 0);
+                       }
+                       else {
+                               C_ms_stb_dnam(db_str.base, N_LCSYM, 0, str, (arith) 0);
+                       }
                }
                else {  /* local variable */
                        stb_type(tp, 1);        /* assign type num to avoid