Do you care at all about this parameter? If not, just put the line
#define STATUS_PARAM
in a file mymacros.h and then use spatch with the argument
-macro_file mymacros.h
You may then want to run spatch with the argument -parse_cocci and your C
file, or -parse_cocci -dir and your source code directory. Then it will
tell you at the end the most common tokens that caused parsing problems.
julia
On Wed, 23 Nov 2011, Andreas Färber wrote:
Hello,
I'm new to Coccinelle and I've tried to use it on QEMU's version of the
SoftFloat library, but it runs into parse errors:
semantic error two or more data types
=File "fpu/softfloat.c", line 62, column 37, charpos = 2995
around = 'STATUS_PARAM', whole content = void
set_float_rounding_mode(int val STATUS_PARAM)
badcount: 5
bad: #include "softfloat-specialize.h"
bad:
BAD:!!!!! void set_float_rounding_mode(int val STATUS_PARAM)
bad: {
bad: STATUS(float_rounding_mode) = val;
bad: }
A simplified pseudo-C file to demonstrate this follows.
test.c:
---8<---
#define STATUS_PARAM , C d
uint16
myfunc(A b STATUS_PARAM);
uint16
myfunc(A b STATUS_PARAM)
{
uint16 x;
}
---8<---
Is there any way I can make a patch operate on such functions?
Thanks in advance,
Andreas
$ spatch -version
spatch version 1.0.0-rc7 with Python support and with Str regexp support
$ spatch -parse_c test.c
init_defs_builtins: /usr/share/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 21, charpos = 21
around = ',', whole content = #define STATUS_PARAM , C d
badcount: 0
BAD:!!!!! #define STATUS_PARAM , C d
(ONCE) CPP-TYPEDEF: promoting: uint16
(ONCE) CPP-TYPEDEF: promoting: A
(ONCE) CPP-TYPEDEF: promoting: b
ERROR-RECOV: found sync '}' at line 10
parsing pass2: try again
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
ERROR-RECOV: found sync '}' at line 10
parsing pass3: try again
(ONCE) CPP-MACRO: found known macro = STATUS_PARAM
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
ERROR-RECOV: found sync '}' at line 10
parsing pass4: try again
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
ERROR-RECOV: found sync '}' at line 10
semantic error two or more data types
=File "test.c", line 1, column 21, charpos = 21
around = ',', whole content = #define STATUS_PARAM , C d
badcount: 9
BAD:!!!!! #define STATUS_PARAM , C d
bad:
bad: uint16
bad: myfunc(A b STATUS_PARAM);
bad:
bad: uint16
bad: myfunc(A b STATUS_PARAM)
bad: {
bad: uint16 x;
bad: }
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
passed:STATUS_PARAM
passed:STATUS_PARAM
-----------------------------------------------------------------------
maybe 10 most problematic tokens
-----------------------------------------------------------------------
C: present in 3 parsing errors
example:
#define STATUS_PARAM , C d
d: present in 3 parsing errors
example:
#define STATUS_PARAM , C d
STATUS_PARAM: present in 1 parsing errors
example:
#define STATUS_PARAM , C d
-----------------------------------------------------------------------
NB total files = 1; perfect = 0; pbs = 1; timeout = 0; =========> 0%
nb good = 1, nb passed = 2 =========> 200.000000% passed
nb good = 1, nb bad = 9 =========> 10.000000% good
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)