public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>,
	Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [PATCH] stdlib: DIAG_IGNORE_NEEDS_COMMENT setenv.c
Date: Mon, 19 Sep 2022 11:05:31 -0300	[thread overview]
Message-ID: <ff98d6aa-7a31-30bb-0813-3bbbaff2719e@linaro.org> (raw)
In-Reply-To: <87tu5u5hjf.fsf@oldenburg.str.redhat.com>



On 30/08/22 04:15, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
> 
>> Checked on x86_64-linux-gnu.
>> ---
>>  stdlib/setenv.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/stdlib/setenv.c b/stdlib/setenv.c
>> index 2176cbac31..2add8bfb41 100644
>> --- a/stdlib/setenv.c
>> +++ b/stdlib/setenv.c
>> @@ -19,12 +19,14 @@
>>  # include <config.h>
>>  #endif
>>  
>> +#if _LIBC
>> +# include <libc-diag.h>
>>  /* Pacify GCC; see the commentary about VALLEN below.  This is needed
>>     at least through GCC 4.9.2.  Pacify GCC for the entire file, as
>>     there seems to be no way to pacify GCC selectively, only for the
>> -   place where it's needed.  Do not use DIAG_IGNORE_NEEDS_COMMENT
>> -   here, as it's not defined yet.  */
>> -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
>> +   place where it's needed.  */
>> +DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
>> +#endif
> 
> The comment was added in:
> 
> commit 03c1e456b079929a8290aeb4aadb05c0df73bfd2
> Author: Paul Eggert <eggert@cs.ucla.edu>
> Date:   Sun Apr 19 01:06:33 2015 -0700
> 
>     Better fix for setenv (..., NULL, ...)
>     
>     * stdlib/setenv.c (__add_to_environ):
>     Dump core quickly if setenv (..., NULL, ...) is called.
>     This time, do it the right way, and pacify GCC with a pragma.
> 
> Paul, what did you mean when you wrote “not defined yet”?  Is it a
> gnulib thing?

Paul, is anything to prevent us to use DIAG_IGNORE_NEEDS_COMMENT here?
For glibc it is the best way to possible handle different compiler that
might not need to define it.

      parent reply	other threads:[~2022-09-19 14:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 19:00 Adhemerval Zanella
2022-08-30  7:15 ` Florian Weimer
2022-08-30  7:15   ` Florian Weimer
2022-09-19 14:05   ` Adhemerval Zanella Netto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff98d6aa-7a31-30bb-0813-3bbbaff2719e@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).