diff mbox series

include/opensm: eliminate include loop

Message ID 20181022140852.10127-1-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series include/opensm: eliminate include loop | expand

Commit Message

Honggang LI Oct. 22, 2018, 2:08 p.m. UTC
From: Honggang Li <honli@redhat.com>

Signed-off-by: Honggang Li <honli@redhat.com>
---
 include/opensm/osm_congestion_control.h | 1 -
 include/opensm/osm_multicast.h          | 1 -
 include/opensm/osm_sm.h                 | 1 -
 3 files changed, 3 deletions(-)

Comments

Hal Rosenstock Oct. 22, 2018, 2:21 p.m. UTC | #1
On 10/22/2018 10:08 AM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>

How is there include loop ?

There are ifdef guards around every include file to prevent it being
included more than once.

However, I agree that the includes removed are superflous now.

> Signed-off-by: Honggang Li <honli@redhat.com>
> ---
>  include/opensm/osm_congestion_control.h | 1 -
>  include/opensm/osm_multicast.h          | 1 -
>  include/opensm/osm_sm.h                 | 1 -
>  3 files changed, 3 deletions(-)
> 
> diff --git a/include/opensm/osm_congestion_control.h b/include/opensm/osm_congestion_control.h
> index 78e4a642..c59bf888 100644
> --- a/include/opensm/osm_congestion_control.h
> +++ b/include/opensm/osm_congestion_control.h
> @@ -51,7 +51,6 @@
>  #include <opensm/osm_subnet.h>
>  #include <opensm/osm_log.h>
>  #include <opensm/osm_sm.h>
> -#include <opensm/osm_opensm.h>
>  #include <opensm/osm_base.h>
>  
>  /****s* OpenSM: Base/OSM_DEFAULT_CC_KEY
> diff --git a/include/opensm/osm_multicast.h b/include/opensm/osm_multicast.h
> index 5b9f427f..3237c87c 100644
> --- a/include/opensm/osm_multicast.h
> +++ b/include/opensm/osm_multicast.h
> @@ -54,7 +54,6 @@
>  #include <opensm/osm_mcm_port.h>
>  #include <opensm/osm_subnet.h>
>  #include <opensm/osm_log.h>
> -#include <opensm/osm_sm.h>
>  
>  #ifdef __cplusplus
>  #  define BEGIN_C_DECLS extern "C" {
> diff --git a/include/opensm/osm_sm.h b/include/opensm/osm_sm.h
> index f075abb2..d54cf75a 100644
> --- a/include/opensm/osm_sm.h
> +++ b/include/opensm/osm_sm.h
> @@ -61,7 +61,6 @@
>  #include <opensm/osm_port.h>
>  #include <opensm/osm_db.h>
>  #include <opensm/osm_remote_sm.h>
> -#include <opensm/osm_multicast.h>
>  
>  #ifdef __cplusplus
>  #  define BEGIN_C_DECLS extern "C" {
>
Honggang LI Oct. 22, 2018, 11:29 p.m. UTC | #2
On Mon, Oct 22, 2018 at 10:21:34AM -0400, Hal Rosenstock wrote:
> On 10/22/2018 10:08 AM, Honggang LI wrote:
> > From: Honggang Li <honli@redhat.com>
> 
> How is there include loop ?
> 
> There are ifdef guards around every include file to prevent it being
> included more than once.

Yes, you are right.

The include loop was not found by compiler. I created a map with
graphviz for header file include by search "#include" in all headers.

opensm (master)]$ pwd
~/upstream-repos/opensm/include/opensm

opensm (master)]$ cat graph.sh
#!/bin/bash

function line_x
{
	head -n $1 /tmp/p.txt | tail -1
}

echo "strict digraph {"
echo "rankdir=LR;"

grep '^#include' *.h | sed -e 's/#include//' | grep opensm | sed -e 's/://' -e 's/<opensm\///' -e 's/>//' | \
	sort | uniq > /tmp/p.txt

N=$(cat /tmp/p.txt | wc -l)
for n in $(seq 1 $N); do
	line=$(line_x $n)
	a=$(echo $line | awk '{print $1}')
	b=$(echo $line | awk '{print $2}')
	if [ -f $b ]; then
		echo '"'${a}'"' " -> " '"'${b}'"'";";
	fi
	#else
	#	echo '"'${a}'"'";";
	#fi
done

echo "}"

> 
> However, I agree that the includes removed are superflous now.
> 
> > Signed-off-by: Honggang Li <honli@redhat.com>
> > ---
> >  include/opensm/osm_congestion_control.h | 1 -
> >  include/opensm/osm_multicast.h          | 1 -
> >  include/opensm/osm_sm.h                 | 1 -
> >  3 files changed, 3 deletions(-)
> > 
> > diff --git a/include/opensm/osm_congestion_control.h b/include/opensm/osm_congestion_control.h
> > index 78e4a642..c59bf888 100644
> > --- a/include/opensm/osm_congestion_control.h
> > +++ b/include/opensm/osm_congestion_control.h
> > @@ -51,7 +51,6 @@
> >  #include <opensm/osm_subnet.h>
> >  #include <opensm/osm_log.h>
> >  #include <opensm/osm_sm.h>
> > -#include <opensm/osm_opensm.h>
> >  #include <opensm/osm_base.h>
> >  
> >  /****s* OpenSM: Base/OSM_DEFAULT_CC_KEY
> > diff --git a/include/opensm/osm_multicast.h b/include/opensm/osm_multicast.h
> > index 5b9f427f..3237c87c 100644
> > --- a/include/opensm/osm_multicast.h
> > +++ b/include/opensm/osm_multicast.h
> > @@ -54,7 +54,6 @@
> >  #include <opensm/osm_mcm_port.h>
> >  #include <opensm/osm_subnet.h>
> >  #include <opensm/osm_log.h>
> > -#include <opensm/osm_sm.h>
> >  
> >  #ifdef __cplusplus
> >  #  define BEGIN_C_DECLS extern "C" {
> > diff --git a/include/opensm/osm_sm.h b/include/opensm/osm_sm.h
> > index f075abb2..d54cf75a 100644
> > --- a/include/opensm/osm_sm.h
> > +++ b/include/opensm/osm_sm.h
> > @@ -61,7 +61,6 @@
> >  #include <opensm/osm_port.h>
> >  #include <opensm/osm_db.h>
> >  #include <opensm/osm_remote_sm.h>
> > -#include <opensm/osm_multicast.h>
> >  
> >  #ifdef __cplusplus
> >  #  define BEGIN_C_DECLS extern "C" {
> >
diff mbox series

Patch

diff --git a/include/opensm/osm_congestion_control.h b/include/opensm/osm_congestion_control.h
index 78e4a642..c59bf888 100644
--- a/include/opensm/osm_congestion_control.h
+++ b/include/opensm/osm_congestion_control.h
@@ -51,7 +51,6 @@ 
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_sm.h>
-#include <opensm/osm_opensm.h>
 #include <opensm/osm_base.h>
 
 /****s* OpenSM: Base/OSM_DEFAULT_CC_KEY
diff --git a/include/opensm/osm_multicast.h b/include/opensm/osm_multicast.h
index 5b9f427f..3237c87c 100644
--- a/include/opensm/osm_multicast.h
+++ b/include/opensm/osm_multicast.h
@@ -54,7 +54,6 @@ 
 #include <opensm/osm_mcm_port.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_sm.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
diff --git a/include/opensm/osm_sm.h b/include/opensm/osm_sm.h
index f075abb2..d54cf75a 100644
--- a/include/opensm/osm_sm.h
+++ b/include/opensm/osm_sm.h
@@ -61,7 +61,6 @@ 
 #include <opensm/osm_port.h>
 #include <opensm/osm_db.h>
 #include <opensm/osm_remote_sm.h>
-#include <opensm/osm_multicast.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {