diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-10-27 10:34:31 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-10-27 10:34:31 +0200 |
commit | 65485663ce42b92f3f4f1ea62910fd91d8ec7b29 (patch) | |
tree | cb85b8a2323b9e868f4089450936368c33cc6dba /odb/gcc.hxx | |
parent | ef27013bab8ce027cce1c3efe4acafb8aef9d2e3 (diff) |
Use expansion point rather than macro location in GCC 4.7.0 and later
Diffstat (limited to 'odb/gcc.hxx')
-rw-r--r-- | odb/gcc.hxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/odb/gcc.hxx b/odb/gcc.hxx index 341b8e0..51974e4 100644 --- a/odb/gcc.hxx +++ b/odb/gcc.hxx @@ -65,6 +65,23 @@ extern "C" } // extern "C" #endif +// Since 4.7.0 the location may point inside a macro rather than at +// the expansion point. We are only really interested in the expansion +// points so we use the real_source_location() wrapper rather than +// DECL_SOURCE_LOCATION() to do this at the source. +// +inline location_t +real_source_location (tree n) +{ + location_t l (DECL_SOURCE_LOCATION (n)); + +#if BUILDING_GCC_MAJOR > 4 || BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR > 6 + l = linemap_resolve_location (line_table, l, LRK_MACRO_EXPANSION_POINT, 0); +#endif + + return l; +} + // In 4.9.0 the tree code type was changed from int to enum tree_code. // the tree_code_name array is also gone with the get_tree_code_name() // function in its place. |