OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / c-decl.c
index eb29b17..2d21a43 100644 (file)
@@ -439,6 +439,18 @@ int warn_multichar = 1;
 #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.  */
@@ -3420,9 +3432,18 @@ start_decl (declarator, declspecs, initialized, attributes)
      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)))
@@ -4091,6 +4112,14 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
     {
       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])
@@ -5664,11 +5693,10 @@ finish_struct (t, fieldlist, attributes)
         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))
@@ -5679,7 +5707,7 @@ finish_struct (t, fieldlist, attributes)
            {
              /* 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)),
@@ -6947,11 +6975,6 @@ c_expand_body (fndecl, nested_p, can_defer_p)
 
   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