Joseph Myers <jos...@codesourcery.com> writes:

> I think both the patches in this discussion (special { 0 } handling
> and the new warning option) generally look good.

I also wrote another small patch, which you might have missed since it's
buried in the discussion here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547554.html
(perhaps I should have sent it as its own message).

Here is the patch below, for convenience:
From 6b18a033ece794088ad7a86bfc557c787c7fc4ae Mon Sep 17 00:00:00 2001
From: Asher Gordon <asd...@posteo.net>
Date: Mon, 8 Jun 2020 20:59:38 -0400
Subject: [PATCH] Replace free with XDELETE.

gcc/c/ChangeLog:

	* c-typeck.c (free_all_tagged_tu_seen_up_to): Replace free
	with XDELETE.
	(finish_init): Likewise.
	(pop_init_level): Likewise.
---
 gcc/c/c-typeck.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 3be3690c6e2..fa506b6515c 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -1407,7 +1407,7 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til)
       const struct tagged_tu_seen_cache *const tu1
 	= (const struct tagged_tu_seen_cache *) tu;
       tu = tu1->next;
-      free (CONST_CAST (struct tagged_tu_seen_cache *, tu1));
+      XDELETE (CONST_CAST (struct tagged_tu_seen_cache *, tu1));
     }
   tagged_tu_seen_base = tu_til;
 }
@@ -8279,13 +8279,13 @@ finish_init (void)
     {
       struct constructor_stack *q = constructor_stack;
       constructor_stack = q->next;
-      free (q);
+      XDELETE (q);
     }
 
   gcc_assert (!constructor_range_stack);
 
   /* Pop back to the data of the outer initializer (if any).  */
-  free (spelling_base);
+  XDELETE (spelling_base);
 
   constructor_decl = p->decl;
   require_constant_value = p->require_constant_value;
@@ -8298,7 +8298,7 @@ finish_init (void)
   spelling_size = p->spelling_size;
   constructor_top_level = p->top_level;
   initializer_stack = p->next;
-  free (p);
+  XDELETE (p);
 }

 /* Call here when we see the initializer is surrounded by braces.
@@ -8829,7 +8829,7 @@ pop_init_level (location_t loc, int implicit,
   RESTORE_SPELLING_DEPTH (constructor_depth);
 
   constructor_stack = p->next;
-  free (p);
+  XDELETE (p);
 
   if (ret.value == NULL_TREE && constructor_stack == 0)
     ret.value = error_mark_node;
-- 
2.27.0

> I don't see you in the FSF copyright assignment list; could you
> complete
> https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
> (unless you're already covered by an employer assignment)?

Done.

Thanks,
Asher

-- 
By necessity, by proclivity, and by delight, we all quote.  In fact, it is as
difficult to appropriate the thoughts of others as it is to invent.
                -- R. Emerson
                -- Quoted from a fortune cookie program
                (whose author claims, "Actually, stealing IS easier.")
                [to which I reply, "You think it's easy for me to
                misconstrue all these misquotations?!?"  Ed.]
                               --------
I prefer to send and receive mail encrypted. Please send me your
public key, and if you do not have my public key, please let me
know. Thanks.

GPG fingerprint: 38F3 975C D173 4037 B397  8095 D4C9 C4FC 5460 8E68

Attachment: signature.asc
Description: PGP signature

Reply via email to