cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Lucian Popescu <lucian.popescu187@gmail.com>
To: cocci@inria.fr
Subject: [cocci]  Coccinelle does not parse macros ending in a comma
Date: Sat, 25 Jun 2022 21:00:01 +0300	[thread overview]
Message-ID: <CAEUDFgXAX=0ECa4Um9uOzRCBtF2arHjTAF+Kp_UAvkzEafboOg@mail.gmail.com> (raw)

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

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?

Lucian

[-- Attachment #2: Type: text/html, Size: 1244 bytes --]

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 18:00 Lucian Popescu [this message]
2022-06-25 18:32 ` [cocci] Coccinelle does not parse macros ending in a comma 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='CAEUDFgXAX=0ECa4Um9uOzRCBtF2arHjTAF+Kp_UAvkzEafboOg@mail.gmail.com' \
    --to=lucian.popescu187@gmail.com \
    --cc=cocci@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;
as well as URLs for NNTP newsgroup(s).