Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

uentry.c File Reference

#include "lclintMacros.nf"
#include "basic.h"
#include "structNames.h"
#include "nameChecks.h"

Go to the source code of this file.

Functions

cstring uentry_specOrDefName (uentry u)
cstring uentry_specDeclName (uentry u)
uentry uentry_makeEnumConstant (cstring n, ctype t)
uentry uentry_makeEnumInitializedConstant (cstring n, ctype t, exprNode expr)
uentry uentry_makeSpecEnumConstant (cstring n, ctype t, fileloc loc)
uentry uentry_makeVariableLoc (cstring n, ctype t)
uentry uentry_makeUnnamedVariable (ctype t)
uentry uentry_makeIdDatatype (idDecl id)
void uentry_checkParams (uentry ue)
uentry uentry_makeIdFunction (idDecl id)
void uentry_setRefCounted (uentry e)
void uentry_setStatic (uentry c)
void uentry_setExtern (uentry c)
void uentry_setParamNo (uentry ue, int pno)
uentry uentry_makeVariableSrefParam (cstring n, ctype t, sRef s)
void uentry_fixupSref (uentry ue)
void uentry_setSpecialClauses (uentry ue, specialClauses clauses)
void uentry_setModifies (uentry ue, sRefSet sr)
void uentry_setMutable (uentry e)
void uentry_reflectQualifiers (uentry ue, qualList q)
bool uentry_isOnly (uentry ue)
bool uentry_isUnique (uentry ue)
bool uentry_isFileStatic (uentry ue)
bool uentry_isExported (uentry ue)
bool uentry_isNonLocal (uentry ue)
bool uentry_isGlobal (uentry ue)
bool uentry_isPrintfLike (uentry ue)
bool uentry_isScanfLike (uentry ue)
bool uentry_isMessageLike (uentry ue)
void uentry_setPrintfLike (uentry ue)
void uentry_setScanfLike (uentry ue)
void uentry_setMessageLike (uentry ue)
bool uentry_isSpecialFunction (uentry ue)
uentry uentry_makeParam (idDecl t, int i)
uentry uentry_makeIdVariable (idDecl t)
uentry uentry_makeVariableParam (cstring n, ctype t)
uentry uentry_makeConstantAux (cstring n, ctype t, fileloc f, bool priv, multiVal m)
uentry uentry_makeConstant (cstring n, ctype t, fileloc f)
uentry uentry_makeIdConstant (idDecl t)
void uentry_setDefState (uentry ue, sstate defstate)
bool uentry_isCheckedUnknown (uentry ue)
bool uentry_isCheckMod (uentry ue)
bool uentry_isUnchecked (uentry ue)
bool uentry_isChecked (uentry ue)
bool uentry_isCheckedModify (uentry ue)
bool uentry_isCheckedStrict (uentry ue)
void uentry_setUnchecked (uentry ue)
void uentry_setChecked (uentry ue)
void uentry_setCheckMod (uentry ue)
void uentry_setCheckedStrict (uentry ue)
bool uentry_isYield (uentry ue)
uentry uentry_makeVariable (cstring n, ctype t, fileloc f, bool isPriv)
void uentry_makeVarFunction (uentry ue)
void uentry_setGlobals (uentry ue, globSet globs)
void uentry_addAccessType (uentry ue, typeId tid)
uentry uentry_makeFunction (cstring n, ctype t, typeId access, globSet globs, sRefSet mods, fileloc f)
uentry uentry_makePrivFunction2 (cstring n, ctype t, typeIdSet access, globSet globs, sRefSet mods, fileloc f)
uentry uentry_makeSpecFunction (cstring n, ctype t, typeIdSet access, globSet globs, sRefSet mods, fileloc f)
uentry uentry_makeExpandedMacro (cstring s, fileloc f)
uentry uentry_makeForwardFunction (cstring n, typeId access, fileloc f)
bool uentry_isForward (uentry e)
uentry uentry_makeTypeListFunction (cstring n, typeIdSet access, fileloc f)
uentry uentry_makeUnspecFunction (cstring n, ctype t, typeIdSet access, fileloc f)
uentry uentry_makeDatatypeAux (cstring n, ctype t, ynm mut, ynm abs, fileloc f, bool priv)
uentry uentry_makeDatatype (cstring n, ctype t, ynm mut, ynm abs, fileloc f)
uentry uentry_makeBoolDatatype (ynm abs)
uentry uentry_makeIter (cstring n, ctype ct, fileloc f)
uentry uentry_makeEndIter (cstring n, fileloc f)
uentry uentry_makeStructTagLoc (cstring n, ctype t)
uentry uentry_makeStructTag (cstring n, ctype t, fileloc loc)
uentry uentry_makeUnionTag (cstring n, ctype t, fileloc loc)
uentry uentry_makeEnumTag (cstring n, ctype t, fileloc loc)
uentry uentry_makeUnionTagLoc (cstring n, ctype t)
uentry uentry_makeEnumTagLoc (cstring n, ctype t)
bool uentry_isStructTag (uentry ue)
bool uentry_isUnionTag (uentry ue)
bool uentry_isEnumTag (uentry ue)
bool uentry_isAnyTag (uentry ue)
void uentry_destroyMod (void)
uentry uentry_makeElipsisMarker (void)
bool uentry_equiv (uentry p1, uentry p2)
int uentry_xcomparealpha (uentry *p1, uentry *p2)
int uentry_xcompareuses (uentry *p1, uentry *p2)
int uentry_compareStrict (uentry v1, uentry v2)
int uentry_compare (uentry u1, uentry u2)
bool uentry_hasGlobs (uentry ue)
bool uentry_hasSpecialClauses (uentry ue)
specialClauses uentry_getSpecialClauses (uentry ue)
bool uentry_hasMods (uentry ue)
void uentry_markFree ( uentry u)
uentry uentry_undump (ekind kind, fileloc loc, char **s)
cstring uentry_dump (uentry v)
cstring uentry_dumpParam (uentry v)
cstring uentry_unparseAbbrev (uentry v)
cstring uentry_unparse (uentry v)
cstring uentry_unparseFull (uentry v)
bool uentry_hasAccessType (uentry e)
typeIdSet uentry_accessType (uentry e)
bool uentry_isVariable (uentry e)
bool uentry_isSpecified (uentry e)
bool uentry_isVar (uentry e)
bool uentry_isFakeTag (uentry e)
bool uentry_isDatatype (uentry e)
void uentry_setAbstract (uentry e)
void uentry_setConcrete (uentry e)
bool uentry_isAbstractDatatype (uentry e)
bool uentry_isMaybeAbstract (uentry e)
bool uentry_isMutableDatatype (uentry e)
bool uentry_isRefCountedDatatype (uentry e)
bool uentry_isParam (uentry u)
bool uentry_isExpandedMacro (uentry u)
bool uentry_isSefParam (uentry u)
bool uentry_isRefParam (uentry u)
bool uentry_isAnyParam (uentry u)
sstate uentry_getDefState (uentry u)
bool uentry_isOut (uentry u)
bool uentry_isPartial (uentry u)
bool uentry_isStateSpecial (uentry u)
exitkind uentry_getExitCode (uentry ue)
qual uentry_nullPred (uentry u)
bool uentry_possiblyNull (uentry u)
alkind uentry_getAliasKind (uentry u)
exkind uentry_getExpKind (uentry u)
bool uentry_isIter (uentry e)
bool uentry_isEndIter (uentry e)
bool uentry_isRealFunction (uentry e)
bool uentry_hasName (uentry e)
bool uentry_hasRealName (uentry e)
globSet uentry_getGlobs (uentry l)
sRefSet uentry_getMods (uentry l)
ekind uentry_getKind (uentry e)
multiVal uentry_getConstantValue (uentry e)
uentryList uentry_getParams (uentry l)
cstring uentry_rawName (uentry e)
cstring uentry_getName (uentry e)
cstring uentry_getRealName (uentry e)
ctype uentry_getType (uentry e)
fileloc uentry_whereLast (uentry e)
fileloc uentry_whereEither (uentry e)
fileloc uentry_whereSpecified (uentry e)
fileloc uentry_whereDefined (uentry e)
fileloc uentry_whereDeclared (uentry e)
fileloc uentry_whereEarliest (uentry e)
void uentry_setFunctionDefined (uentry e, fileloc loc)
void uentry_setDeclaredForce (uentry e, fileloc f)
void uentry_setDeclaredForceOnly (uentry e, fileloc f)
void uentry_setDeclaredOnly (uentry e, fileloc f)
void uentry_setDeclared (uentry e, fileloc f)
void uentry_clearDefined (uentry e)
void uentry_setDefined (uentry e, fileloc f)
bool uentry_isCodeDefined (uentry e)
bool uentry_isDeclared (uentry e)
sRef uentry_getSref (uentry e)
sRef uentry_getOrigSref (uentry e)
void uentry_setName (uentry e, cstring n)
void uentry_setType (uentry e, ctype t)
void uentry_resetParams (uentry ue, uentryList pn)
void uentry_setRefParam (uentry e)
void uentry_setParam (uentry e)
void uentry_setSref (uentry e, sRef s)
ctype uentry_getAbstractType (uentry e)
ctype uentry_getRealType (uentry e)
ctype uentry_getForceRealType (uentry e)
uentry uentry_nameCopy (cstring name, uentry e)
void uentry_setDatatype (uentry e, usymId uid)
void uentry_markOwned ( uentry u)
void uentry_free ( uentry e)
void uentry_freeComplete ( uentry e)
void uentry_showWhereLast (uentry spec)
void uentry_showDefSpecInfo (uentry ce, fileloc fwhere)
void uentry_showWhereLastExtra (uentry spec, cstring extra)
void uentry_showWhereDeclared (uentry spec)
void uentry_showWhereAny (uentry spec)
void uentry_showWhereDefined (uentry spec)
void uentry_showWhereLastPlain (uentry spec)
void uentry_showWhereSpecified (uentry spec)
void uentry_showWhereSpecifiedExtra (uentry spec, cstring s)
cstring uentry_checkedName (uentry ue)
void uentry_checkMatchParam (uentry u1, uentry u2, int paramno, exprNode e)
void uentry_mergeConstantValue (uentry ue, multiVal m)
void uentry_mergeEntries (uentry spec, uentry def)
void uentry_clearDecl (void)
void uentry_checkDecl (void)
void uentry_mergeDefinition (uentry old, uentry unew)
void uentry_copyState (uentry res, uentry other)
bool uentry_sameKind (uentry u1, uentry u2)
uentry uentry_copy (uentry e)
void uentry_setState (uentry res, uentry other)
void uentry_mergeUses (uentry res, uentry other)
void uentry_mergeState (uentry res, uentry other, fileloc loc, bool mustReturn, bool flip, bool opt, clause cl)
void uentry_setUsed (uentry e, fileloc loc)
bool uentry_isReturned (uentry u)
sRef uentry_returnedRef (uentry u, exprNodeList args)
void uentry_checkYieldParam (uentry old, uentry unew)
cstring uentry_ekindName (uentry ue)
void uentry_setHasNameError (uentry ue)
void uentry_checkName (uentry ue)
uentry uentry_makeUnrecognized (cstring c, fileloc loc)


Function Documentation

typeIdSet uentry_accessType ( uentry e )
 

Definition at line 4566 of file uentry.c.

Referenced by uentry_compare().

04567 {
04568   if (uentry_isValid (e))
04569     {
04570       switch (e->ukind)
04571         {
04572         case KITER:
04573           return (e->info->iter->access);
04574         case KENDITER:
04575           return (e->info->enditer->access);
04576         case KFCN:
04577           return (e->info->fcn->access);
04578         case KENUMCONST:
04579         case KCONST:
04580           return (e->info->uconst->access);
04581         default:
04582           break;
04583         }
04584     }
04585 
04586   return typeIdSet_undefined;
04587 }

void uentry_addAccessType ( uentry ue,
typeId tid )
 

Definition at line 2854 of file uentry.c.

02855 {
02856   if (uentry_isFunction (ue))
02857     {
02858       ue->info->fcn->access = typeIdSet_insert (ue->info->fcn->access, tid);
02859     }
02860   else if (uentry_isEitherConstant (ue))
02861     {
02862       ue->info->uconst->access = typeIdSet_insert (ue->info->uconst->access, tid);
02863     }
02864   else if (uentry_isIter (ue))
02865     {
02866       ue->info->iter->access = typeIdSet_insert (ue->info->iter->access, tid);
02867     }
02868   else if (uentry_isEndIter (ue))
02869     {
02870       ue->info->enditer->access = typeIdSet_insert (ue->info->enditer->access, tid);
02871     }
02872   else
02873     {
02874       llbug (message ("no access for: %q", uentry_unparse (ue)));
02875     }
02876 }

void uentry_checkDecl ( void )
 

Definition at line 8196 of file uentry.c.

08197 {
08198   if (uentry_isValid (posRedeclared))
08199     {
08200       llassert (fileloc_isDefined (posLoc));
08201 
08202       if (uentry_isCodeDefined (posRedeclared))
08203         {
08204           if (optgenerror (FLG_REDECL,
08205                            message ("%s %q declared after definition", 
08206                                     ekind_capName (posRedeclared->ukind),
08207                                     uentry_getName (posRedeclared)),
08208                            posLoc))
08209             {
08210               llgenindentmsg (message ("Definition of %q", 
08211                                        uentry_getName (posRedeclared)),
08212                               posRedeclared->whereDeclared);
08213             }
08214         }
08215       else
08216         {
08217           if (optgenerror (FLG_REDECL,
08218                            message ("%s %q declared more than once", 
08219                                     ekind_capName (posRedeclared->ukind),
08220                                     uentry_getName (posRedeclared)),
08221                            posLoc))
08222             {
08223               llgenindentmsg (message ("Previous declaration of %q", 
08224                                        uentry_getName (posRedeclared)),
08225                               posRedeclared->whereDeclared);
08226             }
08227         }
08228     }
08229 
08230   fileloc_free (posLoc);
08231   posLoc = fileloc_undefined;
08232   posRedeclared = uentry_undefined;
08233 }

void uentry_checkMatchParam ( uentry u1,
uentry u2,
int paramno,
exprNode e )
 

Definition at line 7000 of file uentry.c.

07001 {
07002   if (uentry_isElipsisMarker (u1) || uentry_isElipsisMarker (u2))
07003     {
07004       return;
07005     }
07006 
07007   llassert (uentry_isVar (u1));
07008   llassert (uentry_isVar (u2));
07009 
07010   if (u1->info->var->kind != u2->info->var->kind) {
07011     if (u1->info->var->kind == VKSEFRETPARAM) {
07012       if (u2->info->var->kind == VKRETPARAM) {
07013         voptgenerror 
07014           (FLG_TYPE,
07015            message ("Function types are inconsistent. Parameter %d is "
07016                     "sef parameter, but non-sef parameter in "
07017                     "assigned function: %s",
07018                     paramno, exprNode_unparse (e)),
07019            exprNode_loc (e));
07020       } else if (u2->info->var->kind == VKSEFPARAM) {
07021         voptgenerror 
07022           (FLG_TYPE,
07023            message ("Function types are inconsistent. Parameter %d is "
07024                     "returns parameter, but non-returns parameter in "
07025                     "assigned function: %s",
07026                     paramno, exprNode_unparse (e)),
07027            exprNode_loc (e));
07028       } else {
07029         voptgenerror 
07030           (FLG_TYPE,
07031            message ("Function types are inconsistent. Parameter %d is "
07032                     "sef returns parameter, but non-sef returns parameter in "
07033                     "assigned function: %s",
07034                     paramno, exprNode_unparse (e)),
07035            exprNode_loc (e));
07036       }
07037     } else if (u1->info->var->kind == VKRETPARAM) {
07038       voptgenerror 
07039         (FLG_TYPE,
07040          message ("Function types are inconsistent. Parameter %d is "
07041                   "returns parameter, but non-returns parameter in "
07042                   "assigned function: %s",
07043                   paramno, exprNode_unparse (e)),
07044          exprNode_loc (e));
07045     } else if (u1->info->var->kind == VKSEFPARAM) {
07046       voptgenerror 
07047         (FLG_TYPE,
07048          message ("Function types are inconsistent. Parameter %d is "
07049                   "sef parameter, but non-sef parameter in "
07050                   "assigned function: %s",
07051                   paramno, exprNode_unparse (e)),
07052          exprNode_loc (e));
07053     } else {
07054       if (u2->info->var->kind == VKSEFRETPARAM) {
07055         voptgenerror 
07056           (FLG_TYPE,
07057            message ("Function types are inconsistent. Parameter %d is "
07058                     "normal parameter, but sef returns parameter in "
07059                     "assigned function: %s",
07060                     paramno, exprNode_unparse (e)),
07061            exprNode_loc (e));
07062       } else if (u2->info->var->kind == VKSEFPARAM) {
07063         voptgenerror 
07064           (FLG_TYPE,
07065            message ("Function types are inconsistent. Parameter %d is "
07066                     "normal parameter, but sef parameter in "
07067                     "assigned function: %s",
07068                     paramno, exprNode_unparse (e)),
07069            exprNode_loc (e));
07070       } else if (u2->info->var->kind == VKRETPARAM) {
07071         voptgenerror 
07072           (FLG_TYPE,
07073            message ("Function types are inconsistent. Parameter %d is "
07074                     "normal parameter, but returns parameter in "
07075                     "assigned function: %s",
07076                     paramno, exprNode_unparse (e)),
07077            exprNode_loc (e));
07078       } else {
07079         BADBRANCH;
07080       }
07081     }
07082   }
07083 
07084   if (u1->info->var->defstate != u2->info->var->defstate) 
07085     {
07086       voptgenerror 
07087         (FLG_TYPE,
07088          message ("Function types are inconsistent. Parameter %d is "
07089                   "%s, but %s in assigned function: %s",
07090                   paramno, 
07091                   sstate_unparse (u1->info->var->defstate),
07092                   sstate_unparse (u2->info->var->defstate),
07093                   exprNode_unparse (e)),
07094          exprNode_loc (e));
07095     }
07096 
07097   if (u1->info->var->nullstate != u2->info->var->nullstate) 
07098     {
07099       voptgenerror 
07100         (FLG_TYPE,
07101          message ("Function types are inconsistent. Parameter %d is "
07102                   "%s, but %s in assigned function: %s",
07103                   paramno, 
07104                   nstate_unparse (u1->info->var->nullstate),
07105                   nstate_unparse (u2->info->var->nullstate),
07106                   exprNode_unparse (e)),
07107          exprNode_loc (e));
07108     }
07109       
07110   if (sRef_getAliasKind (u1->sref) != sRef_getAliasKind (u2->sref))
07111     {
07112       voptgenerror 
07113         (FLG_TYPE,
07114          message ("Function types are inconsistent. Parameter %d is "
07115                   "%s, but %s in assigned function: %s",
07116                   paramno, 
07117                   alkind_unparse (sRef_getAliasKind (u1->sref)),
07118                   alkind_unparse (sRef_getAliasKind (u2->sref)),
07119                   exprNode_unparse (e)),
07120          exprNode_loc (e));
07121     }
07122 
07123   if (sRef_getExKind (u1->sref) != sRef_getExKind (u2->sref))
07124     {
07125       voptgenerror 
07126         (FLG_TYPE,
07127          message ("Function types are inconsistent. Parameter %d is "
07128                   "%s, but %s in assigned function: %s",
07129                   paramno, 
07130                   exkind_unparse (sRef_getExKind (u1->sref)),
07131                   exkind_unparse (sRef_getExKind (u2->sref)),
07132                   exprNode_unparse (e)),
07133          exprNode_loc (e));
07134     }
07135 }

void uentry_checkName ( uentry ue )
 

Definition at line 9290 of file uentry.c.

Referenced by uentry_mergeDefinition(), and uentry_mergeEntries().

09291 {
09292   if (uentry_isValid (ue) 
09293       && !uentry_isElipsisMarker (ue)
09294       && context_getFlag (FLG_NAMECHECKS)
09295       && !ue->hasNameError 
09296       && !uentry_isEndIter (ue)
09297       && !fileloc_isBuiltin (uentry_whereLast (ue))
09298       && (uentry_isExpandedMacro (ue) || !uentry_isForward (ue)))
09299     {
09300       
09301       if (uentry_isPriv (ue))
09302         {
09303           ; /* any checks here? */
09304         }
09305       else if (fileloc_isExternal (uentry_whereDefined (ue)))
09306         {
09307           ; /* no errors for externals */
09308         }
09309       else
09310         {
09311           int scope;
09312           
09313           if (uentry_isExpandedMacro (ue))
09314             {
09315               scope = globScope;
09316             }
09317           else
09318             {
09319               if (uentry_isExpandedMacro (ue))
09320                 {
09321                   scope = fileScope;
09322                 }
09323               else if (uentry_isVariable (ue))
09324                 {
09325                   sRef sr = uentry_getSref (ue);
09326 
09327                   if (sRef_isValid (sr))
09328                     {
09329                       scope = sRef_getScope (sr);
09330                     }
09331                   else
09332                     {
09333                       scope = fileScope; 
09334                     }
09335                 }
09336               else if (uentry_isFunction (ue)
09337                        || uentry_isIter (ue)
09338                        || uentry_isEndIter (ue)
09339                        || uentry_isConstant (ue))
09340                 {
09341                   scope = uentry_isStatic (ue) ? fileScope : globScope;
09342                 }
09343               else /* datatypes, etc. must be global */
09344                 {
09345                   scope = globScope;
09346                 }
09347               
09348               usymtab_checkDistinctName (ue, scope);
09349             }
09350 
09351           if (context_getFlag (FLG_CPPNAMES)) 
09352             {
09353               if (checkCppName (uentry_rawName (ue), uentry_whereLast (ue)))
09354                 {
09355                   uentry_setHasNameError (ue);
09356                 }
09357             }
09358 
09359           if (scope == globScope)
09360             {
09361               checkGlobalName (ue);
09362 
09363               if (context_getFlag (FLG_ANSIRESERVED))
09364                 {
09365                   if (uentry_hasName (ue)
09366                       && !uentry_isAnyTag (ue))
09367                     {
09368                       if (checkAnsiName (uentry_rawName (ue),
09369                                          uentry_whereLast (ue)))
09370                         {
09371                           uentry_setHasNameError (ue);
09372                         }
09373                     }
09374                 }
09375             }
09376           else
09377             {
09378               checkLocalName (ue);
09379               
09380               if (context_getFlag (FLG_ANSIRESERVEDLOCAL))
09381                 {
09382                   if (uentry_hasName (ue)
09383                       && !uentry_isAnyTag (ue))
09384                     {
09385                       if (checkAnsiName (uentry_rawName (ue),
09386                                          uentry_whereLast (ue)))
09387                         {
09388                           uentry_setHasNameError (ue);
09389                         }
09390                     }
09391                 }
09392             }
09393 
09394           DPRINTF (("Check prefix: %s", uentry_unparse (ue)));
09395           checkPrefix (ue);
09396         }
09397     }
09398 }

void uentry_checkParams ( uentry ue )
 

Definition at line 647 of file uentry.c.

Referenced by declareStaticFunction(), and processNamedDecl().

