cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [cocci] Adding function attributes with SmPL?
@ 2023-01-16 11:37 Markus Elfring
  2023-01-16 17:33 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2023-01-16 11:37 UTC (permalink / raw)
  To: cocci

Hello,

I would occasionally like to adjust function attributes.
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.html

Thus I have tried another tiny script variant out for the semantic patch language
(according to the software combination “Coccinelle 1.1.1”).


@addition@
@@
 int must_be_checked(...)
+__attribute__ ((warn_unused_result))
 ;


Unfortunately, I stumbled on the following display.


Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci add_warn_unused_result1.cocci
…
plus: parse error:
  File "add_warn_unused_result1.cocci", line 4, column 1, charpos = 41
  around = '__attribute__',
  whole content = +__attribute__ ((warn_unused_result))


Can the software tool be extended accordingly?

Regards,
Markus


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

* Re: [cocci] Adding function attributes with SmPL?
  2023-01-16 11:37 [cocci] Adding function attributes with SmPL? Markus Elfring
@ 2023-01-16 17:33 ` Julia Lawall
  2023-01-17 12:24   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2023-01-16 17:33 UTC (permalink / raw)
  To: Markus Elfring; +Cc: cocci

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]



On Mon, 16 Jan 2023, Markus Elfring wrote:

> Hello,
>
> I would occasionally like to adjust function attributes.
> https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.html
>
> Thus I have tried another tiny script variant out for the semantic patch language
> (according to the software combination “Coccinelle 1.1.1”).
>
>
> @addition@
> @@
>  int must_be_checked(...)
> +__attribute__ ((warn_unused_result))
>  ;
>
>
> Unfortunately, I stumbled on the following display.
>
>
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci add_warn_unused_result1.cocci
> …
> plus: parse error:
>   File "add_warn_unused_result1.cocci", line 4, column 1, charpos = 41
>   around = '__attribute__',
>   whole content = +__attribute__ ((warn_unused_result))
>
>
> Can the software tool be extended accordingly?

Work on attributes is in progress.

julia

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

* Re: [cocci] Adding function attributes with SmPL?
  2023-01-16 17:33 ` Julia Lawall
@ 2023-01-17 12:24   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2023-01-17 12:24 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

> Work on attributes is in progress.

Will an attribute like “[[ nodiscard ( "Reminder: Please use the return value
in meaningful ways." ) ]]” be taken into account accordingly?
https://en.cppreference.com/w/c/language/attributes/nodiscard

Regards,
Markus

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

end of thread, other threads:[~2023-01-17 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 11:37 [cocci] Adding function attributes with SmPL? Markus Elfring
2023-01-16 17:33 ` Julia Lawall
2023-01-17 12:24   ` Markus Elfring

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).