cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: John E. Malmberg <wb8tyw_at_qsl.net>
Date: Fri, 28 Nov 2014 11:22:36 -0600

On 11/26/2014 3:10 AM, Dan Fandrich wrote:
> 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.

As near as I can tell the definition of gss_OID_desc has not changed in
a while.

>> 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.
<snip>
> 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!

The compiler is complaining that Curl_krb5_mech_oid is not const
qualified, yet is being initialized to point to a structure that is
const qualified.

The compiler is simply warning that some code external to the module
being compiler may try to modify the constant via the structure pointer
as a lint feature.

The typedef for Kerberos has not changed as near as I can tell from an
internet search, so updating Kerberos will not change the diagnostic.

This issue was not present when I last built curl on VMS, which was
version 7.32.

The only options I can find is either to disable that diagnostic message
globally or mark each case where it occurs with a cast.

Regards,
-John

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