summaryrefslogtreecommitdiff
path: root/libcc1/callbacks.hh
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@gcc.gnu.org>2014-10-27 17:21:42 +0000
committerPhil Muldoon <pmuldoon@gcc.gnu.org>2014-10-27 17:21:42 +0000
commitddc8de034a1f79861fed57b231813a5c5c48a130 (patch)
tree93d1166de8622ded3678c7599baa864b75cb5e25 /libcc1/callbacks.hh
parent50a504654d2c54b270615541ab66af7c4f3d664f (diff)
Let GDB reuse GCC's parser.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * aclocal.m4: New file. * callbacks.cc: New file. * callbacks.hh: New file. * cc1plugin-config.h.in: New file. * configure: New file. * configure.ac: New file. * connection.cc: New file. * connection.hh: New file. * findcomp.cc: New file. * findcomp.hh: New file. * libcc1.cc: New file. * libcc1plugin.sym: New file. * libcc1.sym: New file. * Makefile.am: New file. * Makefile.in: New file. * marshall.cc: New file. * marshall.hh: New file. * names.cc: New file. * names.hh: New file. * plugin.cc: New file. * rpc.hh: New file. * status.hh: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * gcc-c-fe.def: New file. * gcc-c-interface.h: New file. * gcc-interface.h: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * c-tree.h (enum c_oracle_request): New. (c_binding_oracle_function): New typedef. (c_binding_oracle, c_pushtag, c_bind): Declare. * c-decl.c (c_binding_oracle): New global. (I_SYMBOL_CHECKED): New macro. (i_symbol_binding): New function. (I_SYMBOL_BINDING, I_SYMBOL_DECL): Redefine. (I_TAG_CHECKED): New macro. (i_tag_binding): New function. (I_TAG_BINDING, I_TAG_DECL): Redefine. (I_LABEL_CHECKED): New macro. (i_label_binding): New function. (I_LABEL_BINDING, I_LABEL_DECL): Redefine. (c_print_identifier): Save and restore c_binding_oracle. (c_pushtag, c_bind): New functions. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * aclocal.m4, configure: Rebuild. * Makefile.in (aclocal_deps): Add gcc-plugin.m4. * configure.ac: Use GCC_ENABLE_PLUGINS. * stor-layout.c (finish_bitfield_layout): Now public. Change argument type to 'tree'. (finish_record_layout): Update. * stor-layout.h (finish_bitfield_layout): Declare. 2014-10-27 Tom Tromey <tromey@redhat.com> * gcc-plugin.m4: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * Makefile.def: Add libcc1 to host_modules. * configure.ac (host_tools): Add libcc1. * Makefile.in, configure: Rebuild. From-SVN: r216748
Diffstat (limited to 'libcc1/callbacks.hh')
-rw-r--r--libcc1/callbacks.hh64
1 files changed, 64 insertions, 0 deletions
diff --git a/libcc1/callbacks.hh b/libcc1/callbacks.hh
new file mode 100644
index 00000000000..bde1100fd06
--- /dev/null
+++ b/libcc1/callbacks.hh
@@ -0,0 +1,64 @@
+/* Callback management
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef CC1_PLUGIN_CALLBACKS_HH
+#define CC1_PLUGIN_CALLBACKS_HH
+
+#include "status.hh"
+#include "hashtab.h"
+
+namespace cc1_plugin
+{
+ class connection;
+
+ // The type of a callback method.
+ typedef status callback_ftype (connection *);
+
+ // This class manages callback functions. A callback has a name and
+ // an underlying function. When a query packet arrives, the name is
+ // inspected and the corresponding function is called. A callback
+ // function has to know how to decode its own arguments, but
+ // wrappers are provided elsewhere to automate this.
+ class callbacks
+ {
+ public:
+
+ callbacks ();
+ ~callbacks ();
+
+ // Add a callback named NAME. FUNC is the function to call when
+ // this method is invoked.
+ void add_callback (const char *name, callback_ftype *func);
+
+ // Look up a callback by name. Returns NULL if the method is not
+ // found.
+ callback_ftype *find_callback (const char *name);
+
+ private:
+
+ // Declared but not defined to avoid use.
+ callbacks (const callbacks &);
+ callbacks &operator= (const callbacks &);
+
+ // The mapping.
+ htab_t m_registry;
+ };
+};
+
+#endif // CC1_PLUGIN_CALLBACKS_HH