All of lore.kernel.org
 help / color / mirror / Atom feed
From: micah.fedke@collabora.co.uk (Micah Fedke)
To: cocci@systeme.lip6.fr
Subject: [Cocci] failure parsing macro replacement of function definition
Date: Thu, 11 Jun 2015 12:53:08 -0500	[thread overview]
Message-ID: <5579CB04.8060907@collabora.co.uk> (raw)

Hi, I'm trying to use cocci to update an internal API in the 
intel-gpu-tools code tree, but it doesn't seem to be able to recognize 
the somewhat unusual use of a macro to replace the declaration of 
main(), which is used in most all of the igt tests.  Can anything be done?

SmPL and output when run on 
http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tests/core_getclient.c:


@@
expression a;
@@
- a = drm_open_any();
+ a = drm_open_any(OPEN_INTEL);


spatch -sp_file drm_open.cocci tests/core_getclient.c -debug 
-verbose_parsing
init_defs_builtins: /usr/share/coccinelle/standard.h
-----------------------------------------------------------------------
processing semantic patch file: drm_open.cocci
with isos from: /usr/share/coccinelle/standard.iso
-----------------------------------------------------------------------
@@
expression a;
@@
- a = drm_open_any();
+ a = drm_open_any(OPEN_INTEL);

HANDLING: tests/core_getclient.c
-----------------------------------------------------------------------
let's go
-----------------------------------------------------------------------
-----------------------------------------------------------------------
ERROR-RECOV: found sync '}' at line 62
parsing pass2: try again
ERROR-RECOV: found sync '}' at line 62
parse error
  = File "tests/core_getclient.c", line 38, column 0,  charpos = 1396
     around = '{', whole content = {
badcount: 27
bad: IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_CLIENT ioctl.");
bad:
bad: igt_simple_main
BAD:!!!!! {
bad: 	int fd, ret;
bad: 	drm_client_t client;
bad:
bad: 	fd = drm_open_any();
bad:
bad: 	/* Look for client index 0.  This should exist whether we're operating
bad: 	 * on an otherwise unused drm device, or the X Server is running on
bad: 	 * the device.
bad: 	 */
bad: 	client.idx = 0;
bad: 	ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
bad: 	igt_assert(ret == 0);
bad:
bad: 	/* Look for some absurd client index and make sure it's invalid.
bad: 	 * The DRM drivers currently always return data, so the user has
bad: 	 * no real way to detect when the list has terminated.  That's bad,
bad: 	 * and this test is XFAIL as a result.
bad: 	 */
bad: 	client.idx = 0x7fffffff;
bad: 	ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
bad: 	igt_assert(ret == -1 && errno == EINVAL);
bad:
bad: 	close(fd);
bad: }
-----------------------------------------------------------------------
rule starting on line 1 =
-----------------------------------------------------------------------
dependencies for rule rule starting on line 1 satisfied:
binding in = []
binding relevant in = []
-----------------------------------------------------------------------
Finished
-----------------------------------------------------------------------
Check duplication for 1 files


definition of igt_simple_main: 
http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/lib/igt_core.h#n244
-- 

Micah Fedke
Collabora Ltd.
+44 1223 362967
https://www.collabora.com/
https://twitter.com/collaboraltd

             reply	other threads:[~2015-06-11 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 17:53 Micah Fedke [this message]
2015-06-11 18:34 ` [Cocci] failure parsing macro replacement of function definition Julia Lawall
2015-06-12  0:33   ` Micah Fedke

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=5579CB04.8060907@collabora.co.uk \
    --to=micah.fedke@collabora.co.uk \
    --cc=cocci@systeme.lip6.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.