Skip to contentSkip to conversation

Does coccinelle have the notion of signedness?

Cocci Mitchell Cuddie 3 participants 4 messages Aug 22, 2014 – Aug 23, 2014

lore
Share & tools
lore
#0 lore raw

Julia,

I would like to declare a metatype T, where T is restricted to the set of unsigned types.

(i.e. unsigned long, unsigned int, but not int or long)

cheers,

Mitchell

#1 lore raw

I would try:
@r@
type T;
identifier i;
@@
T i;

@script:python@
T << r.T;
@@
if "unsigned" not in T:
cocci.include_match(False)

@printer@
type r.T;
identifier r.i;
@@
* T i;

Quoted 14 lines · Mitchell Cuddie

Julia,

I would like to declare a metatype T, where T is restricted to the set of unsigned types.

(i.e. unsigned long, unsigned int, but not int or long)

cheers,

Mitchell
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Signature · 1 line
Peter
#2 lore raw

Gmail has changed the text format. There is a tab before cocci.include_match(False)

Quoted 39 lines · Peter Senna Tschudin

I would try:
@r@
type T;
identifier i;
@@
T i;

@script:python@
T << r.T;
@@
if "unsigned" not in T:
cocci.include_match(False)

@printer@
type r.T;
identifier r.i;
@@
* T i;

Quoted 7 lines · Mitchell Cuddie

Julia,

I would like to declare a metatype T, where T is restricted to the set of unsigned types.

(i.e. unsigned long, unsigned int, but not int or long)

Quoted 7 lines

cheers,

Mitchell
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

--
Peter

Signature · 1 line
Peter
#3 lore raw

You should be able to do

type T;
unsigned T x;

or perhaps even just

unsigned x;

However, the success of this depends on the software you are working on. Linux code has a huge number of typedefs for various unsigned types.

julia

Quoted 54 lines · Peter Senna Tschudin

Gmail has changed the text format. There is a tab before cocci.include_match(False)

Quoted 39 lines · Peter Senna Tschudin

I would try:
@r@
type T;
identifier i;
@@
T i;

@script:python@
T << r.T;
@@
if "unsigned" not in T:
cocci.include_match(False)

@printer@
type r.T;
identifier r.i;
@@
* T i;

Quoted 7 lines · Mitchell Cuddie

Julia,

I would like to declare a metatype T, where T is restricted to the set of unsigned types.

(i.e. unsigned long, unsigned int, but not int or long)

Quoted 7 lines

cheers,

Mitchell
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

--
Peter

Signature · 5 lines
Peter
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci