stmt->no_warning = value;
}
-/* Return EXPR location or zero. */
+/* Return EXPR location or 'UNKNOWN_LOCATION'. */
-static inline key_type_t
-convert_to_key (const_tree expr)
+static inline location_t
+get_location (const_tree expr)
{
if (DECL_P (expr))
return DECL_SOURCE_LOCATION (expr);
if (EXPR_P (expr))
return EXPR_LOCATION (expr);
- return 0;
+ return UNKNOWN_LOCATION;
}
-/* Return STMT location (may be zero). */
+/* Return STMT location (may be 'UNKNOWN_LOCATION'). */
-static inline key_type_t
-convert_to_key (const gimple *stmt)
+static inline location_t
+get_location (const gimple *stmt)
{
return gimple_location (stmt);
}
static nowarn_spec_t *
get_nowarn_spec (const_tree expr)
{
- const key_type_t key = convert_to_key (expr);
+ const location_t loc = get_location (expr);
- if (!get_no_warning_bit (expr) || !key)
+ if (loc == UNKNOWN_LOCATION)
return NULL;
- return nowarn_map ? nowarn_map->get (key) : NULL;
+ if (!get_no_warning_bit (expr))
+ return NULL;
+
+ return nowarn_map ? nowarn_map->get (loc) : NULL;
}
/* Return the no-warning bitmap for stateemt STMT. */
static nowarn_spec_t *
get_nowarn_spec (const gimple *stmt)
{
- const key_type_t key = convert_to_key (stmt);
+ const location_t loc = get_location (stmt);
if (!get_no_warning_bit (stmt))
return NULL;
- return nowarn_map ? nowarn_map->get (key) : NULL;
+ return nowarn_map ? nowarn_map->get (loc) : NULL;
}
/* Return true if warning OPT is suppressed for decl/expression EXPR.
if (opt == no_warning)
return;
- const key_type_t key = convert_to_key (expr);
+ const location_t loc = get_location (expr);
- supp = suppress_warning_at (key, opt, supp) || supp;
+ supp = suppress_warning_at (loc, opt, supp) || supp;
set_no_warning_bit (expr, supp);
}
if (opt == no_warning)
return;
- const key_type_t key = convert_to_key (stmt);
+ const location_t loc = get_location (stmt);
- supp = suppress_warning_at (key, opt, supp) || supp;
+ supp = suppress_warning_at (loc, opt, supp) || supp;
set_no_warning_bit (stmt, supp);
}
template <class ToType, class FromType>
void copy_warning (ToType to, FromType from)
{
- const key_type_t to_key = convert_to_key (to);
+ const location_t to_loc = get_location (to);
if (nowarn_spec_t *from_map = get_nowarn_spec (from))
{
gcc_assert (get_no_warning_bit (from));
gcc_checking_assert (nowarn_map);
- nowarn_map->put (to_key, *from_map);
+ nowarn_map->put (to_loc, *from_map);
set_no_warning_bit (to, true);
}
else
{
if (nowarn_map)
- nowarn_map->remove (to_key);
+ nowarn_map->remove (to_loc);
/* The no-warning bit might be set even if there's no entry
in the map. */