00648 {
00649   if (uentry_isValid (ue))
00650     {
00651       bool isExt = uentry_isExtern (ue);
00652 
00653       if (uentry_isRealFunction (ue))
00654         {
00655           uentryList params = uentry_getParams (ue);
00656 
00657           uentryList_elements (params, current)
00658             {
00659               if (uentry_isValid (current))
00660                 {
00661                   ctype ct = current->utype;                  
00662                   
00663                   if (ctype_isFixedArray (ct))
00664                     {
00665                       if (ctype_isArray (ctype_baseArrayPtr (ct))
00666                           && !ctype_isFixedArray (ctype_baseArrayPtr (ct)))
00667                         {
00668                           ;
00669                         }
00670                       else
00671                         {
00672                           voptgenerror 
00673                             (FLG_FIXEDFORMALARRAY,
00674                              message ("Function parameter %q declared as "
00675                                       "manifest array (size constant is meaningless)",
00676                                       uentry_getName (current)),
00677                              uentry_whereDeclared (current));
00678                         }
00679                     }
00680                   else 
00681                     {
00682                       if (ctype_isArray (ct))
00683                         {
00684                           voptgenerror 
00685                             (FLG_FORMALARRAY,
00686                              message ("Function parameter %q declared as "
00687                                       "array (treated as pointer)", 
00688                                       uentry_getName (current)),
00689                              uentry_whereDeclared (current));
00690                         }
00691                     }
00692 
00693                   if (sRef_getNullState (uentry_getSref (current)) == NS_MNOTNULL)
00694                     {
00695                       if (ctype_isAbstract (ct) && 
00696                           (isExt || (ctype_isAbstract (ctype_realType (ct))
00697                                      && !context_hasFileAccess (ctype_typeId (ct)))))
00698                         {
00699                           vgenhinterror 
00700                             (FLG_INCONDEFS,
00701                              message 
00702                              ("Function %q declared with notnull parameter %q of abstract "
00703                               "type %s",
00704                               uentry_getName (ue),
00705                               uentry_getName (current),
00706                               ctype_unparse (ct)),
00707                              message 
00708                              ("Since %s is an abstract type, notnull can only be "
00709                               "used for parameters if the function is static to a "
00710                               "module where %s is accessible.",
00711                               ctype_unparse (ct),
00712                               ctype_unparse (ct)),
00713                              uentry_whereDeclared (current));
00714                         }
00715                     }
00716                 }
00717             } end_uentryList_elements;
00718           
00719           if (sRef_getNullState (uentry_getSref (ue)) == NS_MNOTNULL)
00720             {
00721               ctype ct = ue->utype;
00722                   
00723               if (ctype_isAbstract (ct) 
00724                   && (isExt || (ctype_isAbstract (ctype_realType (ct))
00725                                 && !context_hasFileAccess (ctype_typeId (ct)))))
00726                 {
00727                   vgenhinterror 
00728                     (FLG_INCONDEFS,
00729                      message 
00730                      ("%s %q declared %s notnull storage of abstract type %s",
00731                       ekind_capName (uentry_getKind (ue)),
00732                       uentry_getName (ue),
00733                       fcnErrName (ue),
00734                       ctype_unparse (ct)),
00735                      message 
00736                      ("Since %s is an abstract type, notnull can only be used "
00737                       "if it is static to a module where %s is accessible.",
00738                       ctype_unparse (ct),
00739                       ctype_unparse (ct)),
00740                      uentry_whereDeclared (ue));
00741                 }
00742             }
00743         }
00744     }
00745 }

void uentry_checkYieldParam ( uentry old,
uentry unew )
 

Definition at line 9209 of file uentry.c.

Referenced by processNamedDecl().

09210 {
09211   cstring name;
09212 
09213   llassert (uentry_isVariable (old));
09214   llassert (uentry_isVariable (unew));
09215 
09216   unew->info->var->kind = VKYIELDPARAM;
09217   (void) checkTypeConformance (old, unew, TRUE);
09218   checkVarConformance (old, unew, TRUE, FALSE);
09219 
09220   /* get rid of param marker */
09221 
09222   name = uentry_getName (unew);
09223   cstring_free (unew->uname);
09224   unew->uname = name;
09225   unew->info->var->kind = VKREFYIELDPARAM;
09226 
09227   uentry_setUsed (old, fileloc_undefined);
09228   uentry_setUsed (unew, fileloc_undefined);
09229 }

cstring uentry_checkedName ( uentry ue )
 

Definition at line 6447 of file uentry.c.

06448 {
06449   if (uentry_isVar (ue))
06450     {
06451       return (checkedName (ue->info->var->checked));
06452     }
06453   else
06454     {
06455       return (cstring_makeLiteralTemp ("<checked invalid>"));
06456     }
06457 }

void uentry_clearDecl ( void )
 

Definition at line 8188 of file uentry.c.

08189 {
08190   posRedeclared = uentry_undefined;
08191   fileloc_free (posLoc);
08192   posLoc = fileloc_undefined;
08193 }

void uentry_clearDefined ( uentry e )
 

Definition at line 5215 of file uentry.c.

05216 {
05217   if (uentry_isValid (e))
05218     {
05219       e->whereDefined = fileloc_update (e->whereDefined, fileloc_undefined);
05220     }
05221 }

int uentry_compare ( uentry u1,
uentry u2 )
 

Definition at line 3378 of file uentry.c.

Referenced by uentryList_compareFields(), uentry_equiv(), and uentry_xcomparealpha().

03379 {
03380   if (u1 == u2) return 0;
03381   
03382   if (uentry_isInvalid (u1)) return -1;
03383   if (uentry_isInvalid (u2)) return 1;
03384 
03385   INTCOMPARERETURN (u1->ukind, u2->ukind);
03386   COMPARERETURN (ctype_compare (u1->utype, u2->utype));
03387   COMPARERETURN (bool_compare (uentry_isPriv (u1), uentry_isPriv (u2)));
03388 
03389   COMPARERETURN (sRef_compare (u1->sref, u2->sref));
03390 
03391   switch (u1->ukind)
03392     {
03393     case KINVALID:
03394     case KELIPSMARKER:
03395       /* bug detected by lclint:  
03396       ** uentry.c:753,14: Return value type bool does not match declared type int: TRUE 
03397       */
03398       return 0;
03399     case KENUMCONST:
03400     case KCONST:
03401       return (multiVal_compare (u1->info->uconst->val,
03402                                 u2->info->uconst->val));
03403     case KSTRUCTTAG: 
03404     case KUNIONTAG: 
03405     case KENUMTAG: 
03406       return (ctype_compare (u1->info->datatype->type, u2->info->datatype->type));
03407     case KITER:
03408       COMPARERETURN (typeIdSet_compare (uentry_accessType (u1), 
03409                                          uentry_accessType (u2)));
03410       return (uentryList_compareParams (uentry_getParams (u1), 
03411                                         uentry_getParams (u2)));
03412     case KENDITER:
03413       return (typeIdSet_compare (uentry_accessType (u1), 
03414                                   uentry_accessType (u2)));
03415     case KFCN:
03416       COMPARERETURN (typeIdSet_compare (uentry_accessType (u1), 
03417                                          uentry_accessType (u2)));
03418       COMPARERETURN (globSet_compare (uentry_getGlobs (u1), 
03419                                       uentry_getGlobs (u2)));
03420       COMPARERETURN (uentryList_compareParams (uentry_getParams (u1), 
03421                                                uentry_getParams (u2)));
03422       COMPARERETURN (generic_compare (u1->info->fcn->specialCode,
03423                                        u2->info->fcn->specialCode));
03424       COMPARERETURN (generic_compare (u1->info->fcn->nullPred,
03425                                        u2->info->fcn->nullPred));
03426 
03427       return (sRefSet_compare (uentry_getMods (u1), uentry_getMods (u2)));
03428     case KVAR:
03429       COMPARERETURN (generic_compare (u1->info->var->kind, u2->info->var->kind));
03430       COMPARERETURN (generic_compare (sRef_getOrigAliasKind (u1->sref),
03431                                       sRef_getOrigAliasKind (u2->sref)));
03432       COMPARERETURN (generic_compare (sRef_getOrigExKind (u1->sref),
03433                                       sRef_getOrigExKind (u2->sref)));
03434       COMPARERETURN (generic_compare (u1->info->var->checked,
03435                                       u2->info->var->checked));
03436       COMPARERETURN (generic_compare (u1->info->var->defstate, 
03437                                       u2->info->var->defstate));
03438       return        (generic_compare (u1->info->var->nullstate, 
03439                                       u2->info->var->nullstate));
03440     case KDATATYPE:
03441       COMPARERETURN (ctype_compare (u1->info->datatype->type,
03442                                     u2->info->datatype->type));
03443       COMPARERETURN (ynm_compare (u1->info->datatype->mut,
03444                                   u2->info->datatype->mut));
03445       return (ynm_compare (u1->info->datatype->abs, u2->info->datatype->abs));
03446     }
03447   
03448   BADEXIT;
03449 }

int uentry_compareStrict ( uentry v1,
uentry v2 )
 

Definition at line 3363 of file uentry.c.

03364 {
03365   COMPARERETURN (uentry_compare (v1, v2));
03366 
03367   if (v1 != v2 && uentry_isValid (v1) && uentry_isValid (v2))
03368     {
03369       COMPARERETURN (fileloc_compare (v1->whereDeclared, v2->whereDeclared));
03370       COMPARERETURN (fileloc_compare (v1->whereDefined, v2->whereDefined));
03371       COMPARERETURN (fileloc_compare (v1->whereSpecified, v2->whereSpecified));
03372     }
03373 
03374   return 0;
03375 }

uentry uentry_copy ( uentry e )
 

Definition at line 8559 of file uentry.c.

Referenced by uentryList_copy().

08560 {
08561   if (uentry_isValid (e))
08562     {
08563       uentry enew = uentry_alloc ();
08564       DPRINTF (("copy: %s", uentry_unparseFull (e)));
08565       uentry_copyInto (enew, e);
08566       DPRINTF (("Here we are..."));
08567       DPRINTF (("original: %s", uentry_unparseFull (e)));
08568       DPRINTF (("copy: %s", uentry_unparse (enew)));
08569       DPRINTF (("copy: %s", uentry_unparseFull (enew)));
08570       return enew;
08571     }
08572   else
08573     {
08574       return uentry_undefined;
08575     }
08576 }

void uentry_copyState ( uentry res,
uentry other )
 

Definition at line 8491 of file uentry.c.

08492 {
08493   llassert (uentry_isValid (res));
08494   llassert (uentry_isValid (other));
08495 
08496   res->used = other->used;
08497 
08498   res->info->var->kind = other->info->var->kind;
08499   res->info->var->defstate = other->info->var->defstate;
08500   res->info->var->nullstate = other->info->var->nullstate;
08501   res->info->var->checked = other->info->var->checked;
08502 
08503   sRef_copyState (res->sref, other->sref);
08504 }

void uentry_destroyMod ( void )
 

Definition at line 3259 of file uentry.c.

Referenced by llexit().

03261 {
03262   static bool wasDestroyed = FALSE;
03263 
03264   llassert (!wasDestroyed);
03265 
03266   if (emarker != NULL)
03267     {
03268       uentry_reallyFree (emarker);
03269     }
03270 
03271   wasDestroyed = TRUE;
03272 }

cstring uentry_dump ( uentry v )
 

Definition at line 4202 of file uentry.c.

Referenced by usymtab_dump().

04203 {
04204   return (uentry_dumpAux (v, FALSE));
04205 }

cstring uentry_dumpParam ( uentry v )
 

Definition at line 4208 of file uentry.c.

04209 {
04210   llassertprint (uentry_isVariable (v) || uentry_isElipsisMarker (v),
04211                  ("dump: %s", uentry_unparseFull (v)));
04212 
04213   return (uentry_dumpAux (v, TRUE));
04214 }

cstring uentry_ekindName ( uentry ue )
 

Definition at line 9232 of file uentry.c.

Referenced by checkPrefix().

09233 {
09234   if (uentry_isValid (ue))
09235     {
09236       switch (ue->ukind)
09237         {
09238         case KINVALID:
09239           return cstring_makeLiteralTemp ("<Error: invalid uentry>");
09240         case KDATATYPE: 
09241           return cstring_makeLiteralTemp ("Datatype");
09242         case KENUMCONST:
09243           return cstring_makeLiteralTemp ("Enum member");
09244         case KCONST:  
09245           return cstring_makeLiteralTemp ("Constant");
09246         case KVAR:      
09247           if (uentry_isParam (ue))
09248             {
09249               return cstring_makeLiteralTemp ("Parameter");
09250             }
09251           else if (uentry_isExpandedMacro (ue))
09252             {
09253               return cstring_makeLiteralTemp ("Expanded macro");
09254             }
09255           else
09256             {
09257               return cstring_makeLiteralTemp ("Variable");
09258             }
09259         case KFCN:   
09260           return cstring_makeLiteralTemp ("Function");
09261         case KITER: 
09262           return cstring_makeLiteralTemp ("Iterator");
09263         case KENDITER:
09264           return cstring_makeLiteralTemp ("Iterator finalizer");
09265         case KSTRUCTTAG:
09266           return cstring_makeLiteralTemp ("Struct tag");
09267         case KUNIONTAG:
09268           return cstring_makeLiteralTemp ("Union tag");
09269         case KENUMTAG: 
09270           return cstring_makeLiteralTemp ("Enum tag");
09271         case KELIPSMARKER: 
09272           return cstring_makeLiteralTemp ("Optional parameters");
09273         }
09274     }
09275   else
09276     {
09277       return cstring_makeLiteralTemp ("<Undefined>");
09278     }
09279 
09280   BADEXIT;
09281 }

bool uentry_equiv ( uentry p1,
uentry p2 )
 

Definition at line 3304 of file uentry.c.

Referenced by usymtab_dump().

03305 {
03306   if (uentry_compare (p1, p2) != 0)
03307     {
03308       return FALSE;
03309     }
03310   else
03311     {
03312       return TRUE;
03313     }
03314 }

void uentry_fixupSref ( uentry ue )
 

Definition at line 1117 of file uentry.c.

Referenced by checkPassTransfer(), and usymtab_exitScope().

01118 {
01119   sRef sr;
01120   
01121   if (uentry_isUndefined (ue) || uentry_isElipsisMarker (ue)) 
01122     {
01123       return;
01124     }
01125   
01126   sr = uentry_getSref (ue);
01127 
01128   sRef_resetState (sr);
01129   sRef_clearDerived (sr);
01130   
01131   llassertprint (uentry_isVariable (ue), ("fixing: %s", uentry_unparseFull (ue)));
01132   llassert (sRef_isValid (sr)); 
01133   
01134   if (uentry_isVariable (ue))
01135     {
01136       sRef_setDefState (sr, ue->info->var->defstate, fileloc_undefined);
01137       sRef_setNullState (sr, ue->info->var->nullstate, fileloc_undefined);
01138     }
01139 }

void uentry_free ( uentry e )
 

Definition at line 5853 of file uentry.c.

Referenced by exprNode_destroyMod(), uentryList_free(), uentryList_undump(), uentry_mergeDefinition(), uentry_mergeEntries(), and usymtab_popBranches().

05854 {
05855   if (uentry_isValid (e) && !uentry_isElipsisMarker (e))
05856     {
05857       uentry_reallyFree (e);
05858     }
05859 }

void uentry_freeComplete ( uentry e )
 

Definition at line 5866 of file uentry.c.

05867 {
05868   if (uentry_isValid (e) && !uentry_isElipsisMarker (e))
05869     {
05870       /*@i@*/ sRef_free (e->sref);
05871       e->sref = sRef_undefined;
05872       uentry_reallyFree (e);
05873     }
05874 }

ctype uentry_getAbstractType ( uentry e )
 

Definition at line 5446 of file uentry.c.

Referenced by declareEnum(), declareUnnamedEnum(), handleEnum(), handleStruct(), handleUnion(), uentry_getForceRealType(), uentry_getRealType(), usymtab_lookupAbstractType(), and usymtab_supForwardTypeEntry().

05447 {
05448   llassert (uentry_isDatatype (e));
05449 
05450   /*
05451   ** This assertion removed.
05452   ** Okay to have undefined type, for system types
05453   
05454   llassertprintret (!ctype_isUndefined (e->info->datatype->type),
05455                     ("uentry_getAbstractType %q: undefined", uentry_unparseFull (e)),
05456                     e->utype);
05457                     
05458   */
05459 
05460   if (ctype_isUndefined (e->info->datatype->type))
05461     {
05462       return ctype_unknown;
05463     }
05464 
05465   /*
05466   ** Sadly, a kludge...
05467   */
05468 
05469   if (ctype_isUserBool (e->info->datatype->type)) {
05470     return ctype_bool;
05471   }
05472 
05473   return e->info->datatype->type;
05474 }

alkind uentry_getAliasKind ( uentry u )
 

Definition at line 4793 of file uentry.c.

04794 {
04795   if (uentry_isValid (u))
04796     {
04797       return (sRef_getAliasKind (uentry_getSref (u)));
04798     }
04799   else
04800     {
04801       return AK_UNKNOWN;
04802     }
04803 }

multiVal uentry_getConstantValue ( uentry e )
 

Definition at line 4911 of file uentry.c.

04912 {
04913   llassert (uentry_isEitherConstant (e));
04914 
04915   return (e->info->uconst->val);
04916 }

sstate uentry_getDefState ( uentry u )
 

Definition at line 4724 of file uentry.c.

Referenced by sRef_setStateFromUentry().

04725 {
04726   if (uentry_isValid (u))
04727     {
04728       return (sRef_getDefState (u->sref));
04729     }
04730   else
04731     {
04732       return (SS_UNKNOWN);
04733     }
04734 }

exitkind uentry_getExitCode ( uentry ue )
 

Definition at line 4758 of file uentry.c.

04759 {
04760   if (uentry_isFunction (ue))
04761     {
04762       return ue->info->fcn->exitCode;
04763     }
04764   else
04765     {
04766       return XK_UNKNOWN;
04767     }
04768 }

exkind uentry_getExpKind ( uentry u )
 

Definition at line 4806 of file uentry.c.

04807 {
04808   if (uentry_isValid (u))
04809     {
04810       return (sRef_getExKind (uentry_getSref (u)));
04811     }
04812   else
04813     {
04814       return XO_UNKNOWN;
04815     }
04816 }

ctype uentry_getForceRealType ( uentry e )
 

Definition at line 5544 of file uentry.c.

Referenced by ctype_forceRealType().

05545 {
05546   ctype   ct;
05547   typeId uid = USYMIDINVALID;
05548 
05549   if (uentry_isInvalid (e))
05550     {
05551       return ctype_unknown;
05552     }
05553 
05554   llassertprint (uentry_isDatatype (e), ("not datatype: %s", uentry_unparse (e)));
05555   
05556   if (uentry_isAnyTag (e))
05557     {
05558       return (e->utype);
05559     }
05560   
05561   if (uentry_isAbstractType (e))
05562     {
05563       ct = uentry_getAbstractType (e);      
05564       llassert (ctype_isUA (ct));
05565       
05566       uid = ctype_typeId (ct);
05567       /* no check for access! */
05568     }
05569   
05570   ct = uentry_getType (e);
05571 
05572   /* evs 2000-07-25 */
05573   /* if (ctype_isUserBool (ct)) return ct; */
05574 
05575   if (ctype_isManifestBool (ct)) {
05576     return ctype_bool;
05577   }
05578   
05579   if (ctype_isUA (ct))
05580     {
05581       usymId iid = ctype_typeId (ct);
05582       
05583       if /*@access usymId@*/ (iid == uid) /*@noaccess usymId@*/
05584         {         
05585           llcontbug (message ("uentry_getRealType: recursive type! %s",
05586                               ctype_unparse (ct)));
05587           return ct;
05588         }
05589       else
05590         {
05591           return uentry_getForceRealType (usymtab_getTypeEntry (iid));
05592         }
05593     }
05594   else
05595     {
05596       return ct;
05597     }
05598 }

globSet uentry_getGlobs ( uentry l )
 

Definition at line 4859 of file uentry.c.

Referenced by context_enterFunction(), and uentry_compare().

04860 {
04861   if (uentry_isInvalid (l)) 
04862     {
04863       return globSet_undefined;
04864     }
04865 
04866   if (l->ukind != KFCN)
04867     {
04868       if (l->ukind != KITER && l->ukind != KENDITER)
04869         {
04870           if (l->ukind == KVAR)
04871             {
04872               llbug (message ("Bad call to uentry_getGlobs (var): %q (%s)", 
04873                               uentry_unparse (l), 
04874                               ekind_unparse (l->ukind)));
04875             }
04876           else
04877             {
04878               llbug (message ("Bad call to uentry_getGlobs: %q (%s)", 
04879                               uentry_unparse (l), 
04880                               ekind_unparse (l->ukind)));
04881             }
04882         }
04883       return globSet_undefined;
04884     }
04885 
04886   return l->info->fcn->globs;
04887 }

ekind uentry_getKind ( uentry e )
 

Definition at line 4904 of file uentry.c.

Referenced by usymtab_dump().

04905 {
04906   llassert (uentry_isValid (e));
04907 
04908   return (e->ukind);
04909 }

sRefSet uentry_getMods ( uentry l )
 

Definition at line 4890 of file uentry.c.

Referenced by context_enterFunction(), and uentry_compare().

04891 {
04892   llassert (uentry_isValid (l));
04893 
04894   if (l->ukind != KFCN && l->ukind != KITER && l->ukind != KENDITER)
04895     {
04896       llcontbug (message ("Bad call to uentry_getMods: %q", uentry_unparse (l)));
04897       return sRefSet_undefined; 
04898     }
04899 
04900   return l->info->fcn->mods;
04901 }

cstring uentry_getName ( uentry e )
 

Definition at line 4978 of file uentry.c.

Referenced by checkParamNames(), checkPrefix(), exprChecks_checkEmptyMacroBody(), exprNode_checkMacroBody(), exprNode_iter(), exprNode_iterId(), sRef_sameName(), specialClauses_checkAll(), uentryList_lookupRealName(), uentry_checkDecl(), uentry_checkParams(), uentry_checkYieldParam(), uentry_mergeConstantValue(), uentry_mergeDefinition(), uentry_mergeEntries(), uentry_reflectQualifiers(), uentry_setDefined(), uentry_unparse(), uentry_unparseAbbrev(), uentry_unparseFull(), usymIdSet_unparse(), usymtab_allDefined(), usymtab_allUsed(), usymtab_checkFinalScope(), usymtab_exportHeader(), usymtab_exportLocal(), and usymtab_getTypeEntryName().

04979 {
04980   cstring ret = cstring_undefined;
04981 
04982   if (uentry_isValid (e))
04983     {
04984       
04985       if (uentry_isAnyTag (e))
04986         {
04987           ret = fixTagName (e->uname); 
04988         }
04989       else if (uentry_isAnyParam (e))
04990         {
04991           ret = cstring_copy (fixParamName (e->uname));
04992         }
04993       else
04994         {
04995           ret = cstring_copy (e->uname);
04996         }
04997     }
04998 
04999   return ret;
05000 }

sRef uentry_getOrigSref ( uentry e )
 

Definition at line 5294 of file uentry.c.

