Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: picca <picca@debian.org>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@inria.fr
Subject: Re: [cocci] Bug dans la parseur de coccinelle ?
Date: Mon, 16 Nov 2026 15:44:52 +0100	[thread overview]
Message-ID: <2d228ae9f4244ff6f84d036f5c0f531f@debian.org> (raw)
In-Reply-To: <f7e0d31a-d8a5-cdb7-9cd0-998511f1216c@inria.fr>

Le 2026-11-13 23:07, Julia Lawall a écrit :
> The macros in standard.h get expanded before any other processing.

ok

> Some options:
> 
> * We remove the #define INLINE inline in standard.h
> I don't know if anyone is relying on this macro.

What is the purpose of standard.h ?

Maybe the default should be no standard.h at all.

> * You make your own copy of standard.h for your software.  Then you 
> would
> need to include it on the command line with --macro-file-builtins
> yourfile.h.  This is a good solution if you have eg multiple macros 
> that
> are causing problems for parsing.

Yes I have at least one macro

#define alldevs(a)                                      \
         {                                               \
                 cpgslct(pg->X_DEVICE);                  \
                 pg->PLOT_DEV=pg->X_DEVICE;              \
                 a ;                                     \
                 cpgslct(pg->PS_DEVICE);                 \
                 pg->PLOT_DEV=pg->PS_DEVICE;             \
                 a ;                                     \
         }


When I use it like this

	alldevs(cpgsci(pg->COLCURVE);
                 cpgsls(pg->LINESTYLE);

                 xcirc[0]=xpos;
                 ycirc[0]=ypos;
                 th_step=(th2-th1)/(49.0);
                 for(n=1; n<51; n++){
                         th=th1+(n-1)*th_step;
                         xcirc[n]=xpos+radius*cos(th);
                         ycirc[n]=ypos+radius*sin(th);
		}
                 xcirc[51]=xpos;
                 ycirc[51]=ypos;
                 cpgpoly(51,xcirc,ycirc);
                 );

the rules are not applyed inside alldevs.

Can I solve this issue with standards.h ?


> * There is a command line option --undefined NAME, which makes NAME be
> considered to be undefined for the purposes of evaluating ifdefs.  
> Maybe
> this could be extended to all uses of the macro name.  Then you would 
> need
> to write --undefined NAME on the command line.
> 
> Rather than adding options on the command line, you can also put them 
> in
> the semantic patch, with a line like
> 
> --undefined NAME

ok

> 
> Do any of these seem acceptable?

I like the idea to have a .h dedicated to the refactoring or to put all 
theses standards.h in the semantic patch.

Cheers

Fredric

  reply	other threads:[~2026-11-16 14:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 10:34 [cocci] Bug dans la parseur de coccinelle ? picca
2026-11-12 10:40 ` Julia Lawall
2026-11-12 10:47   ` picca
2026-11-12 12:12     ` Victor Gambier
2026-11-12 12:26       ` picca
2026-11-12 12:29         ` Victor Gambier
2026-11-12 12:36           ` picca
2026-11-12 14:10           ` picca
2026-11-12 14:43             ` Julia Lawall
2026-11-12 14:44             ` Julia Lawall
2026-11-12 12:36     ` Markus Elfring
2026-11-12 12:41       ` picca
2026-11-12 14:51   ` picca
2026-11-12 14:55     ` Julia Lawall
2026-11-13 22:07     ` Julia Lawall
2026-11-16 14:44       ` picca [this message]
2026-11-16 14:59         ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d228ae9f4244ff6f84d036f5c0f531f@debian.org \
    --to=picca@debian.org \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox