plugin.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Header file for internal GCC plugin mechanism.
  2. Copyright (C) 2009-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef PLUGIN_H
  16. #define PLUGIN_H
  17. #include "gcc-plugin.h"
  18. struct attribute_spec;
  19. struct scoped_attributes;
  20. extern void add_new_plugin (const char *);
  21. extern void parse_plugin_arg_opt (const char *);
  22. extern int invoke_plugin_callbacks_full (int, void *);
  23. extern void initialize_plugins (void);
  24. extern bool plugins_active_p (void);
  25. extern void dump_active_plugins (FILE *);
  26. extern void debug_active_plugins (void);
  27. extern void warn_if_plugins (void);
  28. extern void plugins_internal_error_function (diagnostic_context *,
  29. const char *, va_list *);
  30. extern void print_plugins_versions (FILE *file, const char *indent);
  31. extern void print_plugins_help (FILE *file, const char *indent);
  32. extern void finalize_plugins (void);
  33. extern bool flag_plugin_added;
  34. /* Called from inside GCC. Invoke all plugin callbacks registered with
  35. the specified event.
  36. Return PLUGEVT_SUCCESS if at least one callback was called,
  37. PLUGEVT_NO_CALLBACK if there was no callback.
  38. EVENT - the event identifier
  39. GCC_DATA - event-specific data provided by the compiler */
  40. static inline int
  41. invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
  42. void *gcc_data ATTRIBUTE_UNUSED)
  43. {
  44. #ifdef ENABLE_PLUGIN
  45. /* True iff at least one plugin has been added. */
  46. if (flag_plugin_added)
  47. return invoke_plugin_callbacks_full (event, gcc_data);
  48. #endif
  49. return PLUGEVT_NO_CALLBACK;
  50. }
  51. /* In attribs.c. */
  52. extern void register_attribute (const struct attribute_spec *attr);
  53. extern struct scoped_attributes* register_scoped_attributes (const struct attribute_spec *,
  54. const char *);
  55. #endif /* PLUGIN_H */