05295 {
05296   if (uentry_isValid (e))
05297     {
05298       sRef sr = sRef_copy (uentry_getSref (e));
05299       
05300       sRef_resetState (sr);
05301       sRef_clearDerived (sr);
05302       
05303       if (uentry_isVariable (e))
05304         {
05305           sRef_setDefState (sr, e->info->var->defstate, fileloc_undefined);
05306           sRef_setNullState (sr, e->info->var->nullstate, fileloc_undefined);
05307         }
05308       
05309       return (sr);
05310     }
05311   else
05312     {
05313       return sRef_undefined;
05314     }
05315 }

uentryList uentry_getParams ( uentry l )
 

Definition at line 4919 of file uentry.c.

Referenced by checkParamNames(), context_getParams(), exprNode_checkAllMods(), exprNode_iterStart(), uentry_checkParams(), uentry_compare(), and uentry_returnedRef().

04920 {
04921   if (uentry_isInvalid (l)) return uentryList_undefined;
04922 
04923   switch (l->ukind)
04924     {
04925     case KFCN:  
04926     case KITER:
04927       {
04928         ctype ct = l->utype;
04929 
04930         if (ctype_isFunction (ct))
04931           {
04932             return (ctype_argsFunction (ct));
04933           }
04934         else
04935           {
04936             return uentryList_undefined;
04937           }
04938       }
04939     case KVAR:  
04940       {
04941         ctype ct = l->utype;
04942 
04943         llassert (ctype_isFunction (ct));
04944         return (ctype_argsFunction (ct));
04945       }
04946     BADDEFAULT;
04947     }
04948   BADEXIT;
04949 }

cstring uentry_getRealName ( uentry e )
 

Definition at line 5002 of file uentry.c.

05003 {
05004   if (uentry_isValid (e))
05005     {
05006       if (uentry_isAnyTag (e))
05007         {
05008           return (cstring_undefined);
05009         }
05010       else
05011         {
05012           return (e->uname);
05013         }
05014     }
05015   return cstring_undefined;
05016 }

ctype uentry_getRealType ( uentry e )
 

Definition at line 5476 of file uentry.c.

Referenced by ctype_realType(), ctype_realishType(), usymtab_allUsed(), and usymtab_lookupType().

05477 {
05478   ctype ct;
05479   typeId uid = USYMIDINVALID;
05480 
05481   if (uentry_isInvalid (e))
05482     {
05483       return ctype_unknown;
05484     }
05485 
05486   llassertprint (uentry_isDatatype (e), ("not datatype: %s", uentry_unparse (e)));
05487 
05488   if (uentry_isAnyTag (e))
05489     {
05490       return (e->utype);
05491     }
05492   
05493   if (uentry_isAbstractType (e))
05494     {
05495       ct = uentry_getAbstractType (e);      
05496 
05497       if (ctype_isManifestBool (ct)) {
05498         return ct;
05499       }
05500 
05501       llassert (ctype_isUA (ct));
05502       
05503       uid = ctype_typeId (ct);
05504       
05505       if (!context_hasAccess (uid))
05506         {
05507           return (ct);
05508         }
05509     }
05510 
05511   ct = uentry_getType (e);
05512 
05513   /* if (ctype_isUserBool (ct)) return ct; */
05514 
05515   if (ctype_isManifestBool (ct)) {
05516     return ctype_bool;
05517   }
05518   
05519   if (ctype_isUA (ct))
05520     {
05521       usymId iid = ctype_typeId (ct);
05522       
05523       if /*@access usymId@*/ (iid == uid) /*@noaccess usymId@*/
05524         {         
05525           llcontbug (message ("uentry_getRealType: recursive type! %s",
05526                               ctype_unparse (ct)));
05527           return ct;
05528         }
05529       else
05530         {
05531           /* evs 2000-07-25: possible infinite recursion ? */
05532           uentry ue2 = usymtab_getTypeEntry (iid);
05533           llassertprint (ue2 != e, ("Bad recursion: %s", uentry_unparseFull (e)));
05534 
05535           return uentry_getRealType (ue2);
05536         }
05537     }
05538   else
05539     {
05540       return ct;
05541     }
05542 }

specialClauses uentry_getSpecialClauses ( uentry ue )
 

Definition at line 3687 of file uentry.c.

Referenced by checkReturnTransfer(), specialClauses_checkAll(), specialClauses_checkEqual(), uentry_returnedRef(), and usymtab_checkFinalScope().

03688 {
03689   llassert (uentry_isFunction (ue));
03690   return ue->info->fcn->specclauses;
03691 }

sRef uentry_getSref ( uentry e )
 

Definition at line 5284 of file uentry.c.

Referenced by aliasTable_fixSrefs(), checkPassTransfer(), checkReturnTransfer(), checkSpecClausesId(), exprNode_checkMacroBody(), exprNode_createId(), exprNode_iterId(), exprNode_iterNewId(), fixModifiesId(), fixSpecClausesId(), processNamedDecl(), sRefSet_fixSrefs(), sRef_fixOuterRef(), sRef_updateSref(), specialClauses_checkAll(), uentryList_fixImpParams(), uentry_checkName(), uentry_directParamNo(), uentry_fixupSref(), usymtab_allUsed(), usymtab_checkFinalScope(), usymtab_popAndBranch(), and usymtab_supEntrySref().

05285 {
05286   /* not true, used for functions too (but shouldn't be? */
05287   /* llassertprint (e->ukind == KVAR, ("uentry_getSref: not variable!")); */
05288 
05289   if (uentry_isInvalid (e)) return sRef_undefined;
05290   
05291   return (e->sref);
05292 }

ctype uentry_getType ( uentry e )
 

Definition at line 5018 of file uentry.c.

Referenced by checkPassTransfer(), checkValueConstant(), context_currentFunctionType(), context_getRetType(), declareEnum(), exprNode_arrowAccess(), exprNode_checkMacroBody(), exprNode_createId(), exprNode_fieldAccess(), exprNode_iterId(), exprNode_iterNewId(), exprNode_offsetof(), sRef_deriveType(), uentryList_fixMissingNames(), uentryList_matchFields(), uentryList_matchParams(), uentryList_showFieldDifference(), uentry_getForceRealType(), uentry_getRealType(), uentry_isForward(), uentry_makeIdFunction(), uentry_reflectQualifiers(), uentry_showWhereLast(), usymtab_enterFunctionScope(), usymtab_enumEnumNameListType(), and usymtab_matchForwardStruct().

05019 {
05020   if (uentry_isValid (e))
05021     {
05022       return e->utype;
05023     }
05024   else
05025     {
05026       return ctype_unknown;
05027     }
05028 }

bool uentry_hasAccessType ( uentry e )
 

Definition at line 4543 of file uentry.c.

Referenced by context_enterFunction().

04544 {
04545   if (uentry_isValid (e))
04546     {
04547       switch (e->ukind)
04548         {
04549         case KITER:
04550           return (!typeIdSet_isEmpty (e->info->iter->access));
04551         case KENDITER:
04552           return (!typeIdSet_isEmpty (e->info->enditer->access));
04553         case KFCN:
04554           return (!typeIdSet_isEmpty (e->info->fcn->access));
04555         case KENUMCONST:
04556         case KCONST:
04557           return (!typeIdSet_isEmpty (e->info->uconst->access));
04558         default:
04559           return FALSE;
04560         }
04561     }
04562 
04563   return FALSE;
04564 }

bool uentry_hasGlobs ( uentry ue )
 

Definition at line 3672 of file uentry.c.

Referenced by context_exitFunction().

03673 {
03674   if (uentry_isFunction (ue))
03675     {
03676       return (ue->info->fcn->hasGlobs);
03677     }
03678 
03679   return FALSE;
03680 }

bool uentry_hasMods ( uentry ue )
 

Definition at line 3693 of file uentry.c.

Referenced by context_exitFunction(), and context_hasMods().

03694 {
03695   if (uentry_isFunction (ue))
03696     {
03697       return (ue->info->fcn->hasMods);
03698     }
03699 
03700   return FALSE;
03701 }

bool uentry_hasName ( uentry e )
 

Definition at line 4838 of file uentry.c.

Referenced by checkGlobalName(), checkParamNames(), sRef_hasName(), uentry_checkName(), uentry_makeParam(), uentry_showWhereAny(), uentry_showWhereDeclared(), uentry_showWhereLast(), uentry_showWhereSpecified(), uentry_showWhereSpecifiedExtra(), and usymtab_allUsed().

04839 {
04840   if (uentry_isValid (e))
04841     {
04842       cstring s = e->uname;
04843       
04844       return (!(cstring_isEmpty (s) || cstring_equalLit (s, "...")));
04845     }
04846   else
04847     {
04848       return FALSE;
04849     }
04850 }

bool uentry_hasRealName ( uentry e )
 

Definition at line 4852 of file uentry.c.

Referenced by exprNode_checkAllMods(), uentryList_fixMissingNames(), usymtab_allUsed(), and usymtab_dump().

04853 {
04854   return (uentry_isValid (e) && cstring_isNonEmpty (e->uname));
04855 }

bool uentry_hasSpecialClauses ( uentry ue )
 

Definition at line 3682 of file uentry.c.

Referenced by checkPassTransfer(), and usymtab_checkFinalScope().

03683 {
03684   return (uentry_isFunction (ue) && specialClauses_isDefined (ue->info->fcn->specclauses));
03685 }

bool uentry_isAbstractDatatype ( uentry e )
 

Definition at line 4651 of file uentry.c.

Referenced by usymtab_supReturnTypeEntry(), and usymtab_supTypeEntry().

04652 {
04653   return (uentry_isDatatype (e) 
04654           && (ynm_isOn (e->info->datatype->abs)));
04655 }

bool uentry_isAnyParam ( uentry u )
 

Definition at line 4713 of file uentry.c.

Referenced by checkPrefix(), sRef_isRealLocalVar(), uentry_getName(), and usymtab_checkFinalScope().

04714 {
04715   return (uentry_isVariable (u) 
04716           && ((u->info->var->kind == VKPARAM)
04717               || (u->info->var->kind == VKSEFPARAM)
04718               || (u->info->var->kind == VKYIELDPARAM)
04719               || (u->info->var->kind == VKRETPARAM)
04720               || (u->info->var->kind == VKSEFRETPARAM)));
04721 }

bool uentry_isAnyTag ( uentry ue )
 

Definition at line 3250 of file uentry.c.

Referenced by checkPrefix(), uentry_checkName(), uentry_getForceRealType(), uentry_getName(), uentry_getRealName(), uentry_getRealType(), usymtab_allDefined(), usymtab_allUsed(), usymtab_exportHeader(), usymtab_exportLocal(), and usymtab_matchForwardStruct().

03251 {
03252   return (uentry_isStructTag (ue) 
03253           || uentry_isUnionTag (ue)
03254           || uentry_isEnumTag (ue));
03255 }

bool uentry_isCheckMod ( uentry ue )
 

Definition at line 2582 of file uentry.c.

Referenced by context_checkAliasGlob(), and context_checkGlobUse().

02583 {
02584   return (uentry_isVar (ue) 
02585           && (ue->info->var->checked == CH_CHECKMOD));
02586 }

bool uentry_isChecked ( uentry ue )
 

Definition at line 2594 of file uentry.c.

Referenced by context_checkAliasGlob(), and context_checkGlobUse().

02595 {
02596   return (uentry_isVar (ue) 
02597           && (ue->info->var->checked == CH_CHECKED));
02598 }

bool uentry_isCheckedModify ( uentry ue )
 

Definition at line 2600 of file uentry.c.

Referenced by context_checkGlobMod().

02601 {
02602   return (uentry_isVar (ue) 
02603           && (ue->info->var->checked == CH_CHECKED
02604               || ue->info->var->checked == CH_CHECKMOD
02605               || ue->info->var->checked == CH_CHECKEDSTRICT));
02606 }

bool uentry_isCheckedStrict ( uentry ue )
 

Definition at line 2608 of file uentry.c.

Referenced by context_checkAliasGlob(), context_checkGlobMod(), and context_checkGlobUse().

02609 {
02610   return (uentry_isVar (ue) 
02611           && (ue->info->var->checked == CH_CHECKEDSTRICT));
02612 }

bool uentry_isCheckedUnknown ( uentry ue )
 

Definition at line 2576 of file uentry.c.

Referenced by context_checkAliasGlob(), context_checkGlobUse(), doDeclareVar(), and processNamedDecl().

02577 {
02578   return (uentry_isVar (ue) 
02579           && (ue->info->var->checked == CH_UNKNOWN));
02580 }

bool uentry_isCodeDefined ( uentry e )
 

Definition at line 5268 of file uentry.c.

Referenced by uentryList_showFieldDifference(), uentry_checkDecl(), uentry_makeDatatypeAux(), uentry_showWhereDefined(), and usymtab_allDefined().

05269 {
05270   return (uentry_isValid (e) && fileloc_isDefined (e->whereDefined));
05271 }

bool uentry_isDatatype ( uentry e )
 

Definition at line 4621 of file uentry.c.

Referenced by checkPrefix(), context_checkExport(), exprChecks_checkExport(), exprNode_fromUIO(), uentry_isAbstractDatatype(), uentry_isMaybeAbstract(), uentry_isMutableDatatype(), uentry_isOut(), uentry_isPartial(), uentry_isRefCountedDatatype(), uentry_possiblyNull(), uentry_unparseFull(), usymtab_allUsed(), usymtab_existsType(), usymtab_existsTypeEither(), usymtab_exportHeader(), usymtab_exportLocal(), and usymtab_getTypeId().

04622 {
04623   return (!uentry_isUndefined (e) &&
04624           (e->ukind == KDATATYPE || e->ukind == KSTRUCTTAG ||
04625            e->ukind == KUNIONTAG || e->ukind == KENUMTAG));
04626 }

bool uentry_isDeclared ( uentry e )
 

Definition at line 5274 of file uentry.c.

Referenced by specialClauses_checkEqual(), uentryList_showFieldDifference(), uentry_makeDatatypeAux(), uentry_showWhereAny(), uentry_showWhereDeclared(), uentry_showWhereLast(), uentry_showWhereLastExtra(), uentry_showWhereLastPlain(), uentry_showWhereSpecified(), uentry_showWhereSpecifiedExtra(), uentry_specDeclName(), and uentry_specOrDefName().

05275 {
05276   if (uentry_isValid (e))
05277     {
05278       return (fileloc_isDefined (e->whereDeclared));
05279     }
05280 
05281   return FALSE;
05282 }

bool uentry_isEndIter ( uentry e )
 

Definition at line 4825 of file uentry.c.

Referenced by context_checkExport(), exprChecks_checkExport(), uentry_addAccessType(), uentry_checkName(), usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

04826 {
04827   return (!uentry_isUndefined (e) && e->ukind == KENDITER);
04828 }

bool uentry_isEnumTag ( uentry ue )
 

Definition at line 3244 of file uentry.c.

Referenced by uentry_isAnyTag(), and usymtab_enumEnumNameListType().

03245 {
03246   return (uentry_isValid (ue) && ue->ukind == KENUMTAG);
03247 }

bool uentry_isExpandedMacro ( uentry u )
 

Definition at line 4687 of file uentry.c.

Referenced by checkPrefix(), context_checkExport(), exprChecks_checkExport(), uentry_checkName(), uentry_ekindName(), uentry_mergeDefinition(), usymtab_allUsed(), usymtab_existsReal(), usymtab_exportHeader(), and usymtab_exportLocal().

04688 {
04689   return (uentry_isVariable (u) && (u->info->var->kind == VKEXPMACRO));
04690 }

bool uentry_isExported ( uentry ue )
 

Definition at line 2259 of file uentry.c.

Referenced by checkPrefix().

02260 {
02261   if (uentry_isValid (ue))
02262     {
02263       if (uentry_isVariable (ue))
02264         {
02265           return (sRef_isRealGlobal (uentry_getSref (ue)));
02266         }
02267       else
02268         {
02269           return !uentry_isStatic (ue);
02270         }
02271     }
02272 
02273   return FALSE;
02274 }

bool uentry_isFakeTag ( uentry e )
 

Definition at line 4615 of file uentry.c.

Referenced by usymtab_allDefined().

04616 {
04617   return (uentry_isValid (e) && strchr (cstring_toCharsSafe (e->uname), '!') != 0);
04618 }

bool uentry_isFileStatic ( uentry ue )
 

Definition at line 2251 of file uentry.c.

Referenced by checkPrefix().

02252 {
02253   return (uentry_isStatic (ue) 
02254           && (!uentry_isVariable (ue)
02255               || sRef_isFileStatic (uentry_getSref (ue))));
02256 }

bool uentry_isForward ( uentry e )
 

Definition at line 2943 of file uentry.c.

Referenced by uentry_checkName(), uentry_mergeDefinition(), and usymtab_exportHeader().

02944 {
02945   if (uentry_isValid (e))
02946     {
02947       ctype ct = uentry_getType (e);
02948 
02949       return (ctype_isUnknown (ct)
02950               || (ctype_isFunction (ct)
02951                   && ctype_isUnknown (ctype_returnValue (ct))));
02952     }
02953 
02954   return FALSE;
02955 }

bool uentry_isGlobal ( uentry ue )
 

Definition at line 2284 of file uentry.c.

Referenced by checkPrefix().

02285 {
02286   return (uentry_isValid (ue) && uentry_isVariable (ue) && 
02287           sRef_isGlobal (ue->sref));
02288 }

bool uentry_isIter ( uentry e )
 

Definition at line 4819 of file uentry.c.

Referenced by checkPrefix(), context_checkExport(), exprChecks_checkExport(), exprNode_iter(), exprNode_iterStart(), uentry_addAccessType(), uentry_checkName(), uentry_setGlobals(), uentry_setModifies(), uentry_unparseFull(), usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

04820 {
04821   return (!uentry_isUndefined (e) && e->ukind == KITER);
04822 }

bool uentry_isMaybeAbstract ( uentry e )
 

Definition at line 4658 of file uentry.c.

Referenced by processNamedDecl().

04659 {
04660   return (uentry_isDatatype (e) 
04661           && (ynm_isMaybe (e->info->datatype->abs)));
04662 }

bool uentry_isMessageLike ( uentry ue )
 

Definition at line 2305 of file uentry.c.

02306 {
02307   return (uentry_isFunction (ue) 
02308           && (ue->info->fcn->specialCode == SPC_MESSAGELIKE));
02309 }

bool uentry_isMutableDatatype ( uentry e )
 

Definition at line 4665 of file uentry.c.

04666 {
04667   bool res = uentry_isDatatype (e) 
04668     && (ynm_toBoolRelaxed (e->info->datatype->mut));
04669   
04670   return res;
04671 }

bool uentry_isNonLocal ( uentry ue )
 

Definition at line 2277 of file uentry.c.

Referenced by exprNode_createId().

02278 {
02279   return (uentry_isValid (ue) && uentry_isVariable (ue)
02280           && (sRef_isGlobal (ue->sref) || uentry_isStatic (ue)));
02281 }

bool uentry_isOnly ( uentry ue )
 

Definition at line 2217 of file uentry.c.

02218 {
02219   return (!uentry_isUndefined (ue) 
02220           && uentry_isVariable (ue) 
02221           && alkind_isOnly (sRef_getOrigAliasKind (ue->sref)));
02222 }

bool uentry_isOut ( uentry u )
 

Definition at line 4737 of file uentry.c.

Referenced by checkPassTransfer(), and usymtab_checkFinalScope().

04738 {
04739   return ((uentry_isVariable (u) && (u->info->var->defstate == SS_ALLOCATED))
04740           || (uentry_isDatatype (u) && (sRef_isAllocated (u->sref))));
04741 }

bool uentry_isParam ( uentry u )
 

Definition at line 4680 of file uentry.c.

Referenced by exprChecks_checkExport(), uentry_ekindName(), and usymtab_allUsed().

04681 {
04682   return (uentry_isVariable (u) && (u->info->var->kind == VKPARAM
04683                                     || u->info->var->kind == VKYIELDPARAM));
04684 }

bool uentry_isPartial ( uentry u )
 

Definition at line 4744 of file uentry.c.

Referenced by checkPassTransfer().

04745 {
04746   return ((uentry_isVariable (u) && (u->info->var->defstate == SS_PARTIAL))
04747           || (uentry_isDatatype (u) && (sRef_isAllocated (u->sref))));
04748 }

bool uentry_isPrintfLike ( uentry ue )
 

Definition at line 2291 of file uentry.c.

02292 {
02293   return (uentry_isFunction (ue) 
02294           && (ue->info->fcn->specialCode == SPC_PRINTFLIKE));
02295 }

bool uentry_isRealFunction ( uentry e )
 

Definition at line 4831 of file uentry.c.

Referenced by uentry_checkParams(), and usymtab_checkFinalScope().

04832 {
04833   return (uentry_isFunction (e) ||
04834           (uentry_isVariable (e) && ctype_isFunction (uentry_getType (e))));
04835 }

bool uentry_isRefCountedDatatype ( uentry e )
 

Definition at line 4674 of file uentry.c.

04675 {
04676   return (uentry_isDatatype (e) && (sRef_isRefCounted (uentry_getSref (e))));
04677 }

bool uentry_isRefParam ( uentry u )
 

Definition at line 4703 of file uentry.c.

Referenced by checkPrefix(), exprNode_sizeofExpr(), sRef_isRealLocalVar(), sRef_similarRelaxed(), usymtab_allUsed(), and usymtab_checkFinalScope().

04704 {
04705   return (uentry_isVariable (u) 
04706           && (u->info->var->kind == VKREFPARAM
04707               || u->info->var->kind == VKREFYIELDPARAM
04708               || u->info->var->kind == VKREFSEFPARAM
04709               || u->info->var->kind == VKREFSEFRETPARAM));
04710 }

bool uentry_isReturned ( uentry u )
 

Definition at line 9015 of file uentry.c.

Referenced by checkPassTransfer(), uentryList_hasReturned(), and uentry_returnedRef().

09016 {
09017   return (uentry_isValid (u) && uentry_isVar (u) 
09018           && (u->info->var->kind == VKRETPARAM
09019               || u->info->var->kind == VKSEFRETPARAM));
09020 }

bool uentry_isScanfLike ( uentry ue )
 

Definition at line 2298 of file uentry.c.

02299 {
02300   return (uentry_isFunction (ue) 
02301           && (ue->info->fcn->specialCode == SPC_SCANFLIKE));
02302 }

bool uentry_isSefParam ( uentry u )
 

Definition at line 4693 of file uentry.c.

Referenced by uentry_mergeState(), and uentry_setUsed().

04694 {
04695   return (uentry_isVariable (u) 
04696           && (u->info->var->kind == VKSEFPARAM
04697               || u->info->var->kind == VKREFSEFPARAM
04698               || u->info->var->kind == VKSEFRETPARAM
04699               || u->info->var->kind == VKREFSEFRETPARAM));
04700 }

bool uentry_isSpecialFunction ( uentry ue )
 

Definition at line 2424 of file uentry.c.

02425 {
02426   return (uentry_isFunction (ue) 
02427           && (ue->info->fcn->specialCode != SPC_NONE));
02428 }

bool uentry_isSpecified ( uentry e )
 

Definition at line 4596 of file uentry.c.

