bool
warning_suppressed_at (location_t loc, opt_code opt /* = all_warnings */)
{
+ gcc_checking_assert (!RESERVED_LOCATION_P (loc));
+
if (!nowarn_map)
return false;
suppress_warning_at (location_t loc, opt_code opt /* = all_warnings */,
bool supp /* = true */)
{
+ gcc_checking_assert (!RESERVED_LOCATION_P (loc));
+
const nowarn_spec_t optspec (supp ? opt : opt_code ());
if (nowarn_spec_t *pspec = nowarn_map ? nowarn_map->get (loc) : NULL)
if (!nowarn_map)
return;
- if (nowarn_spec_t *pspec = nowarn_map->get (from))
- nowarn_map->put (to, *pspec);
+ nowarn_spec_t *from_spec;
+ if (RESERVED_LOCATION_P (from))
+ from_spec = NULL;
+ else
+ from_spec = nowarn_map->get (from);
+ if (RESERVED_LOCATION_P (to))
+ /* We cannot set no-warning dispositions for 'to', so we have no chance but
+ lose those potentially set for 'from'. */
+ ;
else
- nowarn_map->remove (to);
+ {
+ if (from_spec)
+ nowarn_map->put (to, *from_spec);
+ else
+ nowarn_map->remove (to);
+ }
}
{
const location_t loc = get_location (expr);
- if (loc == UNKNOWN_LOCATION)
+ if (RESERVED_LOCATION_P (loc))
return NULL;
if (!get_no_warning_bit (expr))
{
const location_t loc = get_location (stmt);
+ if (RESERVED_LOCATION_P (loc))
+ return NULL;
+
if (!get_no_warning_bit (stmt))
return NULL;
const location_t loc = get_location (expr);
- supp = suppress_warning_at (loc, opt, supp) || supp;
+ if (!RESERVED_LOCATION_P (loc))
+ supp = suppress_warning_at (loc, opt, supp) || supp;
set_no_warning_bit (expr, supp);
}
const location_t loc = get_location (stmt);
- supp = suppress_warning_at (loc, opt, supp) || supp;
+ if (!RESERVED_LOCATION_P (loc))
+ supp = suppress_warning_at (loc, opt, supp) || supp;
set_no_warning_bit (stmt, supp);
}
{
const location_t to_loc = get_location (to);
- if (nowarn_spec_t *from_map = get_nowarn_spec (from))
- {
- /* If there's an entry in the map the no-warning bit must be set. */
- gcc_assert (get_no_warning_bit (from));
+ bool supp = get_no_warning_bit (from);
- gcc_checking_assert (nowarn_map);
- nowarn_map->put (to_loc, *from_map);
- set_no_warning_bit (to, true);
- }
+ nowarn_spec_t *from_spec = get_nowarn_spec (from);
+ if (RESERVED_LOCATION_P (to_loc))
+ /* We cannot set no-warning dispositions for 'to', so we have no chance but
+ lose those potentially set for 'from'. */
+ ;
else
{
- if (nowarn_map)
- nowarn_map->remove (to_loc);
-
- /* The no-warning bit might be set even if there's no entry
- in the map. */
- set_no_warning_bit (to, get_no_warning_bit (from));
+ if (from_spec)
+ {
+ /* If there's an entry in the map the no-warning bit must be set. */
+ gcc_assert (supp);
+
+ gcc_checking_assert (nowarn_map);
+ nowarn_map->put (to_loc, *from_spec);
+ }
+ else
+ {
+ if (nowarn_map)
+ nowarn_map->remove (to_loc);
+ }
}
+
+ /* The no-warning bit might be set even if the map has not been consulted, or
+ otherwise if there's no entry in the map. */
+ set_no_warning_bit (to, supp);
}
/* Copy the warning disposition mapping from one expression to another. */