diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-09-07 16:56:23 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-09-07 16:56:23 +0000 |
commit | e5106e27feded7797a6df36493aa37cb673bcad1 (patch) | |
tree | bcfb76c5cbb7225eaaa830c5addd7d9df3bc60ab /gcc/langhooks.h | |
parent | 7100c1f253908708185aa9878bb147cef986279e (diff) | |
download | gcc-e5106e27feded7797a6df36493aa37cb673bcad1.zip gcc-e5106e27feded7797a6df36493aa37cb673bcad1.tar.gz gcc-e5106e27feded7797a6df36493aa37cb673bcad1.tar.bz2 |
Move class substring_loc from c-family into gcc
gcc/ChangeLog:
* Makefile.in (OBJS): Add substring-locations.o.
* langhooks-def.h (class substring_loc): New forward decl.
(lhd_get_substring_location): New decl.
(LANG_HOOKS_GET_SUBSTRING_LOCATION): New macro.
(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_GET_SUBSTRING_LOCATION.
* langhooks.c (lhd_get_substring_location): New function.
* langhooks.h (class substring_loc): New forward decl.
(struct lang_hooks): Add field get_substring_location.
* substring-locations.c: New file, taking definition of
format_warning_va and format_warning_at_substring from
c-family/c-format.c, making them non-static.
* substring-locations.h (class substring_loc): Move class here
from c-family/c-common.h. Add and rewrite comments.
(format_warning_va): New decl.
(format_warning_at_substring): New decl.
(get_source_location_for_substring): Add comment.
gcc/c-family/ChangeLog:
* c-common.c (get_cpp_ttype_from_string_type): Handle being passed
a POINTER_TYPE.
(substring_loc::get_location): Move to substring-locations.c,
keeping implementation as...
(c_get_substring_location): New function, from the above, reworked
to use accessors rather than member lookup.
* c-common.h (class substring_loc): Move to substring-locations.h,
replacing with a forward decl.
(c_get_substring_location): New decl.
* c-format.c: Include "substring-locations.h".
(format_warning_va): Move to substring-locations.c.
(format_warning_at_substring): Likewise.
gcc/c/ChangeLog:
* c-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Use
c_get_substring_location for this new langhook.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_string_literals.c: Include
"substring-locations.h".
From-SVN: r240028
Diffstat (limited to 'gcc/langhooks.h')
-rw-r--r-- | gcc/langhooks.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 44c258e..c109c8c 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -34,6 +34,8 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent); enum classify_record { RECORD_IS_STRUCT, RECORD_IS_CLASS, RECORD_IS_INTERFACE }; +class substring_loc; + /* The following hooks are documented in langhooks.c. Must not be NULL. */ @@ -513,6 +515,13 @@ struct lang_hooks /* Run all lang-specific selftests. */ void (*run_lang_selftests) (void); + /* Attempt to determine the source location of the substring. + If successful, return NULL and write the source location to *OUT_LOC. + Otherwise return an error message. Error messages are intended + for GCC developers (to help debugging) rather than for end-users. */ + const char *(*get_substring_location) (const substring_loc &, + location_t *out_loc); + /* Whenever you add entries here, make sure you adjust langhooks-def.h and langhooks.c accordingly. */ }; |