From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17238 invoked by alias); 18 Oct 2011 09:00:39 -0000 Received: (qmail 17224 invoked by uid 22791); 18 Oct 2011 09:00:37 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_SV X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 09:00:14 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9I8xmvD015917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Oct 2011 04:59:48 -0400 Received: from localhost (ovpn-113-95.phx2.redhat.com [10.3.113.95]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9I8xk6h002540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Oct 2011 04:59:47 -0400 Received: by localhost (Postfix, from userid 500) id 75D9229C129; Tue, 18 Oct 2011 10:59:45 +0200 (CEST) From: Dodji Seketeli To: Jason Merrill Cc: "H.J. Lu" , Richard Guenther , gcc-patches@gcc.gnu.org, tromey@redhat.com, gdr@integrable-solutions.net, joseph@codesourcery.com, burnus@net-b.de, charlet@act-europe.fr Subject: Re: [PATCH 3/6] Emit macro expansion related diagnostics References: <1318845428-32182-1-git-send-email-dodji@redhat.com> <1318845428-32182-4-git-send-email-dodji@redhat.com> <4E9CD95C.5070008@redhat.com> X-URL: http://www.redhat.com Date: Tue, 18 Oct 2011 09:22:00 -0000 In-Reply-To: <4E9CD95C.5070008@redhat.com> (Jason Merrill's message of "Mon, 17 Oct 2011 21:41:48 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01603.txt.bz2 Jason Merrill 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 (s.duplicated_macro_maps_locations_size), STAT_LABEL (s.duplicated_macro_maps_locations_size)); - fprintf (stderr, "Total allocated maps size: %5lu%c\n", + fprintf (stderr, "Total allocated maps size: %5ld%c\n", SCALE (total_allocated_map_size), STAT_LABEL (total_allocated_map_size)); - fprintf (stderr, "Total used maps size: %5lu%c\n", + fprintf (stderr, "Total used maps size: %5ld%c\n", SCALE (total_used_map_size), STAT_LABEL (total_used_map_size)); fprintf (stderr, "\n"); diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 1e2a148..ef98f59 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -687,17 +687,17 @@ expanded_location linemap_expand_location_full (struct line_maps *, linemap_get_statistics. */ struct linemap_stats { - size_t num_ordinary_maps_allocated; - size_t num_ordinary_maps_used; - size_t ordinary_maps_allocated_size; - size_t ordinary_maps_used_size; - size_t num_expanded_macros; - size_t num_macro_tokens; - size_t num_macro_maps_used; - size_t macro_maps_allocated_size; - size_t macro_maps_used_size; - size_t macro_maps_locations_size; - size_t duplicated_macro_maps_locations_size; + long num_ordinary_maps_allocated; + long num_ordinary_maps_used; + long ordinary_maps_allocated_size; + long ordinary_maps_used_size; + long num_expanded_macros; + long num_macro_tokens; + long num_macro_maps_used; + long macro_maps_allocated_size; + long macro_maps_used_size; + long macro_maps_locations_size; + long duplicated_macro_maps_locations_size; }; /* Compute and return statistics about the memory consumption of some diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 43e2856..fb3be3a 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -1180,7 +1180,7 @@ void linemap_get_statistics (struct line_maps *set, struct linemap_stats *s) { - size_t ordinary_maps_allocated_size, ordinary_maps_used_size, + long ordinary_maps_allocated_size, ordinary_maps_used_size, macro_maps_allocated_size, macro_maps_used_size, macro_maps_locations_size = 0, duplicated_macro_maps_locations_size = 0; diff --git a/libcpp/macro.c b/libcpp/macro.c index 2d0eeaa..f313959 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1278,6 +1278,10 @@ macro_arg_token_iter_init (macro_arg_token_iter *iter, iter->track_macro_exp_p = track_macro_exp_p; iter->kind = kind; iter->token_ptr = token_ptr; + /* Unconditionally initialize this so that the compiler doesn't warn + about iter->location_ptr being possibly uninitialized later after + this code has been inlined somewhere. */ + iter->location_ptr = NULL; if (track_macro_exp_p) iter->location_ptr = get_arg_token_location (arg, kind); #ifdef ENABLE_CHECKING -- Dodji