#endif
int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
+/* States indicating how grokdeclarator() should handle declspecs marked
+ with __attribute__((deprecated)). An object declared as
+ __attribute__((deprecated)) suppresses warnings of uses of other
+ deprecated items. */
+
+enum deprecated_states {
+ DEPRECATED_NORMAL,
+ DEPRECATED_SUPPRESS
+};
+
+static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
+
/* Decode the string P as a language-specific option for C.
Return the number of strings consumed. Should not complain
if it does not recognise the option. */
int initialized;
tree attributes;
{
- tree decl = grokdeclarator (declarator, declspecs,
- NORMAL, initialized);
+ tree decl;
tree tem;
+
+ /* An object declared as __attribute__((deprecated)) suppresses
+ warnings of uses of other deprecated items. */
+ if (lookup_attribute ("deprecated", attributes))
+ deprecated_state = DEPRECATED_SUPPRESS;
+
+ decl = grokdeclarator (declarator, declspecs,
+ NORMAL, initialized);
+
+ deprecated_state = DEPRECATED_NORMAL;
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
&& MAIN_NAME_P (DECL_NAME (decl)))
{
tree id = TREE_VALUE (spec);
+ /* If the entire declaration is itself tagged as deprecated then
+ suppress reports of deprecated items. */
+ if (id && TREE_DEPRECATED (id))
+ {
+ if (deprecated_state != DEPRECATED_SUPPRESS)
+ warn_deprecated_use (id);
+ }
+
if (id == ridpointers[(int) RID_INT])
explicit_int = 1;
if (id == ridpointers[(int) RID_CHAR])
field widths. */
if (DECL_INITIAL (x))
{
- int max_width;
- if (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node)
- max_width = CHAR_TYPE_SIZE;
- else
- max_width = TYPE_PRECISION (TREE_TYPE (x));
+ int max_width
+ = (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node
+ ? CHAR_TYPE_SIZE : TYPE_PRECISION (TREE_TYPE (x)));
+
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
error_with_decl (x, "negative width in bit-field `%s'");
else if (0 < compare_tree_int (DECL_INITIAL (x), max_width))
{
/* The test above has assured us that TREE_INT_CST_HIGH is 0. */
unsigned HOST_WIDE_INT width
- = TREE_INT_CST_LOW (DECL_INITIAL (x));
+ = tree_low_cst (DECL_INITIAL (x), 1);
if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
&& (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
timevar_push (TV_EXPAND);
- if (DECL_INLINE (fndecl))
- /* Do any preparation such as emitting abstract debug info for the
- inline before it gets mangled by optimization. */
- (*debug_hooks->outlining_inline_function) (fndecl);
-
if (nested_p)
{
/* Make sure that we will evaluate variable-sized types involved