Re: [PATCH v2 1/1] fs: proc: Fix build with GCC 15 due to -Werror=unterminated-string-initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02.10.2024 14:48, Andrew Morton wrote:
> "array".  But really, just using "mnemonics[]" conveys all we need.

Noted :)

> If we want to preserve the party trick then perhaps we can use
> 
> -                [0 ... (BITS_PER_LONG-1)] = { "??" },
> +                [0 ... (BITS_PER_LONG-1)] = { '?', '?' },
> 
> and this will shut gcc up?

Wouldn't that mean we would have to split every element of mnemonics[]
For example, [ilog2(VM_READ)] = "rd" to [ilog2(VM_READ)] = {'r', 'd'}
and so on.

> If we do remove the party trick (as you have done) then this:
> 
> 		if (vma->vm_flags & (1UL << i)) {
> 			seq_putc(m, mnemonics[i][0]);
> 			seq_putc(m, mnemonics[i][1]);
> 			seq_putc(m, ' ');
> 		}
> 
> can be simplified (and probably sped up) with
> 
> 		
> 		if (vma->vm_flags & (1UL << i))
> 			seq_printf(m, "%s ", mnemonics[i]);
> 
> yes?
> 
That does seems correct.

P.S. Sorry for the late reply.
-- 
Regards,
listout




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux