From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A4D441F8C6 for ; Sat, 7 Aug 2021 19:51:07 +0000 (UTC) Received: from localhost ([::1]:42788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCSLa-0007w0-GB for normalperson@yhbt.net; Sat, 07 Aug 2021 15:51:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCSLW-0007uN-IN for bug-gnulib@gnu.org; Sat, 07 Aug 2021 15:51:02 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.163]:32275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCSLT-0002oX-PK for bug-gnulib@gnu.org; Sat, 07 Aug 2021 15:51:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1628365857; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=fwGoxA2lc8OFLyYpi1oROdlDXaPbF6CS8o36e5/d/DY=; b=L9vJYw1bVSXDRBckY9MsXTkxd7wpPho6Ry6RVCzqnFCitzkrFTt83xQ4EGgthkv6qO borRvQvAujutZ5KU0d2gfCK4tmgnca4s3I/IJcmVirT8J2mMqvICq00tL817NaWVmoBk eoygtNBRJ4UZhgZf1VJh2ZJ8woxC6bb4sKldgn8T6g+QDZNzPbLZkyD3O4YfGpTVXpsJ Avwt/oBZky0TdIlndzFejoqI2z+5Yl9HiABBLorak6aaFIiiSpwow1K29KZIa3IEqosl 5SzSL6+Zc0HvDiJ3wGQLRT7uXcDkOWkxqaHRFgCAZEcgycNTVuQozeU24c93ubPgU19u sc/A== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH/DXj0JGsbh0vbrMZq" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.31.0 DYNA|AUTH) with ESMTPSA id I0a189x77JouFvV (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sat, 7 Aug 2021 21:50:56 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: pipe-filter-gi: Improve GCC 11 allocation-deallocation checking Date: Sat, 07 Aug 2021 21:50:56 +0200 Message-ID: <4217162.T5AuPNMGXD@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.163; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" 2021-08-07 Bruno Haible pipe-filter-gi: Improve GCC 11 allocation-deallocation checking. * lib/pipe-filter.h (pipe_filter_gi_close): Move declaration up. (pipe_filter_gi_create): Declare that deallocation must happen through 'pipe_filter_gi_close'. diff --git a/lib/pipe-filter.h b/lib/pipe-filter.h index 614b9e0..c308cf3 100644 --- a/lib/pipe-filter.h +++ b/lib/pipe-filter.h @@ -152,6 +152,23 @@ struct pipe_filter_ig; struct pipe_filter_gi; +/* Finish reading the output via the prepare_read/done_read functions + specified to pipe_filter_gi_create. + + Note that the prepare_read/done_read functions may be called in a + different thread than the current thread (depending on the platform). + However, they will always be called before pipe_filter_gi_close has + returned. + + The write side of the pipe is closed as soon as pipe_filter_gi_close + starts, while the read side will be closed just before it finishes. + + Return 0 upon success, or (only if exit_on_error is false): + - -1 with errno set upon failure, + - the positive exit code of the subprocess if that failed. */ +extern int + pipe_filter_gi_close (struct pipe_filter_gi *filter); + /* Create a subprocess and pipe some data through it. Arguments: - progname is the program name used in error messages. @@ -185,7 +202,8 @@ extern struct pipe_filter_gi * bool null_stderr, bool exit_on_error, prepare_read_fn prepare_read, done_read_fn done_read, - void *private_data); + void *private_data) + _GL_ATTRIBUTE_DEALLOC (pipe_filter_gi_close, 1); /* Write size bytes starting at buf into the pipe and in the meanwhile possibly call the prepare_read and done_read functions specified to @@ -207,23 +225,6 @@ extern int pipe_filter_gi_write (struct pipe_filter_gi *filter, const void *buf, size_t size); -/* Finish reading the output via the prepare_read/done_read functions - specified to pipe_filter_gi_create. - - Note that the prepare_read/done_read functions may be called in a - different thread than the current thread (depending on the platform). - However, they will always be called before pipe_filter_gi_close has - returned. - - The write side of the pipe is closed as soon as pipe_filter_gi_close - starts, while the read side will be closed just before it finishes. - - Return 0 upon success, or (only if exit_on_error is false): - - -1 with errno set upon failure, - - the positive exit code of the subprocess if that failed. */ -extern int - pipe_filter_gi_close (struct pipe_filter_gi *filter); - /* ============================ pipe_filter_gg ============================ */