Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.

Message ID 4c0d8778-916b-43d4-3206-2653f3696390@linux.vnet.ibm.com
State Committed
Headers

Commit Message

Stefan Liebler Jan. 31, 2017, 3:13 p.m. UTC
  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
  

Comments

Stefan Liebler Feb. 8, 2017, 2:52 p.m. UTC | #1
On 01/31/2017 04:13 PM, 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
>

ping
  
Stefan Liebler Feb. 24, 2017, 7:41 a.m. UTC | #2
On 02/08/2017 03:52 PM, Stefan Liebler wrote:
> On 01/31/2017 04:13 PM, 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
>>
>
> ping
>
ping
  
Dmitry V. Levin Feb. 24, 2017, 9:57 a.m. UTC | #3
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.
  
Stefan Liebler Feb. 24, 2017, 12:34 p.m. UTC | #4
On 02/24/2017 10:57 AM, Dmitry V. Levin 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.
>
>
Committed.

Thanks.
Stefan
  
H.J. Lu Sept. 7, 2017, 5:28 p.m. UTC | #5
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.
  
Paul Eggert Sept. 7, 2017, 5:38 p.m. UTC | #6
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.
  
H.J. Lu Sept. 7, 2017, 5:42 p.m. UTC | #7
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?
  
Florian Weimer Sept. 7, 2017, 7:30 p.m. UTC | #8
* 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.
  
Paul Eggert Sept. 7, 2017, 7:51 p.m. UTC | #9
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.
  

Patch

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)