[19475] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: Making discarded-qualifiers a gcc error instead of warning?

daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Sep 2 02:24:28 2016

To: krbdev@mit.edu
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <617a547f-feae-5b8f-f127-b63c52c2e956@mit.edu>
Date: Fri, 2 Sep 2016 02:24:11 -0400
MIME-Version: 1.0
In-Reply-To: <20160902002300.GA15711@oracle.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu

On 09/01/2016 08:23 PM, Will Fiveash wrote:
> On Thu, Sep 01, 2016 at 05:56:15PM -0500, Will Fiveash wrote:
>> I'm in the process of making the Solaris compile of MIT krb more strict
>> and one thing I've noticed in the MIT build environment is that
>> -Wdiscarded-qualifiers is being treated by gcc as a warning, not an
>> error.  Given there are only three of these types of warnings in the
>> entire 1.14.3 code base I was wondering if y'all would consider making
>> discarded-qualifiers an error and adding a cast to the three lines in
>> the source files that need it?

Sure.  Feel free to submit a pull request if you have time to do so;
otherwise I will try to get around to it.

> to compile without a hard error (a -Wincompatible-pointer-types warning
> is issued).  Shouldn't this bug also cause gcc to error out?

See:


https://github.com/krb5/krb5/commit/d69a3bd4c1d0c39a1f527c97f12bc53ea0cc1b8b

Ben wrote:
> char * is explicitly compatible with every (non-function) pointer type in
> the C standard.  So this particular example should not necessarily error
> out, though the analogous one with int* should.

I don't believe that's true.  You can cast any pointer to char * and
dereference it without violating strict aliasing (C99 section 6.5
paragraphs 6-7), but that doesn't mean char * is compatible with char **
(C99 section 6.7.5.1).
_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

home help back first fref pref prev next nref lref last post