typedef struct
{
typeIdSet access;
+ bool macro;
} *ucinfo;
typedef enum
extern /*@notnull@*/ /*@only@*/ uentry
uentry_makeConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f)
/*@*/ ;
+
+extern /*@only@*/ /*@notnull@*/ uentry
+ uentry_makeConstantValue (/*@temp@*/ cstring p_n, ctype p_t, /*@only@*/ fileloc p_f,
+ bool p_priv, multiVal p_val)
+ /*@*/ ;
+
+extern /*@notnull@*/ /*@only@*/ uentry
+ uentry_makeMacroConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f)
+ /*@*/ ;
+
extern /*@notnull@*/ /*@only@*/ uentry
uentry_makeConstantAux (/*@temp@*/ cstring p_n, ctype p_t,
- /*@keep@*/ fileloc p_f, bool p_priv,
+ /*@keep@*/ fileloc p_f, bool p_priv, bool p_macro,
/*@only@*/ multiVal p_m) /*@*/ ;
+
extern /*@notnull@*/ /*@only@*/ uentry
uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, ynm p_abstract,
/*@only@*/ fileloc p_f) /*@*/ ;
extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@only@*/ fileloc p_loc);
# ifdef DOANNOTS
-typedef enum { AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR,
- AN_CONST, AN_LAST
- } ancontext;
+typedef enum
+{
+ AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR,
+ AN_CONST, AN_LAST
+} ancontext;
extern void initAnnots ();
extern void printAnnots (void);
{
fileloc loc = fileloc_makePreproc (g_currentloc);
DPRINTF (("Make constant: %s", sname));
- le = uentry_makeConstant (sname,
- ctype_unknown, loc);
+ le = uentry_makeMacroConstant (sname, ctype_unknown, loc);
(void) usymtab_addEntry (le);
}
uentry_makeVariableAux (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f,
/*@exposed@*/ sRef p_s, bool p_priv, vkind p_kind);
+static /*@only@*/ /*@notnull@*/
+uentry uentry_makeConstantAux (cstring p_n, ctype p_t,
+ /*@keep@*/ fileloc p_f, bool p_priv, bool p_macro,
+ /*@only@*/ multiVal p_m) ;
+
static void uentry_convertVarFunction (uentry ue) /*@modifies ue@*/
{
if (uentry_isVariable (ue)
** constants
*/
-/*@only@*/ /*@notnull@*/
+static /*@only@*/ /*@notnull@*/
uentry uentry_makeConstantAux (cstring n, ctype t,
- /*@keep@*/ fileloc f, bool priv,
+ /*@keep@*/ fileloc f, bool priv, bool macro,
/*@only@*/ multiVal m)
{
uentry e = uentry_alloc ();
e->info = (uinfo) dmalloc (sizeof (*e->info));
e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
e->info->uconst->access = typeIdSet_undefined;
+ e->info->uconst->macro = macro;
uentry_setSpecDef (e, f);
/*@notnull@*/ uentry uentry_makeConstant (cstring n, ctype t, fileloc f)
{
- return (uentry_makeConstantAux (n, t, f, FALSE, multiVal_unknown ()));
+ return (uentry_makeConstantAux (n, t, f, FALSE, FALSE, multiVal_unknown ()));
+}
+
+
+{
+ return (uentry_makeConstantAux (n, t, f, priv, FALSE, val));
+}
+
+/*@notnull@*/ uentry uentry_makeMacroConstant (cstring n, ctype t, fileloc f)
+{
+ return (uentry_makeConstantAux (n, t, f, FALSE, TRUE, multiVal_unknown ()));
}
/*@notnull@*/ uentry uentry_makeIdConstant (idDecl t)
*/
usymtab_supGlobalEntry
- (uentry_makeConstantAux (context_getFalseName (), boolt,
- fileloc_getBuiltin (), FALSE,
- multiVal_makeInt (0)));
+ (uentry_makeConstantValue (context_getFalseName (), boolt,
+ fileloc_getBuiltin (), FALSE,
+ multiVal_makeInt (0)));
usymtab_supGlobalEntry
- (uentry_makeConstantAux (context_getTrueName (), boolt,
- fileloc_getBuiltin (), FALSE,
- multiVal_makeInt (1)));
+ (uentry_makeConstantValue (context_getTrueName (), boolt,
+ fileloc_getBuiltin (), FALSE,
+ multiVal_makeInt (1)));
}
}
if (i->value != (termNode)0 &&
i->value->kind == TRM_LITERAL)
{
- ue = uentry_makeConstantAux (s, ct, loc, priv,
- literalValue (ct, i->value->literal));
+ ue = uentry_makeConstantValue (s, ct, loc, priv, literalValue (ct, i->value->literal));
}
else
{
- ue = uentry_makeConstantAux (s, ct, loc, priv, multiVal_unknown ());
+ ue = uentry_makeConstantValue (s, ct, loc, priv, multiVal_unknown ());
}
-
- uentry_reflectQualifiers (ue, qtype_getQuals (qt));
-
+
+ uentry_reflectQualifiers (ue, qtype_getQuals (qt));
if (context_inLCLLib () && !priv)
{
Two bool values are compared directly using a C primitive. This may produce
unexpected results since all non-zero values are considered TRUE, so
different TRUE values may not be equal. The file bool.h (included in
- lclint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
+ splint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
suppress message)
preds.c:35:7: Test expression for if not bool, type char: c
Two bool values are compared directly using a C primitive. This may produce
unexpected results since all non-zero values are considered TRUE, so
different TRUE values may not be equal. The file bool.h (included in
- lclint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
+ splint/lib) provides bool_equal for safe bool comparisons. (-boolcompare will
suppress message)
preds.c:35:7: Test expression for if not bool, type char: c
bool.h:21:13: Function bool_initMod declared but not used