~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to build/unix/build-toolchain/plugin_finish_decl.diff

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: gcc/doc/plugins.texi
2
 
===================================================================
3
 
--- gcc/doc/plugins.texi        (revision 162126)
4
 
+++ gcc/doc/plugins.texi        (working copy)
5
 
@@ -144,6 +144,7 @@
6
 
 @{
7
 
   PLUGIN_PASS_MANAGER_SETUP,    /* To hook into pass manager.  */
8
 
   PLUGIN_FINISH_TYPE,           /* After finishing parsing a type.  */
9
 
+  PLUGIN_FINISH_DECL,           /* After finishing parsing a declaration. */
10
 
   PLUGIN_FINISH_UNIT,           /* Useful for summary processing.  */
11
 
   PLUGIN_PRE_GENERICIZE,        /* Allows to see low level AST in C and C++ frontends.  */
12
 
   PLUGIN_FINISH,                /* Called before GCC exits.  */
13
 
Index: gcc/plugin.def
14
 
===================================================================
15
 
--- gcc/plugin.def      (revision 162126)
16
 
+++ gcc/plugin.def      (working copy)
17
 
@@ -24,6 +24,9 @@
18
 
 /* After finishing parsing a type.  */
19
 
 DEFEVENT (PLUGIN_FINISH_TYPE)
20
 
 
21
 
+/* After finishing parsing a declaration. */
22
 
+DEFEVENT (PLUGIN_FINISH_DECL)
23
 
+
24
 
 /* Useful for summary processing.  */
25
 
 DEFEVENT (PLUGIN_FINISH_UNIT)
26
 
 
27
 
Index: gcc/testsuite/g++.dg/plugin/plugin.exp
28
 
===================================================================
29
 
--- gcc/testsuite/g++.dg/plugin/plugin.exp      (revision 162126)
30
 
+++ gcc/testsuite/g++.dg/plugin/plugin.exp      (working copy)
31
 
@@ -51,7 +51,8 @@
32
 
     { pragma_plugin.c pragma_plugin-test-1.C } \
33
 
     { selfassign.c self-assign-test-1.C self-assign-test-2.C self-assign-test-3.C } \
34
 
     { dumb_plugin.c dumb-plugin-test-1.C } \
35
 
-    { header_plugin.c header-plugin-test.C } ]
36
 
+    { header_plugin.c header-plugin-test.C } \
37
 
