static void context_exitClausePlain (void) /*@modifies gc@*/ ;
static void context_setJustPopped (void) /*@modifies gc.justpopped@*/ ;
static void context_setValue (flagcode p_flag, int p_val) /*@modifies gc.flags@*/ ;
-static void context_setFlag (flagcode p_f, bool p_b)
+static void context_setFlag (flagcode p_f, bool p_b, fileloc p_loc)
/*@modifies gc.flags@*/ ;
static void
- context_setFlagAux (flagcode p_f, bool p_b, bool p_inFile, bool p_isRestore)
+ context_setFlagAux (flagcode p_f, bool p_b, bool p_inFile,
+ bool p_isRestore, fileloc p_loc)
/*@modifies gc.flags@*/ ;
-static void context_restoreFlag (flagcode p_f) /*@modifies gc.flags@*/ ;
+static void context_restoreFlag (flagcode p_f, fileloc p_loc)
+ /*@modifies gc.flags@*/ ;
/*@+enumindex@*/
}
void
-context_addComment (/*@only@*/ cstring def)
+context_addComment (/*@only@*/ cstring def, fileloc loc)
{
- DPRINTF (("macro comment: %s", def));
- macrocache_addComment (gc.mc, fileloc_copy (g_currentloc), def);
+ macrocache_addComment (gc.mc, fileloc_copy (loc), def);
}
/*
}
void
-context_enterSuppressRegion (void)
+context_enterSuppressRegion (fileloc loc)
{
if (gc.insuppressregion)
{
gc.insuppressregion = FALSE; /* get this msg! */
llmsg (message
("%q: New ignore errors region entered while in ignore errors region",
- fileloc_unparse (g_currentloc)));
+ fileloc_unparse (loc)));
}
gc.insuppressregion = TRUE;
- flagMarkerList_add (gc.markers, flagMarker_createIgnoreOn (g_currentloc));
+ (void) flagMarkerList_add (gc.markers, flagMarker_createIgnoreOn (loc));
}
static void
-context_addFlagMarker (flagcode code, ynm set)
+context_addFlagMarker (flagcode code, ynm set, fileloc loc)
{
- flagMarkerList_add (gc.markers,
- flagMarker_createLocalSet (code, set, g_currentloc));
+ (void) flagMarkerList_add (gc.markers,
+ flagMarker_createLocalSet (code, set, loc));
}
void
-context_enterSuppressLine (int count)
+context_enterSuppressLine (int count, fileloc loc)
{
- fileloc nextline = fileloc_copy (g_currentloc);
+ if (context_processingMacros ())
+ {
+ return;
+ }
- flagMarkerList_add (gc.markers,
- flagMarker_createIgnoreCount (count, g_currentloc));
+ if (flagMarkerList_add
+ (gc.markers,
+ flagMarker_createIgnoreCount (count, loc)))
+ {
+ fileloc nextline = fileloc_copy (loc);
+ fileloc_nextLine (nextline);
+ fileloc_setColumn (nextline, 0);
- fileloc_nextLine (nextline);
- flagMarkerList_add (gc.markers,
- flagMarker_createIgnoreOff (nextline));
- fileloc_free (nextline);
+ check (flagMarkerList_add (gc.markers,
+ flagMarker_createIgnoreOff (nextline)));
+ fileloc_free (nextline);
+ }
}
void context_checkSuppressCounts (void)
}
void
-context_exitSuppressRegion (void)
+context_exitSuppressRegion (fileloc loc)
{
if (!gc.insuppressregion)
{
- llerrorlit (FLG_SYNTAX,
- "End ignore errors in region while not ignoring errors");
+ voptgenerror
+ (FLG_SYNTAX,
+ message ("End ignore errors in region while not ignoring errors"),
+ loc);
}
-
- gc.insuppressregion = FALSE;
- flagMarkerList_add (gc.markers, flagMarker_createIgnoreOff (g_currentloc));
+
+ gc.insuppressregion = FALSE;
+ (void) flagMarkerList_add (gc.markers, flagMarker_createIgnoreOff (loc));
}
void
void
context_resetModeFlags (void)
-{
-
+{
allFlagCodes (code)
{
if (flagcode_isModeFlag (code))
{
- context_setFlag (code, FALSE);
+ context_setFlag (code, FALSE, g_currentloc);
}
} end_allFlagCodes;
}
gc.flags[FLG_ZEROPTR] = TRUE;
gc.flags[FLG_NUMLITERAL] = TRUE;
gc.flags[FLG_DUPLICATEQUALS] = TRUE;
- gc.flags[FLG_SKIPANSIHEADERS] = TRUE;
+ gc.flags[FLG_SKIPISOHEADERS] = TRUE;
gc.flags[FLG_SKIPPOSIXHEADERS] = TRUE;
gc.flags[FLG_SYSTEMDIREXPAND] = TRUE;
gc.flags[FLG_UNRECOGCOMMENTS] = TRUE;
if (!flagcode_isModeFlag (modeflags[i])) \
{ llbug (message ("not a mode flag: %s", \
flagcode_unparse (modeflags[i]))); } \
- else { context_setFlag (modeflags[i], TRUE); } i++; }}
+ else { context_setFlag (modeflags[i], TRUE, g_currentloc); } i++; }}
static void context_setModeAux (cstring p_s, bool p_warn) ;
FLG_LOOPLOOPBREAK, FLG_SWITCHLOOPBREAK, FLG_MODGLOBS,
FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS,
FLG_MACROMATCHNAME, FLG_WARNLINTCOMMENTS,
- FLG_INCLUDENEST, FLG_ANSIRESERVED, FLG_CPPNAMES,
+ FLG_INCLUDENEST, FLG_ISORESERVED, FLG_CPPNAMES,
FLG_NOPARAMS, FLG_IFEMPTY, FLG_WHILEEMPTY, FLG_REALCOMPARE,
FLG_BOOLOPS, FLG_SHIFTNEGATIVE,
FLG_SHIFTIMPLEMENTATION,
FLG_PTRNUMCOMPARE,
FLG_BOOLCOMPARE, FLG_UNSIGNEDCOMPARE,
FLG_NOEFFECT, FLG_RETVALINT, FLG_RETVALBOOL, FLG_RETVALOTHER,
- FLG_ANSIRESERVED, FLG_ANSIRESERVEDLOCAL, FLG_CPPNAMES,
+ FLG_ISORESERVED, FLG_ISORESERVEDLOCAL, FLG_CPPNAMES,
FLG_RETVALBOOL, FLG_RETVALINT, FLG_SPECUNDEF,
FLG_DECLUNDEF, FLG_STRICTOPS, FLG_INCONDEFS,
FLG_MISPLACEDSHAREQUAL, FLG_REDUNDANTSHAREQUAL,
FLG_IMPCHECKEDSTRICTSPECGLOBALS,
FLG_IMPCHECKMODINTERNALS,
FLG_WARNMISSINGGLOBALS, FLG_WARNMISSINGGLOBALSNOGLOBS,
- FLG_WARNLINTCOMMENTS, FLG_ANSIRESERVEDLOCAL,
+ FLG_WARNLINTCOMMENTS, FLG_ISORESERVEDLOCAL,
FLG_INCLUDENEST, FLG_STRINGLITERALLEN,
FLG_NUMSTRUCTFIELDS, FLG_NUMENUMMEMBERS,
FLG_CONTROLNESTDEPTH,
{
llerror_flagWarning (message ("Value for %s must be a positive "
- "number (given %d)",
- flagcode_unparse (flag), val));
+ "number (given %d)",
+ flagcode_unparse (flag), val));
return;
}
if (flag == FLG_LINELEN && val < MINLINELEN)
{
llerror_flagWarning (message ("Value for %s must be at least %d (given %d)",
- flagcode_unparse (flag),
- MINLINELEN, val));
+ flagcode_unparse (flag),
+ MINLINELEN, val));
val = MINLINELEN;
}
break;
{
int n = cstring_length (tval) - 1;
- while (isspace ((int) cstring_getChar (tval, n)))
+ while (isspace ((int) cstring_getChar (tval, size_fromInt (n))))
{
n--;
}
- if (cstring_getChar (tval, n) != '\"')
+ if (cstring_getChar (tval, size_fromInt (n)) != '\"')
{
llerror_flagWarning (message ("Setting -systemdirs to string with unmatching quotes: %s", val));
}
else
{
cstring otval = tval;
- tval = cstring_prefix (tval, n);
+ tval = cstring_prefix (tval, size_fromInt (n));
cstring_free (otval);
}
}
{
if (gc.flags[FLG_EXPORTHEADER])
{
- llerror_flagWarning (cstring_makeLiteral
- ("setting +neverinclude after +exportheader. "
- "Turning off exportheader, since headers are not checked "
- "when +neverinclude is used."));
+ llerror_flagWarning
+ (cstring_makeLiteral
+ ("setting +neverinclude after +exportheader. "
+ "Turning off exportheader, since headers are not checked "
+ "when +neverinclude is used."));
gc.flags[FLG_EXPORTHEADER] = FALSE;
}
{
if (gc.flags[FLG_NEVERINCLUDE])
{
- llerror_flagWarning (cstring_makeLiteral
- ("setting +exportheader after +neverinclude. "
- "Not setting exportheader, since headers are not checked "
- "when +neverinclude is used."));
+ llerror_flagWarning
+ (cstring_makeLiteral
+ ("setting +exportheader after +neverinclude. "
+ "Not setting exportheader, since headers are not checked "
+ "when +neverinclude is used."));
gc.flags[FLG_EXPORTHEADER] = FALSE;
return;
}
&& !flagcode_isIdemFlag (f)
&& !flagcode_hasArgument (f))
{
- llerror_flagWarning (message ("setting %s%s redundant with current value",
- cstring_makeLiteralTemp (b ? "+" : "-"),
- flagcode_unparse (f)));
+ llerror_flagWarning
+ (message ("setting %s%s redundant with current value",
+ cstring_makeLiteralTemp (b ? "+" : "-"),
+ flagcode_unparse (f)));
}
}
{
if (!context_getFlag (FLG_WARNUSE))
{
- llerror_flagWarning (message ("flag +%s is canceled by -warnuse",
- flagcode_unparse (f)));
-
+ llerror_flagWarning
+ (message ("flag +%s is canceled by -warnuse",
+ flagcode_unparse (f)));
}
}
if (gc.library != FLG_ANSILIB
&& gc.library != f)
{
- llerror_flagWarning (message ("selecting library %s after library %s was "
- "selected (only one library may be used)",
- flagcode_unparse (f),
- flagcode_unparse (gc.library)));
+ llerror_flagWarning
+ (message ("selecting library %s after library %s was "
+ "selected (only one library may be used)",
+ flagcode_unparse (f),
+ flagcode_unparse (gc.library)));
}
-
+
if (f == FLG_UNIXLIB)
{
if (context_getFlag (FLG_WARNUNIXLIB))
{
- llerror_flagWarning (cstring_makeLiteral
- ("selecting unix library. Unix library is "
- "ad hoc addition to POSIX library. Recommend "
- "use +posixlib to select POSIX library instead. "
- "Use -warnunixlib to suppress this message."));
+ llerror_flagWarning
+ (cstring_makeLiteral
+ ("selecting unix library. Unix library is "
+ "ad hoc addition to POSIX library. Recommend "
+ "use +posixlib to select POSIX library instead. "
+ "Use -warnunixlib to suppress this message."));
}
}
gc.library = f;
}
-
+
if (flagcode_isNameChecksFlag (f) && b && !context_maybeSet (FLG_NAMECHECKS))
{
- llerror_flagWarning (message
- ("setting +%s will not produce warnings with -namechecks. Must set +namechecks also.",
- flagcode_unparse (f)));
+ llerror_flagWarning
+ (message
+ ("setting +%s will not produce warnings with -namechecks. "
+ "Must set +namechecks also.",
+ flagcode_unparse (f)));
}
-
+
gc.setGlobally[f] = TRUE;
- context_setFlag (f, b);
+ context_setFlag (f, b, g_currentloc);
}
void
-context_fileSetFlag (flagcode f, ynm set)
+context_fileSetFlag (flagcode f, ynm set, fileloc loc)
{
if (!gc.savedFlags)
{
if (ynm_isOff (set))
{
- context_setFlagAux (f, FALSE, TRUE, FALSE);
+ context_setFlagAux (f, FALSE, TRUE, FALSE, loc);
}
else if (ynm_isOn (set))
{
- context_setFlagAux (f, TRUE, TRUE, FALSE);
+ context_setFlagAux (f, TRUE, TRUE, FALSE, loc);
gc.setLocally[f] = TRUE;
}
else
{
- context_restoreFlag (f);
+ context_restoreFlag (f, loc);
}
}
static void
-context_restoreFlag (flagcode f)
+context_restoreFlag (flagcode f, fileloc loc)
{
-
if (!gc.savedFlags)
{
voptgenerror
message ("Attempt to restore flag %s when no file scope flags "
"have been set.",
flagcode_unparse (f)),
- g_currentloc);
+ loc);
}
else
{
- context_addFlagMarker (f, MAYBE);
- context_setFlagAux (f, gc.saveflags[f], FALSE, TRUE);
+ context_addFlagMarker (f, MAYBE, loc);
+ context_setFlagAux (f, gc.saveflags[f], FALSE, TRUE, loc);
}
}
static void
-context_setFlag (flagcode f, bool b)
+context_setFlag (flagcode f, bool b, fileloc loc)
{
- context_setFlagAux (f, b, FALSE, FALSE);
+ context_setFlagAux (f, b, FALSE, FALSE, loc);
}
void
/*@notfunction@*/
# define DOSET(ff,b) \
do { if (inFile) { gc.setLocally[ff] = TRUE; \
- context_addFlagMarker (ff, ynm_fromBool (b)); } \
+ context_addFlagMarker (ff, ynm_fromBool (b), loc); } \
DPRINTF (("set flag: %s / %s", flagcode_unparse (ff), bool_unparse (b))); \
gc.flags[ff] = b; } while (FALSE)
static void
context_setFlagAux (flagcode f, bool b, bool inFile,
- /*@unused@*/ bool isRestore)
+ /*@unused@*/ bool isRestore, fileloc loc)
{
DPRINTF (("Set flag: %s / %s", flagcode_unparse (f), bool_unparse (b)));