]> git.pld-linux.org Git - packages/gcc.git/blob - gcc-unnecessary_anonymous_warning.patch
- up from gcc-4_2-branch branch
[packages/gcc.git] / gcc-unnecessary_anonymous_warning.patch
1 --- gcc-4.2.0-20070501/gcc/c-common.h.orig      2006-08-17 03:02:55.000000000 -0400
2 +++ gcc-4.2.0-20070501/gcc/c-common.h   2007-05-03 10:20:24.674526804 -0400
3 @@ -698,6 +698,7 @@
4  extern int self_promoting_args_p (tree);
5  extern tree strip_array_types (tree);
6  extern tree strip_pointer_operator (tree);
7 +extern tree strip_pointer_or_array_types (tree);
8  extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
9  
10  /* This is the basic parsing function.  */
11 --- gcc-4.2.0-20070501/gcc/c-common.c.orig      2007-03-12 14:50:38.000000000 -0400
12 +++ gcc-4.2.0-20070501/gcc/c-common.c   2007-05-03 10:20:00.282869853 -0400
13 @@ -3604,6 +3604,15 @@
14    return t;
15  }
16  
17 +/* Recursively remove pointer or array type from TYPE. */
18 +tree
19 +strip_pointer_or_array_types (tree t)
20 +{
21 +  while (TREE_CODE (t) == ARRAY_TYPE || POINTER_TYPE_P (t))
22 +    t = TREE_TYPE (t);
23 +  return t;
24 +}
25 +
26  /* Used to compare case labels.  K1 and K2 are actually tree nodes
27     representing case labels, or NULL_TREE for a `default' label.
28     Returns -1 if K1 is ordered before K2, -1 if K1 is ordered after
29 --- gcc-4.2.0-20070501/gcc/cp/decl2.c.orig      2006-12-06 12:41:29.000000000 -0500
30 +++ gcc-4.2.0-20070501/gcc/cp/decl2.c   2007-05-03 10:18:55.360665142 -0400
31 @@ -1855,13 +1855,17 @@
32    for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
33      if (TREE_CODE (t) == FIELD_DECL && TREE_TYPE (t) != error_mark_node)
34        {
35 -       tree ftype = strip_array_types (TREE_TYPE (t));
36 +       tree ftype = strip_pointer_or_array_types (TREE_TYPE (t));
37         int subvis = type_visibility (ftype);
38  
39         if (subvis == VISIBILITY_ANON)
40 -         warning (0, "\
41 +         {
42 +           if (strcmp (main_input_filename,
43 +                       DECL_SOURCE_FILE (TYPE_MAIN_DECL (ftype))))
44 +             warning (0, "\
45  %qT has a field %qD whose type uses the anonymous namespace",
46 -                  type, t);
47 +                      type, t);
48 +         }
49         else if (IS_AGGR_TYPE (ftype)
50                  && vis < VISIBILITY_HIDDEN
51                  && subvis >= VISIBILITY_HIDDEN)
52 @@ -1876,9 +1880,13 @@
53        int subvis = type_visibility (TREE_TYPE (t));
54  
55        if (subvis == VISIBILITY_ANON)
56 -       warning (0, "\
57 +        {
58 +         if (strcmp (main_input_filename,
59 +                     DECL_SOURCE_FILE (TYPE_MAIN_DECL (TREE_TYPE (t)))))
60 +           warning (0, "\
61  %qT has a base %qT whose type uses the anonymous namespace",
62 -                type, TREE_TYPE (t));
63 +                    type, TREE_TYPE (t));
64 +       }
65        else if (vis < VISIBILITY_HIDDEN
66                && subvis >= VISIBILITY_HIDDEN)
67         warning (OPT_Wattributes, "\
This page took 0.031166 seconds and 3 git commands to generate.