Re: [Cocci] Function-like macro with the same name as a typedef
Markus Elfring writes: >>> * How many software implementations use identical type definitions >>> and function-like macros? >> >> I don't know. > > Can it become interesting to find more about such usage patterns out? Rule of thumb: for every user reporting an issue, there are several more suffering quietly. How many more? I don't know. A better estimate of how widespread such use is might be useful, but I can't provide one. >> For what it's worth, it's valid C. Unless I'm mistaken, >> Coccinelle tries to support as much of C as it possibly can. > > How do you think about limitations for corresponding software > development resources? > > >> The QEMU project can certainly work around this Coccinelle >> bug / restriction. > > Which adjustments will be chosen? Rename either the typedef or the macro. More complicated than it sounds, because both conform to naming conventions. >>> * How will the evolution be continued around Coccinelle? >> >> Is this a question about Coccinelle's future? > > Yes, of course. > > Are we trying to influence further development anyhow? I'm trying to help the Coccinelle project by reporting an issue, no more, no less :) ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Function-like macro with the same name as a typedef
Markus Elfring writes: * spatch seems to have trouble parsing ARMSSE *s = ARMSSE(opaque); where ARMSSE is a typedef, and ARMSSE() is a function-like macro. Yes, I know that's in rather poor taste. >>> >>> I am curious for the safe handling of related software development >>> challenges. >>> >>> * Workaround #1: rename the typedef to ARMSSE_ >>> >>> Will adjustments become more interesting also around such name space issues? >> >> I'm not sure I understand your question. Can you elaborate? > > Do we come along the need to adjust (or even improve) two software areas? > > * How many software implementations use identical type definitions > and function-like macros? I don't know. For what it's worth, it's valid C. Unless I'm mistaken, Coccinelle tries to support as much of C as it possibly can. The QEMU project can certainly work around this Coccinelle bug / restriction. I'm reporting it because I've found Coccinelle useful. > * How will the evolution be continued around Coccinelle? Is this a question about Coccinelle's future? ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Function-like macro with the same name as a typedef
Markus Elfring writes: >> * spatch seems to have trouble parsing >> >> ARMSSE *s = ARMSSE(opaque); >> >> where ARMSSE is a typedef, and ARMSSE() is a function-like macro. >> Yes, I know that's in rather poor taste. > > I am curious for the safe handling of related software development challenges. > > >> * Workaround #1: rename the typedef to ARMSSE_ > > Will adjustments become more interesting also around such name space issues? I'm not sure I understand your question. Can you elaborate? ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Function-like macro with the same name as a typedef
>> * How many software implementations use identical type definitions >> and function-like macros? > > I don't know. Can it become interesting to find more about such usage patterns out? > For what it's worth, it's valid C. Unless I'm mistaken, > Coccinelle tries to support as much of C as it possibly can. How do you think about limitations for corresponding software development resources? > The QEMU project can certainly work around this Coccinelle > bug / restriction. Which adjustments will be chosen? >> * How will the evolution be continued around Coccinelle? > > Is this a question about Coccinelle's future? Yes, of course. Are we trying to influence further development anyhow? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Function-like macro with the same name as a typedef
>>> * spatch seems to have trouble parsing >>> >>> ARMSSE *s = ARMSSE(opaque); >>> >>> where ARMSSE is a typedef, and ARMSSE() is a function-like macro. >>> Yes, I know that's in rather poor taste. >> >> I am curious for the safe handling of related software development >> challenges. >> >> >>> * Workaround #1: rename the typedef to ARMSSE_ >> >> Will adjustments become more interesting also around such name space issues? > > I'm not sure I understand your question. Can you elaborate? Do we come along the need to adjust (or even improve) two software areas? * How many software implementations use identical type definitions and function-like macros? * How will the evolution be continued around Coccinelle? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Function-like macro with the same name as a typedef
> * spatch seems to have trouble parsing > > ARMSSE *s = ARMSSE(opaque); > > where ARMSSE is a typedef, and ARMSSE() is a function-like macro. > Yes, I know that's in rather poor taste. I am curious for the safe handling of related software development challenges. > * Workaround #1: rename the typedef to ARMSSE_ Will adjustments become more interesting also around such name space issues? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
[Cocci] Function-like macro with the same name as a typedef -> parse error
I noticed that Coccinelle skips over much of QEMU's hw/arm/armsse.c. I append a minimized test case. Observations: * spatch seems to have trouble parsing ARMSSE *s = ARMSSE(opaque); where ARMSSE is a typedef, and ARMSSE() is a function-like macro. Yes, I know that's in rather poor taste. * Workaround #1: rename the typedef to ARMSSE_ * Workaround #2: move the typedef and the macro from the .h to the .c. $ cat armsse.c #include "armsse.h" void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); s->nsccfg = level; } $ cat armsse.h #ifndef ARMSSE_H #define ARMSSE_H typedef struct { int nsccfg; } ARMSSE; #define ARMSSE(obj) ((ARMSSE *)(obj)) #endif $ spatch --parse-c armsse.c init_defs_builtins: /usr/lib64/coccinelle/standard.h PARSING: armsse.c including ./armsse.h ERROR-RECOV: found sync '}' at line 8 parsing pass2: try again ERROR-RECOV: found sync '}' at line 8 parsing pass3: try again ERROR-RECOV: found sync '}' at line 8 parse error = File "armsse.c", line 5, column 16, charpos = 91 around = 'ARMSSE', whole content = ARMSSE *s = ARMSSE(opaque); badcount: 7 bad: #include "armsse.h" bad: bad: void nsccfg_handler(void *opaque, int n, int level) bad: { BAD:! ARMSSE *s = ARMSSE(opaque); bad: bad: s->nsccfg = level; bad: } --- maybe 10 most problematic tokens --- ARMSSE: present in 2 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); opaque: present in 2 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); level: present in 1 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); n: present in 1 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); nsccfg_handler: present in 1 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); s: present in 1 parsing errors example: void nsccfg_handler(void *opaque, int n, int level) { ARMSSE *s = ARMSSE(opaque); --- NB total files = 1; perfect = 0; pbs = 1; timeout = 0; => 0% nb good = 0, nb passed = 0 => 0.00% passed nb good = 0, nb bad = 7 => 0.00% good or passed $ spatch --version spatch version 1.0.7 compiled with OCaml version 4.07.0 Flags passed to the configure script: --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-python=/usr/bin/python3 --with-menhir=/usr/bin/menhir OCaml scripting support: yes Python scripting support: yes Syntax of regular expresssions: PCRE ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci