This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


-- 
ldv

Attachment: pgpZTHn8_Bo2I.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]