Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Lucian Popescu <lucian.popescu187@gmail.com>
Cc: cocci@inria.fr
Subject: Re: [cocci] Coccinelle does not parse macros ending in a comma
Date: Sat, 25 Jun 2022 14:32:52 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2206251431460.2146@hadrien> (raw)
In-Reply-To: <CAEUDFgXAX=0ECa4Um9uOzRCBtF2arHjTAF+Kp_UAvkzEafboOg@mail.gmail.com>

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



On Sat, 25 Jun 2022, Lucian Popescu wrote:

> Hi,
> I ran spatch --parse-c on the following code:
>
> #define something 0,
>
> int main() {
>     return 0;
> }
>
> This code compiles fine according to the C standard, however the output of
> spatch is:
>
> init_defs_builtins: /usr/local/lib/coccinelle/standard.h
>
> PARSING: test.c
> ERROR-RECOV: found sync end of #define, line 1
> parsing pass2: try again
> ERROR-RECOV: found sync end of #define, line 1
> parse error
>  = File "test.c", line 1, column 20, charpos = 20
>   around = '',
>   whole content = #define something 0,
> badcount: 0
> BAD:!!!!! #define something 0,
> -----------------------------------------------------------------------
> maybe 10 most problematic tokens
> -----------------------------------------------------------------------
> something: present in 1 parsing errors
> example:
>        
>        #define something 0,
>        
> -----------------------------------------------------------------------
>
> Is this a known limitation? If not, is there a way to solve this issue?

This is the expected behavior.  Is there something that ou want to do
withe macro definition?  The inability to parse that shouldn't impact the
ability to treat other code, at least not other code that doesn't use the
macro.

julia

      reply	other threads:[~2022-06-25 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 18:00 [cocci] Coccinelle does not parse macros ending in a comma Lucian Popescu
2022-06-25 18:32 ` Julia Lawall [this message]

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=alpine.DEB.2.22.394.2206251431460.2146@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=cocci@inria.fr \
    --cc=lucian.popescu187@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).