public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00           ` H.J. Lu
  2017-01-01  0:00             ` Paul Eggert
@ 2017-01-01  0:00             ` Florian Weimer
  1 sibling, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2017-01-01  0:00 UTC (permalink / raw)
  To: H.J. Lu
  Cc: Paul Eggert, Stefan Liebler, GNU C Library, Libc-stable Mailing List

* H. J. Lu:

> On Thu, Sep 7, 2017 at 10:38 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
>> H.J. Lu wrote:
>>>
>>> -static const const char *domain = "www.example.com";
>>> +static const char * const domain = "www.example.com";
>>
>>
>> Why not:
>>
>> static const char domain[] = "www.example.com";
>>
>> instead, before you backport?  It's simpler and less confusing.
>
> If we want to do this, it should go into master branch first and
> backport it 2.26 branch before putting in 2.25 branch.    Should
> we do it?

I have no objections.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00         ` Paul Eggert
@ 2017-01-01  0:00           ` H.J. Lu
  2017-01-01  0:00             ` Paul Eggert
  2017-01-01  0:00             ` Florian Weimer
  0 siblings, 2 replies; 7+ messages in thread
From: H.J. Lu @ 2017-01-01  0:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Stefan Liebler, GNU C Library, Libc-stable Mailing List

On Thu, Sep 7, 2017 at 10:38 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> H.J. Lu wrote:
>>
>> -static const const char *domain = "www.example.com";
>> +static const char * const domain = "www.example.com";
>
>
> Why not:
>
> static const char domain[] = "www.example.com";
>
> instead, before you backport?  It's simpler and less confusing.

If we want to do this, it should go into master branch first and
backport it 2.26 branch before putting in 2.25 branch.    Should
we do it?


-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
       [not found]     ` <20170224095709.GA4243@altlinux.org>
@ 2017-01-01  0:00       ` H.J. Lu
  2017-01-01  0:00         ` Paul Eggert
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2017-01-01  0:00 UTC (permalink / raw)
  To: Stefan Liebler, GNU C Library, Libc-stable Mailing List

On Fri, Feb 24, 2017 at 1:57 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Tue, Jan 31, 2017 at 04:13:29PM +0100, Stefan Liebler wrote:
>> On 01/31/2017 11:23 AM, Andreas Schwab wrote:
>> >On Jan 31 2017, Stefan Liebler <stli@linux.vnet.ibm.com> wrote:
>> >
>> >> static const const char *domain = "www.example.com";
>> >
>> >domain should be const.
>> >
>> >Andreas.
>> >
>> Okay.
>>
>> Here is the updated patch.
>>
>> Okay to commit (after release)?
>>
>> Bye.
>> Stefan
>>
>> commit 322394d80126fb540026818bb81f0df79d2fa3cf
>> Author: Stefan Liebler <stli@linux.vnet.ibm.com>
>> Date:   Mon Jan 30 09:06:44 2017 +0100
>>
>>     Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
>>
>>     Compiling resolv/tst-resolv-qtypes.c with GCC 7 results in:
>>     tst-resolv-qtypes.c:53:14: error: duplicate ‘const’ declaration specifier [-Werror=duplicate-decl-specifier]
>>      static const const char *domain = "www.example.com";
>>
>>     This patch removes the duplicate const and makes domain a const pointer
>>     to const char literal.
>>
>>     ChangeLog:
>>
>>       * resolv/tst-resolv-qtypes.c (domain):
>>       Change type to const pointer to const char.
>>
>> diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c
>> index dcb39e5..06ea3db 100644
>> --- a/resolv/tst-resolv-qtypes.c
>> +++ b/resolv/tst-resolv-qtypes.c
>> @@ -50,7 +50,7 @@ response (const struct resolv_response_context *ctx,
>>    resolv_response_close_record (b);
>>  }
>>
>> -static const const char *domain = "www.example.com";
>> +static const char * const domain = "www.example.com";
>>
>>  static int
>>  wrap_res_query (int type, unsigned char *answer, int answer_length)
>
> Yes, this is OK.
>

I'd like to backport it to 2.25 branch.   Any objections?

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00             ` Paul Eggert
@ 2017-01-01  0:00               ` H.J. Lu
  2017-01-01  0:00                 ` Paul Eggert
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2017-01-01  0:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Stefan Liebler, GNU C Library, Libc-stable Mailing List

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

On Thu, Sep 7, 2017 at 12:51 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> H.J. Lu wrote:
>>>
>>> Why not:
>>>
>>> static const char domain[] = "www.example.com";
>>>
>>> instead, before you backport?  It's simpler and less confusing.
>
>
>> If we want to do this, it should go into master branch first and
>> backport it 2.26 branch before putting in 2.25 branch.    Should
>> we do it?
>
>
> Yes, that's the idea.

Here is the patch.  Tested with GCC 7 on x86-64.

OK for master and 2.25/2.26 branches?

Thanks.


-- 
H.J.

[-- Attachment #2: 0001-Use-static-const-char-domain.patch --]
[-- Type: text/x-patch, Size: 846 bytes --]

From cb99c41d24dbba967974ac6ed3d1a23dc7f66cfd Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 7 Sep 2017 13:02:36 -0700
Subject: [PATCH] Use "static const char domain[] ="

	* resolv/tst-resolv-qtypes.c (domain): Changed to
	"const char domain[] =".
---
 resolv/tst-resolv-qtypes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c
index 06ea3dbd14..da3325f80c 100644
--- a/resolv/tst-resolv-qtypes.c
+++ b/resolv/tst-resolv-qtypes.c
@@ -50,7 +50,7 @@ response (const struct resolv_response_context *ctx,
   resolv_response_close_record (b);
 }
 
-static const char * const domain = "www.example.com";
+static const char domain[] = "www.example.com";
 
 static int
 wrap_res_query (int type, unsigned char *answer, int answer_length)
-- 
2.13.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00       ` Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c H.J. Lu
@ 2017-01-01  0:00         ` Paul Eggert
  2017-01-01  0:00           ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2017-01-01  0:00 UTC (permalink / raw)
  To: H.J. Lu, Stefan Liebler, GNU C Library, Libc-stable Mailing List

H.J. Lu wrote:
> -static const const char *domain = "www.example.com";
> +static const char * const domain = "www.example.com";

Why not:

static const char domain[] = "www.example.com";

instead, before you backport?  It's simpler and less confusing.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00               ` H.J. Lu
@ 2017-01-01  0:00                 ` Paul Eggert
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Eggert @ 2017-01-01  0:00 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Stefan Liebler, GNU C Library, Libc-stable Mailing List

H.J. Lu wrote:
> OK for master and 2.25/2.26 branches?

Thanks, it looks good.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
  2017-01-01  0:00           ` H.J. Lu
@ 2017-01-01  0:00             ` Paul Eggert
  2017-01-01  0:00               ` H.J. Lu
  2017-01-01  0:00             ` Florian Weimer
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2017-01-01  0:00 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Stefan Liebler, GNU C Library, Libc-stable Mailing List

H.J. Lu wrote:
>> Why not:
>>
>> static const char domain[] = "www.example.com";
>>
>> instead, before you backport?  It's simpler and less confusing.

> If we want to do this, it should go into master branch first and
> backport it 2.26 branch before putting in 2.25 branch.    Should
> we do it?

Yes, that's the idea.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-09-07 20:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <8d30c0c3-0b00-fc08-8e49-811aec114ef9@linux.vnet.ibm.com>
     [not found] ` <878tpry1ce.fsf@linux-m68k.org>
     [not found]   ` <4c0d8778-916b-43d4-3206-2653f3696390@linux.vnet.ibm.com>
     [not found]     ` <20170224095709.GA4243@altlinux.org>
2017-01-01  0:00       ` Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c H.J. Lu
2017-01-01  0:00         ` Paul Eggert
2017-01-01  0:00           ` H.J. Lu
2017-01-01  0:00             ` Paul Eggert
2017-01-01  0:00               ` H.J. Lu
2017-01-01  0:00                 ` Paul Eggert
2017-01-01  0:00             ` Florian Weimer

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).