cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Using a macro for variable attributes
@ 2020-04-28 10:11 Paul Chaignon
  2020-04-28 17:44 ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Chaignon @ 2020-04-28 10:11 UTC (permalink / raw)
  To: cocci; +Cc: paul.chaignon

Hi all,

I am working on a small semantic patch to annotate specific variables in
our codebase with __attribute__((aligned(8))). The following program works
fine.

  @r@
  expression e1, e2;
  identifier x;
  @@
  (
    struct \(icmphdr\|icmp6hdr\) x
  + __attribute__((aligned(8)))
    ;
  |
    struct \(icmphdr\|icmp6hdr\) x
  + __attribute__((aligned(8)))
    = ...;
  )
    ... when exists
    ctx_load_bytes(e1, e2, &x, ...)

However, when I replace __attribute__((aligned(8))) with our internal
macro __align_stack_8, it fails with the following error:

  plus: parse error:
    File "/home/paul/cilium/contrib/coccinelle/aligned.cocci", line 7, column 2, charpos = 77
    around = '__align_stack_8',
    whole content = + __align_stack_8

I've tried adding '#define __align_stack_8' in a file passed with
--macro-file, without success. Is this a known limitation for macros or
am I missing something?

Thanks,
Paul
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2020-05-01 13:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 10:11 [Cocci] Using a macro for variable attributes Paul Chaignon
2020-04-28 17:44 ` Julia Lawall
2020-04-28 18:17   ` Paul Chaignon
2020-04-28 18:41     ` Julia Lawall
2020-04-28 18:58       ` Paul Chaignon
2020-04-30 15:40     ` Jaskaran Singh
2020-05-01 13:45       ` Paul Chaignon

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