Adding function attributes with SmPL?
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
Quoted 27 lines · Markus Elfring
Hello,
I would occasionally like to adjust function attributes.
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.htmlThus I have tried another tiny script variant out for the semantic patch language (according to the software combination “Coccinelle 1.1.1”).
@addition@
@@
intmust_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))
Quoted 1 line
Can the software tool be extended accordingly?
Work on attributes is in progress.
julia
Quoted 1 line
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