Making discarded-qualifiers a gcc error instead of warning?

Will Fiveash will.fiveash at oracle.com
Thu Sep 1 20:23:00 EDT 2016


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?

Related to this, the current MIT gcc settings allows:

#include <stdio.h>
#include <stdlib.h>

void
foo(char *arg)
{
	printf("arg is %p\n", arg);
	return;
}

int
main (int argc, char *argv[])
{
	char *bad;

	foo(&bad);  /* <----- this should just be bad */
}

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

-- 
Will Fiveash
Oracle Solaris Software Engineer


More information about the krbdev mailing list