Referenced by exprNode_fromUIO(), uentry_showWhereAny(), uentry_showWhereDeclared(), uentry_showWhereLast(), uentry_showWhereLastExtra(), uentry_showWhereLastPlain(), uentry_showWhereSpecified(), and uentry_showWhereSpecifiedExtra().

04597 {
04598   return (uentry_isValid (e) && !fileloc_isUndefined (e->whereSpecified));
04599 }

bool uentry_isStateSpecial ( uentry u )
 

Definition at line 4751 of file uentry.c.

Referenced by checkPassTransfer().

04752 {
04753   return ((uentry_isVariable (u) 
04754            && (u->info->var->defstate == SS_SPECIAL))
04755           || (uentry_isValid (u) && sRef_isStateSpecial (u->sref)));
04756 }

bool uentry_isStructTag ( uentry ue )
 

Definition at line 3232 of file uentry.c.

Referenced by uentry_isAnyTag().

03233 {
03234   return (uentry_isValid (ue) && ue->ukind == KSTRUCTTAG);
03235 }

bool uentry_isUnchecked ( uentry ue )
 

Definition at line 2588 of file uentry.c.

Referenced by context_checkGlobMod().

02589 {
02590   return (uentry_isVar (ue) 
02591           && (ue->info->var->checked == CH_UNCHECKED));
02592 }

bool uentry_isUnionTag ( uentry ue )
 

Definition at line 3238 of file uentry.c.

Referenced by uentry_isAnyTag().

03239 {
03240   return (uentry_isValid (ue) && ue->ukind == KUNIONTAG);
03241 }

bool uentry_isUnique ( uentry ue )
 

Definition at line 2243 of file uentry.c.

02244 {
02245   return (!uentry_isUndefined (ue) 
02246           && uentry_isVariable (ue) 
02247           && alkind_isUnique (sRef_getOrigAliasKind (ue->sref)));
02248 }

bool uentry_isVar ( uentry e )
 

Definition at line 4609 of file uentry.c.

Referenced by processNamedDecl(), uentry_checkedName(), uentry_directParamNo(), uentry_isCheckMod(), uentry_isChecked(), uentry_isCheckedModify(), uentry_isCheckedStrict(), uentry_isCheckedUnknown(), uentry_isReturned(), uentry_isUnchecked(), uentry_isVariable(), uentry_sameKind(), uentry_setParam(), uentry_setRefParam(), and usymtab_existsVar().

04610 {
04611   return (!uentry_isUndefined (e) && e->ukind == KVAR);
04612 }

bool uentry_isVariable ( uentry e )
 

Definition at line 4590 of file uentry.c.

Referenced by checkPrefix(), context_checkExport(), exprChecks_checkExport(), uentryList_dumpFields(), uentry_checkName(), uentry_fixupSref(), uentry_getOrigSref(), uentry_isAnyParam(), uentry_isExpandedMacro(), uentry_isExported(), uentry_isFileStatic(), uentry_isGlobal(), uentry_isNonLocal(), uentry_isOnly(), uentry_isOut(), uentry_isParam(), uentry_isPartial(), uentry_isRealFunction(), uentry_isRefParam(), uentry_isSefParam(), uentry_isStateSpecial(), uentry_isUnique(), uentry_isYield(), uentry_mergeDefinition(), uentry_possiblyNull(), uentry_reflectQualifiers(), uentry_resetParams(), uentry_setDefState(), uentry_setGlobals(), uentry_setMessageLike(), uentry_setModifies(), uentry_setPrintfLike(), uentry_setScanfLike(), uentry_setStatic(), uentry_unparseAbbrev(), uentry_unparseFull(), usymtab_allDefined(), usymtab_checkFinalScope(), usymtab_exitScope(), and usymtab_exportHeader().

04591 {
04592   return (uentry_isVar (e));
04593 }

bool uentry_isYield ( uentry ue )
 

Definition at line 2693 of file uentry.c.

Referenced by checkPrefix(), exprNode_assign(), exprNode_iterExpr(), exprNode_iterId(), exprNode_iterNewId(), exprNode_iterStart(), processNamedDecl(), uentry_mergeDefinition(), uentry_setUsed(), and usymtab_allUsed().

02694 {
02695   return (uentry_isVariable (ue) 
02696           && (ue->info->var->kind == VKYIELDPARAM
02697               || ue->info->var->kind == VKREFYIELDPARAM));
02698 }

uentry uentry_makeBoolDatatype ( ynm abs )
 

Definition at line 3039 of file uentry.c.

Referenced by usymtab_initBool().

03040 {
03041   uentry ret = uentry_makeDatatypeAux (context_getBoolName (),
03042                                        ctype_bool, NO, abs, 
03043                                        fileloc_getBuiltin (),
03044                                        FALSE);
03045   
03046   ret->info->datatype->type = ctype_bool;
03047   return ret;
03048 }

uentry uentry_makeConstant ( cstring n,
ctype t,
fileloc f )
 

Definition at line 2540 of file uentry.c.

Referenced by uentry_makeEnumConstant(), uentry_makeEnumInitializedConstant(), uentry_makeIdConstant(), and uentry_makeSpecEnumConstant().

02541 {
02542   return (uentry_makeConstantAux (n, t, f, FALSE, multiVal_unknown ()));
02543 }

uentry uentry_makeConstantAux ( cstring n,
ctype t,
fileloc f,
bool priv,
multiVal m )
 

Definition at line 2505 of file uentry.c.

Referenced by doDeclareConstant(), uentry_makeConstant(), and usymtab_initBool().

02508 {
02509   uentry e = uentry_alloc ();
02510 
02511   e->ukind = KCONST;
02512   e->uname = cstring_copy (n);
02513   e->utype = t;
02514   e->storageclass = SCNONE;
02515 
02516   e->sref  = sRef_makeConst (t);
02517 
02518   e->lset = FALSE;
02519   e->used = FALSE;
02520   
02521   e->uses = filelocList_new ();
02522   e->isPrivate = priv;
02523   e->hasNameError = FALSE;
02524 
02525   e->info = (uinfo) dmalloc (sizeof (*e->info));
02526   e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
02527   e->info->uconst->val = m;
02528   e->info->uconst->access = typeIdSet_undefined;
02529 
02530   uentry_setSpecDef (e, f);
02531 
02532   if (multiVal_isInt (m) && (multiVal_forceInt (m) == 0))
02533     {
02534       sRef_setDefNull (e->sref, uentry_whereDeclared (e)); 
02535     }
02536 
02537   return (e);
02538 }

uentry uentry_makeDatatype ( cstring n,
ctype t,
ynm mut,
ynm abs,
fileloc f )
 

Definition at line 3033 of file uentry.c.

Referenced by o_fctInfo(), and uentry_makeIdDatatype().

03035 {
03036   return (uentry_makeDatatypeAux (n, t, mut, abs, f, FALSE));
03037 }

uentry uentry_makeDatatypeAux ( cstring n,
ctype t,
ynm mut,
ynm abs,
fileloc f,
bool priv )
 

Definition at line 2987 of file uentry.c.

Referenced by uentry_makeBoolDatatype(), and uentry_makeDatatype().

02989 {
02990   uentry e = uentry_alloc ();
02991 
02992   /* e->shallowCopy = FALSE; */
02993   e->ukind = KDATATYPE;
02994   e->uname = cstring_copy (n);
02995   e->utype = t;
02996   e->storageclass = SCNONE;
02997   e->sref  = sRef_makeUnknown ();
02998 
02999   if (ctype_isUA (t))
03000     {
03001       sRef_setStateFromType (e->sref, t);
03002     }
03003 
03004   uentry_setSpecDef (e, f);
03005 
03006   e->uses = filelocList_new ();
03007   e->isPrivate = priv;
03008   e->hasNameError = FALSE;
03009 
03010   e->used = FALSE;
03011   e->lset = FALSE;
03012 
03013   e->info = (uinfo) dmalloc (sizeof (*e->info));
03014   e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype));
03015   e->info->datatype->abs = abs;
03016   e->info->datatype->mut = mut;
03017   e->info->datatype->type = ctype_undefined;
03018 
03019   if (uentry_isDeclared (e))
03020     {
03021       uentry_setDefined (e, f);
03022     }
03023 
03024   if (ynm_isOn (abs) && !(uentry_isCodeDefined (e)))
03025     {
03026       sRef_setNullState (e->sref, NS_ABSNULL, uentry_whereDeclared (e));
03027     }
03028 
03029   return (e);
03030 }

uentry uentry_makeElipsisMarker ( void )
 

Definition at line 3275 of file uentry.c.

Referenced by uentry_undump().

03276 {
03277   if (emarker == NULL)
03278     {
03279       emarker = uentry_alloc ();
03280 
03281       emarker->ukind = KELIPSMARKER;
03282       emarker->uname = cstring_makeLiteral ("...");
03283       emarker->utype = ctype_elipsMarker;
03284       emarker->sref  = sRef_undefined;
03285       emarker->storageclass = SCNONE;
03286       emarker->used = FALSE;
03287       emarker->lset = FALSE;
03288       emarker->info = NULL;
03289 
03290       uentry_setSpecDef (emarker, fileloc_undefined);
03291       emarker->uses = filelocList_new ();
03292       emarker->isPrivate = FALSE;
03293       emarker->hasNameError = FALSE;
03294     }
03295 
03296   /*@ignore@*/ return (emarker); /*@end@*/
03297 }

uentry uentry_makeEndIter ( cstring n,
fileloc f )
 

Definition at line 3118 of file uentry.c.

Referenced by declareIter().

03119 {
03120   return (uentry_makeEndIterAux (n, context_fileAccessTypes (), f));
03121 }

uentry uentry_makeEnumConstant ( cstring n,
ctype t )
 

Definition at line 572 of file uentry.c.

00573 {
00574   fileloc loc = setLocation ();
00575   uentry ue = uentry_makeConstant (n, t, loc);
00576 
00577   ue->ukind = KENUMCONST;
00578   uentry_setDefined (ue, loc);
00579   return ue;
00580 }

uentry uentry_makeEnumInitializedConstant ( cstring n,
ctype t,
exprNode expr )
 

Definition at line 582 of file uentry.c.

00583 {
00584   fileloc loc = setLocation ();
00585   uentry ue = uentry_makeConstant (n, t, loc);
00586   ctype etype = exprNode_getType (expr);
00587 
00588   if (!ctype_isRealInt (etype)) {
00589     voptgenerror 
00590       (FLG_ENUMMEMBERS,
00591        message
00592        ("Value of enum member is not an integeral type (type %s): %s",
00593         ctype_unparse (etype), exprNode_unparse (expr)),
00594        exprNode_loc (expr));
00595   }
00596   
00597   ue->ukind = KENUMCONST;
00598   uentry_setDefined (ue, loc);
00599   return ue;
00600 }

uentry uentry_makeEnumTag ( cstring n,
ctype t,
fileloc loc )
 

Definition at line 3201 of file uentry.c.

03202 {
03203   cstring ename = makeEnum (n);
03204   uentry ret = uentry_makeTagAux (ename, t, loc, FALSE, KENUMTAG);
03205 
03206   cstring_free (ename);
03207   return ret;
03208 }

uentry uentry_makeEnumTagLoc ( cstring n,
ctype t )
 

Definition at line 3222 of file uentry.c.

Referenced by declareEnum(), and declareUnnamedEnum().

03223 {
03224   cstring ename = makeEnum (n);
03225   uentry ret = uentry_makeTagAux (ename, t, setLocation (), FALSE, KENUMTAG);
03226 
03227   cstring_free (ename);
03228   return ret;
03229 }

uentry uentry_makeExpandedMacro ( cstring s,
fileloc f )
 

Definition at line 2921 of file uentry.c.

02922 {
02923   uentry ue = uentry_makeVariableAux (s, ctype_unknown, fileloc_undefined, 
02924                                       sRef_undefined, FALSE, VKEXPMACRO);
02925 
02926   uentry_setDefined (ue, f);
02927   return ue;
02928 }

uentry uentry_makeForwardFunction ( cstring n,
typeId access,
fileloc f )
 

Definition at line 2931 of file uentry.c.

02932 {
02933   uentry ue = uentry_makeFunctionAux (n, ctype_unknown, 
02934                                       typeIdSet_singleOpt (access),
02935                                       globSet_undefined, sRefSet_undefined, 
02936                                       fileloc_undefined,
02937                                       FALSE, TRUE);
02938 
02939   ue->whereDeclared = fileloc_update (ue->whereDeclared, f);
02940   return ue;
02941 }

uentry uentry_makeFunction ( cstring n,
ctype t,
typeId access,
globSet globs,
sRefSet mods,
fileloc f )
 

Definition at line 2879 of file uentry.c.

Referenced by uentry_makeIdFunction().

02883 {
02884   return (uentry_makeFunctionAux (n, t, 
02885                                   ((typeId_isInvalid (access)) ? typeIdSet_emptySet () 
02886                                    : typeIdSet_single (access)),
02887                                   globs, mods, f,
02888                                   FALSE, FALSE));
02889 }

uentry uentry_makeIdConstant ( idDecl t )
 

Definition at line 2545 of file uentry.c.

Referenced by checkConstant(), and checkValueConstant().

02546 {
02547   uentry ue = uentry_makeConstant (idDecl_observeId (t), 
02548                                    idDecl_getCtype (t), 
02549                                    fileloc_undefined);
02550 
02551   llassert (fileloc_isUndefined (ue->whereDeclared));
02552   ue->whereDeclared = setLocation ();
02553 
02554   uentry_reflectQualifiers (ue, idDecl_getQuals (t));
02555 
02556   return ue;
02557 }

uentry uentry_makeIdDatatype ( idDecl id )
 

Definition at line 624 of file uentry.c.

Referenced by processNamedDecl().

00625 {
00626   ctype ct = idDecl_getCtype (id);
00627   uentry ue = uentry_makeDatatype (idDecl_observeId (id), ct, 
00628                                    MAYBE, MAYBE, setLocation ());
00629 
00630   uentry_reflectQualifiers (ue, idDecl_getQuals (id));
00631   
00632   if (!ynm_isOn (ue->info->datatype->abs))
00633     {
00634       if (ctype_isUnknown (ct))
00635         {
00636           ue->info->datatype->mut = MAYBE;
00637         }
00638       else
00639         {
00640           ue->info->datatype->mut = ynm_fromBool (ctype_isMutable (ct));
00641         }
00642     }
00643   
00644   return ue;
00645 }

uentry uentry_makeIdFunction ( idDecl id )
 

Definition at line 868 of file uentry.c.

Referenced by declareStaticFunction(), processNamedDecl(), and uentry_makeIdVariable().

00869 {
00870   uentry ue = 
00871     uentry_makeFunction (idDecl_observeId (id), idDecl_getCtype (id), 
00872                          typeId_invalid, globSet_undefined, 
00873                          sRefSet_undefined, 
00874                          setLocation ());
00875   
00876   uentry_reflectQualifiers (ue, idDecl_getQuals (id));
00877   reflectImplicitFunctionQualifiers (ue, FALSE);
00878 
00879   if (!uentry_isStatic (ue)
00880       && cstring_equalLit (ue->uname, "main"))
00881     {
00882       ctype typ = ue->utype;
00883       ctype retval;
00884       uentryList args;
00885 
00886       llassert (ctype_isFunction (typ));
00887 
00888       retval = ctype_returnValue (typ);
00889 
00890       if (!ctype_isInt (retval))
00891         {
00892           voptgenerror 
00893             (FLG_MAINTYPE,
00894              message ("Function main declared to return %s, should return int",
00895                       ctype_unparse (retval)),
00896              uentry_whereDeclared (ue));
00897         }
00898 
00899       args = ctype_argsFunction (typ);
00900 
00901       if (uentryList_isMissingParams (args) 
00902           || uentryList_size (args) == 0)
00903         {
00904           ;
00905         }
00906       else
00907         {
00908           if (uentryList_size (args) != 2)
00909             {
00910               voptgenerror 
00911                 (FLG_MAINTYPE,
00912                  message ("Function main declared with %d arg%p, "
00913                           "should have 2 (int argc, char *argv[])",
00914                           uentryList_size (args)),
00915                  uentry_whereLast (ue));
00916             }
00917           else
00918             {
00919               uentry arg = uentryList_getN (args, 0);
00920               ctype ct = uentry_getType (arg);
00921 
00922               if (!ctype_isInt (ct))
00923                 {
00924                   voptgenerror 
00925                     (FLG_MAINTYPE,
00926                      message ("Parameter 1, %q, of function main declared "
00927                               "with type %t, should have type int",
00928                               uentry_getName (arg), ct),
00929                      uentry_whereDeclared (arg));
00930                 }
00931 
00932               arg = uentryList_getN (args, 1);
00933               ct = uentry_getType (arg);
00934 
00935               if (ctype_isArrayPtr (ct)
00936                   && ctype_isArrayPtr (ctype_baseArrayPtr (ct))
00937                   && ctype_isChar (ctype_baseArrayPtr (ctype_baseArrayPtr (ct))))
00938                 {
00939                   ;
00940                 }
00941               else
00942                 {
00943                   voptgenerror 
00944                     (FLG_MAINTYPE,
00945                      message ("Parameter 2, %q, of function main declared "
00946                               "with type %t, should have type char **",
00947                               uentry_getName (arg), ct),
00948                      uentry_whereDeclared (arg));
00949                 }
00950             }
00951         }
00952     }
00953 
00954   return ue;
00955 }

uentry uentry_makeIdVariable ( idDecl t )
 

Definition at line 2469 of file uentry.c.

Referenced by fixUentryList(), and processNamedDecl().

02470 {
02471   ctype ct = idDecl_getCtype (t);
02472 
02473   if (ctype_isFunction (ct))
02474     {
02475             return (uentry_makeIdFunction (t));
02476     }
02477   else
02478     {
02479       fileloc loc = setLocation ();
02480       uentry ue = uentry_makeVariable (idDecl_observeId (t), ct, loc, FALSE);
02481       
02482       uentry_reflectQualifiers (ue, idDecl_getQuals (t));
02483 
02484       if (!uentry_isExtern (ue))
02485         {
02486           uentry_setDefined (ue, loc);
02487         }
02488 
02489       return ue;
02490     }
02491 }

uentry uentry_makeIter ( cstring n,
ctype ct,
fileloc f )
 

Definition at line 3084 of file uentry.c.

Referenced by declareCIter(), and declareIter().

03085 {
03086   return (uentry_makeIterAux (n, context_fileAccessTypes (), ct, f));
03087 }

uentry uentry_makeParam ( idDecl t,
int i )
 

Definition at line 2430 of file uentry.c.

Referenced by exprNode_initMod(), makeCurrentParam(), and processNamedDecl().

02431 {
02432   ctype ct = idDecl_getCtype (t);
02433   ctype base = ct;
02434   sRef pref = sRef_makeParam (i, ct);
02435   uentry ue = uentry_makeVariableSrefParam (idDecl_observeId (t), ct, pref);
02436 
02437   uentry_reflectQualifiers (ue, idDecl_getQuals (t));
02438   uentry_implicitParamAnnots (ue);
02439 
02440   /* Parameter type [][] or [x][] is invalid */
02441 
02442   while (ctype_isFixedArray (base)) {
02443     base = ctype_baseArrayPtr (base);
02444   }
02445   
02446   if (ctype_isIncompleteArray (base)) {
02447     base = ctype_baseArrayPtr (base);
02448 
02449     if (ctype_isArray (base)) {
02450       if (!uentry_hasName (ue)) {
02451         (void) optgenerror (FLG_INCOMPLETETYPE, 
02452                             message ("Unnamed function parameter %d is incomplete type (inner array must have bounds): %s",
02453                                      i + 1,
02454                                      ctype_unparse (ct)),
02455                             uentry_whereLast (ue));
02456       } else {
02457         (void) optgenerror (FLG_INCOMPLETETYPE, 
02458                             message ("Function parameter %q is incomplete type (inner array must have bounds): %s",
02459                                      uentry_getName (ue),
02460                                      ctype_unparse (ct)),
02461                             uentry_whereLast (ue));
02462       }
02463     }
02464   }
02465 
02466   return ue;
02467 }

uentry uentry_makePrivFunction2 ( cstring n,
ctype t,
typeIdSet access,
globSet globs,
sRefSet mods,
fileloc f )
 

Definition at line 2893 of file uentry.c.

02897 {
02898   return (uentry_makeFunctionAux (n, t, access, globs, mods, f, TRUE, FALSE));
02899 }

uentry uentry_makeSpecEnumConstant ( cstring n,
ctype t,
fileloc loc )
 

Definition at line 603 of file uentry.c.

00604 {
00605   uentry ue = uentry_makeConstant (n, t, loc);
00606 
00607   ue->ukind = KENUMCONST;
00608   return ue;
00609 }

uentry uentry_makeSpecFunction ( cstring n,
ctype t,
typeIdSet access,
globSet globs,
sRefSet mods,
fileloc f )
 

Definition at line 2903 of file uentry.c.

02908 {
02909   uentry ue = uentry_makeFunctionAux (n, t, access, 
02910                                       globs, mods, f,
02911                                       FALSE, FALSE);
02912 
02913   uentry_setHasGlobs (ue);
02914   uentry_setHasMods (ue);
02915 
02916   reflectImplicitFunctionQualifiers (ue, TRUE);
02917   return (ue);
02918 }

uentry uentry_makeStructTag ( cstring n,
ctype t,
fileloc loc )
 

Definition at line 3180 of file uentry.c.

Referenced by ctype_createForwardStruct().

03181 {
03182   cstring sname = makeStruct (n);
03183   uentry ret = uentry_makeTagAux (sname, t, loc, FALSE, KSTRUCTTAG);
03184 
03185   cstring_free (sname);
03186   return ret;
03187 }

uentry uentry_makeStructTagLoc ( cstring n,
ctype t )
 

Definition at line 3170 of file uentry.c.

Referenced by ctype_createUnnamedStruct(), and declareStruct().

03171 {
03172   cstring sname = makeStruct (n);
03173   uentry ret = uentry_makeTagAux (sname, t, setLocation (), FALSE, KSTRUCTTAG);
03174 
03175   cstring_free (sname);
03176   return (ret);
03177 }

uentry uentry_makeTypeListFunction ( cstring n,
typeIdSet access,
fileloc f )
 

Definition at line 2959 of file uentry.c.

02960 {
02961   return (uentry_makeFunctionAux (n, ctype_unknown, access,
02962                                   globSet_new (),
02963                                   sRefSet_new (), f,
02964                                   FALSE, TRUE));
02965 }

uentry uentry_makeUnionTag ( cstring n,
ctype t,
fileloc loc )
 

Definition at line 3190 of file uentry.c.

Referenced by ctype_createForwardUnion().

03191 {
03192   cstring uname = makeUnion (n);
03193   uentry ret = uentry_makeTagAux (uname, t, loc, FALSE, KUNIONTAG);
03194 
03195   cstring_free (uname);
03196   return (ret);
03197 }

uentry uentry_makeUnionTagLoc ( cstring n,
ctype t )
 

Definition at line 3212 of file uentry.c.

Referenced by ctype_createUnnamedUnion(), and declareUnion().