+    { decl_plugin.c decl-plugin-test.C } ]
38
 
 
39
 
 foreach plugin_test $plugin_test_list {
40
 
     # Replace each source file with its full-path name
41
 
Index: gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
42
 
===================================================================
43
 
--- gcc/testsuite/g++.dg/plugin/decl-plugin-test.C      (revision 0)
44
 
+++ gcc/testsuite/g++.dg/plugin/decl-plugin-test.C      (revision 0)
45
 
@@ -0,0 +1,32 @@
46
 
+
47
 
+
48
 
+extern int global; // { dg-warning "Decl Global global" }
49
 
+int global_array[] = { 1, 2, 3 }; // { dg-warning "Decl Global global_array" }
50
 
+
51
 
+int takes_args(int arg1, int arg2)
52
 
+{
53
 
+  int local = arg1 + arg2 + global; // { dg-warning "Decl Local local" }
54
 
+  return local + 1;
55
 
+}
56
 
+
57
 
+int global = 12; // { dg-warning "Decl Global global" }
58
 
+
59
 
+struct test_str {
60
 
+  int field; // { dg-warning "Decl Field field" }
61
 
+};
62
 
+
63
 
+class test_class {
64
 
+  int class_field1; // { dg-warning "Decl Field class_field1" }
65
 
+  int class_field2; // { dg-warning "Decl Field class_field2" }
66
 
+
67
 
+  test_class() // { dg-warning "Decl Function test_class" }
68
 
+    : class_field1(0), class_field2(0)
69
 
+  {}
70
 
+
71
 
+  void swap_fields(int bias) // { dg-warning "Decl Function swap_fields" }
72
 
+  {
73
 
+    int temp = class_field1 + bias; // { dg-warning "Decl Local temp" }
74
 
+    class_field1 = class_field2 - bias;
75
 
+    class_field2 = temp;
76
 
+  }
77
 
+};
78
 
Index: gcc/testsuite/g++.dg/plugin/decl_plugin.c
79
 
===================================================================
80
 
--- gcc/testsuite/g++.dg/plugin/decl_plugin.c   (revision 0)
81
 
+++ gcc/testsuite/g++.dg/plugin/decl_plugin.c   (revision 0)
82
 
@@ -0,0 +1,51 @@
83
 
+/* A plugin example that shows which declarations are caught by FINISH_DECL */
84
 
+
85
 
+#include "gcc-plugin.h"
86
 
+#include <stdlib.h>
87
 
+#include "config.h"
88
 
+#include "system.h"
89
 
+#include "coretypes.h"
90
 
+#include "tree.h"
91
 
+#include "tree-pass.h"
92
 
+#include "intl.h"
93
 
+
94
 
+int plugin_is_GPL_compatible;
95
 
+
96
 
+/* Callback function to invoke after GCC finishes a declaration. */
97
 
+
98
 
+void plugin_finish_decl (void *event_data, void *data)
99
 
+{
100
 
+  tree decl = (tree) event_data;
101
 
+
102
 
+  const char *kind = NULL;
103
 
+  switch (TREE_CODE(decl)) {
104
 
+  case FUNCTION_DECL:
105
 
+    kind = "Function"; break;
106
 
+  case PARM_DECL:
107
 
+    kind = "Parameter"; break;
108
 
+  case VAR_DECL:
109
 
+    if (DECL_CONTEXT(decl) != NULL)
110
 
+      kind = "Local";
111
 
+    else
112
 
+      kind = "Global";
113
 
+    break;
114
 
+  case FIELD_DECL:
115
 
+    kind = "Field"; break;
116
 
+  default:
117
 
+    kind = "Unknown";
118
 
+  }
119
 
+
120
 
+  warning (0, G_("Decl %s %s"),
121
 
+           kind, IDENTIFIER_POINTER (DECL_NAME (decl)));
122
 
+}
123
 
+
124
 
+int
125
 
+plugin_init (struct plugin_name_args *plugin_info,
126
 
+             struct plugin_gcc_version *version)
127
 
+{
128
 
+  const char *plugin_name = plugin_info->base_name;
129
 
+
130
 
+  register_callback (plugin_name, PLUGIN_FINISH_DECL,
131
 
+                     plugin_finish_decl, NULL);
132
 
+  return 0;
133
 
+}
134
 
Index: gcc/cp/decl.c
135
 
===================================================================
136
 
--- gcc/cp/decl.c       (revision 162126)
137
 
+++ gcc/cp/decl.c       (working copy)
138
 
@@ -5967,6 +5967,8 @@
139
 
   /* If this was marked 'used', be sure it will be output.  */
140
 
   if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
141
 
     mark_decl_referenced (decl);
142
 
+
143
 
+  invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
144
 
 }
145
 
 
146
 
 /* Returns a declaration for a VAR_DECL as if:
147
 
Index: gcc/c-decl.c
148
 
===================================================================
149
 
--- gcc/c-decl.c        (revision 162126)
150
 
+++ gcc/c-decl.c        (working copy)
151
 
@@ -4392,6 +4392,8 @@
152
 
       && DECL_INITIAL (decl) == NULL_TREE)
153
 
     warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
154
 
                "uninitialized const %qD is invalid in C++", decl);
155
 
+
156
 
+  invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
157
 
 }
158
 
 
159
 
 /* Given a parsed parameter declaration, decode it into a PARM_DECL.  */
160
 
Index: gcc/plugin.c
161
 
===================================================================
162
 
--- gcc/plugin.c        (revision 162126)
163
 
+++ gcc/plugin.c        (working copy)
164
 
@@ -400,6 +400,7 @@
165
 
          }
166
 
       /* Fall through.  */
167
 
       case PLUGIN_FINISH_TYPE:
168
 
+      case PLUGIN_FINISH_DECL:
169
 
       case PLUGIN_START_UNIT:
170
 
       case PLUGIN_FINISH_UNIT:
171
 
       case PLUGIN_PRE_GENERICIZE:
172
 
@@ -481,6 +482,7 @@
173
 
        gcc_assert (event < event_last);
174
 
       /* Fall through.  */
175
 
       case PLUGIN_FINISH_TYPE:
176
 
+      case PLUGIN_FINISH_DECL:
177
 
       case PLUGIN_START_UNIT:
178
 
       case PLUGIN_FINISH_UNIT:
179
 
       case PLUGIN_PRE_GENERICIZE: