All of lore.kernel.org
 help / color / mirror / Atom feed
* Split String Checkpatch Warning
@ 2016-09-29 22:14 Elizabeth Ferdman
  2016-09-29 23:50 ` Alison Schofield
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Elizabeth Ferdman @ 2016-09-29 22:14 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: amsfield22

I'm seeing this checkpatch error:

WARNING: quoted string split across lines

example:
MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, "
             "Christoph Bartelmus, Andrei Tanas");

Just wondering if this is a good thing to fix, and how do I fix it? I
don't see anything about it in the style guide. If I put the whole
string on one line, it's more than 80 characters. I found one option on
stack overflow that says you can do:

char *my_string = "Line 1 \
                   Line 2";

So I'd be putting a space and a backslash after the line?
I don't know if that conforms with linux kernel coding style though.

I'm also wondering if anyone knows any good resources on common
checkpatch errors and the proper way to fix them. 

Thanks,
Liz


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

* Re: Split String Checkpatch Warning
  2016-09-29 22:14 Split String Checkpatch Warning Elizabeth Ferdman
@ 2016-09-29 23:50 ` Alison Schofield
  2016-09-30  0:04   ` Elizabeth Ferdman
  2016-09-30  4:52 ` [Outreachy kernel] " Greg KH
  2016-09-30  4:56 ` Julia Lawall
  2 siblings, 1 reply; 5+ messages in thread
From: Alison Schofield @ 2016-09-29 23:50 UTC (permalink / raw)
  To: Elizabeth Ferdman; +Cc: outreachy-kernel

On Thu, Sep 29, 2016 at 03:14:05PM -0700, Elizabeth Ferdman wrote:
> I'm seeing this checkpatch error:
> 
> WARNING: quoted string split across lines
> 
> example:
> MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, "
>              "Christoph Bartelmus, Andrei Tanas");
> 
> Just wondering if this is a good thing to fix, and how do I fix it? I
> don't see anything about it in the style guide. If I put the whole
> string on one line, it's more than 80 characters. I found one option on
> stack overflow that says you can do:
> 
> char *my_string = "Line 1 \
>                    Line 2";
> 
> So I'd be putting a space and a backslash after the line?
> I don't know if that conforms with linux kernel coding style though.
> 
> I'm also wondering if anyone knows any good resources on common
> checkpatch errors and the proper way to fix them. 
> 
> Thanks,
> Liz
Hi Liz,
Best guide may very well be this googlegroup!  It goes back a few years,
so pretty much every checkpatch error has some history in here.  'split
string' not so much, only 11.  Hopefully you can find something in there
that gives you a lead.  Search through the googlegroups web interface.
alisons


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

* Re: Split String Checkpatch Warning
  2016-09-29 23:50 ` Alison Schofield
@ 2016-09-30  0:04   ` Elizabeth Ferdman
  0 siblings, 0 replies; 5+ messages in thread
From: Elizabeth Ferdman @ 2016-09-30  0:04 UTC (permalink / raw)
  To: Alison Schofield; +Cc: outreachy-kernel

On Thu, Sep 29, 2016 at 04:50:14PM -0700, Alison Schofield wrote:
> On Thu, Sep 29, 2016 at 03:14:05PM -0700, Elizabeth Ferdman wrote:
> > I'm seeing this checkpatch error:
> > 
> > WARNING: quoted string split across lines
> > 
> > example:
> > MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, "
> >              "Christoph Bartelmus, Andrei Tanas");
> > 
> > Just wondering if this is a good thing to fix, and how do I fix it? I
> > don't see anything about it in the style guide. If I put the whole
> > string on one line, it's more than 80 characters. I found one option on
> > stack overflow that says you can do:
> > 
> > char *my_string = "Line 1 \
> >                    Line 2";
> > 
> > So I'd be putting a space and a backslash after the line?
> > I don't know if that conforms with linux kernel coding style though.
> > 
> > I'm also wondering if anyone knows any good resources on common
> > checkpatch errors and the proper way to fix them. 
> > 
> > Thanks,
> > Liz
> Hi Liz,
> Best guide may very well be this googlegroup!  It goes back a few years,
> so pretty much every checkpatch error has some history in here.  'split
> string' not so much, only 11.  Hopefully you can find something in there
> that gives you a lead.  Search through the googlegroups web interface.
> alisons

Ohh that makes a lot of sense i will definitely do that from now on.
So for the split string, it looks like you can just make a long string
and ignore the 80 char warning.

Thanks so much!
Liz


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

* Re: [Outreachy kernel] Split String Checkpatch Warning
  2016-09-29 22:14 Split String Checkpatch Warning Elizabeth Ferdman
  2016-09-29 23:50 ` Alison Schofield
