cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Removing trailing whitespace at the end of changes lines?
@ 2018-07-30 19:53 Timur Tabi
  2018-07-30 20:21 ` Julia Lawall
  2018-07-31 19:18 ` Julia Lawall
  0 siblings, 2 replies; 4+ messages in thread
From: Timur Tabi @ 2018-07-30 19:53 UTC (permalink / raw)
  To: cocci

I've noticed that some lines changed with my cocci script have a
trailing whitespace at the end of the first line.  For example:

-        DBG_PRINTF((DBG_MODULE_GLOBAL, DBG_LEVEL_ERRORS,
-                    "NVRM: %s: failed to save GPU crash data\n",
-                    __FUNCTION__));
+        NV_PRINTF(LEVEL_ERROR,
+                  "%s: failed to save GPU crash data\n", __FUNCTION__);

There is a blank space after "LEVEL_ERROR,".  I've attached my cocci
script, but considering that coccinelle seems to reformat lines after
they've been modified,
I suspect that the problem is not in my script per se.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nv_printf.cocci
Type: application/octet-stream
Size: 1915 bytes
Desc: not available
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20180730/592b7c82/attachment.obj>

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

* [Cocci] Removing trailing whitespace at the end of changes lines?
  2018-07-30 19:53 [Cocci] Removing trailing whitespace at the end of changes lines? Timur Tabi
@ 2018-07-30 20:21 ` Julia Lawall
  2018-07-30 20:27   ` Timur Tabi
  2018-07-31 19:18 ` Julia Lawall
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2018-07-30 20:21 UTC (permalink / raw)
  To: cocci



On Mon, 30 Jul 2018, Timur Tabi wrote:

> I've noticed that some lines changed with my cocci script have a
> trailing whitespace at the end of the first line.  For example:
>
> -        DBG_PRINTF((DBG_MODULE_GLOBAL, DBG_LEVEL_ERRORS,
> -                    "NVRM: %s: failed to save GPU crash data\n",
> -                    __FUNCTION__));
> +        NV_PRINTF(LEVEL_ERROR,
> +                  "%s: failed to save GPU crash data\n", __FUNCTION__);
>
> There is a blank space after "LEVEL_ERROR,".  I've attached my cocci
> script, but considering that coccinelle seems to reformat lines after
> they've been modified,
> I suspect that the problem is not in my script per se.

Coccinelle makes some special efforts to add newlines to respect the 80
character boundary.  It seems that the associated space is not always
getting removed.  I will try to take a look.

julia

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

* [Cocci] Removing trailing whitespace at the end of changes lines?
  2018-07-30 20:21 ` Julia Lawall
@ 2018-07-30 20:27   ` Timur Tabi
  0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2018-07-30 20:27 UTC (permalink / raw)
  To: cocci

On Mon, Jul 30, 2018 at 3:21 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> Coccinelle makes some special efforts to add newlines to respect the 80
> character boundary.  It seems that the associated space is not always
> getting removed.  I will try to take a look.

It appears to happen only when the second parameter is on the second
line.  That is, the LEVEL_xxx parameter is the only parameter on the
first line.

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

* [Cocci] Removing trailing whitespace at the end of changes lines?
  2018-07-30 19:53 [Cocci] Removing trailing whitespace at the end of changes lines? Timur Tabi
  2018-07-30 20:21 ` Julia Lawall
@ 2018-07-31 19:18 ` Julia Lawall
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2018-07-31 19:18 UTC (permalink / raw)
  To: cocci



On Mon, 30 Jul 2018, Timur Tabi wrote:

> I've noticed that some lines changed with my cocci script have a
> trailing whitespace at the end of the first line.  For example:
>
> -        DBG_PRINTF((DBG_MODULE_GLOBAL, DBG_LEVEL_ERRORS,
> -                    "NVRM: %s: failed to save GPU crash data\n",
> -                    __FUNCTION__));
> +        NV_PRINTF(LEVEL_ERROR,
> +                  "%s: failed to save GPU crash data\n", __FUNCTION__);
>
> There is a blank space after "LEVEL_ERROR,".  I've attached my cocci
> script, but considering that coccinelle seems to reformat lines after
> they've been modified,
> I suspect that the problem is not in my script per se.

Could you send a .c file that produces the problem?  I tried with the
attached file but I don't get any trailing spaces.

julia

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nv_printf.c
Type: text/x-csrc
Size: 171 bytes
Desc: 
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20180731/e82135ec/attachment.bin>

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

end of thread, other threads:[~2018-07-31 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 19:53 [Cocci] Removing trailing whitespace at the end of changes lines? Timur Tabi
2018-07-30 20:21 ` Julia Lawall
2018-07-30 20:27   ` Timur Tabi
2018-07-31 19:18 ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).