03213 {
03214   cstring uname = makeUnion (n);
03215   uentry ret = uentry_makeTagAux (uname, t, setLocation (), FALSE, KUNIONTAG);
03216 
03217   cstring_free (uname);
03218   return ret;
03219 }

uentry uentry_makeUnnamedVariable ( ctype t )
 

Definition at line 618 of file uentry.c.

00619 {
00620   return uentry_makeVariable (cstring_undefined, t, setLocation (), FALSE);
00621 }

uentry uentry_makeUnrecognized ( cstring c,
fileloc loc )
 

Definition at line 9400 of file uentry.c.

Referenced by coerceId().

09401 {
09402   uentry ue;
09403   fileloc tloc;
09404 
09405   /*
09406   ** Can't but unrecognized ids in macros in global scope, because srefs will break! */
09407   if (!context_inMacro ())
09408     {
09409       sRef_setGlobalScopeSafe ();
09410     }
09411 
09412   ue = uentry_makeVariable (c, ctype_unknown, loc, FALSE);
09413   uentry_setUsed (ue, loc);               
09414   
09415   tloc = fileloc_createExternal ();
09416   uentry_setDefined (ue, tloc);
09417   fileloc_free (tloc);
09418   uentry_setHasNameError (ue);
09419   
09420   if (context_getFlag (FLG_REPEATUNRECOG))
09421     {
09422       uentry_markOwned (ue);
09423     }
09424   else
09425     {
09426       ue = usymtab_supReturnFileEntry (ue);
09427     }
09428   
09429   if (!context_inMacro ())
09430     {
09431       sRef_clearGlobalScopeSafe ();
09432     }
09433 
09434   return ue;
09435 }

uentry uentry_makeUnspecFunction ( cstring n,
ctype t,
typeIdSet access,
fileloc f )
 

Definition at line 2968 of file uentry.c.

02971 {
02972   uentry ue = uentry_makeFunctionAux (n, t, access, globSet_new (),
02973                                       sRefSet_new (), f, FALSE, TRUE);
02974 
02975   reflectImplicitFunctionQualifiers (ue, TRUE);
02976   return ue;
02977 }

void uentry_makeVarFunction ( uentry ue )
 

Definition at line 2717 of file uentry.c.

Referenced by uentry_resetParams(), uentry_setGlobals(), uentry_setMessageLike(), uentry_setModifies(), uentry_setPrintfLike(), and uentry_setScanfLike().

02718 {
02719   alkind ak;
02720   exkind ek;
02721   uvinfo oldInfo;
02722   fileloc loc;
02723 
02724   llassert (uentry_isValid (ue));
02725   llassert (!sRef_modInFunction ());
02726 
02727   ak = sRef_getOrigAliasKind (ue->sref);
02728   ek = sRef_getOrigExKind (ue->sref);
02729 
02730   oldInfo = ue->info->var;
02731 
02732   llassert (ctype_isUnknown (ue->utype) || ctype_isFunction (ue->utype));
02733 
02734   /*
02735   ** expanded macro is marked used (until I write a pre-processor)
02736   */
02737 
02738   ue->used |= (oldInfo->kind == VKEXPMACRO);
02739 
02740   ue->ukind = KFCN;
02741   ue->info->fcn = (ufinfo) dmalloc (sizeof (*ue->info->fcn));
02742   ue->info->fcn->exitCode = XK_UNKNOWN;
02743   ue->info->fcn->nullPred = QU_UNKNOWN;
02744   ue->info->fcn->specialCode = SPC_NONE;
02745   ue->info->fcn->access = typeIdSet_undefined;
02746   ue->info->fcn->hasGlobs = FALSE;
02747   ue->info->fcn->globs = globSet_undefined;
02748   ue->info->fcn->hasMods = FALSE;
02749   ue->info->fcn->mods = sRefSet_undefined;
02750   ue->info->fcn->specclauses = NULL;
02751   ue->info->fcn->defparams = uentryList_undefined;
02752 
02753   if (ctype_isFunction (ue->utype))
02754     {
02755       ue->sref = sRef_makeType (ctype_returnValue (ue->utype)); 
02756     }
02757   else
02758     {
02759       ue->sref = sRef_makeType (ctype_unknown); 
02760     }
02761 
02762   if (sRef_isRefCounted (ue->sref))
02763     {
02764       ak = AK_NEWREF;
02765     }
02766   else
02767     {
02768       if (alkind_isUnknown (ak))
02769         {
02770           if (exkind_isKnown (ek))
02771             {
02772               ak = AK_IMPDEPENDENT;
02773             }
02774           else 
02775             {
02776               if (context_getFlag (FLG_RETIMPONLY))
02777                 {
02778                   if (ctype_isFunction (ue->utype)
02779                       && ctype_isVisiblySharable 
02780                       (ctype_realType (ctype_returnValue (ue->utype))))
02781                     {
02782                       if (uentryList_hasReturned (uentry_getParams (ue)))
02783                         {
02784                           ;
02785                         }
02786                       else
02787                         {
02788                           ak = AK_IMPONLY;
02789                                                 }
02790                     }
02791                 }
02792             }
02793         }
02794     }
02795 
02796   loc = ue->whereDeclared;
02797 
02798   sRef_setAliasKind (ue->sref, ak, loc);
02799   sRef_setNullState (ue->sref, oldInfo->nullstate, loc);
02800   sRef_setDefState (ue->sref, oldInfo->defstate, loc);
02801   sRef_setExKind (ue->sref, ek, loc);
02802 
02803   if (oldInfo->kind == VKEXPMACRO)
02804     {
02805       fileloc_free (loc);
02806       ue->whereDeclared = fileloc_undefined;
02807     }
02808   else
02809     {
02810       fileloc_free (ue->whereDefined);
02811       ue->whereDefined = fileloc_undefined;
02812     }
02813 
02814   uvinfo_free (oldInfo);
02815 }

uentry uentry_makeVariable ( cstring n,
ctype t,
fileloc f,
bool isPriv )
 

Definition at line 2707 of file uentry.c.

Referenced by doDeclareVar(), exprNode_initMod(), exprNode_iterId(), exprNode_iterNewId(), o_fctInfo(), uentry_makeIdVariable(), uentry_makeUnnamedVariable(), uentry_makeUnrecognized(), and uentry_makeVariableLoc().

02708 {
02709   return (uentry_makeVariableAux (n, t, f, sRef_makeType (t), isPriv, 
02710                                   fileloc_isSpec (f) ? VKSPEC : VKNORMAL));
02711 }

uentry uentry_makeVariableLoc ( cstring n,
ctype t )
 

Definition at line 612 of file uentry.c.

Referenced by declareFunction(), declareStaticFunction(), doVaDcl(), exprNode_iterNewId(), and usymtab_getParam().

00613 {
00614   return uentry_makeVariable (n, t, setLocation (), FALSE);
00615 }

uentry uentry_makeVariableParam ( cstring n,
ctype t )
 

Definition at line 2494 of file uentry.c.

02495 {
02496   return (uentry_makeVariableParamAux (n, t, sRef_makeType (t), SS_DEFINED));
02497 }

uentry uentry_makeVariableSrefParam ( cstring n,
ctype t,
sRef s )
 

Definition at line 1111 of file uentry.c.

Referenced by doVaDcl(), and uentry_makeParam().

01112 {
01113   return (uentry_makeVariableParamAux (n, t, s, SS_UNKNOWN));
01114 }

void uentry_markFree ( uentry u )
 

Definition at line 3919 of file uentry.c.

03920 {
03921   /* should save u */
03922 /*@-mustfree@*/
03923 }

void uentry_markOwned ( uentry u )
 

Definition at line 5847 of file uentry.c.

Referenced by exprNode_iterNewId(), uentry_makeUnrecognized(), and usymtab_getParam().

05848 {
05849   sfreeEventually (u);
05850 }

void uentry_mergeConstantValue ( uentry ue,
multiVal m )
 

Definition at line 7489 of file uentry.c.

Referenced by checkValueConstant(), and exprNode_checkMacroBody().

07490 {
07491   multiVal uval;
07492 
07493   llassert (uentry_isValid (ue));
07494   llassert (uentry_isEitherConstant (ue));
07495 
07496   uval = ue->info->uconst->val;
07497 
07498   if (multiVal_isDefined (uval))
07499     {
07500       if (multiVal_isDefined (m))
07501         {
07502           if (!multiVal_equiv (uval, m))
07503             {
07504               if (optgenerror 
07505                   (FLG_INCONDEFS,
07506                    message ("%s %q defined with inconsistent value: %q",
07507                             ekind_capName (ue->ukind),
07508                             uentry_getName (ue), 
07509                             multiVal_unparse (m)),
07510                    g_currentloc))
07511                 {
07512                   uentry_showWhereLastExtra (ue, multiVal_unparse (uval));
07513                 }
07514             }
07515         }
07516       multiVal_free (m);
07517     }
07518   else
07519     {
07520       ue->info->uconst->val = m;
07521       multiVal_free (uval);
07522     }
07523 }

void uentry_mergeDefinition ( uentry old,
uentry unew )
 

Definition at line 8241 of file uentry.c.

08242 {
08243   fileloc olddef = uentry_whereDeclared (old);
08244   fileloc unewdef = uentry_whereDeclared (unew);
08245   bool mustConform;
08246   bool wasForward;
08247  
08248   if (uentry_isExtern (unew))
08249     {
08250       uentry_setUsed (old, unewdef);
08251     }
08252 
08253   wasForward = 
08254     fileloc_isUndefined (olddef) 
08255       && fileloc_isDefined (uentry_whereDefined (old)) 
08256         && !uentry_isExpandedMacro (old);
08257   
08258   if (!context_getFlag (FLG_INCONDEFSLIB)
08259       && (fileloc_isLib (olddef) || fileloc_isImport (olddef)))
08260     {
08261       mustConform = FALSE;
08262     }
08263   else
08264     {
08265       mustConform = TRUE;
08266     }
08267   
08268   llassert (uentry_isValid (old));
08269   llassert (uentry_isValid (unew));
08270   llassert (cstring_equal (old->uname, unew->uname));
08271 
08272   /*
08273   ** should check old one was extern!
08274   */
08275 
08276   if (uentry_isStatic (old))
08277     {
08278       if (!(uentry_isStatic (unew)))
08279         {
08280           if (optgenerror 
08281               (FLG_SHADOW,
08282                message ("%s %q shadows static declaration",
08283                         ekind_capName (unew->ukind),
08284                         uentry_getName (unew)),
08285                unewdef))
08286             {
08287               uentry_showWhereLast (old);
08288             }
08289         }
08290       else
08291         {
08292           uentry_setDeclDef (old, unewdef);
08293         }
08294     }
08295   else if (uentry_isStatic (unew))
08296     {
08297       uentry_setDeclDef (old, unewdef);
08298     }
08299   else if (uentry_isExtern (old))
08300     {
08301       uentry_setDeclared (old, unewdef);
08302     }
08303   else
08304     {
08305       if (!uentry_isExtern (unew) && !uentry_isForward (old)
08306           && !fileloc_equal (olddef, unewdef)
08307           && !fileloc_isUndefined (olddef)
08308           && !fileloc_isUndefined (unewdef)
08309           && !fileloc_isBuiltin (olddef)
08310           && !fileloc_isBuiltin (unewdef)
08311           && !uentry_isYield (old)
08312           && !(fileloc_isLib (olddef) || fileloc_isImport (olddef)))
08313         {
08314           if (uentry_isVariable (old) || uentry_isVariable (unew))
08315             {
08316               ; /* will report redeclaration error later */
08317             }
08318           else
08319             {
08320               if (fileloc_isDefined (uentry_whereDefined (old)))
08321                 {
08322                   if (optgenerror
08323                       (FLG_REDEF,
08324                        message ("%s %q defined more than once", 
08325                                 ekind_capName (unew->ukind),
08326                                 uentry_getName (unew)),
08327                        uentry_whereLast (unew)))
08328                     {
08329                       llgenindentmsg
08330                         (message ("Previous definition of %q", 
08331                                   uentry_getName (old)),
08332                          uentry_whereLast (old));
08333                     }
08334                   /*
08335                   if (uentry_isDatatype (old) || uentry_isAnyTag (old))
08336                     {
08337                       uentry_copyInto (old, unew);
08338                       old->sref = sRef_saveCopy (old->sref);
08339                     }
08340                     */
08341                 }
08342             }
08343         }
08344       else
08345         {
08346           if (fileloc_isLib (olddef)
08347               || fileloc_isUndefined (olddef)
08348               || fileloc_isImport (olddef))
08349             {
08350               if (uentry_isExtern (unew)) 
08351                 {
08352                   if (uentry_isExtern (old)
08353                       || (fileloc_isDefined (uentry_whereDeclared (old))
08354                           && (!fileloc_equal (uentry_whereDeclared (old),
08355                                               uentry_whereDefined (old)))))
08356                     {
08357                       if (optgenerror
08358                           (FLG_REDECL,
08359                            message ("%s %q declared more than once", 
08360                                     ekind_capName (unew->ukind),
08361                                     uentry_getName (unew)),
08362                            unew->whereDeclared))
08363                         {
08364                           llgenindentmsg
08365                             (message ("Previous declaration of %q", 
08366                                       uentry_getName (old)),
08367                              old->whereDeclared);
08368                         }
08369                     }
08370                   
08371                   uentry_setExtern (old);
08372                 }
08373               else
08374                 {
08375                   uentry_setDefined (old, unewdef);
08376                 }
08377             }
08378         }
08379     }
08380 
08381   uentry_checkConformance (old, unew, mustConform, FALSE);
08382 
08383   old->used = old->used || unew->used;
08384   old->uses = filelocList_append (old->uses, unew->uses);
08385   unew->uses = filelocList_undefined; 
08386 
08387   sRef_storeState (old->sref); 
08388   sRef_storeState (unew->sref);
08389 
08390   if (wasForward)
08391     {
08392       old->whereDefined = fileloc_update (old->whereDefined,
08393                                           fileloc_undefined);
08394     }
08395 
08396   /*
08397   ** No redeclaration errors for functions here, since we
08398   ** don't know if this is the definition of the function.
08399   */
08400 
08401   if (fileloc_isUser (old->whereDeclared)
08402       && fileloc_isUser (unew->whereDeclared)
08403       && !fileloc_equal (old->whereDeclared, unew->whereDeclared)
08404       && !fileloc_isDefined (unew->whereDefined))
08405     {
08406       if (uentry_isFunction (old))
08407         {
08408           /*@-temptrans@*/ posRedeclared = old; /*@=temptrans@*/
08409           posLoc = fileloc_update (posLoc, unew->whereDeclared);
08410         }
08411       else
08412         {
08413           if (optgenerror (FLG_REDECL,
08414                            message ("%s %q declared more than once", 
08415                                     ekind_capName (unew->ukind),
08416                                     uentry_getName (unew)),
08417                            unew->whereDeclared))
08418             {
08419               llgenindentmsg (message ("Previous declaration of %q", 
08420                                        uentry_getName (old)),
08421                               old->whereDeclared);
08422             }
08423         }
08424     }
08425 
08426   if (fileloc_isUndefined (old->whereDefined))
08427     {
08428       old->whereDefined = fileloc_update (old->whereDefined, unew->whereDefined);
08429     }
08430   else
08431     {
08432       if (!context_processingMacros ()
08433           && fileloc_isUser (old->whereDefined) 
08434           && fileloc_isUser (unew->whereDefined)
08435           && !fileloc_equal (old->whereDefined, unew->whereDefined))
08436         {
08437           if (uentry_isVariable (unew) || uentry_isFunction (unew))
08438             {
08439               if (uentry_isVariable (unew) 
08440                   && uentry_isExtern (unew))
08441                 {
08442                   if (optgenerror (FLG_REDECL,
08443                                    message ("%s %q declared after definition", 
08444                                             ekind_capName (unew->ukind),
08445                                             uentry_getName (unew)),
08446                                    unew->whereDeclared))
08447                     {
08448                       llgenindentmsg (message ("Definition of %q", 
08449                                                uentry_getName (old)),
08450                                       old->whereDefined);
08451                     }
08452                 }
08453               else
08454                 {
08455                   if (optgenerror (FLG_REDEF,
08456                                    message ("%s %q redefined", 
08457                                             ekind_capName (unew->ukind),
08458                                             uentry_getName (unew)),
08459                                    unew->whereDefined))
08460                     {
08461                       llgenindentmsg (message ("Previous definition of %q", 
08462                                                uentry_getName (old)),
08463                                       old->whereDefined);
08464                     }
08465                 }
08466             }
08467         }
08468     }
08469 
08470   if (uentry_isExternal (unew))
08471     {
08472       old->whereDefined = fileloc_createExternal ();
08473     }
08474 
08475   if (unew->hasNameError)
08476     {
08477       old->hasNameError = TRUE;
08478     }
08479 
08480   uentry_free (unew);
08481 
08482   if (!old->hasNameError)
08483     {
08484       uentry_checkName (old);
08485     }
08486 
08487   llassert (!ctype_isUndefined (old->utype));
08488 }

void uentry_mergeEntries ( uentry spec,
uentry def )
 

Definition at line 8129 of file uentry.c.

08130 {
08131   llassert (uentry_isValid (spec));
08132   llassert (uentry_isValid (def));
08133   llassert (cstring_equal (spec->uname, def->uname));
08134 
08135   uentry_checkConformance (spec, def, TRUE, 
08136                            context_getFlag (FLG_NEEDSPEC));
08137 
08138   /* was: !(fileloc_isImport (uentry_whereSpecified (spec)))); */
08139 
08140   /*
08141   ** okay, declarations conform.  Propagate extra information.
08142   */
08143 
08144   uentry_setDefined (spec, uentry_whereDefined (def));
08145   uentry_setDeclared (spec, uentry_whereDeclared (def));
08146 
08147   if (uentry_isStatic (def))
08148     {
08149       if (optgenerror 
08150           (FLG_INCONDEFS,
08151            message ("%s %q specified, but declared as static",
08152                     ekind_capName (def->ukind),
08153                     uentry_getName (def)),
08154            uentry_whereDeclared (def)))
08155         {
08156           uentry_showWhereSpecified (spec);
08157         }
08158     }
08159   else 
08160     {
08161       spec->storageclass = def->storageclass;
08162     }
08163 
08164   sRef_storeState (spec->sref);
08165 
08166   spec->used = def->used || spec->used;
08167   spec->hasNameError |= def->hasNameError;
08168 
08169   uentry_free (def);
08170 
08171   if (!spec->hasNameError)
08172     {
08173       uentry_checkName (spec);
08174     }
08175   else
08176     {
08177       ;
08178     }
08179 }

void uentry_mergeState ( uentry res,
uentry other,
fileloc loc,
bool mustReturn,
bool flip,
bool opt,
clause cl )
 

Definition at line 8717 of file uentry.c.

Referenced by usymtab_exitSwitch(), usymtab_newCase(), usymtab_popAndBranch(), usymtab_popBranches(), usymtab_popOrBranch(), and usymtab_quietExitScope().

08720 {
08721   llassert (uentry_isValid (res));
08722   llassert (uentry_isValid (other));
08723 
08724   llassert (res->ukind == other->ukind);
08725   llassert (res->ukind == KVAR);
08726 
08727   DPRINTF (("Merge state: %s / %s", 
08728             uentry_unparse (res),
08729             uentry_unparse (other)));
08730 
08731   if (sRef_isValid (res->sref))
08732     {
08733       if (!mustReturn)
08734         {
08735           if (incompatibleStates (res->sref, other->sref))
08736             {
08737               if (sRef_isThroughArrayFetch (res->sref)
08738                   && !context_getFlag (FLG_STRICTBRANCHSTATE))
08739                 {
08740                   if (sRef_isKept (res->sref) || sRef_isKept (other->sref))
08741                     {
08742                       sRef_maybeKill (res->sref, loc);
08743                     }
08744                   else if (sRef_isPossiblyDead (other->sref))
08745                     {
08746                       sRef_maybeKill (res->sref, loc);
08747                     }
08748                   else
08749                     {
08750                       ;
08751                     }
08752                 }
08753               else
08754                 {
08755                   if (notNull (other->sref, flip))
08756                     {
08757                       if (sRef_isLocalParamVar (res->sref) 
08758                           && (sRef_isLocalState (other->sref) 
08759                               || sRef_isDependent (other->sref)))
08760                         {
08761                           if (sRef_isDependent (res->sref))
08762                             {
08763                               sRef_setDependent (other->sref, loc);
08764                             }
08765                           else
08766                             {
08767                               sRef_setDefState (res->sref, SS_UNUSEABLE, loc);
08768                             }
08769                         }
08770                       else 
08771                         {
08772                           branchStateError (res, other, flip, cl, loc);
08773                         }
08774                     }
08775                 }
08776               
08777               if (sRef_isKept (res->sref))
08778                 {
08779                   sRef_setKept (other->sref, loc);
08780                 }
08781             }
08782           else
08783             {
08784               if (incompatibleStates (other->sref, res->sref))
08785                 {
08786                   if (notNull (res->sref, !flip))
08787                     {
08788                       if (sRef_isLocalParamVar (res->sref) 
08789                           && (sRef_isDependent (res->sref)
08790                               || sRef_isLocalState (res->sref)))
08791                         {
08792                           if (sRef_isDependent (other->sref))
08793                             {
08794                               sRef_setDependent (res->sref, loc);
08795                             }
08796                           else
08797                             {
08798                               sRef_setDefState (res->sref, SS_UNUSEABLE, loc);
08799                             }
08800                         }
08801                       else
08802                         {
08803                           if (sRef_isParam (other->sref))
08804                             {
08805                               /* 
08806                               ** If the local variable associated
08807                               ** with the param has the correct state,
08808                               ** its okay.
08809                               ** (e.g., free (s); s = new(); ...
08810                               */
08811 
08812                               uentry uvar = usymtab_lookupSafe (other->uname);
08813 
08814                               if (uentry_isValid (uvar)
08815                                   && ((sRef_isDead (other->sref) 
08816                                        && sRef_isOnly (uvar->sref))
08817                                       || (sRef_isDependent (other->sref)
08818                                           && sRef_isOwned (uvar->sref))))
08819                                 {
08820                                   /* no error */
08821                                 }
08822                               else
08823                                 {
08824                                   branchStateAltError (res, other,
08825                                                        flip, cl, loc);
08826                                 }
08827                             }
08828                           else
08829                             {
08830                               branchStateAltError (res, other, 
08831                                                    flip, cl, loc);
08832                             }
08833                         }
08834                     }
08835                 }
08836 
08837               if (sRef_isKept (other->sref))
08838                 {
08839                   sRef_setKept (res->sref, loc);
08840                 }
08841             }
08842           
08843           if (opt)
08844             {
08845               DPRINTF (("Merge opt..."));
08846               sRef_mergeOptState (res->sref, other->sref, cl, loc);
08847               DPRINTF (("Done!"));
08848             }
08849           else
08850             {
08851               sRef_mergeState (res->sref, other->sref, cl, loc);
08852             }
08853         }
08854       else
08855         {
08856           if (sRef_isModified (other->sref))
08857             {
08858               sRef_setModified (res->sref);
08859             }
08860         }
08861 
08862       if (cl == DOWHILECLAUSE)
08863         {
08864           res->used = other->used || res->used;
08865           res->lset = other->lset || res->lset;
08866           res->uses = filelocList_append (res->uses, other->uses);
08867           other->uses = filelocList_undefined;
08868         }
08869       else
08870         {
08871           if (sRef_isMacroParamRef (res->sref)
08872               && !uentry_isSefParam (other)
08873               && !uentry_isSefParam (res))
08874             {
08875               bool hasError = FALSE;
08876               
08877               if (bool_equal (res->used, other->used))
08878                 {
08879                   res->used = other->used;
08880                 }
08881               else
08882                 {
08883                   if (other->used && !flip)
08884                     {
08885                       hasError = 
08886                         optgenerror 
08887                           (FLG_MACROPARAMS,
08888                            message ("Macro parameter %q used in true clause, "
08889                                     "but not in false clause",
08890                                     uentry_getName (res)),
08891                            uentry_whereDeclared (res));
08892                     }
08893                   else
08894                     {   
08895                       hasError = 
08896                         optgenerror 
08897                           (FLG_MACROPARAMS,
08898                            message ("Macro parameter %q used in false clause, "
08899                                     "but not in true clause",
08900                                     uentry_getName (res)),
08901                            uentry_whereDeclared (res));
08902                     }
08903                   res->used = TRUE;
08904                   
08905                   if (hasError)
08906                     {
08907                       /* make it sef now, prevent more errors */
08908                       res->info->var->kind = VKREFSEFPARAM;
08909                     }
08910                 }
08911             }
08912           else
08913             {
08914               res->used = other->used || res->used;
08915               res->lset = other->lset || res->lset;
08916               res->uses = filelocList_append (res->uses, other->uses);
08917               other->uses = filelocList_undefined;
08918             }
08919         }
08920     }
08921 }

void uentry_mergeUses ( uentry res,
uentry other )
 

Definition at line 8596 of file uentry.c.

Referenced by usymtab_exitSwitch(), and usymtab_popBranches().

08597 {
08598   llassert (uentry_isValid (res));
08599   llassert (uentry_isValid (other));
08600 
08601   res->used = other->used || res->used;
08602   res->lset = other->lset || res->lset;
08603   res->uses = filelocList_append (res->uses, other->uses);
08604   other->uses = filelocList_undefined;
08605 }

uentry uentry_nameCopy ( cstring name,
uentry e )
 

Definition at line 5600 of file uentry.c.

Referenced by usymtab_load().

05601 {
05602   uentry enew = uentry_alloc ();
05603 
05604   llassert (uentry_isValid (e));
05605 
05606   /* enew->shallowCopy = FALSE; */
05607   enew->ukind = e->ukind;
05608   enew->uname = name;
05609   enew->utype = e->utype;
05610   enew->whereSpecified = fileloc_copy (e->whereSpecified);
05611   enew->whereDefined = fileloc_copy (e->whereDefined);
05612   enew->whereDeclared = fileloc_copy (e->whereDeclared);
05613   enew->sref = sRef_copy (e->sref); 
05614   enew->used = e->used;
05615   enew->lset = FALSE;
05616   enew->isPrivate = e->isPrivate;
05617   enew->hasNameError = FALSE;
05618 
05619   enew->uses = filelocList_new ();
05620 
05621   enew->storageclass = e->storageclass;
05622   enew->info = uinfo_copy (e->info, e->ukind);
05623 
05624   return enew;
05625 }

qual uentry_nullPred ( uentry u )
 

Definition at line 4771 of file uentry.c.

04772 {
04773   llassert (uentry_isRealFunction (u));
04774 
04775   if (uentry_isFunction (u))
04776     {
04777       return (u->info->fcn->nullPred);
04778     }
04779   else
04780     {
04781       return QU_UNKNOWN;
04782     }
04783 }

bool uentry_possiblyNull ( uentry u )
 

Definition at line 4786 of file uentry.c.

04787 {
04788   return ((uentry_isVariable (u) && (nstate_possiblyNull (u->info->var->nullstate)))
04789           || (uentry_isDatatype (u) && (sRef_possiblyNull (u->sref))));
04790 }

cstring uentry_rawName ( uentry e )
 

Definition at line 4952 of file uentry.c.

Referenced by checkModifiesId(), checkSpecClausesId(), context_inFunctionName(), exprNode_checkAllMods(), uentryList_compareFields(), uentryList_matchFields(), uentryList_showFieldDifference(), usymtab_convertId(), usymtab_dump(), and usymtab_popBranches().

04953 {
04954   if (uentry_isValid (e))
04955     {
04956       return (e->uname);
04957     }
04958   else
04959     {
04960       return cstring_undefined;
04961     }
04962 }

void uentry_reflectQualifiers ( uentry ue,
qualList q )
 

Definition at line 1970 of file uentry.c.

Referenced by doDeclareConstant(), doDeclareVar(), processNamedDecl(), uentry_makeIdConstant(), uentry_makeIdDatatype(), uentry_makeIdFunction(), uentry_makeIdVariable(), and uentry_makeParam().

01971 {
01972   llassert (uentry_isValid (ue)); 
01973 
01974   qualList_elements (q, qel)
01975     {
01976       if (qual_isStatic (qel))
01977         {
01978           uentry_setStatic (ue);
01979         }
01980       else if (qual_isUnused (qel))
01981         {
01982           uentry_setUsed (ue, fileloc_undefined);         
01983         }
01984       else if (qual_isExternal (qel))
01985         {
01986           fileloc_free (ue->whereDefined);
01987           ue->whereDefined = fileloc_createExternal ();
01988         }
01989       else if (qual_isSef (qel))
01990         {
01991           if (uentry_isVariable (ue))
01992             {
01993               vkind vk = ue->info->var->kind;
01994 
01995               llassert (vk != VKREFPARAM);
01996 
01997               if (vk == VKYIELDPARAM)
01998                 {
01999                   llerror
02000                     (FLG_SYNTAX,
02001                      message ("Qualifier sef cannot be used with %s: %q",
02002                               cstring_makeLiteralTemp (vk == VKYIELDPARAM ? "yield" : "returned"),
02003                               uentry_unparse (ue)));
02004                 }
02005               else if (vk == VKRETPARAM)
02006                 {
02007                   ue->info->var->kind = VKSEFRETPARAM;
02008                 }
02009               else
02010                 {
02011                   ue->info->var->kind = VKSEFPARAM;
02012                 }
02013             }
02014           else
02015             {
02016               llerror 
02017                 (FLG_SYNTAX,
02018                  message ("Qualifier sef is meaningful only on parameters: %q", 
02019                           uentry_unparse (ue)));
02020             }
02021         }
02022       else if (qual_isExtern (qel))
02023         {
02024           ue->storageclass = SCEXTERN;
02025         }
02026       else if (qual_isGlobalQual (qel)) /* undef, killed */
02027         {
02028           if (uentry_isVariable (ue))
02029             {
02030               sstate oldstate = ue->info->var->defstate;
02031               sstate defstate = sstate_fromQual (qel);
02032 
02033 
02034               if ((oldstate == SS_UNDEFGLOB && defstate == SS_KILLED)
02035                   || (oldstate == SS_KILLED && defstate == SS_UNDEFGLOB))
02036                 {
02037                   defstate = SS_UNDEFKILLED;
02038                 }
02039               else 
02040                 {
02041                   ; /* any errors? */
02042                 }
02043 
02044               sRef_setDefState (ue->sref, defstate, fileloc_undefined);
02045               ue->info->var->defstate = defstate;
02046             }
02047           else
02048             {
02049               llerror 
02050                 (FLG_SYNTAX, 
02051                  message ("Qualifier %s used on non-variable: %q",
02052                           qual_unparse (qel), uentry_unparse (ue)));          
02053             }
02054         }
02055       else if (qual_isAllocQual (qel)) /* out, partial, reldef, special, etc. */
02056         {
02057           ctype realType = ctype_realType (ue->utype);
02058           sstate defstate = sstate_fromQual (qel);
02059 
02060           if (ctype_isFunction (realType))
02061             {
02062               realType = ctype_realType (ctype_returnValue (realType));
02063             }
02064 
02065           if (qual_isRelDef (qel))
02066             {
02067               ; /* okay anywhere */
02068             }
02069           else
02070             {
02071               if (!ctype_isAP (realType) 
02072                   && !ctype_isSU (realType)
02073                   && !ctype_isUnknown (realType)
02074                   && !ctype_isAbstract (ue->utype))
02075                 {
02076                   llerror 
02077                     (FLG_SYNTAX, 
02078                      message ("Qualifier %s used on non-pointer or struct: %q",
02079                               qual_unparse (qel), uentry_unparse (ue)));
02080                 }
02081             }
02082 
02083           uentry_setDefState (ue, defstate);
02084 
02085           if (sRef_isStateSpecial (ue->sref)
02086               && alkind_isImplicit (sRef_getAliasKind (ue->sref)))
02087             {
02088               sRef_setAliasKind (ue->sref, AK_ERROR, fileloc_undefined);
02089             }
02090         }
02091       else if (qual_isYield (qel))
02092         {
02093           if (uentry_isVariable (ue))
02094             {
02095               ue->info->var->kind = VKYIELDPARAM;
02096             }
02097           else
02098             {
02099               llerror 
02100                 (FLG_SYNTAX, 
02101                  message ("Qualifier %s used on non-iterator parameter: %q",
02102                           qual_unparse (qel), uentry_unparse (ue)));          
02103             }
02104         }
02105       else if (qual_isExQual (qel))
02106         {
02107           exkind ek = exkind_fromQual (qel);
02108           ctype ut = uentry_getType (ue);
02109 
02110           if (ctype_isFunction (ut))
02111             {
02112               ut = ctype_returnValue (ut);
02113             }
02114           
02115           if (!(ctype_isVisiblySharable (ut))
02116               && !(ctype_isArray (ut)) /* can apply to arrays also! */
02117               && !(ctype_isStruct (ctype_realType (ut)))) /* applies to structure fields! */
02118             {
02119               if (!qual_isImplied (qel))
02120                 {
02121                   llerror 
02122                     (FLG_SYNTAX, 
02123                      message ("Qualifier %s used on unsharable storage type %t: %q",
02124                               exkind_unparse (ek), ut, uentry_getName (ue)));
02125                 }
02126             }
02127           else
02128             {
02129               alkind ak = sRef_getAliasKind (ue->sref);
02130 
02131               sRef_setExKind (ue->sref, ek, uentry_whereDeclared (ue));
02132 
02133               if (alkind_isUnknown (ak) || alkind_isImplicit (ak) || alkind_isStatic (ak))
02134                 {
02135                   if (!alkind_isTemp (ak))
02136                     {
02137                       uentry_setAliasKind (ue, AK_IMPDEPENDENT);
02138                     }
02139                 }
02140               else if (alkind_isDependent (ak) || alkind_isTemp (ak)
02141                        || alkind_isOwned (ak))
02142                 {
02143                   ; /* okay */
02144                 }
02145               else
02146                 {
02147                   llerror 
02148                     (FLG_SYNTAX, 
02149                      message ("Exposure qualifier %s used on %s storage (should "
02150                               "be dependent): %q",
02151                               qual_unparse (qel), 
02152                               alkind_unparse (ak),
02153                               uentry_unparse (ue)));
02154                 }
02155             }
02156         }
02157       else if (qual_isGlobCheck (qel))
02158         {
02159           if (uentry_isVariable (ue))
02160             {
02161               chkind ch = chkind_fromQual (qel);                
02162                        
02163               if (ue->info->var->checked != CH_UNKNOWN)
02164                 {
02165                   if (ch == ue->info->var->checked)
02166                     {
02167                       llerror (FLG_SYNTAX, 
02168                                message ("Redundant %s qualifier on %q",
02169                                         qual_unparse (qel),
02170                                         uentry_getName (ue)));
02171                     }
02172                   else
02173                     {
02174                       llerror (FLG_SYNTAX, 
02175                                message
02176                                ("Contradictory %s and %s qualifiers on %q",
02177                                 qual_unparse (qel),
02178                                 checkedName (ue->info->var->checked),
02179                                 uentry_getName (ue)));
02180                     }
02181                 }
02182 
02183               ue->info->var->checked = ch;
02184             }
02185           else
02186             {
02187               llerror
02188                 (FLG_SYNTAX, 
02189                  message ("Qualifier %s used with non-variable", 
02190                           qual_unparse (qel)));
02191             }
02192         }
02193       else if (qual_isReturned (qel))
02194         {
02195           if (uentry_isVariable (ue))
02196             {
02197               ue->info->var->kind = VKRETPARAM;
02198             }
02199           else
02200             {
02201               llerror (FLG_SYNTAX, message ("Qualifier %s used with non-variable", 
02202                                             qual_unparse (qel)));
02203             }
02204         }
02205       else
02206         {
02207           uentry_reflectOtherQualifier (ue, qel);
02208         }
02209 
02210       sRef_storeState (ue->sref);
02211     } end_qualList_elements;
02212 
02213   qualList_clear (q);
02214 }

void uentry_resetParams ( uentry ue,
uentryList pn )
 

Definition at line 5341 of file uentry.c.

05342 {
05343   ctype rct;
05344   ctype rettype = ctype_unknown;
05345   
05346   llassert (uentry_isValid (ue));
05347 
05348   rct = ctype_realType (ue->utype);
05349 
05350   if (uentry_isVariable (ue) && (ctype_isFunction (rct) || ctype_isUnknown (rct)))
05351     {
05352       uentry_makeVarFunction (ue);
05353     }
05354 
05355   llassert (uentry_isFunction (ue));
05356 
05357   if (ctype_isFunction (rct))
05358     {
05359       rettype = ctype_returnValue (rct);
05360     }
05361 
05362   ue->utype = ctype_makeNFParamsFunction (rettype, pn);      
05363 }

sRef uentry_returnedRef ( uentry u,
exprNodeList args )
 

Definition at line 9022 of file uentry.c.

09023 {
09024   llassert (uentry_isRealFunction (u));
09025 
09026   if (ctype_isFunction (u->utype)
09027       && sRef_isStateSpecial (uentry_getSref (u)))
09028     {
09029       specialClauses clauses = uentry_getSpecialClauses (u);
09030       sRef res = sRef_makeNew (ctype_returnValue (u->utype), u->sref, u->uname);
09031 
09032       sRef_setAllocated (res, g_currentloc);
09033 
09034       specialClauses_postElements (clauses, cl)
09035         {
09036           sRefSet refs = specialClause_getRefs (cl);
09037           sRefMod modf = specialClause_getEffectFunction (cl);
09038 
09039           sRefSet_elements (refs, el)
09040             {
09041               sRef base = sRef_getRootBase (el);
09042 
09043               if (sRef_isResult (base))
09044                 {
09045                   if (modf != NULL)
09046                     {
09047                       sRef sr = sRef_fixBase (el, res);
09048                       modf (sr, g_currentloc);
09049                     }
09050                 }
09051               else
09052                 {
09053                   ;
09054                 }
09055             } end_sRefSet_elements ;
09056 
09057         } end_specialClauses_postElements ;
09058 
09059       return res;
09060     }
09061   else
09062     {
09063       uentryList params;
09064       alkind ak;
09065       sRefSet prefs = sRefSet_new ();
09066       sRef res = sRef_undefined;
09067       int paramno = 0;
09068       
09069       params = uentry_getParams (u);
09070       
09071       uentryList_elements (params, current)
09072         {
09073           if (uentry_isReturned (current))
09074             {
09075               if (exprNodeList_size (args) >= paramno)
09076                 {
09077                   exprNode ecur = exprNodeList_nth (args, paramno);
09078                   sRef tref = exprNode_getSref (ecur);
09079                   
09080                   if (sRef_isValid (tref))
09081                     {
09082                       sRef tcref = sRef_copy (tref);
09083                       
09084                       if (sRef_isDead (tcref))
09085                         {
09086                           sRef_setDefined (tcref, g_currentloc);
09087                           sRef_setOnly (tcref, g_currentloc);
09088                         }
09089                       
09090                       if (sRef_isRefCounted (tcref))
09091                         {
09092                           /* could be a new ref now (but only if its returned) */
09093                           sRef_setAliasKindComplete (tcref, AK_ERROR, g_currentloc);
09094                         }
09095                       
09096                       sRef_makeSafe (tcref);
09097                       
09098                       prefs = sRefSet_insert (prefs, tcref);
09099                     }
09100                 }
09101             }
09102           
09103           paramno++;
09104         } end_uentryList_elements ;
09105       
09106       if (sRefSet_size (prefs) > 0)
09107         {
09108           nstate n = sRef_getNullState (u->sref);
09109           
09110           if (sRefSet_size (prefs) == 1)
09111             {
09112               res = sRefSet_choose (prefs);
09113             }
09114           else
09115             {
09116               res = sRefSet_mergeIntoOne (prefs);
09117             }
09118           
09119           if (nstate_isKnown (n))
09120             {
09121               sRef_setNullState (res, n, g_currentloc);
09122             }
09123         }
09124       else
09125         {
09126           if (ctype_isFunction (u->utype))
09127             {
09128               res = sRef_makeNew (ctype_returnValue (u->utype), u->sref, u->uname);
09129             }
09130           else
09131             {
09132               res = sRef_makeNew (ctype_unknown, u->sref, u->uname);
09133             }
09134           
09135           if (sRef_isRefCounted (res))
09136             {
09137               sRef_setAliasKind (res, AK_NEWREF, g_currentloc);
09138             }
09139         }
09140       
09141       if (sRef_getNullState (res) == NS_ABSNULL)
09142         {
09143           ctype ct = ctype_realType (u->utype);
09144           
09145           if (ctype_isAbstract (ct))
09146             {
09147               sRef_setNotNull (res, g_currentloc);
09148             }
09149           else
09150             {
09151               if (ctype_isUser (ct))
09152                 {
09153                   sRef_setStateFromUentry (res, usymtab_getTypeEntry (ctype_typeId (ct)));
09154                 }
09155               else
09156                 {
09157                   sRef_setNotNull (res, g_currentloc);
09158                 }
09159             }
09160         }
09161       
09162       if (sRef_isRefCounted (res))
09163         {
09164           sRef_setAliasKind (res, AK_NEWREF, g_currentloc);
09165         }
09166       else if (sRef_isKillRef (res))
09167         {
09168           sRef_setAliasKind (res, AK_REFCOUNTED, g_currentloc);
09169         }
09170       else
09171         {
09172           ;
09173         }
09174       
09175       ak = sRef_getAliasKind (res);
09176       
09177       if (alkind_isImplicit (ak))
09178         {
09179           sRef_setAliasKind (res, 
09180                              alkind_fixImplicit (ak),
09181                              g_currentloc);
09182         }
09183       
09184       sRefSet_free (prefs);
09185       
09186       return res;
09187     }
09188 }

bool uentry_sameKind ( uentry u1,
uentry u2 )
 

Definition at line 8507 of file uentry.c.

08508 {
08509   if (uentry_isValid (u1) && uentry_isValid (u2))
08510     {
08511       if (uentry_isVar (u1) && uentry_isVar (u2))
08512         {
08513           ctype c1 = u1->utype;
08514           ctype c2 = u2->utype;
08515 
08516           if (ctype_isUnknown (c1) || ctype_isUnknown (c2)) return FALSE;
08517 
08518           /*
08519           ** both functions, or both not functions
08520           */
08521 
08522           return (bool_equal (ctype_isFunction (c1), ctype_isFunction (c2)));
08523         }
08524       else
08525         {
08526           return ((u1->ukind == u2->ukind));
08527         }
08528     }
08529   
08530   return FALSE;
08531 }

void uentry_setAbstract ( uentry e )
 

Definition at line 4629 of file uentry.c.

Referenced by processNamedDecl().

04630 {
04631   typeId oldid;
04632 
04633   llassert (uentry_isDatatype (e) 
04634             && (ynm_isMaybe (e->info->datatype->abs)));
04635 
04636   oldid = ctype_typeId (e->info->datatype->type);
04637   e->info->datatype->abs = YES;
04638   e->info->datatype->type = ctype_createAbstract (oldid);
04639 }

void uentry_setCheckMod ( uentry ue )
 

Definition at line 2628 of file uentry.c.

Referenced by doDeclareVar(), and processNamedDecl().

02629 {
02630   llassert (uentry_isVar (ue));
02631 
02632   ue->info->var->checked = CH_CHECKMOD;
02633 }

void uentry_setChecked ( uentry ue )
 

Definition at line 2621 of file uentry.c.

Referenced by doDeclareVar(), and processNamedDecl().

02622 {
02623   llassert (uentry_isVar (ue));
02624 
02625   ue->info->var->checked = CH_CHECKED;
02626 }

void uentry_setCheckedStrict ( uentry ue )
 

Definition at line 2635 of file uentry.c.

Referenced by doDeclareVar(), and processNamedDecl().

02636 {
02637   llassert (uentry_isVar (ue));
02638   
02639   ue->info->var->checked = CH_CHECKEDSTRICT;
02640 }

void uentry_setConcrete ( uentry e )
 

Definition at line 4642 of file uentry.c.

Referenced by processNamedDecl().

04643 {
04644   llassert (uentry_isDatatype (e) 
04645             && (ynm_isMaybe (e->info->datatype->abs)));
04646 
04647   e->info->datatype->abs = NO;
04648 }

void uentry_setDatatype ( uentry e,
usymId uid )
 

Definition at line 5628 of file uentry.c.

Referenced by usymtab_supAbstractTypeEntry(), usymtab_supExposedTypeEntry(), and usymtab_supForwardTypeEntry().

05629 {
05630   llassert (uentry_isDatatype (e));
05631 
05632   if (uentry_isAbstractType (e))
05633     {
05634       e->info->datatype->type = ctype_createAbstract (uid);
05635     }
05636   else
05637     {
05638       e->info->datatype->type = ctype_createUser (uid);
05639     }
05640 }

void uentry_setDeclared ( uentry e,
fileloc f )
 

Definition at line 5190 of file uentry.c.

Referenced by uentry_mergeDefinition(), and uentry_mergeEntries().

05191 {
05192   fileloc oldloc;
05193 
05194   llassert (uentry_isValid (e));
05195   oldloc = e->whereDeclared;  
05196 
05197   if (fileloc_isDefined (oldloc))
05198     {
05199       if (fileloc_isLib (oldloc) || fileloc_isImport (oldloc))
05200         {
05201           e->whereDeclared = fileloc_update (e->whereDeclared, f);
05202         }
05203       else
05204         {
05205           ;
05206         }
05207     }
05208   else
05209     {
05210       e->whereDeclared = fileloc_update (e->whereDeclared, f);
05211     }
05212 }

void uentry_setDeclaredForce ( uentry e,
fileloc f )
 

Definition at line 5148 of file uentry.c.

05149 {
05150   llassert (uentry_isValid (e));
05151   e->whereDeclared = fileloc_update (e->whereDeclared, f);
05152 }

void uentry_setDeclaredForceOnly ( uentry e,
fileloc f )
 

Definition at line 5155 of file uentry.c.

05156 {
05157   llassert (uentry_isValid (e));
05158   fileloc_free (e->whereDeclared);
05159   e->whereDeclared = f;
05160 }

void uentry_setDeclaredOnly ( uentry e,
fileloc f )
 

Definition at line 5163 of file uentry.c.

Referenced by processNamedDecl().

05164 {
05165   fileloc oldloc;
05166 
05167   llassert (uentry_isValid (e));
05168   oldloc = e->whereDeclared;  
05169 
05170   if (fileloc_isDefined (oldloc))
05171     {
05172       if (fileloc_isLib (oldloc) || fileloc_isImport (oldloc))
05173         {
05174           e->whereDeclared = f;
05175           fileloc_free (oldloc);
05176         }
05177       else
05178         {
05179           fileloc_free (f);
05180         }
05181     }
05182   else
05183     {
05184       e->whereDeclared = f;
05185       fileloc_free (oldloc);
05186     }
05187 }

void uentry_setDefState ( uentry ue,
sstate defstate )
 

Definition at line 2563 of file uentry.c.

Referenced by uentry_reflectQualifiers().

02564 {
02565   if (uentry_isValid (ue))
02566     {
02567       sRef_setDefState (ue->sref, defstate, fileloc_undefined);
02568 
02569       if (uentry_isVariable (ue))
02570         {
02571           ue->info->var->defstate = defstate; /* evs 2000-05-17: fixed bug, was SS_DEFINED! */
02572         }
02573     }
02574 }

void uentry_setDefined ( uentry e,
fileloc f )
 

Definition at line 5224 of file uentry.c.

Referenced by doDeclareConstant(), doDeclareVar(), exprNode_checkMacroBody(), processNamedDecl(), uentry_makeDatatypeAux(), uentry_makeEnumConstant(), uentry_makeEnumInitializedConstant(), uentry_makeExpandedMacro(), uentry_makeIdVariable(), uentry_makeUnrecognized(), uentry_mergeDefinition(), and uentry_mergeEntries().

05225 {
05226   fileloc oldloc;
05227 
05228   llassert (uentry_isValid (e));
05229   oldloc = e->whereDefined;
05230 
05231   if (fileloc_isDefined (oldloc))
05232     {
05233       if (fileloc_isLib (oldloc) 
05234           || fileloc_isImport (oldloc)
05235           || fileloc_isBuiltin (oldloc) 
05236           || fileloc_isPreproc (oldloc))
05237         {
05238           e->whereDefined = fileloc_update (e->whereDefined, f);
05239         }
05240       else
05241         {
05242           if (fileloc_equal (oldloc, f) || context_processingMacros ())
05243             {
05244               ; /* okay */
05245             }
05246           else
05247             {
05248               if (optgenerror (FLG_REDEF,
05249                                message ("%s %q redefined", 
05250                                         ekind_capName (e->ukind),
05251                                         uentry_getName (e)),
05252                                f))
05253                 {
05254                   llgenindentmsg (message ("Previous definition of %q", 
05255                                            uentry_getName (e)),
05256                                   e->whereDefined);
05257                 }
05258             }
05259         }
05260     }
05261   else
05262     {
05263       e->whereDefined = fileloc_update (e->whereDefined, f);
05264     }
05265 }

void uentry_setExtern ( uentry c )
 

Definition at line 1058 of file uentry.c.

Referenced by uentry_mergeDefinition().

01059 {
01060   if (uentry_isValid (c)) 
01061     c->storageclass = SCEXTERN;
01062 }

void uentry_setFunctionDefined ( uentry e,
fileloc loc )
 

Definition at line 5117 of file uentry.c.

Referenced by context_setFunctionDefined().

05118 {
05119   if (uentry_isValid (e))
05120     {
05121       llassert (uentry_isFunction (e));
05122 
05123       if (fileloc_isUndefined (e->whereDeclared))
05124         {
05125           e->whereDeclared = fileloc_update (e->whereDeclared, loc);
05126         }
05127       
05128       if (!fileloc_isDefined (e->whereDefined))
05129         {
05130           e->whereDefined = fileloc_update (e->whereDefined, loc);
05131         }
05132     }
05133 }

void uentry_setGlobals ( uentry ue,
globSet globs )
 

Definition at line 2818 of file uentry.c.

02819 {
02820   llassert (uentry_isValid (ue));
02821 
02822   if (uentry_isIter (ue))
02823     {
02824       llassert (globSet_isUndefined (ue->info->iter->globs));
02825       ue->info->iter->globs = globs;
02826     }
02827   else
02828     {
02829       if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
02830         {
02831           uentry_makeVarFunction (ue);
02832         }
02833       
02834       llassert (uentry_isFunction (ue));
02835       llassert (!ue->info->fcn->hasGlobs 
02836                 && globSet_isUndefined (ue->info->fcn->globs));
02837       
02838       ue->info->fcn->hasGlobs = TRUE;
02839       /*@-mustfree@*/ ue->info->fcn->globs = globs;
02840       /*@=mustfree@*/
02841     }
02842 
02843   if (globSet_hasStatic (globs))
02844     {
02845       context_recordFileGlobals (globs);
02846     }
02847 
02848   if (context_getFlag (FLG_GLOBALSIMPMODIFIESNOTHING))
02849     {
02850       ue->info->fcn->hasMods = TRUE;
02851     }
02852 }

void uentry_setHasNameError ( uentry ue )
 

Definition at line 9283 of file uentry.c.

Referenced by checkParamNames(), checkPrefix(), exprNode_initMod(), exprNode_iterId(), exprNode_iterNewId(), uentry_checkName(), uentry_makeUnrecognized(), and usymtab_checkDistinctName().

09284 {
09285   llassert (uentry_isValid (ue));
09286 
09287   ue->hasNameError = TRUE;
09288 }

void uentry_setMessageLike ( uentry ue )
 

Definition at line 2411 of file uentry.c.

02412 {
02413   if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
02414     {
02415       uentry_makeVarFunction (ue);
02416     }
02417   
02418   llassertfatal (uentry_isFunction (ue));
02419   ue->info->fcn->specialCode = SPC_MESSAGELIKE;
02420   checkSpecialFunction (ue);
02421 }

void uentry_setModifies ( uentry ue,
sRefSet sr )
 

Definition at line 1165 of file uentry.c.

01166 {
01167   if (sRef_modInFunction ())
01168     {
01169       llparseerror
01170         (message ("Modifies list not in function context.  "
01171                   "A modifies list can only appear following the parameter list "
01172                   "in a function declaration or header."));
01173 
01174       /*@-mustfree@*/ return; /*@=mustfree@*/ 
01175     }
01176 
01177   if (sRefSet_hasStatic (sr))
01178     {
01179       context_recordFileModifies (sr);
01180     }
01181 
01182   if (uentry_isValid (ue))
01183     {
01184       if (uentry_isIter (ue))
01185         {
01186           llassert (sRefSet_isUndefined (ue->info->iter->mods));
01187           ue->info->iter->mods = sr;
01188         }
01189       else
01190         {
01191           if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
01192             {
01193               uentry_makeVarFunction (ue);
01194             }
01195           
01196           llassertfatal (uentry_isFunction (ue));
01197           llassert (sRefSet_isUndefined (ue->info->fcn->mods));
01198           
01199           ue->info->fcn->mods = sr;
01200           ue->info->fcn->hasMods = TRUE;
01201           
01202           checkGlobalsModifies (ue, sr);
01203         }
01204       
01205       if (context_getFlag (FLG_MODIFIESIMPNOGLOBALS))
01206         {
01207           ue->info->fcn->hasGlobs = TRUE;
01208         }
01209     }
01210   else
01211     {
01212       sRefSet_free (sr);
01213     }
01214 }

void uentry_setMutable ( uentry e )
 

Definition at line 1549 of file uentry.c.

01550 {
01551   llassert (uentry_isDatatype (e));
01552   e->info->datatype->mut = YES;
01553 }

void uentry_setName ( uentry e,
cstring n )
 

Definition at line 5322 of file uentry.c.

Referenced by uentryList_fixMissingNames().

05323 {
05324   llassert (uentry_isValid (e));
05325 
05326   cstring_free (e->uname);
05327   e->uname = n;
05328 }

void uentry_setParam ( uentry e )
 

Definition at line 5395 of file uentry.c.

Referenced by handleParamIdList().

05396 {
05397   if (!uentry_isVar (e))
05398     {
05399       if (uentry_isElipsisMarker (e))
05400         {
05401 
05402         }
05403       else
05404         {
05405           llbug (message ("uentry_setParam: not variable: %q", uentry_unparse (e)));
05406         }
05407     }
05408   else
05409     {
05410       cstring oldname;
05411 
05412       if (e->info->var->kind == VKYIELDPARAM 
05413           || e->info->var->kind == VKSEFPARAM
05414           || e->info->var->kind == VKSEFRETPARAM)
05415         {
05416           ;
05417         }
05418       else
05419         {
05420           e->info->var->kind = VKPARAM;
05421         }
05422 
05423       oldname = e->uname;
05424       e->uname = makeParam (e->uname);
05425       cstring_free (oldname);
05426     }
05427 }

void uentry_setParamNo ( uentry ue,
int pno )
 

Definition at line 1065 of file uentry.c.

01066 {
01067   llassert (uentry_isAnyParam (ue) && sRef_isParam (ue->sref));
01068   sRef_setParamNo (ue->sref, pno);
01069 }

void uentry_setPrintfLike ( uentry ue )
 

Definition at line 2385 of file uentry.c.

02386 {
02387   if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
02388     {
02389       uentry_makeVarFunction (ue);
02390     }
02391   
02392   llassertfatal (uentry_isFunction (ue));
02393   ue->info->fcn->specialCode = SPC_PRINTFLIKE;
02394   checkSpecialFunction (ue);
02395 }

void uentry_setRefCounted ( uentry e )
 

Definition at line 999 of file uentry.c.

01000 {
01001   if (uentry_isValid (e))
01002     {
01003       uentry_setAliasKind (e, AK_REFCOUNTED);
01004       sRef_storeState (e->sref);
01005     }
01006 }

void uentry_setRefParam ( uentry e )
 

Definition at line 5366 of file uentry.c.

05367 {
05368   
05369   if (!uentry_isVar (e))
05370     {
05371       llbug (message ("uentry_setParam: not variable: %q", uentry_unparse (e)));
05372     }
05373   else
05374     {
05375       if (e->info->var->kind == VKSEFPARAM)
05376         {
05377           e->info->var->kind = VKREFSEFPARAM;
05378         }
05379       else if (e->info->var->kind == VKSEFRETPARAM)
05380         {
05381           e->info->var->kind = VKREFSEFRETPARAM;
05382         }
05383       else if (e->info->var->kind == VKYIELDPARAM)
05384         {
05385           e->info->var->kind = VKREFYIELDPARAM;
05386         }
05387       else
05388         {
05389           e->info->var->kind = VKREFPARAM;
05390         }
05391     }
05392 }

void uentry_setScanfLike ( uentry ue )
 

Definition at line 2398 of file uentry.c.

02399 {
02400   if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
02401     {
02402       uentry_makeVarFunction (ue);
02403     }
02404   
02405   llassertfatal (uentry_isFunction (ue));
02406   ue->info->fcn->specialCode = SPC_SCANFLIKE;
02407   checkSpecialFunction (ue);
02408 }

void uentry_setSpecialClauses ( uentry ue,
specialClauses clauses )
 

Definition at line 1141 of file uentry.c.

01142 {
01143   llassert (uentry_isFunction (ue));
01144   llassert (!specialClauses_isDefined (ue->info->fcn->specclauses));
01145 
01146   ue->info->fcn->specclauses = clauses;
01147   specialClauses_checkAll (ue);
01148 }

void uentry_setSref ( uentry e,
sRef s )
 

Definition at line 5430 of file uentry.c.

Referenced by handleParamIdList().

05431 {
05432   if (uentry_isValid (e))
05433     {
05434       if (sRef_isValid (e->sref))
05435         {
05436           sRef_mergeStateQuietReverse (e->sref, s);
05437         }
05438       else
05439         {
05440           e->sref = sRef_saveCopy (s);
05441         }
05442     }
05443 }

void uentry_setState ( uentry res,
uentry other )
 

Definition at line 8579 of file uentry.c.

Referenced by usymtab_exitSwitch(), and usymtab_popBranches().

08580 {
08581   llassert (uentry_isValid (res));
08582   llassert (uentry_isValid (other));
08583 
08584   llassert (res->ukind == other->ukind);
08585   llassert (res->ukind == KVAR);
08586 
08587   res->sref = sRef_saveCopy (other->sref);
08588   res->used = other->used;
08589   filelocList_free (res->uses); 
08590   res->uses = other->uses; 
08591   other->uses = filelocList_undefined; 
08592   res->lset = other->lset;
08593 }

void uentry_setStatic ( uentry c )
 

Definition at line 1010 of file uentry.c.

Referenced by declareStaticFunction(), and uentry_reflectQualifiers().

01011 {
01012   if (uentry_isValid (c)) 
01013     {
01014       alkind ak = sRef_getAliasKind (c->sref);
01015       c->storageclass = SCSTATIC;
01016 
01017       if (uentry_isVariable (c) && !ctype_isFunction (uentry_getType (c)))
01018         {
01019           if (!alkind_isUnknown (ak)
01020               && !alkind_isStatic (ak))
01021             {
01022               if  (!(ctype_isRealPointer (uentry_getType (c)))
01023                    && !(ctype_isAbstract (ctype_realType (uentry_getType (c))))
01024                    && !alkind_isRefCounted (ak))
01025                 {
01026                   if (alkind_isImplicit (ak)
01027                       && alkind_isDependent (ak)
01028                       && ctype_isArray (uentry_getType (c)))
01029                     {
01030                       ; /* no error for observer arrays */
01031                     }
01032                   else
01033                     {
01034                       voptgenerror 
01035                         (FLG_INCONDEFS,
01036                          message ("Static storage %q declared as %s",
01037                                   uentry_getName (c),
01038                                   alkind_unparse (ak)),
01039                          uentry_whereDeclared (c));
01040                     }
01041                 }
01042             }
01043           else
01044             {
01045               if (alkind_isUnknown (ak)
01046                   || (alkind_isImplicit (sRef_getAliasKind (c->sref))
01047                       && !alkind_isDependent (sRef_getAliasKind (c->sref))))
01048                 {
01049                   sRef_setAliasKind (c->sref, AK_STATIC, fileloc_undefined);
01050                   sRef_setOrigAliasKind (c->sref, AK_STATIC);
01051                 }
01052             }
01053         }
01054     }
01055 }

void uentry_setType ( uentry e,
ctype t )
 

Definition at line 5331 of file uentry.c.

Referenced by checkDoneParams(), doneParams(), processNamedDecl(), and uentryList_fixMissingNames().

05332 {
05333   if (uentry_isValid (e)) 
05334     {
05335       e->utype = t;
05336       sRef_setType (e->sref, t);
05337     }
05338 }

void uentry_setUnchecked ( uentry ue )
 

Definition at line 2614 of file uentry.c.

Referenced by processNamedDecl().

02615 {
02616   llassert (uentry_isVar (ue));
02617 
02618   ue->info->var->checked = CH_UNCHECKED;
02619 }

void uentry_setUsed ( uentry e,
fileloc loc )
 

Definition at line 8923 of file uentry.c.

Referenced by doVaDcl(), exprNode_arrowAccess(), exprNode_fieldAccess(), exprNode_iter(), exprNode_iterId(), exprNode_iterNewId(), exprNode_makeInitialization(), main(), uentry_checkYieldParam(), uentry_makeUnrecognized(), uentry_mergeDefinition(), uentry_reflectQualifiers(), and usymtab_allUsed().

08924 {
08925   static bool firstTime = TRUE;
08926   static bool showUses = FALSE;
08927   static bool exportLocal = FALSE;
08928 
08929   if (firstTime)
08930     {
08931       /* need to track uses is FLG_SHOWUSES or FLG_EXPORTLOCAL is true */
08932 
08933       showUses = context_getFlag (FLG_SHOWUSES); 
08934       exportLocal = context_maybeSet (FLG_EXPORTLOCAL);
08935 
08936       firstTime = FALSE;
08937     }
08938 
08939   if (uentry_isValid (e))
08940     {
08941       int dp;
08942       
08943       if (sRef_isMacroParamRef (e->sref))
08944         {
08945           if (uentry_isYield (e) || uentry_isSefParam (e))
08946             {
08947               ;
08948             }
08949           else 
08950             {
08951               if (context_inConditional ())
08952                 {
08953                   if (optgenerror
08954                       (FLG_MACROPARAMS,
08955                        message ("Macro parameter %q used in conditionally "
08956                                 "executed code (may or may not be "
08957                                 "evaluated exactly once)", 
08958                                 uentry_getName (e)),
08959                        loc))
08960                     {
08961                       e->info->var->kind = VKREFSEFPARAM;
08962                     }
08963                 }
08964               else
08965                 {
08966                   if ((e)->used)
08967                     {
08968                       if (optgenerror
08969                           (FLG_MACROPARAMS,
08970                            message ("Macro parameter %q used more than once", 
08971                                     uentry_getName (e)),
08972                            uentry_whereDeclared (e)))
08973                         {
08974                           e->info->var->kind = VKREFSEFPARAM;
08975                         }
08976                     }
08977                 }
08978             }
08979         }
08980       
08981       if ((dp = uentry_directParamNo (e)) >= 0)
08982         {
08983           uentry_setUsed (usymtab_getParam (dp), loc);
08984         }
08985       
08986       e->used = TRUE;
08987       
08988       if (!sRef_isLocalVar (e->sref))
08989         {
08990           if (showUses)
08991             {
08992               e->uses = filelocList_add (e->uses, fileloc_copy (loc));
08993             }
08994           else 
08995             {
08996               if (exportLocal)
08997                 {
08998                   if (context_inMacro ())
08999                     {
09000                       e->uses = filelocList_addUndefined (e->uses);
09001                     }
09002                   else 
09003                     {
09004                       e->uses = filelocList_addDifferentFile
09005                         (e->uses, 
09006                          uentry_whereDeclared (e),
09007                          loc);
09008                     }
09009                 }
09010             }
09011         }
09012     }
09013 }

void uentry_showDefSpecInfo ( uentry ce,
fileloc fwhere )
 

Definition at line 6012 of file uentry.c.

Referenced by usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

06013 {
06014   fileloc loc = uentry_whereDefined (ce);
06015   
06016   if (fileloc_isUser (loc) && !fileloc_equal (loc, fwhere))
06017     {
06018       llgenindentmsg (message ("Definition of %q", uentry_getName (ce)),
06019                       loc);
06020     }
06021 
06022   loc = uentry_whereSpecified (ce);
06023   
06024   if (fileloc_isUser (loc) && !fileloc_equal (loc, fwhere))
06025     {
06026       llgenindentmsg (message ("Specification of %q", uentry_getName (ce)),
06027                       loc);
06028     }
06029 }

void uentry_showWhereAny ( uentry spec )
 

Definition at line 6086 of file uentry.c.

06087 {
06088   if (uentry_isDeclared (spec))
06089     {
06090       if (uentry_hasName (spec))
06091         {
06092           llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)),
06093                           uentry_whereDeclared (spec));
06094         }
06095       else
06096         {
06097           llgenindentmsg (cstring_makeLiteral ("Declaration"), uentry_whereDeclared (spec));
06098         }
06099     }
06100   else if (uentry_isSpecified (spec))
06101     {
06102       if (uentry_hasName (spec))
06103         {
06104           llgenindentmsg (message ("Specification of %q",
06105                                    uentry_getName (spec)),
06106                           uentry_whereSpecified (spec));
06107         }
06108       else
06109         {
06110           llgenindentmsg (cstring_makeLiteral ("Specification"), 
06111                           uentry_whereSpecified (spec));
06112         }
06113     }
06114   else if (fileloc_isDefined (uentry_whereDefined (spec))) 
06115     {
06116       if (uentry_hasName (spec))
06117         {
06118           llgenindentmsg (message ("Definition of %q", uentry_getName (spec)),
06119                           uentry_whereDefined (spec));
06120         }
06121       else
06122         {
06123           llgenindentmsg (cstring_makeLiteral ("Definition"), uentry_whereDefined (spec));
06124         }
06125     }
06126   else
06127     {
06128       /* nothing to show */
06129     }
06130 }

void uentry_showWhereDeclared ( uentry spec )
 

Definition at line 6052 of file uentry.c.

Referenced by checkModifiesId(), checkSpecClausesId(), and exprNode_iterId().

06053 {
06054   if (uentry_isDeclared (spec))
06055     {
06056       if (uentry_hasName (spec))
06057         {
06058           llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)),
06059                           uentry_whereDeclared (spec));
06060         }
06061       else
06062         {
06063           llgenindentmsg (cstring_makeLiteral ("Declaration"), uentry_whereDeclared (spec));
06064         }
06065     }
06066   else if (uentry_isSpecified (spec))
06067     {
06068       if (uentry_hasName (spec))
06069         {
06070           llgenindentmsg (message ("Specification of %q", uentry_getName (spec)),
06071                           uentry_whereSpecified (spec));
06072         }
06073       else
06074         {
06075           llgenindentmsg (cstring_makeLiteral ("Specification"), uentry_whereSpecified (spec));
06076         }
06077     }
06078   else
06079     {
06080       /* nothing to show */
06081     }
06082     
06083 }

void uentry_showWhereDefined ( uentry spec )
 

Definition at line 6133 of file uentry.c.

06134 {
06135   if (uentry_isCodeDefined (spec))
06136     {
06137       llgenindentmsg (message ("Previous definition of %q", uentry_getName (spec)),
06138                       uentry_whereDefined (spec));
06139     }
06140 }

void uentry_showWhereLast ( uentry spec )
 

Definition at line 5969 of file uentry.c.

Referenced by uentry_mergeDefinition().

05970 {
05971   if (uentry_isValid (spec))
05972     {
05973       if (fileloc_isDefined (spec->whereDefined)
05974           && !fileloc_isLib (spec->whereDefined)
05975           && !fileloc_isPreproc (spec->whereDefined))
05976         {
05977           llgenindentmsg (message ("Previous definition of %q: %t", 
05978                                    uentry_getName (spec),
05979                                    uentry_getType (spec)),
05980                           uentry_whereDefined (spec));
05981         }
05982       else if (uentry_isDeclared (spec))
05983         {
05984           llgenindentmsg (message ("Previous declaration of %q: %t", 
05985                                    uentry_getName (spec),
05986                                    uentry_getType (spec)),
05987                           uentry_whereDeclared (spec));
05988         }
05989       else if (uentry_isSpecified (spec))
05990         {
05991           if (uentry_hasName (spec))
05992             {
05993               llgenindentmsg (message ("Specification of %q: %t", 
05994                                        uentry_getName (spec),
05995                                        uentry_getType (spec)),
05996                               uentry_whereSpecified (spec));
05997             }
05998           else
05999             {
06000               llgenindentmsg (message ("Specification: %t", uentry_getType (spec)),
06001                               uentry_whereSpecified (spec));
06002             }
06003         }
06004       else
06005         {
06006           /* nothing to show */
06007         }
06008     }
06009 }

void uentry_showWhereLastExtra ( uentry spec,
cstring extra )
 

Definition at line 6031 of file uentry.c.

Referenced by specialClauses_checkEqual(), and uentry_mergeConstantValue().

06032 {
06033   if (uentry_isDeclared (spec))
06034     {
06035       llgenindentmsg (message ("Previous declaration of %q: %q", 
06036                                uentry_getName (spec), extra),
06037                       uentry_whereDeclared (spec));
06038     }
06039   else if (uentry_isSpecified (spec))
06040     {
06041       llgenindentmsg (message ("Specification of %q: %q", 
06042                                uentry_getName (spec), extra),
06043                       uentry_whereSpecified (spec));
06044     }
06045   else
06046     {
06047       cstring_free (extra);
06048     }
06049 }

void uentry_showWhereLastPlain ( uentry spec )
 

Definition at line 6143 of file uentry.c.

Referenced by uentryList_showFieldDifference().

06144 {
06145   if (uentry_isDeclared (spec))
06146     {
06147       llgenindentmsg (message ("Previous declaration of %q", uentry_getName (spec)),
06148                       uentry_whereDeclared (spec));
06149     }
06150   else if (uentry_isSpecified (spec))
06151     {
06152       llgenindentmsg (message ("Specification of %q", uentry_getName (spec)),
06153                       uentry_whereSpecified (spec));
06154     }
06155   else
06156     {
06157           }
06158 }

void uentry_showWhereSpecified ( uentry spec )
 

Definition at line 6181 of file uentry.c.

Referenced by exprNode_checkAllMods(), exprNode_checkMacroBody(), uentry_mergeEntries(), and usymtab_allUsed().

06182 {
06183   if (uentry_isSpecified (spec))
06184     {
06185       if (uentry_hasName (spec))
06186         {
06187           llgenindentmsg (message ("Specification of %q", uentry_getName (spec)),
06188                           uentry_whereSpecified (spec));
06189         }
06190       else
06191         {
06192           llgenindentmsg (cstring_makeLiteral ("Specification"), 
06193                           uentry_whereSpecified (spec));
06194         }
06195     }
06196   else if (uentry_isDeclared (spec))
06197     {
06198       llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)),
06199                       uentry_whereDeclared (spec));
06200     }
06201   else
06202     {
06203       /* nothing to show */
06204     }
06205 }

void uentry_showWhereSpecifiedExtra ( uentry spec,
cstring s )
 

Definition at line 6208 of file uentry.c.

06209 {
06210   if (uentry_isSpecified (spec))
06211     {
06212       if (uentry_hasName (spec))
06213         {
06214           llgenindentmsg (message ("Specification of %q: %q", 
06215                                    uentry_getName (spec), s),
06216                           uentry_whereSpecified (spec));
06217         }
06218       else
06219         {
06220           llgenindentmsg (message ("Specification: %q", s), 
06221                           uentry_whereSpecified (spec));
06222         }
06223     }
06224   else if (uentry_isDeclared (spec))
06225     {
06226       llgenindentmsg (message ("Declaration of %q: %q", 
06227                                uentry_getName (spec), s),
06228                       uentry_whereDeclared (spec));
06229     }
06230   else
06231     {
06232       llgenindentmsg (message ("Previous: %q", s),
06233                       uentry_whereLast (spec));
06234     }
06235 }

cstring uentry_specDeclName ( uentry u )
 

Definition at line 526 of file uentry.c.

00527 {
00528   if (uentry_isDeclared (u))
00529     {
00530       return cstring_makeLiteralTemp ("previous declaration");
00531     }
00532   else
00533     {
00534       return cstring_makeLiteralTemp ("specification");
00535     }
00536 }

cstring uentry_specOrDefName ( uentry u )
 

Definition at line 514 of file uentry.c.

Referenced by uentryList_showFieldDifference().

00515 {
00516   if (uentry_isDeclared (u))
00517     {
00518       return cstring_makeLiteralTemp ("previously declared");
00519     }
00520   else
00521     {
00522       return cstring_makeLiteralTemp ("specified");
00523     }
00524 }

uentry uentry_undump ( ekind kind,
fileloc loc,
char ** s )
 

Definition at line 3927 of file uentry.c.

Referenced by uentryList_undump(), and usymtab_load().

03928 {
03929   uentry ue;
03930   
03931   if (**s == '!')
03932     {
03933       checkChar (s, '!');
03934       checkChar (s, '.');
03935       ue = uentry_makeElipsisMarker ();
03936     }
03937   else
03938     {
03939       ctype ct = ctype_undump (s);
03940       cstring name;
03941 
03942       switch (kind)
03943         {
03944         case KVAR:
03945           {
03946             vkind  tkind;
03947             sstate defstate;
03948             nstate isnull;
03949             alkind aliased;
03950             exkind exp;
03951             chkind checked;
03952             
03953             checkChar (s, '|');
03954 
03955             if (optCheckChar (s, '@'))
03956               {
03957                 tkind = vkind_fromInt (getInt (s));
03958                 checkChar (s, '|');
03959               }
03960             else
03961               {
03962                 tkind = VKPARAM;
03963               }
03964 
03965             if (optCheckChar (s, '$'))
03966               {
03967                 defstate = SS_UNKNOWN;
03968                 isnull = NS_UNKNOWN;
03969                 aliased = AK_IMPTEMP;
03970                 exp = XO_UNKNOWN;
03971                 checked = CH_UNKNOWN;
03972               }         
03973             else if (optCheckChar (s, '&'))
03974               {
03975                 defstate = SS_DEFINED;
03976                 isnull = NS_UNKNOWN;
03977                 aliased = AK_IMPTEMP;
03978                 exp = XO_UNKNOWN;
03979                 checked = CH_UNKNOWN;
03980               }         
03981             else if (optCheckChar (s, '^'))
03982               {
03983                 defstate = SS_UNKNOWN;
03984                 isnull = NS_UNKNOWN;
03985                 aliased = AK_IMPTEMP;
03986                 exp = XO_UNKNOWN;
03987                 checked = CH_UNKNOWN;
03988               }         
03989             else
03990               {
03991                 defstate = sstate_fromInt (getInt (s));      
03992                 advanceField (s); isnull = nstate_fromInt (getInt (s));      
03993                 advanceField (s); aliased = alkind_fromInt (getInt (s));      
03994 
03995                 if (optCheckChar (s, '&'))
03996                   {
03997                     exp = XO_UNKNOWN;
03998                     checked = CH_UNKNOWN;
03999                   }
04000                 else
04001                   {
04002                     advanceField (s); exp = exkind_fromInt (getInt (s));      
04003                     advanceField (s); checked = (chkind) (getInt (s));      
04004                   }
04005               }
04006 
04007             advanceName (s);
04008             name = getStringWord (s);
04009             
04010             ue = uentry_makeVariableBase (name, ct, tkind, defstate, 
04011                                           isnull, aliased, exp, 
04012                                           checked, fileloc_copy (loc));
04013           }
04014           break;
04015         case KDATATYPE: 
04016           {
04017             ynm abs;
04018             ynm mut;
04019             ctype rtype;
04020             sstate defstate;
04021             nstate isnull;
04022             alkind aliased;
04023             exkind exp;
04024 
04025             advanceField (s); abs = ynm_fromCodeChar (loadChar (s));
04026             advanceField (s); mut = ynm_fromCodeChar (loadChar (s));
04027             advanceField (s); defstate = sstate_fromInt (getInt (s));      
04028             advanceField (s); isnull = nstate_fromInt (getInt (s));      
04029             advanceField (s); aliased = alkind_fromInt (getInt (s));      
04030             advanceField (s); exp = exkind_fromInt (getInt (s));      
04031             advanceField (s); rtype = ctype_undump (s);
04032             advanceName (s); 
04033             name = getStringWord (s);
04034 
04035             ue = uentry_makeDatatypeBase (name, ct, abs, mut, rtype, 
04036                                           aliased, exp, defstate, isnull, 
04037                                           fileloc_copy (loc));
04038           }
04039           break;
04040         case KFCN:
04041           {
04042             alkind     ak;
04043             exkind     exp;
04044             sstate     defstate;
04045             nstate     isnull;
04046             exitkind   exitCode;
04047             specCode   specc;
04048             qual       nullPred;
04049             typeIdSet access;
04050             bool       hasGlobs;
04051             globSet    globs;
04052             bool       hasMods;
04053             sRefSet    mods;
04054             specialClauses specclauses;
04055 
04056             if (optCheckChar (s, '$'))
04057               {
04058                 defstate = SS_DEFINED;
04059                 isnull = NS_UNKNOWN;
04060                 exitCode = XK_UNKNOWN;
04061                 specc = SPC_NONE;
04062                 nullPred = QU_UNKNOWN;
04063               }
04064             else
04065               {
04066                 advanceField (s); defstate = sstate_fromInt (getInt (s)); 
04067                 advanceField (s); isnull = nstate_fromInt (getInt (s)); 
04068                 advanceField (s); exitCode = exitkind_fromInt (getInt (s)); 
04069                 advanceField (s); specc = specCode_fromInt (getInt (s)); 
04070                 advanceField (s); nullPred = qual_fromInt (getInt (s)); 
04071               }
04072 
04073             if (optCheckChar (s, '$'))
04074               {
04075                 hasGlobs = FALSE;
04076                 globs = globSet_undefined;
04077                 hasMods = FALSE;
04078                 mods = sRefSet_undefined;
04079               }
04080             else if (optCheckChar (s, '^'))
04081               {
04082                 hasGlobs = TRUE;
04083                 globs = globSet_undefined;
04084                 hasMods = TRUE;
04085                 mods = sRefSet_undefined;
04086               }
04087             else
04088               {
04089                 advanceField (s); hasGlobs = bool_fromInt (getInt (s));
04090                 advanceField (s); globs  = globSet_undump (s);
04091                 advanceField (s); hasMods = bool_fromInt (getInt (s));
04092                 advanceField (s); mods   = sRefSet_undump (s);      
04093               }
04094 
04095             if (optCheckChar (s, '$'))
04096               {
04097                 ak = AK_UNKNOWN;
04098                 exp = XO_UNKNOWN;
04099               }
04100             else
04101               {
04102                 advanceField (s); ak = alkind_fromInt (getInt (s));
04103                 advanceField (s); exp = exkind_fromInt (getInt (s));      
04104               }
04105 
04106             advanceField (s); access = typeIdSet_undump (s);
04107 
04108             if (optCheckChar (s, '@'))
04109               {
04110                 specclauses = specialClauses_undump (s);
04111               }
04112             else
04113               {
04114                 specclauses = specialClauses_undefined; 
04115               }
04116 
04117             advanceName (s);  name = getStringWord (s);
04118 
04119             ue = uentry_makeFunctionBase (name, ct, access, 
04120                                           hasGlobs, globs, 
04121                                           hasMods, mods, 
04122                                           ak, exp, defstate, isnull, 
04123                                           exitCode, specc, nullPred,
04124                                           specclauses,
04125                                           fileloc_copy (loc));
04126             DPRINTF (("Undump: %s", uentry_unparse (ue)));
04127           }
04128           break;
04129         case KITER:
04130           {
04131             typeIdSet access;
04132             
04133             advanceField (s); access = typeIdSet_undump (s);
04134             advanceName (s);  name = getStringWord (s);
04135             
04136             ue = uentry_makeIterBase (name, access, ct,
04137                                       fileloc_copy (loc));
04138           }
04139           break;
04140         case KENDITER:
04141           {
04142             typeIdSet access;
04143 
04144             advanceField (s); access = typeIdSet_undump (s);
04145             advanceName (s);  name = getStringWord (s);
04146             
04147             ue = uentry_makeEndIterBase (name, access, fileloc_copy (loc));
04148           }
04149           break;
04150         case KENUMCONST:  
04151         case KCONST:  
04152           {
04153             typeIdSet access;
04154             multiVal val;
04155             nstate nullstate;
04156 
04157             if (optCheckChar (s, '$'))
04158               {
04159                 val = multiVal_undefined;
04160                 access = typeIdSet_undefined;
04161                 nullstate = NS_UNKNOWN;
04162               }
04163             else
04164               {
04165                 advanceField (s); val = multiVal_undump (s);
04166                 advanceField (s); access = typeIdSet_undump (s);
04167                 advanceField (s); nullstate = nstate_fromInt (getInt (s));
04168               }
04169 
04170             advanceName (s);  name = getStringWord (s);
04171             
04172             ue = uentry_makeConstantBase (name, ct, access,
04173                                           nullstate, fileloc_copy (loc), val);
04174             break;
04175           }
04176         case KSTRUCTTAG:
04177         case KUNIONTAG:
04178         case KENUMTAG:
04179           {
04180             ctype rtype;
04181             
04182             advanceField (s); rtype = ctype_undump (s);
04183             advanceName (s);  name = getStringWord (s);
04184             ue = uentry_makeTagBase (name, kind, ct, rtype, fileloc_copy (loc));
04185           }
04186           break;
04187         case KINVALID:
04188           llcontbuglit ("uentry_undump: invalid");
04189           ue = uentry_undefined;
04190           break;
04191         case KELIPSMARKER:
04192           llcontbuglit ("uentry_undump: elips marker");
04193           ue = uentry_undefined;
04194           break;
04195         }
04196     }
04197   
04198   return (ue);
04199 }

cstring uentry_unparse ( uentry v )
 

Definition at line 4444 of file uentry.c.

Referenced by uentryList_showFieldDifference(), uentry_getForceRealType(), uentry_getRealType(), uentry_mergeState(), uentry_reflectQualifiers(), uentry_unparseAbbrev(), and usymtab_addEntry().

04445 {
04446   cstring st;
04447 
04448     if (uentry_isUndefined (v)) return (cstring_makeLiteral ("<undefined>"));
04449   if (uentry_isElipsisMarker (v)) return (cstring_makeLiteral ("..."));
04450 
04451   st = uentry_getName (v);
04452 
04453   if (cstring_isDefined (st))
04454     {
04455       return (ctype_unparseDeclaration (v->utype, st)); 
04456     }
04457   else
04458     {
04459       cstring_free (st);
04460       return (cstring_copy (ctype_unparse (v->utype)));
04461     }
04462 }

cstring uentry_unparseAbbrev ( uentry v )
 

Definition at line 4432 of file uentry.c.

04433 {
04434   if (!uentry_isVariable (v))
04435     {
04436       llcontbuglit ("uentry_unparseAbbrev: not variable");
04437       return uentry_unparse (v);
04438     }
04439 
04440   return (message ("%s %q", ctype_unparseDeep (v->utype), uentry_getName (v)));
04441 }

cstring uentry_unparseFull ( uentry v )
 

Definition at line 4465 of file uentry.c.

Referenced by uentry_dumpParam(), uentry_fixupSref(), usymtab_allUsed(), and usymtab_printOut().

04466 {
04467   if (uentry_isUndefined (v))
04468     {
04469       return (cstring_makeLiteral ("<undefined>"));
04470     }
04471   else if (uentry_isDatatype (v))
04472     {
04473       return (message ("[%d] [%s] %s %q : %t [%t] %s %s // %q [s: %q; d: %q]",
04474                        (int) v,
04475                        ekind_unparse (v->ukind),
04476                        v->uname,
04477                        uentry_getName (v),
04478                        v->utype,
04479                        ctype_isDefined (v->info->datatype->type) 
04480                           ? v->info->datatype->type : ctype_unknown,
04481                        ynm_unparse (v->info->datatype->mut),
04482                        ynm_unparse (v->info->datatype->abs),
04483                        sRef_unparseState (v->sref),
04484                        fileloc_unparse (v->whereSpecified),
04485                        fileloc_unparse (v->whereDefined)));
04486     }
04487   else if (uentry_isFunction (v))
04488     {
04489       return (message ("[%w] = [%s] %q : %t / sref: %q / mods: %q / "
04490                        "globs: %q / [s: %q; decl: %q; def: %q]",
04491                        (long unsigned) v,
04492                        ekind_unparse (v->ukind),
04493                        uentry_getName (v),
04494                        v->utype,
04495                        sRef_unparseFull (v->sref),
04496                        sRefSet_unparse (v->info->fcn->mods),
04497                        globSet_unparse  (v->info->fcn->globs),
04498                        fileloc_unparse (v->whereSpecified),
04499                        fileloc_unparse (v->whereDeclared),
04500                        fileloc_unparse (v->whereDefined)));
04501     }
04502   else if (uentry_isIter (v))
04503     {
04504       return (message ("[%s] %q: %t / %q [s: %q; d: %q]",
04505                        ekind_unparse (v->ukind),
04506                        uentry_getName (v),
04507                        v->utype,
04508                        sRef_unparseFull (v->sref),
04509                        fileloc_unparse (v->whereSpecified),
04510                        fileloc_unparse (v->whereDefined)));
04511     }
04512   else if (uentry_isVariable (v))
04513     {
04514       return 
04515         (message ("[check: %s] / [%w] = [%s] %s : %t %q [s: %q; def: %q; dec: %q] "
04516                   "kind <%d> isout <%d> used <%d>",
04517                   checkedName (v->info->var->checked),
04518                   (long unsigned) v,
04519                   ekind_unparse (v->ukind),
04520                   v->uname,
04521                   v->utype,
04522                   sRef_unparseDeep (v->sref),
04523                   fileloc_unparse (v->whereSpecified),
04524                   fileloc_unparse (v->whereDefined),
04525                   fileloc_unparse (v->whereDeclared),
04526                   (int) v->info->var->kind,
04527                   (int) v->info->var->defstate,
04528                   (int) v->used));
04529     }
04530   else
04531     {
04532       return (message ("[%s] %s : %t %q at [s: %q; d: %q]",
04533                        ekind_unparse (v->ukind),
04534                        v->uname,
04535                        v->utype,
04536                        sRef_unparseFull (v->sref),
04537                        fileloc_unparse (v->whereSpecified),
04538                        fileloc_unparse (v->whereDefined)));
04539       
04540     }
04541 }

fileloc uentry_whereDeclared ( uentry e )
 

Definition at line 5090 of file uentry.c.

Referenced by exprChecks_checkExport(), exprChecks_checkUsedGlobs(), processNamedDecl(), uentry_checkParams(), uentry_makeIdFunction(), uentry_mergeDefinition(), uentry_mergeEntries(), uentry_mergeState(), uentry_setStatic(), uentry_setUsed(), uentry_showWhereAny(), uentry_showWhereDeclared(), uentry_showWhereLast(), uentry_showWhereLastExtra(), uentry_showWhereLastPlain(), uentry_showWhereSpecified(), uentry_showWhereSpecifiedExtra(), uentry_whereLast(), usymtab_allDefined(), usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

05091 {
05092   if (uentry_isInvalid (e)) return fileloc_undefined;
05093 
05094   return (e->whereDeclared);
05095 }

fileloc uentry_whereDefined ( uentry e )
 

Definition at line 5083 of file uentry.c.

Referenced by fixUentryList(), uentryList_mergeFields(), uentryList_showFieldDifference(), uentry_mergeDefinition(), uentry_showDefSpecInfo(), uentry_showWhereAny(), uentry_showWhereDefined(), uentry_showWhereLast(), usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

05084 {
05085   if (uentry_isInvalid (e)) return fileloc_undefined;
05086 
05087   return (e->whereDefined);
05088 }

fileloc uentry_whereEarliest ( uentry e )
 

Definition at line 5098 of file uentry.c.

Referenced by usymtab_allUsed(), and usymtab_enterFunctionScope().

05099 {
05100   if (uentry_isInvalid (e)) return fileloc_undefined;
05101   
05102   if (fileloc_isDefined (e->whereSpecified))
05103     {
05104       return (e->whereSpecified);
05105     }
05106   else if (fileloc_isDefined (e->whereDeclared))
05107     {
05108       return (e->whereDeclared);
05109     }
05110   else
05111     {
05112       return e->whereDefined;
05113     }
05114 }

fileloc uentry_whereEither ( uentry e )
 

Definition at line 5057 of file uentry.c.

Referenced by uentryList_showFieldDifference().

05058 {
05059   if (uentry_isInvalid (e)) return fileloc_undefined;
05060 
05061   if (fileloc_isDefined (e->whereDefined) 
05062       && !fileloc_isExternal (e->whereDefined))
05063     {
05064       return e->whereDefined;
05065     }
05066   else if (fileloc_isDefined (e->whereDeclared))
05067     {
05068       return e->whereDeclared;
05069     }
05070   else
05071     {
05072       return e->whereSpecified;
05073     }
05074 }

fileloc uentry_whereLast ( uentry e )
 

Definition at line 5030 of file uentry.c.

Referenced by checkParamNames(), checkPrefix(), declareStruct(), declareUnion(), exprNode_checkAllMods(), processNamedDecl(), sRef_fixResultType(), specialClauses_checkAll(), uentry_checkName(), uentry_makeIdFunction(), uentry_makeParam(), uentry_mergeDefinition(), uentry_showWhereSpecifiedExtra(), and usymtab_checkDistinctName().

05031 {
05032   fileloc loc;
05033 
05034   if (uentry_isInvalid (e)) 
05035     {
05036       return fileloc_undefined;
05037     }
05038   
05039   loc = e->whereDefined;
05040 
05041   if (fileloc_isValid (loc) && !fileloc_isExternal (loc))
05042     {
05043       return loc;
05044     }
05045 
05046   loc = uentry_whereDeclared (e);
05047 
05048   if (fileloc_isValid (loc) && !fileloc_isExternal (loc))
05049     {
05050       return loc;
05051     }
05052 
05053   loc = uentry_whereSpecified (e);
05054   return loc;
05055 }

fileloc uentry_whereSpecified ( uentry e )
 

Definition at line 5076 of file uentry.c.

Referenced by exprChecks_checkUsedGlobs(), exprNode_checkAllMods(), lclRedeclarationError(), uentry_showDefSpecInfo(), uentry_showWhereAny(), uentry_showWhereDeclared(), uentry_showWhereLast(), uentry_showWhereLastExtra(), uentry_showWhereLastPlain(), uentry_showWhereSpecified(), uentry_showWhereSpecifiedExtra(), uentry_whereLast(), and usymtab_allDefined().

05077 {
05078   if (uentry_isInvalid (e)) return fileloc_undefined;
05079 
05080   return (e->whereSpecified);
05081 }

int uentry_xcomparealpha ( uentry * p1,
uentry * p2 )
 

Definition at line 3317 of file uentry.c.

03318 {
03319   int res;
03320 
03321   if ((res = uentry_compare (*p1, *p2)) == 0) {
03322     if ((*p1 != NULL) && (*p2 != NULL)) {
03323       res = cstring_compare ((*p1)->uname,
03324                              (*p2)->uname);
03325     }
03326   }
03327 
03328   return res;
03329 }

int uentry_xcompareuses ( uentry * p1,
uentry * p2 )
 

Definition at line 3332 of file uentry.c.

03333 {
03334   uentry u1 = *p1;
03335   uentry u2 = *p2;
03336 
03337   if (uentry_isValid (u1))
03338     {
03339       if (uentry_isValid (u2))
03340         {
03341           return (-1 * int_compare (filelocList_size (u1->uses), 
03342                                     filelocList_size (u2->uses)));
03343         }
03344       else
03345         {
03346           return 1;
03347         }
03348     }
03349   else
03350     {
03351       if (uentry_isValid (u2))
03352         {
03353           return -1;
03354         }
03355       else
03356         {
03357           return 0;
03358         }
03359     }
03360 }


Generated at Fri Nov 3 18:58:19 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000