[PATCH 3/6] Emit macro expansion related diagnostics
Dodji Seketeli
dodji@redhat.com
Mon Oct 17 12:22:00 GMT 2011
Richard Guenther <richard.guenther@gmail.com> writes:
> This broke bootstrap on x86_64-linux.
>
> /space/rguenther/src/svn/trunk/libcpp/line-map.c: In function
> 'source_location linemap_macro_map_loc_to_exp_point(const line_map*,
> source_location)':
> /space/rguenther/src/svn/trunk/libcpp/line-map.c:628:12: error:
> variable 'token_no' set but not used [-Werror=unused-but-set-variable]
> cc1plus: all warnings being treated as errors
Sigh.
I guess the reason why my testing hasn't caught this is that I am
bootstrapping with --enable-checking and so on my system ENABLE_CHECKING
is defined and my GCC_VERSION >= 2007.
I am bootstrapping and testing the obvious patch below with
--disable-bootstrap and I am planning to check it in if it passes, under
the obvious rule.
Sorry for the inconvenience.
commit e957242a9a8ec8f297e05ca0dae1d63bf543fad8
Author: Dodji Seketeli <dodji@redhat.com>
Date: Mon Oct 17 13:33:41 2011 +0200
Fix bootstrapping with --disable-checking
libcpp/ChangeLog
* line-map.c (linemap_macro_map_loc_to_exp_point): Avoid setting a
variable without using it if ENABLE_CHECKING is not defined.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 87b8bfe..a1d0fbb 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -625,14 +625,12 @@ source_location
linemap_macro_map_loc_to_exp_point (const struct line_map *map,
source_location location)
{
- unsigned token_no;
-
linemap_assert (linemap_macro_expansion_map_p (map)
&& location >= MAP_START_LOCATION (map));
/* Make sure LOCATION is correct. */
- token_no = location - MAP_START_LOCATION (map);
- linemap_assert (token_no < MACRO_MAP_NUM_MACRO_TOKENS (map));
+ linemap_assert ((location - MAP_START_LOCATION (map))
+ < MACRO_MAP_NUM_MACRO_TOKENS (map));
return MACRO_MAP_EXPANSION_POINT_LOCATION (map);
}
--
Dodji
More information about the Gcc-patches
mailing list