#include "lclintMacros.nf"#include "llbasic.h"#include "cgrammar.h"#include "usymtab_interface.h"#include "structNames.h"#include "nameChecks.h"#include "cgrammar_tokens.h"Go to the source code of this file.
Functions | |
| void | setArgsUsed (void) |
| void | setSpecialFunction (qual qu) |
| void | storeLoc () |
| void | setFunctionNoGlobals (void) |
| void | setFunctionStateSpecialClause (lltok stok, specialClauseKind kind, sRefSet s, lltok etok) |
| void | setFunctionSpecialClause (lltok stok, sRefSet s, lltok etok) |
| void | setFunctionModifies (sRefSet s) |
| void | globListAdd (sRef sr, qualList quals) |
| void | declareCIter (cstring name, uentryList params) |
| void | nextIterParam (void) |
| int | iterParamNo (void) |
| uentry | makeCurrentParam (idDecl t) |
| ctype | declareUnnamedEnum (enumNameList el) |
| ctype | declareEnum (cstring ename, enumNameList el) |
| void | setCurrentParams ( uentryList ue) |
| void | clearCurrentParams (void) |
| void | enterParamsTemp (void) |
| void | exitParamsTemp (void) |
| void | declareFunction (idDecl tid) |
| void | declareStaticFunction (idDecl tid) |
| uentryList | fixUentryList (idDeclList tl, qtype q) |
| uentryList | fixUnnamedDecl (qtype q) |
| void | setStorageClass (storageClassCode sc) |
| void | setProcessingIterVars (uentry iter) |
| void | setProcessingGlobalsList () |
| void | setProcessingGlobMods () |
| void | clearProcessingGlobMods () |
| bool | isProcessingGlobMods () |
| void | unsetProcessingGlobals () |
| void | setProcessingVars ( qtype q) |
| void | setProcessingTypedef ( qtype q) |
| void | unsetProcessingVars () |
| void | doneParams () |
| void | checkDoneParams () |
| void | unsetProcessingTypedef () |
| void | checkConstant (qtype t, idDecl id) |
| void | checkValueConstant (qtype t, idDecl id, exprNode e) |
| void | processNamedDecl (idDecl t) |
| ctype | declareUnnamedStruct ( uentryList f) |
| ctype | declareUnnamedUnion ( uentryList f) |
| ctype | declareStruct (cstring id, uentryList f) |
| ctype | declareUnion (cstring id, uentryList f) |
| ctype | handleStruct ( cstring id) |
| ctype | handleUnion ( cstring id) |
| ctype | handleEnum (cstring id) |
| bool | processingIterVars (void) |
| uentry | getCurrentIter (void) |
| void | setFlipOldStyle () |
| bool | isFlipOldStyle () |
| bool | isNewStyle () |
| void | setNewStyle () |
| uentryList | handleParamIdList ( uentryList params) |
| uentryList | handleParamTypeList ( uentryList params) |
| void | doVaDcl () |
| sRef | modListPointer (sRef s) |
| sRef | modListFieldAccess (sRef s, cstring f) |
| sRef | globListUnrecognized (cstring s) |
| sRef | modListArrowAccess (sRef s, cstring f) |
| sRef | checkSpecClausesId (uentry ue) |
| void | checkModifiesId (uentry ue) |
| sRef | fixModifiesId (cstring s) |
| sRef | fixSpecClausesId (cstring s) |
| sRef | modListArrayFetch (sRef s, sRef mexp) |
|
|
Definition at line 1278 of file clabstract.c. 01279 {
01280 uentry e;
01281
01282 id = idDecl_fixBase (id, t);
01283 e = uentry_makeIdConstant (id);
01284
01285 reflectStorageClass (e);
01286 resetStorageClass ();
01287
01288 usymtab_supGlobalEntry (e);
01289 }
|
|
|
Definition at line 1246 of file clabstract.c. 01247 {
01248 if (uentry_isValid (saveFunction))
01249 {
01250 /*
01251 ** old style declaration
01252 */
01253
01254 ctype ct = ctype_returnValue (uentry_getType (saveFunction));
01255 ctype ct2;
01256
01257 uentryList_elements (saveParamList, current)
01258 {
01259 uentry_setType (current, ctype_int); /* all params are ints */
01260 } end_uentryList_elements;
01261
01262 ct2 = ctype_makeParamsFunction (ct, uentryList_copy (saveParamList));
01263
01264 uentry_setType (saveFunction, ct2);
01265 ProcessingParams = FALSE;
01266
01267 oldStyleDeclareFunction (saveFunction);
01268 saveFunction = uentry_undefined;
01269 }
01270 }
|
|
|
Definition at line 2089 of file clabstract.c. 02090 {
02091 cstring s = uentry_rawName (ue);
02092
02093 if (cstring_equalLit (s, "nothing")
02094 || cstring_equalLit (s, "internalState")
02095 || cstring_equalLit (s, "systemState")
02096 || (cstring_equalLit (s, "fileSystem")))
02097 {
02098 if (optgenerror
02099 (FLG_SYNTAX,
02100 message ("Modifies list uses %s which is a variable and has special "
02101 "meaning in a modifies list. (Special meaning assumed.)", s),
02102 g_currentloc))
02103 {
02104 uentry_showWhereDeclared (ue);
02105 }
02106 }
02107 }
|
|
|
Definition at line 2052 of file clabstract.c. 02053 {
02054 cstring s = uentry_rawName (ue);
02055
02056 if (sRef_isGlobal (uentry_getSref (ue)))
02057 {
02058 voptgenerror
02059 (FLG_SYNTAX,
02060 message ("Global variable %s used special clause. (Global variables "
02061 "are not recognized in special clauses. If there is "
02062 "sufficient interest in support for this, it may be "
02063 "added to a future release. Send mail to "
02064 "lclint@cs.virginia.edu.)",
02065 s),
02066 g_currentloc);
02067
02068 return sRef_undefined;
02069 }
02070 else
02071 {
02072 if (cstring_equalLit (s, "result"))
02073 {
02074 if (optgenerror
02075 (FLG_SYNTAX,
02076 message ("Special clause list uses %s which is a variable and has special "
02077 "meaning in a modifies list. (Special meaning assumed.)", s),
02078 g_currentloc))
02079 {
02080 uentry_showWhereDeclared (ue);
02081 }
02082 }
02083
02084 return uentry_getSref (ue);
02085 }
02086 }
|
|
|
Definition at line 1291 of file clabstract.c. 01292 {
01293 uentry ue;
01294
01295 id = idDecl_fixBase (id, t);
01296 ue = uentry_makeIdConstant (id);
01297 reflectStorageClass (ue);
01298 resetStorageClass ();
01299
01300 if (exprNode_isDefined (e))
01301 {
01302 if (!exprNode_matchType (uentry_getType (ue), e))
01303 {
01304 (void) gentypeerror
01305 (exprNode_getType (e), e,
01306 uentry_getType (ue), exprNode_undefined,
01307 message ("Constant %q initialized to type %t, expects %t: %s",
01308 uentry_getName (ue),
01309 exprNode_getType (e),
01310 uentry_getType (ue),
01311 exprNode_unparse (e)),
01312 exprNode_loc (e));
01313 }
01314 else
01315 {
01316 if (exprNode_hasValue (e))
01317 {
01318 uentry_mergeConstantValue (ue, multiVal_copy (exprNode_getValue (e)));
01319 }
01320 }
01321 }
01322
01323 usymtab_supGlobalEntry (ue);
01324 }
|
|
|
Definition at line 582 of file clabstract.c. 00583 {
00584 currentParamList = uentryList_undefined;
00585 }
|
|
|
Definition at line 1148 of file clabstract.c. 01149 {
01150 ProcessingGlobMods = FALSE;
01151 }
|
|
|
Definition at line 363 of file clabstract.c. 00364 {
00365 uentry ue;
00366
00367 ue = uentry_makeIter (name,
00368 ctype_makeFunction (ctype_void, params),
00369 fileloc_copy (g_currentloc));
00370
00371 usymtab_supEntry (uentry_makeEndIter (name, fileloc_copy (g_currentloc)));
00372
00373 reflectModGlobs (ue);
00374
00375 ue = usymtab_supGlobalEntryReturn (ue);
00376 }
|
|
|
Definition at line 441 of file clabstract.c. Referenced by handleEnum(). 00442 {
00443 ctype cet;
00444 uentry e;
00445
00446 llassert (cstring_isDefined (ename));
00447
00448 cet = ctype_createEnum (ename, el);
00449 e = uentry_makeEnumTagLoc (ename, cet);
00450 reflectStorageClass (e);
00451 e = usymtab_supGlobalEntryReturn (e);
00452 cet = uentry_getType (e);
00453 declareEnumList (el, cet, uentry_whereLast (e));
00454 return (uentry_getAbstractType (e));
00455 }
|
|
|
Definition at line 720 of file clabstract.c. 00721 {
00722 uentry ue;
00723
00724 DPRINTF (("Declare function: %s", idDecl_unparse (tid)));
00725
00726 if (ProcessingParams)
00727 {
00728 ue = globalDeclareOldStyleFunction (tid);
00729 saveFunction = ue;
00730 }
00731 else
00732 {
00733 saveFunction = uentry_undefined;
00734
00735 if (context_inRealFunction ())
00736 {
00737 ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown);
00738
00739 llparseerror (message ("Function declared inside function: %q",
00740 idDecl_unparse (tid)));
00741
00742 context_quietExitFunction ();
00743 ue = usymtab_supEntryReturn (ue);
00744 }
00745 else
00746 {
00747 if (context_inInnerScope ())
00748 {
00749 llparseerror (message ("Declaration in inner context: %q",
00750 idDecl_unparse (tid)));
00751
00752 sRef_setGlobalScope ();
00753 ue = uentry_makeVariableLoc (idDecl_observeId (tid),
00754 ctype_unknown);
00755 ue = usymtab_supGlobalEntryReturn (ue);
00756 sRef_clearGlobalScope ();
00757 }
00758 else
00759 {
00760 ue = globalDeclareFunction (tid);
00761 }
00762 }
00763
00764 resetGlobals ();
00765 }
00766
00767 resetStorageClass ();
00768 idDecl_free (tid);
00769 }
|
|
|
Definition at line 771 of file clabstract.c. 00772 {
00773 uentry ue;
00774
00775 DPRINTF (("Declare static funciton: %s", idDecl_unparse (tid)));
00776
00777 if (ProcessingParams)
00778 {
00779 ue = globalDeclareOldStyleFunction (tid);
00780 saveFunction = ue;
00781 }
00782 else
00783 {
00784 saveFunction = uentry_undefined;
00785
00786 if (context_inRealFunction ())
00787 {
00788 ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown);
00789
00790 llparseerror (message ("Function declared inside function: %q",
00791 idDecl_unparse (tid)));
00792
00793 context_quietExitFunction ();
00794 ue = usymtab_supEntryReturn (ue);
00795 }
00796 else
00797 {
00798 if (context_inInnerScope ())
00799 {
00800 llparseerror (message ("Declaration in inner context: %q",
00801 idDecl_unparse (tid)));
00802
00803 sRef_setGlobalScope ();
00804 ue = uentry_makeVariableLoc (idDecl_observeId (tid),
00805 ctype_unknown);
00806 ue = usymtab_supGlobalEntryReturn (ue);
00807 sRef_clearGlobalScope ();
00808 }
00809 else
00810 {
00811 ctype deftype = idDecl_getCtype (tid);
00812 ctype rettype;
00813
00814 if (ctype_isFunction (deftype))
00815 {
00816 rettype = ctype_returnValue (deftype);
00817 }
00818 else
00819 {
00820 rettype = ctype_unknown;
00821 }
00822
00823 /*
00824 ** check has been moved here...
00825 */
00826
00827 if (ctype_isFunction (idDecl_getCtype (tid)))
00828 {
00829 ue = uentry_makeIdFunction (tid);
00830 reflectSpecialCode (ue);
00831 reflectArgsUsed (ue);
00832 }
00833 else
00834 {
00835 llparseerror (message ("Inconsistent function declaration: %q",
00836 idDecl_unparse (tid)));
00837
00838 tid = idDecl_replaceCtype
00839 (tid, ctype_makeFunction (ctype_unknown, uentryList_undefined));
00840 ue = uentry_makeIdFunction (tid);
00841 }
00842
00843 reflectStorageClass (ue);
00844 uentry_setStatic (ue);
00845
00846 uentry_checkParams (ue);
00847 reflectModGlobs (ue);
00848
00849 DPRINTF (("Sub global entry: %s", uentry_unparse (ue)));
00850 ue = usymtab_supGlobalEntryReturn (ue);
00851
00852 context_enterFunction (ue);
00853 enterFunctionParams (uentry_getParams (ue));
00854 resetStorageClass ();
00855 }
00856 }
00857
00858 resetGlobals ();
00859 }
00860
00861 resetStorageClass ();
00862 idDecl_free (tid);
00863 }
|
|
|
Definition at line 1656 of file clabstract.c. 01657 {
01658 ctype ct;
01659 uentry ue;
01660 int num = uentryList_size (f);
01661
01662 ct = ctype_createStruct (cstring_copy (id), f);
01663 ue = uentry_makeStructTagLoc (id, ct);
01664
01665 if (context_maybeSet (FLG_NUMSTRUCTFIELDS))
01666 {
01667 int max = context_getValue (FLG_NUMSTRUCTFIELDS);
01668
01669 if (num > max)
01670 {
01671 voptgenerror
01672 (FLG_NUMSTRUCTFIELDS,
01673 message ("Structure %q declared with %d fields "
01674 "(limit is set to %d)",
01675 uentry_getName (ue), num, max),
01676 uentry_whereLast (ue));
01677 }
01678 }
01679
01680 return (usymtab_supTypeEntry (ue));
01681 }
|
|
|
Definition at line 1683 of file clabstract.c. 01684 {
01685 ctype ct;
01686 uentry ue;
01687 int num = uentryList_size (f);
01688
01689 ct = ctype_createUnion (cstring_copy (id), f);
01690 ue = uentry_makeUnionTagLoc (id, ct);
01691
01692 if (context_maybeSet (FLG_NUMSTRUCTFIELDS))
01693 {
01694 int max = context_getValue (FLG_NUMSTRUCTFIELDS);
01695
01696 if (num > max)
01697 {
01698 voptgenerror
01699 (FLG_NUMSTRUCTFIELDS,
01700 message ("Union %q declared with %d fields "
01701 "(limit is set to %d)",
01702 uentry_getName (ue), num, max),
01703 uentry_whereLast (ue));
01704 }
01705 }
01706
01707 return (usymtab_supTypeEntry (ue));
01708 }
|
|
|
Definition at line 408 of file clabstract.c. 00409 {
00410 ctype ret = usymtab_enumEnumNameListType (el);
00411 ctype rt;
00412 uentry e;
00413
00414 if (ctype_isDefined (ret))
00415 {
00416 rt = ret;
00417 e = uentry_makeEnumTagLoc (ctype_enumTag (rt), ret);
00418
00419 reflectStorageClass (e);
00420 usymtab_supGlobalEntry (e);
00421
00422 declareEnumList (el, ret, g_currentloc);
00423 enumNameList_free (el);
00424 }
00425 else
00426 {
00427 ctype ct = ctype_createEnum (fakeTag (), el);
00428
00429 e = uentry_makeEnumTagLoc (ctype_enumTag (ctype_realType (ct)), ct);
00430 reflectStorageClass (e);
00431
00432 e = usymtab_supGlobalEntryReturn (e);
00433 rt = uentry_getAbstractType (e);
00434 declareEnumList (el, ct, g_currentloc);
00435 }
00436
00437 return (rt);
00438 }
|
|
|
Definition at line 1613 of file clabstract.c. 01614 {
01615 if (context_maybeSet (FLG_NUMSTRUCTFIELDS))
01616 {
01617 int num = uentryList_size (f);
01618 int max = context_getValue (FLG_NUMSTRUCTFIELDS);
01619
01620 if (num > max)
01621 {
01622 voptgenerror
01623 (FLG_NUMSTRUCTFIELDS,
01624 message ("Structure declared with %d fields "
01625 "(limit is set to %d)",
01626 num, max),
01627 g_currentloc);
01628 }
01629 }
01630
01631 return (ctype_createUnnamedStruct (f));
01632 }
|
|
|
Definition at line 1635 of file clabstract.c. 01636 {
01637 if (context_maybeSet (FLG_NUMSTRUCTFIELDS))
01638 {
01639 int num = uentryList_size (f);
01640 int max = context_getValue (FLG_NUMSTRUCTFIELDS);
01641
01642 if (num > max)
01643 {
01644 voptgenerror
01645 (FLG_NUMSTRUCTFIELDS,
01646 message ("Union declared with %d fields "
01647 "(limit is set to %d)",
01648 num, max),
01649 g_currentloc);
01650 }
01651 }
01652
01653 return (ctype_createUnnamedUnion (f));
01654 }
|
|
|
Definition at line 1817 of file clabstract.c. 01818 {
01819 ctype c = ctype_unknown;
01820 cstring id = cstring_makeLiteral ("va_alist");
01821 uentry e;
01822
01823 if (ProcessingParams)
01824 {
01825 int i = uentryList_lookupRealName (saveParamList, id);
01826
01827 if (i >= 0)
01828 {
01829 e = uentry_makeVariableSrefParam (id, c, sRef_makeParam (i, c));
01830 }
01831 else
01832 {
01833 e = uentry_undefined; /* suppress gcc message */
01834 llfatalerrorLoc (cstring_makeLiteral ("va_dcl used without va_alist"));
01835 }
01836 }
01837 else
01838 {
01839 llerror (FLG_SYNTAX, cstring_makeLiteral ("va_dcl used outside of function declaration"));
01840 e = uentry_makeVariableLoc (id, c);
01841 }
01842
01843 cstring_free (id);
01844 uentry_setUsed (e, g_currentloc);
01845 usymtab_supEntrySref (e);
01846 }
|
|
|
Definition at line 1206 of file clabstract.c. 01207 {
01208 if (ProcessingParams)
01209 {
01210 if (uentry_isInvalid (saveFunction))
01211 {
01212 llbuglit ("unsetProcessingVars: no saved function\n");
01213
01214 if (sRefSet_isDefined (fcnModifies)) {
01215 sRefSet_free (fcnModifies);
01216 fcnModifies = sRefSet_undefined;
01217 }
01218 }
01219 else
01220 {
01221 ctype ct = ctype_returnValue (uentry_getType (saveFunction));
01222 uentryList params = uentryList_copy (saveParamList);
01223 ctype ct2 = ctype_makeFunction (ct, params);
01224
01225 uentry_setType (saveFunction, ct2);
01226 ProcessingParams = FALSE;
01227
01228 reflectModGlobs (saveFunction);
01229 oldStyleDeclareFunction (saveFunction);
01230 saveFunction = uentry_undefined;
01231 resetGlobals ();
01232 }
01233 }
01234 else
01235 {
01236 /*
01237 ** If the paramlist used a type name, we could be here.
01238 */
01239
01240 llfatalerror (message ("%q: Old-style function parameter list uses a "
01241 "type name.", fileloc_unparse (g_currentloc)));
01242 }
01243 }
|
|
|
Definition at line 609 of file clabstract.c. 00610 {
00611 usymtab_enterScope ();
00612 enterFunctionParams (currentParamList);
00613 }
|
|
|
Definition at line 615 of file clabstract.c. 00616 {
00617 usymtab_quietPlainExitScope ();
00618 }
|
|
|
Definition at line 2109 of file clabstract.c. 02110 {
02111 sRef ret;
02112 cstring pname = makeParam (s);
02113 uentry ue = usymtab_lookupSafe (pname);
02114
02115 cstring_free (pname);
02116
02117 if (cstring_equalLit (s, "nothing"))
02118 {
02119 ret = sRef_makeNothing ();
02120 }
02121 else if (cstring_equalLit (s, "internalState"))
02122 {
02123 ret = sRef_makeInternalState ();
02124 }
02125 else if (cstring_equalLit (s, "fileSystem")
02126 || cstring_equalLit (s, "systemState"))
02127 {
02128 ret = sRef_makeSystemState ();
02129 }
02130 else
02131 {
02132 ret = sRef_undefined;
02133 }
02134
02135 if (sRef_isValid (ret))
02136 {
02137 if (uentry_isValid (ue))
02138 {
02139 voptgenerror
02140 (FLG_SYNTAX,
02141 message ("Modifies list uses %s which is a parameter and has special "
02142 "meaning in a modifies list. (Special meaning assumed.)", s),
02143 g_currentloc);
02144 }
02145 }
02146 else
02147 {
02148 if (uentry_isValid (ue))
02149 {
02150 ret = uentry_getSref (ue);
02151 }
02152 else
02153 {
02154 fileloc loc = fileloc_decColumn (g_currentloc, cstring_length (s));
02155 ret = sRef_undefined;
02156
02157 voptgenerror
02158 (FLG_UNRECOG,
02159 message ("Unrecognized identifier in modifies comment: %s", s),
02160 loc);
02161
02162 fileloc_free (loc);
02163 }
02164 }
02165
02166 return ret;
02167 }
|
|
|
Definition at line 2169 of file clabstract.c. 02170 {
02171 sRef ret;
02172 cstring pname = makeParam (s);
02173 uentry ue = usymtab_lookupSafe (pname);
02174
02175 cstring_free (pname);
02176
02177 if (cstring_equalLit (s, "result"))
02178 {
02179 ret = sRef_makeResult ();
02180 }
02181 else
02182 {
02183 ret = sRef_undefined;
02184 }
02185
02186 if (sRef_isValid (ret))
02187 {
02188 if (uentry_isValid (ue))
02189 {
02190 voptgenerror
02191 (FLG_SYNTAX,
02192 message ("Special clause uses %s which is a parameter and has special "
02193 "meaning in a special clause. (Special meaning assumed.)", s),
02194 g_currentloc);
02195 }
02196 }
02197 else
02198 {
02199 if (uentry_isValid (ue))
02200 {
02201 ret = uentry_getSref (ue);
02202
02203 if (sRef_isGlobal (ret))
02204 {
02205 voptgenerror
02206 (FLG_SYNTAX,
02207 message ("Global variable %s used special clause. (Global variables "
02208 "are not recognized in special clauses. If there is "
02209 "sufficient interest in support for this, it may be "
02210 "added to a future release. Send mail to "
02211 "lclint@cs.virginia.edu.)",
02212 s),
02213 g_currentloc);
02214
02215 ret = sRef_undefined;
02216 }
02217 }
02218 else
02219 {
02220 fileloc loc = fileloc_decColumn (g_currentloc, cstring_length (s));
02221 ret = sRef_undefined;
02222
02223 voptgenerror
02224 (FLG_UNRECOG,
02225 message ("Unrecognized identifier in special clause: %s", s),
02226 loc);
02227
02228 fileloc_free (loc);
02229 }
02230 }
02231
02232 return ret;
02233 }
|
|
|
Definition at line 1025 of file clabstract.c. 01026 {
01027 uentryList f = uentryList_new ();
01028
01029 idDeclList_elements (tl, i)
01030 {
01031 if (idDecl_isDefined (i))
01032 {
01033 uentry ue;
01034 uentry old;
01035 ctype rt;
01036
01037 (void) idDecl_fixBase (i, q);
01038
01039 /*
01040 ** implicit annotations
01041 */
01042
01043 (void) fixStructDecl (i);
01044
01045 ue = uentry_makeIdVariable (i);
01046 rt = ctype_realType (uentry_getType (ue));
01047
01048 /*
01049 ** where is this here???
01050
01051 if (ctype_isArray (rt) || ctype_isSU (rt))
01052 {
01053 sRef_setAllocated (uentry_getSref (ue), uentry_whereDefined (ue));
01054 }
01055
01056 **
01057 */
01058
01059 if (uentry_isValid (old = uentryList_lookupField (f, uentry_rawName (ue))))
01060 {
01061 if (optgenerror (FLG_SYNTAX,
01062 message ("Field name reused: %s", uentry_rawName (ue)),
01063 uentry_whereDefined (ue)))
01064 {
01065 llgenmsg (message ("Previous use of %s", uentry_rawName (ue)),
01066 uentry_whereDefined (old));
01067 }
01068 }
01069
01070 f = uentryList_add (f, ue);
01071 }
01072 } end_idDeclList_elements;
01073
01074 idDeclList_free (tl);
01075 return (f);
01076 }
|
|
|
Definition at line 1088 of file clabstract.c. 01089 {
01090 ctype ct = ctype_realType (qtype_getType (q));
01091
01092 if (ctype_isStruct (ct) || ctype_isUnion (ct))
01093 {
01094 uentryList res = ctype_getFields (ct);
01095
01096 return (uentryList_copy (res));
01097 }
01098 else
01099 {
01100 BADBRANCHCONT;
01101 }
01102
01103 return uentryList_undefined;
01104 }
|
|
|
Definition at line 1759 of file clabstract.c. 01760 {
01761 return currentIter;
01762 }
|
|
|
Definition at line 352 of file clabstract.c. 00353 {
00354 if (sRef_isValid (sr))
00355 {
00356 sRef sc = sRef_copy (sr);
00357
00358 reflectGlobalQualifiers (sc, quals);
00359 currentGlobals = globSet_insert (currentGlobals, sc);
00360 }
00361 }
|
|
|
Definition at line 1939 of file clabstract.c. 01940 {
01941 if (cstring_equalLit (s, "nothing"))
01942 {
01943 return sRef_makeNothing ();
01944 }
01945 else if (cstring_equalLit (s, "internalState"))
01946 {
01947 return sRef_makeInternalState ();
01948 }
01949 else if (cstring_equalLit (s, "fileSystem")
01950 || cstring_equalLit (s, "systemState"))
01951 {
01952 return sRef_makeSystemState ();
01953 }
01954 else
01955 {
01956 voptgenerror
01957 (FLG_UNRECOG,
01958 message ("Unrecognized identifier in globals list: %s", s),
01959 g_currentloc);
01960
01961 return sRef_undefined;
01962 }
01963 }
|
|
|
Definition at line 1740 of file clabstract.c. 01741 {
01742 if (usymtab_existsEnumTag (id))
01743 {
01744 ctype ret = uentry_getAbstractType (usymtab_lookupEnumTag (id));
01745 cstring_free (id);
01746 return ret;
01747 }
01748 else
01749 {
01750 return (declareEnum (id, enumNameList_new ()));
01751 }
01752 }
|
|
|
Definition at line 1772 of file clabstract.c. 01773 {
01774 int paramno = 0;
01775
01776 /*
01777 ** this is a really YUCKY hack to handle old style
01778 ** declarations.
01779 */
01780
01781 voptgenerror (FLG_OLDSTYLE,
01782 cstring_makeLiteral ("Old style function declaration"),
01783 g_currentloc);
01784
01785 uentryList_elements (params, current)
01786 {
01787 uentry_setParam (current);
01788 uentry_setSref (current, sRef_makeParam (paramno, ctype_unknown));
01789 paramno++;
01790 } end_uentryList_elements;
01791
01792 setGenericParamList (params);
01793 g_expectingTypeName = TRUE;
01794
01795 return params;
01796 }
|
|
|
Definition at line 1798 of file clabstract.c. 01799 {
01800 if (flipOldStyle)
01801 {
01802 uentryList_fixMissingNames (params);
01803
01804 voptgenerror (FLG_OLDSTYLE,
01805 cstring_makeLiteral ("Old style function declaration."),
01806 g_currentloc);
01807
01808 setGenericParamList (params);
01809 flipOldStyle = FALSE;
01810 g_expectingTypeName = TRUE;
01811 }
01812
01813 return (params);
01814 }
|
|
|
Definition at line 1710 of file clabstract.c. 01711 {
01712 if (usymtab_existsStructTag (id))
01713 {
01714 ctype ct = uentry_getAbstractType (usymtab_lookupStructTag (id));
01715
01716 cstring_free (id);
01717 return ct;
01718 }
01719 else
01720 {
01721 return (ctype_createForwardStruct (id));
01722 }
01723 }
|
|
|
Definition at line 1725 of file clabstract.c. 01726 {
01727 if (usymtab_existsUnionTag (id))
01728 {
01729 ctype ret = uentry_getAbstractType (usymtab_lookupUnionTag (id));
01730 cstring_free (id);
01731 return (ret);
01732 }
01733 else
01734 {
01735 return (ctype_createForwardUnion (id));
01736 }
01737 }
|
|
|
Definition at line 1768 of file clabstract.c. 01768 { return flipOldStyle; }
|
|
|
Definition at line 1769 of file clabstract.c. 01769 { return flipNewStyle; }
|
|
|
Definition at line 1154 of file clabstract.c. 01155 {
01156 return (ProcessingGlobMods);
01157 }
|
|
|
Definition at line 384 of file clabstract.c. Referenced by exprNode_iterExpr(), exprNode_iterId(), and exprNode_iterNewId(). 00385 {
00386 llassert (ProcessingIterVars);
00387 return saveIterParamNo;
00388 }
|
|
|
Definition at line 395 of file clabstract.c. 00396 {
00397 uentry ue;
00398
00399 saveStoreLoc = fileloc_undefined;
00400
00401 /* param number unknown */
00402
00403 ue = uentry_makeParam (t, 0);
00404 return ue;
00405 }
|
|
|
Definition at line 2235 of file clabstract.c. 02236 {
02237 ctype ct = sRef_getType (s);
02238 ctype rt = ctype_realType (ct);
02239
02240 if (ctype_isAP (rt))
02241 {
02242 if (context_inHeader () && ctype_isAbstract (ct))
02243 {
02244 voptgenerror
02245 (FLG_ABSTRACT,
02246 message
02247 ("Modifies clause in header file indexes abstract "
02248 "type %s (interface modifies clause should not depend "
02249 "on or expose type representation): %q",
02250 ctype_unparse (ct),
02251 sRef_unparse (s)),
02252 g_currentloc);
02253 }
02254
02255 return (sRef_makeAnyArrayFetch (s));
02256 }
02257 else
02258 {
02259 voptgenerror
02260 (FLG_TYPE,
02261 message
02262 ("Implementation modifies clause uses array fetch on non-array (type %s): %q",
02263 ctype_unparse (ct), sRef_unparse (s)),
02264 g_currentloc);
02265 return s;
02266 }
02267 }
|
|
|
Definition at line 1965 of file clabstract.c. 01966 {
01967 ctype ct = sRef_getType (s);
01968 ctype rt = ctype_realType (ct);
01969
01970 if (ctype_isRealPointer (rt))
01971 {
01972 ctype b = ctype_baseArrayPtr (rt);
01973 ctype rb = ctype_realType (b);
01974
01975 if (ctype_isStructorUnion (rb))
01976 {
01977 uentry tf = uentryList_lookupField (ctype_getFields (rb), f);
01978
01979 if (uentry_isUndefined (tf))
01980 {
01981 voptgenerror (FLG_TYPE,
01982 message ("Modifies list arrow accesses non-existent "
01983 "field %s of %t: %q", f, b,
01984 sRef_unparse (s)),
01985 g_currentloc);
01986
01987 cstring_free (f);
01988 return sRef_undefined;
01989 }
01990 else
01991 {
01992 if (context_inHeader ())
01993 {
01994 if (ctype_isAbstract (b))
01995 {
01996 voptgenerror
01997 (FLG_ABSTRACT,
01998 message
01999 ("Modifies clause in header file arrow accesses abstract "
02000 "type %s (interface modifies clause should not depend "
02001 "on or expose type representation): %q",
02002 ctype_unparse (b),
02003 sRef_unparse (s)),
02004 g_currentloc);
02005 }
02006 }
02007 else
02008 {
02009 if (ctype_isAbstract (ct))
02010 {
02011 voptgenerror
02012 (FLG_ABSTRACT,
02013 message
02014 ("Modifies clause in header file arrow accesses abstract "
02015 "type %s (interface modifies clause should not depend "
02016 "on or expose type representation): %q",
02017 ctype_unparse (ct),
02018 sRef_unparse (s)),
02019 g_currentloc);
02020 }
02021 }
02022 }
02023
02024 cstring_markOwned (f);
02025 return (sRef_makeArrow (s, f));
02026 }
02027 else
02028 {
02029 voptgenerror
02030 (FLG_TYPE,
02031 message ("Modifies clause arrow accesses pointer to "
02032 "non-structure (type %s): %q",
02033 ctype_unparse (rt),
02034 sRef_unparse (s)),
02035 g_currentloc);
02036 }
02037 }
02038 else
02039 {
02040 voptgenerror
02041 (FLG_TYPE,
02042 message ("Modifies clause arrow accesses non-pointer (type %s): %q",
02043 ctype_unparse (rt),
02044 sRef_unparse (s)),
02045 g_currentloc);
02046 }
02047
02048 cstring_free (f);
02049 return s;
02050 }
|
|
|
Definition at line 1886 of file clabstract.c. 01887 {
01888 ctype ct = sRef_getType (s);
01889 ctype rt = ctype_realType (ct);
01890
01891 if (ctype_isStructorUnion (rt))
01892 {
01893 uentry tf = uentryList_lookupField (ctype_getFields (rt), f);
01894
01895 if (uentry_isUndefined (tf))
01896 {
01897 voptgenerror (FLG_TYPE,
01898 message ("Modifies list accesses non-existent "
01899 "field %s of %t: %q", f, ct,
01900 sRef_unparse (s)),
01901 g_currentloc);
01902
01903 cstring_free (f);
01904 return sRef_undefined;
01905 }
01906 else
01907 {
01908 if (ctype_isAbstract (ct) && context_inHeader ())
01909 {
01910 voptgenerror
01911 (FLG_ABSTRACT,
01912 message
01913 ("Modifies clause in header file accesses abstract "
01914 "type %s (interface modifies clause should not depend "
01915 "on or expose type representation): %q",
01916 ctype_unparse (ct),
01917 sRef_unparse (s)),
01918 g_currentloc);
01919 }
01920 }
01921
01922 cstring_markOwned (f);
01923 return (sRef_makeField (s, f));
01924 }
01925 else
01926 {
01927 voptgenerror
01928 (FLG_TYPE,
01929 message ("Modifies clause dereferences non-pointer (type %s): %q",
01930 ctype_unparse (rt),
01931 sRef_unparse (s)),
01932 g_currentloc);
01933
01934 cstring_free (f);
01935 return s;
01936 }
01937 }
|
|
|
Definition at line 1848 of file clabstract.c. 01849 {
01850 ctype ct = sRef_getType (s);
01851 ctype rt = ctype_realType (ct);
01852
01853 if (ctype_isAP (rt))
01854 {
01855 if (context_inHeader () && ctype_isAbstract (ct))
01856 {
01857 voptgenerror
01858 (FLG_ABSTRACT,
01859 message
01860 ("Modifies clause in header file dereferences abstract "
01861 "type %s (interface modifies clause should not depend "
01862 "on or expose type representation): %q",
01863 ctype_unparse (ct),
01864 sRef_unparse (s)),
01865 g_currentloc);
01866 }
01867
01868 return (sRef_constructPointer (s));
01869 }
01870 else
01871 {
01872 if (ctype_isKnown (rt))
01873 {
01874 voptgenerror
01875 (FLG_TYPE,
01876 message ("Implementation modifies clause dereferences non-pointer (type %s): %q",
01877 ctype_unparse (rt),
01878 sRef_unparse (s)),
01879 g_currentloc);
01880 }
01881
01882 return s;
01883 }
01884 }
|
|
|
Definition at line 378 of file clabstract.c. 00379 {
00380 llassert (ProcessingIterVars);
00381 saveIterParamNo++;
00382 }
|
|
|
Definition at line 1327 of file clabstract.c. 01328 {
01329 if (qtype_isUndefined (processingType))
01330 {
01331 llparseerror (message ("No type before declaration name: %q", idDecl_unparse (t)));
01332
01333 processingType = qtype_create (ctype_unknown);
01334 }
01335
01336 t = idDecl_fixBase (t, processingType);
01337
01338 DPRINTF (("Declare: %s", idDecl_unparse (t)));
01339
01340 if (ProcessingGlobals)
01341 {
01342 cstring id = idDecl_getName (t);
01343 uentry ue = usymtab_lookupSafe (id);
01344
01345 if (!uentry_isValid (ue))
01346 {
01347 llerror (FLG_UNRECOG,
01348 message ("Variable used in globals list is undeclared: %s", id));
01349 }
01350 else
01351 {
01352 if (!ctype_match (uentry_getType (ue), idDecl_getCtype (t)))
01353 {
01354 voptgenerror
01355 (FLG_INCONDEFS,
01356 message ("Variable %s used in globals list declared %s, "
01357 "but listed as %s",
01358 id, ctype_unparse (uentry_getType (ue)),
01359 ctype_unparse (idDecl_getCtype (t))),
01360 g_currentloc);
01361 }
01362 else
01363 {
01364 sRef sr = sRef_copy (uentry_getSref (ue));
01365
01366 reflectGlobalQualifiers (sr, idDecl_getQuals (t));
01367
01368 currentGlobals = globSet_insert (currentGlobals, sr);
01369 }
01370 }
01371 }
01372 else if (ProcessingVars)
01373 {
01374 uentry e;
01375 ctype ct;
01376
01377 ct = ctype_realType (idDecl_getCtype (t));
01378
01379 if (ProcessingParams)
01380 {
01381 cstring id = idDecl_getName (t);
01382 int paramno = uentryList_lookupRealName (saveParamList, id);
01383
01384 if (paramno >= 0)
01385 {
01386 uentry cparam = uentryList_getN (saveParamList, paramno);
01387
01388 uentry_setType (cparam, idDecl_getCtype (t));
01389 uentry_reflectQualifiers (cparam, idDecl_getQuals (t));
01390 uentry_setDeclaredOnly (cparam, context_getSaveLocation ());
01391 }
01392 else
01393 {
01394 llfatalerrorLoc
01395 (message ("Old style declaration uses unlisted parameter: %s",
01396 id));
01397 }
01398 }
01399 else
01400 {
01401 fileloc loc;
01402
01403 if (context_inIterDef ())
01404 {
01405 cstring pname = makeParam (idDecl_observeId (t));
01406 uentry p = usymtab_lookupSafe (pname);
01407
01408 cstring_free (pname);
01409
01410 if (uentry_isYield (p))
01411 {
01412 e = uentry_makeParam (t, sRef_getParam (uentry_getSref (p)));
01413
01414 uentry_checkYieldParam (p, e);
01415
01416 usymtab_supEntrySref (e);
01417 return;
01418 }
01419 }
01420
01421 if ((hasSpecialCode () || argsUsed)
01422 && ctype_isFunction (idDecl_getCtype (t)))
01423 {
01424 e = uentry_makeIdFunction (t);
01425 reflectSpecialCode (e);
01426 reflectArgsUsed (e);
01427 }
01428 else
01429 {
01430 e = uentry_makeIdVariable (t);
01431 }
01432
01433 loc = uentry_whereDeclared (e);
01434
01435 /*
01436 if (context_inGlobalScope ())
01437 {
01438 uentry_checkParams was here!
01439 }
01440 */
01441
01442 if (ctype_isFunction (uentry_getType (e)))
01443 {
01444 reflectModGlobs (e);
01445 }
01446 else
01447 {
01448 llassert (!globSet_isDefined (currentGlobals)
01449 && !sRefSet_isDefined (fcnModifies));
01450 }
01451
01452 e = usymtab_supEntrySrefReturn (e);
01453
01454 if (uentry_isExtern (e) && !context_inGlobalScope ())
01455 {
01456 voptgenerror
01457 (FLG_NESTEDEXTERN,
01458 message ("Declaration using extern inside function scope: %q",
01459 uentry_unparse (e)),
01460 g_currentloc);
01461
01462 uentry_setDefined (e, fileloc_getExternal ());
01463 sRef_setDefined (uentry_getSref (e), fileloc_getExternal ());
01464 }
01465
01466 if (uentry_isFunction (e))
01467 {
01468 uentry_checkParams (e);
01469 checkParamNames (e);
01470 }
01471
01472 if (uentry_isVar (e)
01473 && uentry_isCheckedUnknown (e))
01474 {
01475 sRef sr = uentry_getSref (e);
01476
01477 if (sRef_isLocalVar (sr))
01478 {
01479 if (context_getFlag (FLG_IMPCHECKMODINTERNALS))
01480 {
01481 uentry_setCheckMod (e);
01482 }
01483 else
01484 {
01485 uentry_setUnchecked (e);
01486 }
01487 }
01488 else if (sRef_isFileStatic (sr))
01489 {
01490 if (context_getFlag (FLG_IMPCHECKEDSTRICTSTATICS))
01491 {
01492 uentry_setCheckedStrict (e);
01493 }
01494 else if (context_getFlag (FLG_IMPCHECKEDSTATICS))
01495 {
01496 uentry_setChecked (e);
01497 }
01498 else if (context_getFlag (FLG_IMPCHECKMODSTATICS))
01499 {
01500 uentry_setCheckMod (e);
01501 }
01502 else
01503 {
01504 ;
01505 }
01506 }
01507 else /* real global */
01508 {
01509 llassert (sRef_isRealGlobal (sr));
01510
01511 if (context_getFlag (FLG_IMPCHECKEDSTRICTGLOBALS))
01512 {
01513 uentry_setCheckedStrict (e);
01514 }
01515 else if (context_getFlag (FLG_IMPCHECKEDGLOBALS))
01516 {
01517 uentry_setChecked (e);
01518 }
01519 else if (context_getFlag (FLG_IMPCHECKMODGLOBALS))
01520 {
01521 uentry_setCheckMod (e);
01522 }
01523 else
01524 {
01525 ;
01526 }
01527 }
01528 }
01529 }
01530 }
01531 else if (ProcessingTypedef)
01532 {
01533 ctype ct = idDecl_getCtype (t);
01534 uentry e;
01535
01536 DPRINTF (("Processing typedef: %s", ctype_unparse (ct)));
01537
01538 e = uentry_makeIdDatatype (t);
01539
01540 if (cstring_equal (idDecl_getName (t), context_getBoolName ())) {
01541 ctype rt = ctype_realType (ct);
01542
01543 if (ctype_isEnum (rt)) {
01544 ;
01545 } else {
01546 if (!(ctype_isInt (rt)
01547 || ctype_isUnknown (rt)
01548 || ctype_isChar (rt))) {
01549 (void) llgenerror
01550 (FLG_BOOLTYPE,
01551 message ("Boolean type %s defined using non-standard type %s (integral, char or enum type expected)",
01552 context_getBoolName (),
01553 ctype_unparse (ct)),
01554 uentry_whereLast (e));
01555 }
01556
01557 ct = ctype_bool;
01558 uentry_setType (e, ct);
01559 }
01560 }
01561
01562 reflectStorageClass (e);
01563 checkTypeDecl (e, ct);
01564
01565 e = usymtab_supReturnTypeEntry (e);
01566
01567 if (uentry_isMaybeAbstract (e))
01568 {
01569 if (context_getFlag (FLG_IMPABSTRACT))
01570 {
01571 uentry_setAbstract (e);
01572 }
01573 else
01574 {
01575 uentry_setConcrete (e);
01576 }
01577 }
01578 }
01579 else
01580 {
01581 llparseerror (message ("Suspect missing struct or union keyword: %q",
01582 idDecl_unparse (t)));
01583 }
01584
01585 }
|
|
|
Definition at line 1754 of file clabstract.c. Referenced by exprNode_iterExpr(). 01755 {
01756 return ProcessingIterVars;
01757 }
|
|
|
Definition at line 82 of file clabstract.c. 00083 {
00084 if (argsUsed)
00085 {
00086 voptgenerror
00087 (FLG_SYNTAX,
00088 cstring_makeLiteral ("Multiple ARGSUSED comments for one function"),
00089 g_currentloc);
00090 }
00091
00092 argsUsed = TRUE;
00093 }
|
|
|
Definition at line 577 of file clabstract.c. 00578 {
00579 currentParamList = ue;
00580 }
|
|
|
Definition at line 1767 of file clabstract.c. 01767 { flipOldStyle = TRUE; }
|
|
|
Definition at line 271 of file clabstract.c. 00272 {
00273 sRefSet_free (fcnModifies);
00274 fcnModifies = s;
00275 }
|
|
|
Definition at line 210 of file clabstract.c. 00211 {
00212 llassert (globSet_isUndefined (currentGlobals));
00213 fcnNoGlobals = TRUE;
00214 }
|
|
|
Definition at line 241 of file clabstract.c. 00243 {
00244 int tok = lltok_getTok (stok);
00245
00246 switch (tok)
00247 {
00248 case QUSES:
00249 specClauses = specialClauses_add (specClauses, specialClause_createUses (s));
00250 break;
00251 case QDEFINES:
00252 specClauses = specialClauses_add (specClauses, specialClause_createDefines (s));
00253 break;
00254 case QALLOCATES:
00255 specClauses = specialClauses_add (specClauses, specialClause_createAllocates (s));
00256 break;
00257 case QSETS:
00258 specClauses = specialClauses_add (specClauses, specialClause_createSets (s));
00259 break;
00260 case QRELEASES:
00261 specClauses = specialClauses_add (specClauses, specialClause_createReleases (s));
00262 break;
00263 default:
00264 sRefSet_free (s);
00265 BADBRANCH;
00266 }
00267
00268 DPRINTF (("Added to specclauses: %s", specialClauses_unparse (specClauses)));
00269 }
|
|
|
Definition at line 217 of file clabstract.c. 00220 {
00221 int tok = lltok_getTok (stok);
00222
00223 switch (tok)
00224 {
00225 case QPRECLAUSE:
00226 specClauses = specialClauses_add (specClauses,
00227 specialClause_create (TK_BEFORE, kind, s));
00228 break;
00229 case QPOSTCLAUSE:
00230 specClauses = specialClauses_add (specClauses,
00231 specialClause_create (TK_AFTER, kind, s));
00232 break;
00233 default:
00234 sRefSet_free (s);
00235 BADBRANCH;
00236 }
00237
00238 DPRINTF (("Added to specclauses: %s", specialClauses_unparse (specClauses)));
00239 }
|
|
|
Definition at line 1770 of file clabstract.c. 01770 { flipNewStyle = TRUE; }
|
|
|
Definition at line 1142 of file clabstract.c. 01143 {
01144 ProcessingGlobMods = TRUE;
01145 }
|
|
|
Definition at line 1120 of file clabstract.c. 01121 {
01122 ProcessingGlobals = TRUE;
01123
01124 llassert (globSet_isUndefined (currentGlobals));
01125 currentGlobals = globSet_undefined;
01126
01127 llassert (sRefSet_isUndefined (fcnModifies));
01128 fcnModifies = sRefSet_undefined;
01129
01130 /*
01131 ** No, special clauses might have been processed first!
01132 llassert (specialClauses_isUndefined (specClauses));
01133 specClauses = specialClauses_undefined;
01134 */
01135
01136 fcnNoGlobals = FALSE;
01137 }
|
|
|
Definition at line 1112 of file clabstract.c. 01113 {
01114 ProcessingIterVars = TRUE;
01115 currentIter = iter;
01116 saveIterParamNo = 0;
01117 }
|
|
|
Definition at line 1190 of file clabstract.c. 01191 {
01192 ProcessingTypedef = TRUE;
01193
01194 qtype_free (processingType);
01195 processingType = q;
01196 }
|
|
|
Definition at line 1175 of file clabstract.c. 01176 {
01177 ProcessingVars = TRUE;
01178 qtype_free (processingType);
01179 processingType = q;
01180 }
|
|
|
Definition at line 113 of file clabstract.c. 00114 {
00115 if (specialFunctionCode != QU_UNKNOWN)
00116 {
00117 voptgenerror (FLG_SYNTAX,
00118 message ("Multiple special function codes: %s, %s "
00119 "(first code is ignored)",
00120 qual_unparse (specialFunctionCode),
00121 qual_unparse (qu)),
00122 g_currentloc);
00123 }
00124
00125 specialFunctionCode = qu;
00126 }
|
|
|
Definition at line 1106 of file clabstract.c. 01107 {
01108 storageClass = sc;
01109 }
|
|
|
Definition at line 205 of file clabstract.c. 00206 {
00207 saveStoreLoc = g_currentloc;
00208 }
|
|
|
Definition at line 1169 of file clabstract.c. 01170 {
01171 ProcessingGlobals = FALSE;
01172 }
|
|
|
Definition at line 1273 of file clabstract.c. 01274 {
01275 ProcessingTypedef = FALSE;
01276 }
|
|
|
Definition at line 1199 of file clabstract.c. 01200 {
01201 resetStorageClass ();
01202 ProcessingVars = FALSE;
01203 }
|
1.2.3 written by Dimitri van Heesch,
© 1997-2000