On Fri, 18 Oct 2019, Luc Van Oostenryck wrote:

> On Thu, Oct 17, 2019 at 05:49:24PM -0700, Paul Walmsley wrote:
> > sparse complains loudly when string literals associated with
> > preprocessor directives are split into multiple, separately quoted
> > strings across different lines:
> 
> ...
>  
> >  #ifndef __riscv_cmodel_medany
> > -#error "setup_vm() is called from head.S before relocate so it should "
> > -   "not use absolute addressing."
> > +#error "setup_vm() is called from head.S before relocate so it should not 
> > use absolute addressing."
> >  #endif
> 
> Using a blacslash should do the trick :
>       #error "blablablablablablablablablablablabla" \
>                       "and blablabla again"
> Or if need I cn fix Sparse if needed and desiable.

Thanks for the kind offer!

The backslashless syntax is pretty horrible to my eyes.  As far as I can 
tell from a brief glance, the instance fixed by this patch was the only 
instance of its kind in the kernel.  The existing kernel precedents appear 
to be to simply use a single long line.  Example:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/compiler-gcc.h#n3

So, from a kernel point of view, we should just fix this specific 
instance.  It doesn't seem worth changing sparse for such a rare case.

On the other hand, gcc seems to support the non-backslashed syntax.  So if 
the intention is for sparse to follow the gcc practice, and to be used 
beyond the kernel, maybe it's worth aligning sparse to gcc?  Only if 
you're bored, I suppose...


- Paul

Reply via email to