mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-21 19:35:36 -05:00
This patch eliminates the PLUGIN_ANALYZER_INIT event in favor of a new analyzer_events_channel that can be subscribed to, and ports all the in-tree analyzer plugins to using it. The PLUGIN_* approach isn't typesafe, and the name suggests it's only meant to be used for plugins, whereas the pub/sub approach is typesafe, and treats the publish/subscribe network as orthogonal to whether the code is built into the executable or is a plugin. gcc/analyzer/ChangeLog: * common.h: Define INCLUDE_LIST. (class plugin_analyzer_init_iface): Replace with... (gcc::topics::analyzer_events::on_ana_init): ...this. (gcc::topics::analyzer_events::subscriber): New. * engine.cc: Include "context.h" and "channels.h". (class plugin_analyzer_init_impl): Replace with... (class impl_on_ana_init): ...this. Fix some overlong lines. (impl_run_checkers): Port from PLUGIN_ANALYZER_INIT to using publish/subscribe framework. gcc/ChangeLog: * channels.h (gcc::topics::analyzer_events::subscriber): New forward decl. (compiler_channels::analyzer_events_channel): New field. * doc/plugins.texi (PLUGIN_ANALYZER_INIT): Delete. * plugin.cc (register_callback): Delete PLUGIN_ANALYZER_INIT. (invoke_plugin_callbacks_full): Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Delete this event. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Port from PLUGIN_ANALYZER_INIT to subscribing to analyzer_events_channel. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/* channels.h - Publish/Subscribe channels on compiler-specific topics.
|
|
Copyright (C) 2025 Free Software Foundation, Inc.
|
|
Contributed by David Malcolm <dmalcolm@redhat.com>.
|
|
|
|
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 GCC_CHANNELS_H
|
|
#define GCC_CHANNELS_H
|
|
|
|
#include "pub-sub.h"
|
|
|
|
namespace gcc {
|
|
|
|
/* Forward decls of subscribers for the various topics we have
|
|
publish/subscribe channels for. */
|
|
namespace topics {
|
|
namespace analyzer_events { struct subscriber; }
|
|
namespace pass_events { struct subscriber; }
|
|
} // namespace gcc::topics
|
|
|
|
/* Publish/subscribe channels on various compiler-specific topics. */
|
|
|
|
struct compiler_channels
|
|
{
|
|
pub_sub::channel<topics::analyzer_events::subscriber> analyzer_events_channel;
|
|
pub_sub::channel<topics::pass_events::subscriber> pass_events_channel;
|
|
};
|
|
|
|
} // namespace gcc
|
|
|
|
#endif /* ! GCC_CHANNELS_H */
|