cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Const qualifier mis-match detected by DECC/VMS in curl_gssapi.c

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 26 Nov 2014 10:10:38 +0100

On Tue, Nov 25, 2014 at 11:55:10AM -0600, John E. Malmberg wrote:
> In building the Nov 24 daily snapshot on VMS, I am getting the
> following warnings because a const pointer is being assigned to a
> member of a structure that is not const.
>
> Generally with DECC, a cast of (char *) is needed here, I am assuming
> that the current settings used for gcc are not that picky?

Or, the definition of gss_OID_desc has changed at some point.

> I will be submitting a patch that disables that check for VMS builds.
>
> 79919 static const char spnego_oid_bytes[] = "\x2b\x06\x01\x05\x05\x0
> 79920 gss_OID_desc Curl_spnego_mech_oid = { 6, &spnego_oid_bytes };
> .........................................1
> %CC-W-NOTCONSTQUAL, (1) In the initializer for
> Curl_spnego_mech_oid.elements, the referenced type of the pointer
> value
> "&spnego_oid_bytes" is const, but the referenced type of the target
> of this assignment is not.
>
> 79921 static const char krb5_oid_bytes[] = "\x2a\x86\x48\x86\xf7\x12\♦
> 79922 gss_OID_desc Curl_krb5_mech_oid = { 9, &krb5_oid_bytes };
> .......................................1
> %CC-W-NOTCONSTQUAL, (1) In the initializer for
> Curl_krb5_mech_oid.elements, the referenced type of the pointer value
> "&krb5_oid_bytes" is const, but the referenced type of the target of
> this assignment is not.

This is unfortunate. It might be that certain uses of gss_OID_desc require that
the elements pointed to by that pointer be modifiable, for example, if it's
allocated on the heap. If it's indeed safe for this to be const (i.e. the
called functions never actually modify it), then curl will have to cast it.
But if the typedef has changed to make it const in recent versions, and since
no-one else has complained, I would just leave it and suggest upgrading!

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-26