]> andersk Git - splint.git/blobdiff - src/uentry.c
Merged this branch with the one in the splint.sf.net repository.
[splint.git] / src / uentry.c
index 3dee2e7a1c1d3f006482511fc79e1097a810a91c..b9457cb6bbe71c7842f1c846714350ded867850a 100644 (file)
@@ -1008,7 +1008,9 @@ uentry_makeFunctionAux (cstring n, ctype t,
   /*drl 12 28 2000*/
   e->info->fcn->postconditions = NULL;
   /*end drl*/
-  
+
+   e->cQuals = qualList_undefined;
+   
   checkGlobalsModifies (e, mods);
   e->info->fcn->mods = mods;
 
@@ -2506,7 +2508,11 @@ uentry_reflectOtherQualifier (/*@notnull@*/ uentry ue, qual qel)
     {
       if (qual_isCQual (qel))
        {
-         ; /* okay */
+         /*drl 04-19-2002
+           I'm now storing the C qualifiers in the uentry
+           This was necessary to get code generation to work
+         */
+         ue->cQuals = qualList_add(ue->cQuals, qel);
        }
       else
        {
@@ -3169,6 +3175,8 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
   e->info->uconst->access = typeIdSet_undefined;
   e->info->uconst->macro = macro;
 
+  e->cQuals = qualList_undefined;
   uentry_setSpecDef (e, f);
 
   if (multiVal_isInt (m) && (multiVal_forceInt (m) == 0))
@@ -3368,6 +3376,8 @@ uentry uentry_makeVariableAux (cstring n, ctype t,
     }/* end else */
   /* end modification */
 
+  e->cQuals = qualList_undefined;
+  
   return (e);
 }
 
@@ -3818,6 +3828,8 @@ uentry_makeUnspecFunction (cstring n, ctype t,
   e->info->datatype->mut = mut;
   e->info->datatype->type = ctype_undefined;
 
+  e->cQuals = qualList_undefined;
   if (uentry_isDeclared (e))
     {
       uentry_setDefined (e, f);
@@ -3878,7 +3890,9 @@ static /*@only@*/ /*@notnull@*/ uentry
   e->info->iter->access = access;
   e->info->iter->mods = sRefSet_undefined;
   e->info->iter->globs = globSet_undefined;
-
+  
+  e->cQuals = qualList_undefined;
+  
   uentry_checkIterArgs (e);
   return (e);
 }
@@ -3915,6 +3929,9 @@ uentry_makeEndIterAux (cstring n, typeIdSet access, /*@only@*/ fileloc f)
   e->info->enditer->access = access;
 
   e->warn = warnClause_undefined; /*@i452@*/
+
+  e->cQuals = qualList_undefined;
+  
   return (e);
 }
 
@@ -3963,6 +3980,8 @@ static /*@only@*/ /*@notnull@*/ uentry
   e->info->datatype->type = t;
   e->warn = warnClause_undefined; /*@i452@*/
 
+  e->cQuals = qualList_undefined;
+  
   if (uentry_isDeclared (e))
     {
       uentry_setDefined (e, fl);
@@ -4323,6 +4342,9 @@ static uentry
   e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
   e->info->uconst->access = access;
   e->info->uconst->macro = FALSE; /*@i523! fix this when macro info added to library */
+
+  e->cQuals = qualList_undefined;
+  
   uentry_setConstantValue (e, m);
   sRef_storeState (e->sref);
 
@@ -4385,6 +4407,8 @@ static /*@only@*/ uentry
   /*DRL ADDED 9-1-2000 */
   e->info->var->bufinfo = NULL;
   
+  e->cQuals = qualList_undefined;
+  
   return (e);
 }
 
@@ -4463,10 +4487,12 @@ uentry_makeDatatypeBase (/*@only@*/ cstring name, ctype ct, ynm abstract,
   e->info->datatype->mut = mut;
   e->info->datatype->type = rtype;
 
+  e->cQuals = qualList_undefined;
+  
   DPRINTF (("About to store: %s", sRef_unparseFull (e->sref)));
   sRef_storeState (e->sref);
   DPRINTF (("After store: %s", sRef_unparseFull (e->sref)));
-
+  
   return (e);
 }
 
@@ -4620,6 +4646,8 @@ static uentry
   e->info->fcn->postconditions = NULL;
     /* end drl */
   
+  e->cQuals = qualList_undefined;
   return (e);
 }
 
@@ -4668,6 +4696,8 @@ static /*@only@*/ uentry
   e->info->datatype->mut  = MAYBE;
   e->info->datatype->type = rtype;
 
+  e->cQuals = qualList_undefined;
+  
   sRef_storeState (e->sref);
 
   return (e);  
@@ -4712,6 +4742,8 @@ static uentry
   e->info->iter->access = access;
   e->info->iter->mods = sRefSet_undefined;
   e->info->iter->globs = globSet_undefined;
+
+  e->cQuals = qualList_undefined;
   
   sRef_storeState (e->sref);
   return (e);
@@ -4754,6 +4786,9 @@ static uentry
   e->info = (uinfo) dmalloc (sizeof (*e->info));
   e->info->enditer = (ueinfo) dmalloc (sizeof (*e->info->enditer));
   e->info->enditer->access = access;
+
+  e->cQuals = qualList_undefined;
+
   sRef_storeState (e->sref);
 
   return (e);
@@ -5310,6 +5345,53 @@ uentry_unparseAbbrev (uentry v)
   return (message ("%s %q", ctype_unparseDeep (v->utype), uentry_getName (v)));
 }
 
