From e5106e27feded7797a6df36493aa37cb673bcad1 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 7 Sep 2016 16:56:23 +0000 Subject: 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 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-lang.c | 3 +++ 2 files changed, 8 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7fee5b8..a647263 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-09-07 David Malcolm + + * c-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Use + c_get_substring_location for this new langhook. + 2016-09-02 Jakub Jelinek PR c/65467 diff --git a/gcc/c/c-lang.c b/gcc/c/c-lang.c index b26be6a..b4096d0 100644 --- a/gcc/c/c-lang.c +++ b/gcc/c/c-lang.c @@ -43,6 +43,9 @@ enum c_language_kind c_language = clk_c; #define LANG_HOOKS_RUN_LANG_SELFTESTS selftest::run_c_tests #endif /* #if CHECKING_P */ +#undef LANG_HOOKS_GET_SUBSTRING_LOCATION +#define LANG_HOOKS_GET_SUBSTRING_LOCATION c_get_substring_location + /* Each front end provides its own lang hook initializer. */ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; -- cgit v1.1