Skip to contentSkip to conversation

Coccinelle: remove incorrect -include option transformation

PATCH Superseded Andrzej Hajda 3 participants 8 messages Sep 22, 2015 – Oct 26, 2015 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Coccinelle: remove incorrect -include option transformation

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. The same is true for spatch.

---
 scripts/coccicheck | 1 -
 1 file changed, 1 deletion(-)
scripts/coccicheck +0 -1
index bbf901a..6d84b05 100755
@@ -30,7 +30,6 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
 
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
Signature · 1 line
1.9.1
#1 lore raw
Quoted 13 lines · Andrzej Hajda

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. The same is true for spatch.

---
 scripts/coccicheck | 1 -
 1 file changed, 1 deletion(-)
scripts/coccicheck +0 -0
index bbf901a..6d84b05 100755

scripts/coccicheck FLAGS="$SPFLAGS --very-quiet" · line 33

Quoted 4 lines
scripts/coccicheck +0 -1
@@ -30,7 +30,6 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}

I'm not sure of the meaning of the above notation, nor what is the intention. Coccinelle does have a --include option, but it doesn't mean the same thing as -I. It is a way to have a file be included that is not included according to the normal inclusion strategy. For example, if a.h includes b.h which includes c.h, and if one considers that c.h is really important for having the right type information, but one doesn't want the cost of including everything via --recursive-includes, then one could put --include c.h.

julia

Quoted 7 lines
scripts/coccicheck +0 -1
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
--

1.9.1

#2 lore raw
Quoted 20 lines · Julia Lawall
Quoted 13 lines · Andrzej Hajda

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. The same is true for spatch.

---
 scripts/coccicheck | 1 -
 1 file changed, 1 deletion(-)
scripts/coccicheck +0 -0
index bbf901a..6d84b05 100755

scripts/coccicheck FLAGS="$SPFLAGS --very-quiet" · line 33

Quoted 4 lines
scripts/coccicheck +0 -1
@@ -30,7 +30,6 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
Quoted 8 lines

I'm not sure of the meaning of the above notation, nor what is the intention. Coccinelle does have a --include option, but it doesn't mean the same thing as -I. It is a way to have a file be included that is not included according to the normal inclusion strategy. For example, if a.h includes b.h which includes c.h, and if one considers that c.h is really important for having the right type information, but one doesn't want the cost of including everything via --recursive-includes, then one could put --include c.h.

This option has the same meaning for gcc.
But the patch is incorrect. It should be:

COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}

gcc option '-include' should be converted to spatch option '--include', ie one minus should be added.

Regards
Andrzej

Quoted 10 lines

julia

Quoted 6 lines
scripts/coccicheck +0 -1
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
--

1.9.1

#3 lore raw

PATCH v2 1/1 Coccinelle: fix incorrect -include option transformation

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. In case of spatch latter option should be prefixed with two -.

---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
index bbf901a..b2d75818 100755
@@ -30,7 +30,7 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
+COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
 
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
Signature · 1 line
1.9.1
Acked-by on v2 1/1
#4 lore raw

Re: [PATCH v2] Coccinelle: fix incorrect -include option transformation

Quoted 3 lines · Andrzej Hajda

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. In case of spatch latter option should be prefixed with two -.

Thanks!

julia

Quoted 23 lines
---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -2
index bbf901a..b2d75818 100755
@@ -30,7 +30,7 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
+COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
 
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
--

1.9.1

#5 lore raw

Re: [PATCH v2] Coccinelle: fix incorrect -include option transformation

Dne 22.9.2015 v 15:27 Julia Lawall napsal(a):

Quoted 4 lines · Andrzej Hajda
Quoted 3 lines

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. In case of spatch latter option should be prefixed with

That hash sign in the comment was not nice :).

Quoted 3 lines
Quoted 1 line

two -.

Applied to kbuild.git#misc.

Michal

#6 lore raw
In reply to Andrzej Hajda
Quoted 30 lines · Andrzej Hajda
Quoted 20 lines · Julia Lawall
Quoted 13 lines · Andrzej Hajda

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. The same is true for spatch.

---
 scripts/coccicheck | 1 -
 1 file changed, 1 deletion(-)
scripts/coccicheck +0 -0
index bbf901a..6d84b05 100755

scripts/coccicheck FLAGS="$SPFLAGS --very-quiet" · line 33

Quoted 4 lines
scripts/coccicheck +0 -1
@@ -30,7 +30,6 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
Quoted 8 lines

I'm not sure of the meaning of the above notation, nor what is the intention. Coccinelle does have a --include option, but it doesn't mean the same thing as -I. It is a way to have a file be included that is not included according to the normal inclusion strategy. For example, if a.h includes b.h which includes c.h, and if one considers that c.h is really important for having the right type information, but one doesn't want the cost of including everything via --recursive-includes, then one could put --include c.h.

Quoted 7 lines

This option has the same meaning for gcc.
But the patch is incorrect. It should be:

COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}

gcc option '-include' should be converted to spatch option '--include', ie one minus should be added.

OK, do you want to submit a patch for that?

thanks,
julia

Quoted 17 lines

Regards
Andrzej

Quoted 10 lines

julia

Quoted 6 lines
scripts/coccicheck +0 -1
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
--

1.9.1

#7 lore raw
In reply to Andrzej Hajda
Quoted 2 lines · Andrzej Hajda

kbuild/gcc uses -include option to include files and -I to provide paths for #include <> directive. The same is true for spatch.

Nicolas, if you think this is OK, please ack it.

thanks,
julia

Quoted 21 lines
---
 scripts/coccicheck | 1 -
 1 file changed, 1 deletion(-)
scripts/coccicheck +0 -2
index bbf901a..6d84b05 100755
@@ -30,7 +30,6 @@ FLAGS="$SPFLAGS --very-quiet"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
-COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
 
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
--

1.9.1