All of lore.kernel.org
 help / color / mirror / Atom feed
* x86/MCE: drop bogus const modifier from AMD's bank4_names()
@ 2015-01-23  8:32 Jan Beulich
  2015-01-23  9:58 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2015-01-23  8:32 UTC (permalink / raw)
  To: Borislav Petkov, tony.luck; +Cc: linux-kernel

The compiler validly warns about it being ignored.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 arch/x86/kernel/cpu/mcheck/mce_amd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 3.19-rc5/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ 3.19-rc5-x86-MCE-AMD-bank4_names/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -79,7 +79,7 @@ static inline bool is_shared_bank(int ba
 	return (bank == 4);
 }
 
-static const char * const bank4_names(struct threshold_block *b)
+static const char *bank4_names(const struct threshold_block *b)
 {
 	switch (b->address) {
 	/* MSR4_MISC0 */




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
  2015-01-23  8:32 x86/MCE: drop bogus const modifier from AMD's bank4_names() Jan Beulich
@ 2015-01-23  9:58 ` Borislav Petkov
  2015-01-23 10:05   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2015-01-23  9:58 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tony.luck, linux-kernel

On Fri, Jan 23, 2015 at 08:32:01AM +0000, Jan Beulich wrote:
> The compiler validly warns about it being ignored.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Applied, thanks.

Out of curiosity: When do you see this? Building with
-Wignored-qualifiers or -Wextra?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
  2015-01-23  9:58 ` Borislav Petkov
@ 2015-01-23 10:05   ` Jan Beulich
  2015-01-23 10:16     ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2015-01-23 10:05 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: tony.luck, linux-kernel

>>> On 23.01.15 at 10:58, <bp@alien8.de> wrote:
> On Fri, Jan 23, 2015 at 08:32:01AM +0000, Jan Beulich wrote:
>> The compiler validly warns about it being ignored.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Applied, thanks.
> 
> Out of curiosity: When do you see this? Building with
> -Wignored-qualifiers or -Wextra?

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.

Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
  2015-01-23 10:05   ` Jan Beulich
@ 2015-01-23 10:16     ` Borislav Petkov
  2015-01-23 15:04       ` U.Mutlu
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2015-01-23 10:16 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tony.luck, linux-kernel

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

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86/MCE: drop bogus const modifier from AMD's bank4_names()
  2015-01-23 10:16     ` Borislav Petkov
@ 2015-01-23 15:04       ` U.Mutlu
  0 siblings, 0 replies; 5+ messages in thread
From: U.Mutlu @ 2015-01-23 15:04 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-23 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23  8:32 x86/MCE: drop bogus const modifier from AMD's bank4_names() Jan Beulich
2015-01-23  9:58 ` Borislav Petkov
2015-01-23 10:05   ` Jan Beulich
2015-01-23 10:16     ` Borislav Petkov
2015-01-23 15:04       ` U.Mutlu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.