Re: [PATCH 3/6] Emit macro expansion related diagnostics
Jason Merrill ja...@redhat.com writes: If you have a patch like this that fixes a major regression, go ahead and check it in without waiting for approval; we can adjust it as necessary after build is working again. OK. size_t num_expanded_macros; - fprintf (stderr, Number of expanded macros: %5lu\n, - s.num_expanded_macros); + fprintf (stderr, Number of expanded macros: %5ld\n, + (long)s.num_expanded_macros); If we're going to use %l in printf, we should use long rather than size_t in linemap_stats; that way we don't need the cast. OK, I have checked the below in. libcpp/ * include/line-map.h (struct linemap_stats): Change the type of the members from size_t to long. * macro.c (macro_arg_token_iter_init): Unconditionally initialize iter-location_ptr. gcc/c-family/ * c-lex.c (fe_file_change): Use LINEMAP_SYSP when !NO_IMPLICIT_EXTERN_C. gcc/ * input.c (dump_line_table_statistics): Use long, not size_t. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180124 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index be83b61..b151564 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -211,7 +211,7 @@ fe_file_change (const struct line_map *new_map) #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level) ++c_header_level; - else if (new_map-sysp == 2) + else if (LINEMAP_SYSP (new_map) == 2) { c_header_level = 1; ++pending_lang_change; @@ -224,7 +224,7 @@ fe_file_change (const struct line_map *new_map) #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level --c_header_level == 0) { - if (new_map-sysp == 2) + if (LINEMAP_SYSP (new_map) == 2) warning (0, badly nested C headers from preprocessor); --pending_lang_change; } diff --git a/gcc/input.c b/gcc/input.c index 41842b7..a780f5c 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -80,7 +80,7 @@ void dump_line_table_statistics (void) { struct linemap_stats s; - size_t total_used_map_size, + long total_used_map_size, macro_maps_size, total_allocated_map_size; @@ -99,45 +99,45 @@ dump_line_table_statistics (void) + s.macro_maps_used_size + s.macro_maps_locations_size; - fprintf (stderr, Number of expanded macros: %5lu\n, + fprintf (stderr, Number of expanded macros: %5ld\n, s.num_expanded_macros); if (s.num_expanded_macros != 0) -fprintf (stderr, Average number of tokens per macro expansion: %5lu\n, +fprintf (stderr, Average number of tokens per macro expansion: %5ld\n, s.num_macro_tokens / s.num_expanded_macros); fprintf (stderr, \nLine Table allocations during the compilation process\n); - fprintf (stderr, Number of ordinary maps used:%5lu%c\n, + fprintf (stderr, Number of ordinary maps used:%5ld%c\n, SCALE (s.num_ordinary_maps_used), STAT_LABEL (s.num_ordinary_maps_used)); - fprintf (stderr, Ordinary map used size: %5lu%c\n, + fprintf (stderr, Ordinary map used size: %5ld%c\n, SCALE (s.ordinary_maps_used_size), STAT_LABEL (s.ordinary_maps_used_size)); - fprintf (stderr, Number of ordinary maps allocated: %5lu%c\n, + fprintf (stderr, Number of ordinary maps allocated: %5ld%c\n, SCALE (s.num_ordinary_maps_allocated), STAT_LABEL (s.num_ordinary_maps_allocated)); - fprintf (stderr, Ordinary maps allocated size:%5lu%c\n, + fprintf (stderr, Ordinary maps allocated size:%5ld%c\n, SCALE (s.ordinary_maps_allocated_size), STAT_LABEL (s.ordinary_maps_allocated_size)); - fprintf (stderr, Number of macro maps used: %5lu%c\n, + fprintf (stderr, Number of macro maps used: %5ld%c\n, SCALE (s.num_macro_maps_used), STAT_LABEL (s.num_macro_maps_used)); - fprintf (stderr, Macro maps used size:%5lu%c\n, + fprintf (stderr, Macro maps used size:%5ld%c\n, SCALE (s.macro_maps_used_size), STAT_LABEL (s.macro_maps_used_size)); - fprintf (stderr, Macro maps locations size: %5lu%c\n, + fprintf (stderr, Macro maps locations size: %5ld%c\n, SCALE (s.macro_maps_locations_size), STAT_LABEL (s.macro_maps_locations_size)); - fprintf (stderr, Macro maps size: %5lu%c\n, + fprintf (stderr, Macro maps size: %5ld%c\n, SCALE (macro_maps_size), STAT_LABEL (macro_maps_size)); - fprintf (stderr, Duplicated maps locations size: %5lu%c\n, + fprintf (stderr, Duplicated maps locations size: %5ld%c\n, SCALE
Re: [PATCH 3/6] Emit macro expansion related diagnostics
Hey, Dodji, Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. The typedef conflicts with a typedef in an AIX 5.3 header file for locales. AIX should not be using that namespace, but the failure occurs before fix-includes, so it is not possible to fix it there. How can we avoid the namespace conflict? Thanks, David
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On Tue, 18 Oct 2011, David Edelsohn wrote: Hey, Dodji, Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. The typedef conflicts with a typedef in an AIX 5.3 header file for locales. AIX should not be using that namespace, but the failure occurs before fix-includes, so it is not possible to fix it there. The whole *_t namespace is reserved by POSIX, so it's not unreasonable for AIX to have some AIX-specific *_t typedefs although it seems quite rare for this to cause conflicts in practice (and AIX is obviously risking conflicts with future POSIX revisions by using *_t for its own types). -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On Tue, Oct 18, 2011 at 11:09:04AM -0400, David Edelsohn wrote: Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. The typedef conflicts with a typedef in an AIX 5.3 header file for locales. AIX should not be using that namespace, but the failure occurs before fix-includes, so it is not possible to fix it there. At least in POSIX *_t is reserved for the implementation (in any header). So gcc should use something else. Jakub
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On Tue, Oct 18, 2011 at 10:19 AM, Joseph S. Myers jos...@codesourcery.com wrote: On Tue, 18 Oct 2011, David Edelsohn wrote: Hey, Dodji, Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. The typedef conflicts with a typedef in an AIX 5.3 header file for locales. AIX should not be using that namespace, but the failure occurs before fix-includes, so it is not possible to fix it there. The whole *_t namespace is reserved by POSIX, so it's not unreasonable for AIX to have some AIX-specific *_t typedefs although it seems quite rare for this to cause conflicts in practice (and AIX is obviously risking conflicts with future POSIX revisions by using *_t for its own types). any reason we could not call it location_type? or just location?
Re: [PATCH 3/6] Emit macro expansion related diagnostics
David Edelsohn dje@gmail.com writes: Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. The typedef conflicts with a typedef in an AIX 5.3 header file for locales. AIX should not be using that namespace, but the failure occurs before fix-includes, so it is not possible to fix it there. How can we avoid the namespace conflict? I'll change the name to location_type as Gaby proposed and commit it as obvious. Sorry for the inconvenience. -- Dodji
Re: [PATCH 3/6] Emit macro expansion related diagnostics
Dodji Seketeli do...@redhat.com writes: David Edelsohn dje@gmail.com writes: Your patch broke bootstrap on AIX because of the typedef loc_t introduced in tree-diagnostics.c. I have committed the patch below. Tested on x86_64-unknown-linux-gnu only, unfortunately. I hope it fixes the build on AIX. From: Dodji Seketeli do...@seketeli.org Date: Tue, 18 Oct 2011 18:40:06 +0200 Subject: [PATCH] Do not use loc_t as a type name gcc/ * tree-diagnostic (struct loc_t): Rename into struct loc_map_pair. (maybe_unwind_expanded_macro_loc): Adjust. --- gcc/tree-diagnostic.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c index 53b350b..b4b60dc 100644 --- a/gcc/tree-diagnostic.c +++ b/gcc/tree-diagnostic.c @@ -56,10 +56,10 @@ typedef struct { const struct line_map *map; source_location where; -} loc_t; +} loc_map_pair; -DEF_VEC_O (loc_t); -DEF_VEC_ALLOC_O (loc_t, heap); +DEF_VEC_O (loc_map_pair); +DEF_VEC_ALLOC_O (loc_map_pair, heap); /* Unwind the different macro expansions that lead to the token which location is WHERE and emit diagnostics showing the resulting @@ -111,9 +111,9 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context, const struct line_map **first_exp_point_map) { const struct line_map *map; - VEC(loc_t,heap) *loc_vec = NULL; + VEC(loc_map_pair,heap) *loc_vec = NULL; unsigned ix; - loc_t loc, *iter; + loc_map_pair loc, *iter; map = linemap_lookup (line_table, where); if (!linemap_macro_expansion_map_p (map)) @@ -132,7 +132,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context, loc.where = where; loc.map = map; - VEC_safe_push (loc_t, heap, loc_vec, loc); + VEC_safe_push (loc_map_pair, heap, loc_vec, loc); /* WHERE is the location of a token inside the expansion of a macro. MAP is the map holding the locations of that macro @@ -150,7 +150,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context, first macro which expansion triggered this trace was expanded inside a system header. */ if (!LINEMAP_SYSP (map)) -FOR_EACH_VEC_ELT (loc_t, loc_vec, ix, iter) +FOR_EACH_VEC_ELT (loc_map_pair, loc_vec, ix, iter) { source_location resolved_def_loc = 0, resolved_exp_loc = 0; diagnostic_t saved_kind; @@ -203,7 +203,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context, context-printer-prefix = saved_prefix; } - VEC_free (loc_t, heap, loc_vec); + VEC_free (loc_map_pair, heap, loc_vec); } /* This is a diagnostic finalizer implementation that is aware of -- 1.7.6.2 -- Dodji
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On Mon, Oct 17, 2011 at 11:57 AM, Dodji Seketeli do...@redhat.com wrote: In this third instalment the diagnostic machinery -- when faced with the virtual location of a token resulting from macro expansion -- uses the new linemap APIs to unwind the stack of macro expansions that led to that token and emits a [hopefully] more useful message than what we have today. diagnostic_report_current_module has been slightly changed to use the location given by client code instead of the global input_location variable. This results in more precise diagnostic locations in general but then the patch adjusts some C++ tests which output changed as a result of this. Three new regression tests have been added. The mandatory screenshot goes like this: [dodji@adjoa gcc]$ cat -n test.c 1 #define OPERATE(OPRD1, OPRT, OPRD2) \ 2 OPRD1 OPRT OPRD2; 3 4 #define SHIFTL(A,B) \ 5 OPERATE (A,,B) 6 7 #define MULT(A) \ 8 SHIFTL (A,1) 9 10 void 11 g () 12 { 13 MULT (1.0);/* 1.0 1; -- so this is an error. */ 14 } [dodji@adjoa gcc]$ ./cc1 -quiet -ftrack-macro-expansion test.c test.c: In function 'g': test.c:5:14: erreur: invalid operands to binary (have 'double' and 'int') test.c:2:9: note: in expansion of macro 'OPERATE' test.c:5:3: note: expanded from here test.c:5:14: note: in expansion of macro 'SHIFTL' test.c:8:3: note: expanded from here test.c:8:3: note: in expansion of macro 'MULT2' test.c:13:3: note: expanded from here 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 make[3]: *** [line-map.o] Error 1 gcc/ChangeLog 2011-10-15 Tom Tromey tro...@redhat.com Dodji Seketeli do...@redhat.com * gcc/diagnostic.h (diagnostic_report_current_module): Add a location parameter. * diagnostic.c (diagnostic_report_current_module): Add a location parameter to the function definition. Use it instead of input_location. Resolve the virtual location rather than just looking up its map and risking to touch a resulting macro map. (default_diagnostic_starter): Pass the relevant diagnostic location to diagnostic_report_current_module. * tree-diagnostic.c (maybe_unwind_expanded_macro_loc): New. (virt_loc_aware_diagnostic_finalizer): Likewise. (diagnostic_report_current_function): Pass the relevant location to diagnostic_report_current_module. * tree-diagnostic.h (virt_loc_aware_diagnostic_finalizer): Declare new function. * toplev.c (general_init): By default, use the new virt_loc_aware_diagnostic_finalizer as diagnostic finalizer. * Makefile.in: Add vec.h dependency to tree-diagnostic.c. gcc/cp/ChangeLog 2011-10-15 Tom Tromey tro...@redhat.com Dodji Seketeli do...@redhat.com * error.c (cp_diagnostic_starter): Pass the relevant location to diagnostic_report_current_module. (cp_diagnostic_finalizer): Call virt_loc_aware_diagnostic_finalizer. gcc/testsuite/ChangeLog 2011-10-15 Tom Tromey tro...@redhat.com Dodji Seketeli do...@redhat.com * lib/prune.exp (prune_gcc_output): Prune output referring to included files. * gcc.dg/cpp/macro-exp-tracking-1.c: New test. * gcc.dg/cpp/macro-exp-tracking-2.c: Likewise. * gcc.dg/cpp/macro-exp-tracking-3.c: Likewise. * gcc.dg/cpp/pragma-diagnostic-2.c: Likewise. --- gcc/ChangeLog | 21 +++ gcc/Makefile.in | 3 +- gcc/cp/ChangeLog | 7 + gcc/cp/error.c | 5 +- gcc/diagnostic.c | 13 +- gcc/diagnostic.h | 2 +- gcc/testsuite/ChangeLog | 10 ++ gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c | 21 +++ gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c | 21 +++ gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c | 14 ++ gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c | 14 ++ gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c | 34 + gcc/testsuite/lib/prune.exp | 1 + gcc/toplev.c | 3 + gcc/tree-diagnostic.c | 182 ++- gcc/tree-diagnostic.h | 3 +- 16 files changed, 343 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c create mode 100644
Re: [PATCH 3/6] Emit macro expansion related diagnostics
Richard Guenther richard.guent...@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 do...@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
Re: [PATCH 3/6] Emit macro expansion related diagnostics
Finally here is what I am checking in, which passes bootstrap with --disable-checking --enable-languages=all,ada -- modulo this other bug that breaks bootstrap as well http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50709. It's been OKed off-line by Tom Tromey. commit c1cd2be336ceec75cf40ac5f32cc4f72b8fc5da3 Author: Dodji Seketeli do...@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. Mark the LOCATION parameter as being unused. diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 87b8bfe..43e2856 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -621,18 +621,16 @@ linemap_macro_expansion_map_p (const struct line_map *map) Read the comments of struct line_map and struct line_map_macro in line-map.h to understand what a macro expansion point is. */ -source_location +static source_location linemap_macro_map_loc_to_exp_point (const struct line_map *map, - source_location location) + source_location location ATTRIBUTE_UNUSED) { - 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
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On Mon, Oct 17, 2011 at 6:41 AM, Dodji Seketeli do...@redhat.com wrote: Finally here is what I am checking in, which passes bootstrap with --disable-checking --enable-languages=all,ada -- modulo this other bug that breaks bootstrap as well http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50709. It's been OKed off-line by Tom Tromey. commit c1cd2be336ceec75cf40ac5f32cc4f72b8fc5da3 Author: Dodji Seketeli do...@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. Mark the LOCATION parameter as being unused. There are at least 2 bootstrap problems: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50760 -- H.J.
Re: [PATCH 3/6] Emit macro expansion related diagnostics
H.J. Lu hjl.to...@gmail.com writes: There are at least 2 bootstrap problems: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50760 The patch below should address those issues. The first two hunks are to fix bootstrap for targets that have !NO_IMPLICIT_EXTERN_C. To test it, I built the compiler with --target=avr. The next hunk is to fix one part of the issue reported in the PR. It's because size_t on ia32 is unsigned int, while being unsigned long int on x86_64. To fix ia32 in a portable way I am casting size_t to long as it's done in other parts of the compiler when fprinting. The last hunk is because it appears to me that after macro_arg_token_iter_init gets inlined into replace_args, from-token_ptr appears possibly uninitialized. So I am unconditionally initializing it. For the ia32 fixes, as I don't have any such target at hand, I ran configure i686-pc-linux-gnu on my x86_64 host and the bootstrap is underway. It's taking time, sorry. I ran a full bootstrap of the changes which went up to the comparison failure we are currently having on trunk. OK if this appears to fix the raised issues and passes bootstraps on the i686 target? Author: Dodji Seketeli do...@redhat.com Date: Mon Oct 17 22:33:46 2011 +0200 Fix bootstrap on !NO_IMPLICIT_EXTERN_C and ia32 targets libcpp/ * macro.c (macro_arg_token_iter_init): Unconditionally initialize iter-location_ptr. gcc/c-family/ * c-lex.c (fe_file_change): Use LINEMAP_SYSP when !NO_IMPLICIT_EXTERN_C. gcc/ * input.c (dump_line_table_statistics): Cast size_t to long for printing. diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index be83b61..b151564 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -211,7 +211,7 @@ fe_file_change (const struct line_map *new_map) #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level) ++c_header_level; - else if (new_map-sysp == 2) + else if (LINEMAP_SYSP (new_map) == 2) { c_header_level = 1; ++pending_lang_change; @@ -224,7 +224,7 @@ fe_file_change (const struct line_map *new_map) #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level --c_header_level == 0) { - if (new_map-sysp == 2) + if (LINEMAP_SYSP (new_map) == 2) warning (0, badly nested C headers from preprocessor); --pending_lang_change; } diff --git a/gcc/input.c b/gcc/input.c index 41842b7..8138a65 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -99,46 +99,46 @@ dump_line_table_statistics (void) + s.macro_maps_used_size + s.macro_maps_locations_size; - fprintf (stderr, Number of expanded macros: %5lu\n, - s.num_expanded_macros); + fprintf (stderr, Number of expanded macros: %5ld\n, + (long)s.num_expanded_macros); if (s.num_expanded_macros != 0) -fprintf (stderr, Average number of tokens per macro expansion: %5lu\n, - s.num_macro_tokens / s.num_expanded_macros); +fprintf (stderr, Average number of tokens per macro expansion: %5ld\n, + (long)s.num_macro_tokens / s.num_expanded_macros); fprintf (stderr, \nLine Table allocations during the compilation process\n); - fprintf (stderr, Number of ordinary maps used:%5lu%c\n, - SCALE (s.num_ordinary_maps_used), + fprintf (stderr, Number of ordinary maps used:%5ld%c\n, + (long)SCALE (s.num_ordinary_maps_used), STAT_LABEL (s.num_ordinary_maps_used)); - fprintf (stderr, Ordinary map used size: %5lu%c\n, - SCALE (s.ordinary_maps_used_size), + fprintf (stderr, Ordinary map used size: %5ld%c\n, + (long)SCALE (s.ordinary_maps_used_size), STAT_LABEL (s.ordinary_maps_used_size)); - fprintf (stderr, Number of ordinary maps allocated: %5lu%c\n, - SCALE (s.num_ordinary_maps_allocated), + fprintf (stderr, Number of ordinary maps allocated: %5ld%c\n, + (long)SCALE (s.num_ordinary_maps_allocated), STAT_LABEL (s.num_ordinary_maps_allocated)); - fprintf (stderr, Ordinary maps allocated size:%5lu%c\n, - SCALE (s.ordinary_maps_allocated_size), + fprintf (stderr, Ordinary maps allocated size:%5ld%c\n, + (long)SCALE (s.ordinary_maps_allocated_size), STAT_LABEL (s.ordinary_maps_allocated_size)); - fprintf (stderr, Number of macro maps used: %5lu%c\n, - SCALE (s.num_macro_maps_used), + fprintf (stderr, Number of macro maps used: %5ld%c\n, + (long)SCALE (s.num_macro_maps_used), STAT_LABEL (s.num_macro_maps_used)); - fprintf (stderr, Macro maps used size:%5lu%c\n, - SCALE (s.macro_maps_used_size), + fprintf (stderr, Macro maps used size:%5ld%c\n, + (long)SCALE
Re: [PATCH 3/6] Emit macro expansion related diagnostics
On 10/17/2011 06:33 PM, Dodji Seketeli wrote: OK if this appears to fix the raised issues and passes bootstraps on the i686 target? If you have a patch like this that fixes a major regression, go ahead and check it in without waiting for approval; we can adjust it as necessary after build is working again. size_t num_expanded_macros; - fprintf (stderr, Number of expanded macros: %5lu\n, - s.num_expanded_macros); + fprintf (stderr, Number of expanded macros: %5ld\n, + (long)s.num_expanded_macros); If we're going to use %l in printf, we should use long rather than size_t in linemap_stats; that way we don't need the cast. Jason