[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m9tnue$fiu$1@ger.gmane.org>
Date: Fri, 23 Jan 2015 16:04:46 +0100
From: "U.Mutlu" <for-gmane@...luit.com>
To: linux-kernel@...r.kernel.org
Subject: Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
Jan Beulich wrote, On 01/23/2015 09:32 AM:
>
> -static const char * const bank4_names(struct threshold_block *b)
> +static const char *bank4_names(const struct threshold_block *b)
There is a big difference in the return type, cf. below.
Of course, if possible, the more const the better.
Borislav Petkov wrote, On 01/23/2015 11:16 AM:
> On Fri, Jan 23, 2015 at 10:05:40AM +0000, Jan Beulich wrote:
>> It's been a long while ago that I noticed and fixed the warning, so
>> I don't recall the details. What I do know is that I didn't force any
>> extra flags, and that a similar issue elsewhere in the tree (fixed
>> in 3.19-rc5) triggered the same warning in at least one of my builds
>> (again without any extra warning options) in -rc4.
>
> Older compiler maybe. Not that it is worth wasting too much time on it
> though...
int main()
{
char mem1[] = "foo";
char mem2[] = "bar";
const char* const p1 = mem1; // both ptr and content are const
const char* p2 = mem2; // content is const, but not the ptr
// ++p1; // not possible b/c p1 is const
++p2; // possible b/c p2 is not const
// *p1 = 'X'; // not possible b/c content of p1 is const
// *p2 = 'A'; // not possible b/c content of p2 is const
return 0;
}
cu
Uenal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists