]> andersk Git - splint.git/commitdiff
Fixed preds.expect for name change.
authorevans1629 <evans1629>
Mon, 31 Dec 2001 19:40:18 +0000 (19:40 +0000)
committerevans1629 <evans1629>
Mon, 31 Dec 2001 19:40:18 +0000 (19:40 +0000)
src/Headers/uentry.h
src/cpplib.c
src/uentry.c
src/usymtab.c
src/usymtab_interface.c
test/preds.expect

index 67d89532e32037d65a497b88e44b01e4eba6e23e..413039491970070529fb17ab26a85b16dc85c39f 100644 (file)
@@ -18,6 +18,7 @@
 typedef struct 
 {
   typeIdSet access;
+  bool macro;
 } *ucinfo;
 
 typedef enum 
@@ -404,10 +405,21 @@ extern /*@notnull@*/ uentry
 extern /*@notnull@*/ /*@only@*/ uentry 
   uentry_makeConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) 
   /*@*/ ;
+
+extern /*@only@*/ /*@notnull@*/ uentry 
+  uentry_makeConstantValue (/*@temp@*/ cstring p_n, ctype p_t, /*@only@*/ fileloc p_f, 
+                           bool p_priv, multiVal p_val)
+  /*@*/ ;
+
+extern /*@notnull@*/ /*@only@*/ uentry 
+  uentry_makeMacroConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) 
+  /*@*/ ;
+
 extern /*@notnull@*/ /*@only@*/ uentry 
   uentry_makeConstantAux (/*@temp@*/ cstring p_n, ctype p_t,
-                         /*@keep@*/ fileloc p_f, bool p_priv,
+                         /*@keep@*/ fileloc p_f, bool p_priv, bool p_macro,
                          /*@only@*/ multiVal p_m) /*@*/ ;
+
 extern /*@notnull@*/ /*@only@*/ uentry 
   uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, ynm p_abstract, 
                       /*@only@*/ fileloc p_f) /*@*/ ;
@@ -639,9 +651,11 @@ extern bool uentry_isGlobalMarker (uentry) /*@*/ ;
 extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@only@*/ fileloc p_loc);
 
 # ifdef DOANNOTS
-typedef enum { AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR,
-                AN_CONST, AN_LAST
-              } ancontext;
+typedef enum 
+{
+  AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR,
+  AN_CONST, AN_LAST
+} ancontext;
 
 extern void initAnnots ();
 extern void printAnnots (void);
index e80b4224c2520a5599741636f3f93f6a0990ac09..024e6db9b023b437fedf0a432d00b014e0164159 100644 (file)
@@ -7119,8 +7119,7 @@ static bool cpp_shouldCheckMacro (cppReader *pfile, char *p) /*@modifies p*/
                            {
                              fileloc loc = fileloc_makePreproc (g_currentloc);
                              DPRINTF (("Make constant: %s", sname));
-                             le = uentry_makeConstant (sname,
-                                                       ctype_unknown, loc);
+                             le = uentry_makeMacroConstant (sname, ctype_unknown, loc);
                              (void) usymtab_addEntry (le);
                            }
 
index ef968cf17148fefb4cf39a51ebdcbbe3d5b6ca52..d9dcc43c988e9c435e9822e13e06646749a79aac 100644 (file)
@@ -92,6 +92,11 @@ static /*@only@*/ /*@notnull@*/ uentry
   uentry_makeVariableAux (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f,
                          /*@exposed@*/ sRef p_s, bool p_priv, vkind p_kind);
 
+static /*@only@*/ /*@notnull@*/ 
+uentry uentry_makeConstantAux (cstring p_n, ctype p_t, 
+                              /*@keep@*/ fileloc p_f, bool p_priv, bool p_macro,
+                              /*@only@*/ multiVal p_m) ;
+
 static void uentry_convertVarFunction (uentry ue) /*@modifies ue@*/
 {
   if (uentry_isVariable (ue) 
@@ -3101,9 +3106,9 @@ uentry_isSpecialFunction (uentry ue)
 ** constants
 */
 
-/*@only@*/ /*@notnull@*/ 
+static /*@only@*/ /*@notnull@*/ 
 uentry uentry_makeConstantAux (cstring n, ctype t, 
-                              /*@keep@*/ fileloc f, bool priv,
+                              /*@keep@*/ fileloc f, bool priv, bool macro,
                               /*@only@*/ multiVal m)
 {
   uentry e = uentry_alloc ();
@@ -3127,6 +3132,7 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
   e->info = (uinfo) dmalloc (sizeof (*e->info));
   e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
   e->info->uconst->access = typeIdSet_undefined;
+  e->info->uconst->macro = macro;
 
   uentry_setSpecDef (e, f);
 
@@ -3142,7 +3148,17 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
 
 /*@notnull@*/ uentry uentry_makeConstant (cstring n, ctype t, fileloc f)
 {
-  return (uentry_makeConstantAux (n, t, f, FALSE, multiVal_unknown ()));
+  return (uentry_makeConstantAux (n, t, f, FALSE, FALSE, multiVal_unknown ()));
+}
+
+
+{
+  return (uentry_makeConstantAux (n, t, f, priv, FALSE, val));
+}
+
+/*@notnull@*/ uentry uentry_makeMacroConstant (cstring n, ctype t, fileloc f)
+{
+  return (uentry_makeConstantAux (n, t, f, FALSE, TRUE, multiVal_unknown ()));
 }
 
 /*@notnull@*/ uentry uentry_makeIdConstant (idDecl t)
index 278fbb9e41a325c82bdeab85bf7dcbaf5b5f2e62..245b22b236f0d9beba4906c7dc7725a4cb74effb 100644 (file)
@@ -372,13 +372,13 @@ usymtab_initBool ()
       */
 
       usymtab_supGlobalEntry 
-       (uentry_makeConstantAux (context_getFalseName (), boolt, 
-                                fileloc_getBuiltin (), FALSE,
-                                multiVal_makeInt (0)));
+       (uentry_makeConstantValue (context_getFalseName (), boolt, 
+                                  fileloc_getBuiltin (), FALSE, 
+                                  multiVal_makeInt (0)));
       usymtab_supGlobalEntry 
-       (uentry_makeConstantAux (context_getTrueName (), boolt, 
-                                fileloc_getBuiltin (), FALSE,
-                                multiVal_makeInt (1)));
+       (uentry_makeConstantValue (context_getTrueName (), boolt, 
+                                  fileloc_getBuiltin (), FALSE, 
+                                  multiVal_makeInt (1)));
     }
 }
 
index 6000cafce066569a80fd21a439baef1e05719620..c3af74c54f9c9ef4e741cc3f96c1309fa9619143 100644 (file)
@@ -655,16 +655,14 @@ doDeclareConstant (constDeclarationNode c, bool priv)
          if (i->value != (termNode)0 &&
              i->value->kind == TRM_LITERAL)
            {
-             ue = uentry_makeConstantAux (s, ct, loc, priv, 
-                                          literalValue (ct, i->value->literal));
+             ue = uentry_makeConstantValue (s, ct, loc, priv, literalValue (ct, i->value->literal));
            }
          else
            {
-             ue = uentry_makeConstantAux (s, ct, loc, priv, multiVal_unknown ());
+             ue = uentry_makeConstantValue (s, ct, loc, priv, multiVal_unknown ());
            }
-
-                 uentry_reflectQualifiers (ue, qtype_getQuals (qt));
-
+         
+         uentry_reflectQualifiers (ue, qtype_getQuals (qt));
          
          if (context_inLCLLib () && !priv)
            {
index c5549a8d6acd3b4631fa4dcdd70f7cee95767294..c02a08ccaf2fe72c8a09bd19c12c5b5009f20554 100644 (file)
@@ -18,7 +18,7 @@ preds.c:30:7: Use of == with bool variables (risks inconsistency because of
   Two bool values are compared directly using a C primitive. This may produce
   unexpected results since all non-zero values are considered TRUE, so
   different TRUE values may not be equal. The file bool.h (included in
-  lclint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
+  splint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
   suppress message)
 preds.c:35:7: Test expression for if not bool, type char: c
 
@@ -54,7 +54,7 @@ preds.c:30:7: Use of == with bool variables (risks inconsistency because of
   Two bool values are compared directly using a C primitive. This may produce
   unexpected results since all non-zero values are considered TRUE, so
   different TRUE values may not be equal. The file bool.h (included in
-  lclint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
+  splint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
   suppress message)
 preds.c:35:7: Test expression for if not bool, type char: c
 bool.h:21:13: Function bool_initMod declared but not used
This page took 0.102154 seconds and 5 git commands to generate.