@ 2016-09-30  4:52 ` Greg KH
  2016-09-30  4:56 ` Julia Lawall
  2 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2016-09-30  4:52 UTC (permalink / raw)
  To: Elizabeth Ferdman; +Cc: outreachy-kernel, amsfield22

On Thu, Sep 29, 2016 at 03:14:05PM -0700, Elizabeth Ferdman wrote:
> I'm seeing this checkpatch error:
> 
> WARNING: quoted string split across lines
> 
> example:
> MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, "
>              "Christoph Bartelmus, Andrei Tanas");
> 
> Just wondering if this is a good thing to fix, and how do I fix it? I
> don't see anything about it in the style guide. If I put the whole
> string on one line, it's more than 80 characters. I found one option on
> stack overflow that says you can do:
> 
> char *my_string = "Line 1 \
>                    Line 2";

As most stackoverflow answers, this one is technically correct, but
totally wrong :)

You would end up with a string that contained "Line 1          Line 2"
in it.  The leading whitespace is not what you want to have before "Line
2".

Just merge the strings, putting them all on one line, so your example
above should look like:
MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, Christoph Bartelmus, Andrei Tanas");

Hope this helps,

greg k-h


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

* Re: [Outreachy kernel] Split String Checkpatch Warning
  2016-09-29 22:14 Split String Checkpatch Warning Elizabeth Ferdman
  2016-09-29 23:50 ` Alison Schofield
  2016-09-30  4:52 ` [Outreachy kernel] " Greg KH
@ 2016-09-30  4:56 ` Julia Lawall
  2 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-09-30  4:56 UTC (permalink / raw)
  To: Elizabeth Ferdman; +Cc: outreachy-kernel, amsfield22



On Thu, 29 Sep 2016, Elizabeth Ferdman wrote:

> I'm seeing this checkpatch error:
>
> WARNING: quoted string split across lines
>
> example:
> MODULE_AUTHOR("Ralph Metzler, Trent Piepho, Ben Pfaff, "
>              "Christoph Bartelmus, Andrei Tanas");

In general, you can put the whole string on one line, even if it goes over
80 characters.  It makes it easier to grep for.  Perhaps there could be a
way to make the string shorter too.  In this case, obviously you can't.
I'm not sure that there would be a need to grep for this anyway, ie it
doesn't look like something that would be generated in an error case, so
it is probably better left as is.

julia

>
> Just wondering if this is a good thing to fix, and how do I fix it? I
> don't see anything about it in the style guide. If I put the whole
> string on one line, it's more than 80 characters. I found one option on
> stack overflow that says you can do:
>
> char *my_string = "Line 1 \
>                    Line 2";
>
> So I'd be putting a space and a backslash after the line?
> I don't know if that conforms with linux kernel coding style though.
>
> I'm also wondering if anyone knows any good resources on common
> checkpatch errors and the proper way to fix them.
>
> Thanks,
> Liz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160929221404.GA7406%40localhost.
> For more options, visit https://groups.google.com/d/optout.
>


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

end of thread, other threads:[~2016-09-30  4:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 22:14 Split String Checkpatch Warning Elizabeth Ferdman
2016-09-29 23:50 ` Alison Schofield
2016-09-30  0:04   ` Elizabeth Ferdman
2016-09-30  4:52 ` [Outreachy kernel] " Greg KH
2016-09-30  4:56 ` Julia Lawall

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.