linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>, cocci@inria.fr
Cc: linux-cifs@vger.kernel.org
Subject: Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
Date: Mon, 13 Oct 2025 17:47:25 +0200	[thread overview]
Message-ID: <f114858e-84f5-47d3-80e5-febd138d68b0@web.de> (raw)
In-Reply-To: <dcfb5c63-ce1a-f487-df23-cadef6c45a32@inria.fr>

> Thank you for the more understanable example.  I think it should ignore
> the code under the #else since parsing is not successful when that is
> taken into account. …

Improvable software behaviour can be demonstrated also with the following
source file example.


static int my_test_condition(void)
{
#ifdef MY_CONFIG_LEGACY_OPTION
    {
        /* Test comment */
    }
my_info:
 if (0)
    my_log("reminder!");
 else
    {
#else
    {
#endif
     my_log("test end");
    }
 return 0;
}


Questionable test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-c test-ifdef-legacy5.c
…
PB: not found closing brace in fuzzy parsing
ERROR-RECOV: found sync '}' at line 18
…
parse error 
 = File "test-ifdef-legacy5.c", line 19, column 0, charpos = 224
  around = '',
  whole content = 
badcount: 17
bad: static int my_test_condition(void)
…
bad:  return 0;
BAD:!!!!! }
…
nb good = 0,  nb passed = 3 =========> 15.00% passed
nb good = 0,  nb bad = 17 =========> 15.00% good or passed


How will the software evolution be continued?

Regards,
Markus

      parent reply	other threads:[~2025-10-13 15:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 11:50 Improving source code parsing for “fs/smb/client/dir.c”? Markus Elfring
2025-10-13 12:04 ` [cocci] " Julia Lawall
2025-10-13 12:16   ` Markus Elfring
2025-10-13 13:05   ` Markus Elfring
2025-10-13 14:35   ` Markus Elfring
2025-10-13 14:49     ` Julia Lawall
2025-10-13 15:00       ` Markus Elfring
2025-10-13 15:47       ` Markus Elfring [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=f114858e-84f5-47d3-80e5-febd138d68b0@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@inria.fr \
    --cc=linux-cifs@vger.kernel.org \
    /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).