Split String Checkpatch Warning
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
Quoted 16 lines · Elizabeth Ferdman
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";
Quoted 8 lines
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
Quoted 23 lines · Alison Schofield
Quoted 22 lines · Elizabeth Ferdman
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.
Quoted 8 lines
Quoted 2 lines
Thanks,
LizHi 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
Quoted 8 lines · Elizabeth Ferdman
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");
Quoted 7 lines
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
Quoted 7 lines · Elizabeth Ferdman
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
Quoted 25 lines
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 [email protected]. To post to this group, send email to [email protected].
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.