+/*@only@*/ cstring
+uentry_unparseFunctionHeader (uentry v) /*@*/
+{
+  cstring st, cQuals, tmp, ret, storageSp;
+
+  if (uentry_isUndefined (v))
+    return cstring_undefined;
+
+  llassert (uentry_isFunction(v));
+
+  st = uentry_getName(v);
+  tmp =  ctype_unparseFunction (v->utype, st);
+  if ( qualList_isDefined(v->cQuals) )
+    {
+      cQuals = qualList_unparse(v->cQuals);
+    }
+  else
+    {
+      cQuals = cstring_undefined;
+    }
+
+  if (uentry_isStatic(v) )
+    {
+      storageSp = cstring_makeLiteral("static");
+    }
+  else  if (uentry_isExtern(v) )
+    {
+      storageSp = cstring_makeLiteral("extern");
+    }
+  else  if (uentry_isExtern(v) )
+    {
+      storageSp = cstring_makeLiteral("");
+    }
+  else
+    {
+      
+      // // drl  make sure this is a legal/legit case
+      
+      storageSp = cstring_makeLiteral("");
+    }
+
+  ret = message("%q %q %q",storageSp, cQuals, tmp);
+  return  ret;
+  //  ctbase_unparseFunction (ctype_getCtbaseSafe (v->utype), st);
+    
+}
+
 /*@only@*/ cstring
 uentry_unparse (uentry v)
 {
@@ -6553,6 +6635,9 @@ uentry uentry_nameCopy (cstring name, uentry e)
   enew->storageclass = e->storageclass;
   enew->info = uinfo_copy (e->info, e->ukind);
 
+  enew->cQuals = qualList_copy(e->cQuals);
+
+  
   return enew;
 }
 
@@ -6839,7 +6924,7 @@ KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform)
   llassert (uentry_isValid (old));
   llassert (uentry_isValid (unew));
 
-  if ((uentry_isEitherConstant (unew) || uentry_isDatatype (unew))
+  if (uentry_isEitherConstant (unew)
       && (fileloc_isPreproc (uentry_whereDeclared (old))
          || ctype_isUnknown (old->utype))
       && !uentry_isSpecified (old))
@@ -7311,10 +7396,9 @@ checkEnumConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew)
       if (optgenerror 
          (FLG_MATCHFIELDS,
           message ("Enum %q declared with members { %q } but "
-                   "%s with members { %q }",
+                   "specified with members { %q }",
                    uentry_getName (old), 
                    enumNameList_unparse (enew),
-                   uentry_specOrDefName (old),
                    enumNameList_unparse (eold)),
           uentry_whereDeclared (unew)))
        {
@@ -9449,6 +9533,24 @@ uentry_mergeEntries (uentry spec, /*@only@*/ uentry def)
     }
 }
 
+/*drl added 4/02/2002*/
+static void
+uentry_printDecl (void)
+{
+  if (context_getFlag(FLG_GENERATECODE) )
+    {
+      cstring st;
+      if (fileloc_isDotH(g_currentloc) )
+       {
+         return;
+       }
+      st = message ("%s", uentry_unparse(posRedeclared));
+      outputCode(message( "%s", st));
+  
+    }
+}
+
 /*
 ** Can't generate function redeclaration errors when the 
 ** entries are merged, since we don't yet know if its the
@@ -9927,6 +10029,8 @@ uentry_copy (uentry e)
       enew->info = uinfo_copy (e->info, e->ukind);
       enew->warn = warnClause_copy (e->warn);
 
+      enew->cQuals = qualList_copy(e->cQuals);
+      
       DPRINTF (("Here we are..."));
       DPRINTF (("original: %s", uentry_unparseFull (e)));
       DPRINTF (("copy: %s", uentry_unparse (enew)));
This page took 0.364042 seconds and 4 git commands to generate.