Skip to contentSkip to conversation

scripts: refactor remove structure forward declarations

PATCH Superseded Yang Bai 4 participants 11 messages Mar 12, 2012 – Apr 2, 2012 Kbuild

lore
Share & tools
lore

Yang Bai

author
#0 lore raw

PATCH 1/1 scripts: refactor remove structure forward declarations

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

---
 scripts/tags.sh |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/tags.sh +8 -3
index 833813a..2b377fc 100755
@@ -166,9 +166,6 @@ exuberant()
 	all_defconfigs | xargs -r $1 -a                         \
 	--langdef=dotconfig --language-force=dotconfig          \
 	--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
-
-	# Remove structure forward declarations.
-	LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags
 }
 
 emacs()
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then
 	fi
 fi
 
+remove_structs=
 case "$1" in
 	"cscope")
 		docscope
@@ -245,10 +243,17 @@ case "$1" in
 	"tags")
 		rm -f tags
 		xtags ctags
+		remove_structs=y
 		;;
 
 	"TAGS")
 		rm -f TAGS
 		xtags etags
+		remove_structs=y
 		;;
 esac
+
+# Remove structure forward declarations.
+if [ -n $remove_structs ]; then
+    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
+fi
Signature · 1 line
1.7.9.1
author Reviewed-by Stephen Boyd on v1 1/1
#1 lore raw
Quoted 50 lines · Yang Bai

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

---
 scripts/tags.sh |   11 ++++++++---

 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/tags.sh +0 -0
index 833813a..2b377fc 100755
@@ -166,9 +166,6 @@ exuberant()
        all_defconfigs | xargs -r $1 -a                         \
        --langdef=dotconfig --language-force=dotconfig          \

       --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
-
-       # Remove structure forward declarations.
-       LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags }

 emacs()

scripts/tags.sh +0 -0
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then

       fi
 fi

+remove_structs=
 case "$1" in
       "cscope")
               docscope

scripts/tags.sh +0 -0
@@ -245,10 +243,17 @@ case "$1" in
        "tags")

               rm -f tags
               xtags ctags
+               remove_structs=y
               ;;

       "TAGS")
               rm -f TAGS
               xtags etags
+               remove_structs=y
               ;;
 esac

scripts/tags.sh +5 -1
+
+# Remove structure forward declarations.
+if [ -n $remove_structs ]; then
+    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
+fi
--
Quoted 2 lines

1.7.9.1

Reviewed-by Stephen Boyd
Reviewed-by on v1 1/1
#2 lore raw
In reply to Yang Bai
Quoted 5 lines · Yang Bai

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

Quoted 44 lines
---
 scripts/tags.sh |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/tags.sh +8 -3
index 833813a..2b377fc 100755
@@ -166,9 +166,6 @@ exuberant()
 	all_defconfigs | xargs -r $1 -a                         \
 	--langdef=dotconfig --language-force=dotconfig          \
 	--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
-
-	# Remove structure forward declarations.
-	LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags
 }
 
 emacs()
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then
 	fi
 fi
 
+remove_structs=
 case "$1" in
 	"cscope")
 		docscope
@@ -245,10 +243,17 @@ case "$1" in
 	"tags")
 		rm -f tags
 		xtags ctags
+		remove_structs=y
 		;;
 
 	"TAGS")
 		rm -f TAGS
 		xtags etags
+		remove_structs=y
 		;;
 esac
+
+# Remove structure forward declarations.
+if [ -n $remove_structs ]; then
+    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
+fi
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
author
#3 lore raw

Ping.

cc linux-kbuild

Quoted 59 lines · Stephen Boyd
Quoted 5 lines · Yang Bai

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

Quoted 39 lines

---
 scripts/tags.sh |   11 ++++++++---

 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/tags.sh +0 -0
index 833813a..2b377fc 100755
@@ -166,9 +166,6 @@ exuberant()
       all_defconfigs | xargs -r $1 -a                         \
       --langdef=dotconfig --language-force=dotconfig          \

      --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
-
-     # Remove structure forward declarations.
-     LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags }

 emacs()

scripts/tags.sh +0 -0
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then

      fi
 fi

+remove_structs=
 case "$1" in
      "cscope")
              docscope

scripts/tags.sh +0 -0
@@ -245,10 +243,17 @@ case "$1" in
       "tags")

              rm -f tags
              xtags ctags
+             remove_structs=y
              ;;

      "TAGS")
              rm -f TAGS
              xtags etags
+             remove_structs=y
              ;;
 esac

scripts/tags.sh case "$1" in · line 259

Quoted 5 lines
scripts/tags.sh +5 -0
+
+# Remove structure forward declarations.
+if [ -n $remove_structs ]; then
+    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
+fi

--
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

#4 lore raw
Quoted 13 lines · Yang Bai

Ping.

cc linux-kbuild

Quoted 8 lines · Stephen Boyd
Quoted 5 lines · Yang Bai

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

Applied to kbuild.git#misc.

Michal

#5 lore raw
In reply to Yang Bai
Quoted 3 lines · Yang Bai

Since now it has some problems when generate TAGS, refactor this code. Now it will not show the error message and will remove declarations using emacs etags.

Seems broke cscope build:

$ make cscope
  GEN     cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

with V=1:

/bin/sh /Sources/linux-2.6/scripts/tags.sh cscope
+ ignore='( -name SCCS -o -name BitKeeper -o -name .svn -o
-name CVS -o -name .pc -o -name .hg -o -name .git )

                                           -prune -o'

+ '[' '' = '' ']'
+ tree=
+ '[' '' = '' ']'
+ ALLSOURCE_ARCHS=x86
+ '[' x86_64 = um ']'
+ remove_structs=
+ case "$1" in
+ docscope
+ echo -k
+ echo -q
+ all_sources
+ find_arch_include_sources x86 '*.[chS]'
++ find arch/x86/ -name include -type d
+ include=arch/x86/include
+ '[' -n arch/x86/include ']'
+ archincludedir=' arch/x86/include'
+ find arch/x86/include '(' -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git ')' -prune -o -name '*.[chS]' -print
+ '[' '!' -z '' ']'
+ find_include_sources '*.[chS]'
+ find include '(' -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git ')' -prune -o -name config -prune -o -name '*.[chS]' -print
+ for arch in '$ALLSOURCE_ARCHS'
+ find_sources x86 '*.[chS]'
+ find_arch_sources x86 '*.[chS]'
+ for i in '$archincludedir'
+ prune=' -wholename arch/x86/include -prune -o'
+ find arch/x86 '(' -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git ')' -prune -o -wholename arch/x86/include -prune -o -name '*.[chS]' -print
+ find_other_sources '*.[chS]'
+ find COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README REPORTING-BUGS arch block crypto cscope.files cscope.out cscope.out.in cscope.out.po drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tags tools usr virt '(' -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git ')' -prune -o '(' -name include -o -name arch -o -name '.tmp_*' ')' -prune -o -name '*.[chS]' -print
+ cscope -b -f cscope.out
+ '[' -n ']'
+ LANG=C
+ sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

Signature · 2 lines
Thanks,
Jike
#6 lore raw
Quoted 8 lines · Jike Song

Seems broke cscope build:

$ make cscope
  GEN     cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

with V=1:

[snip]

Quoted 7 lines

+ cscope -b -f cscope.out
+ '[' -n ']'
+ LANG=C
+ sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

Ah yes. Forgot the quotes.

---->8------

Subject: [PATCH] tags.sh: Add missing quotes

When $remove_structs is empty a test for empty string will turn into test -n with no arguments meaning true. Add quotes so an empty string is tested and so that make cscope works again.

---
 scripts/tags.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tags.sh +1 -1
index 0d6004e..cf7b12f 100755
@@ -254,6 +254,6 @@ case "$1" in
 esac
 
 # Remove structure forward declarations.
-if [ -n $remove_structs ]; then
+if [ -n "$remove_structs" ]; then
     LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
 fi
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw
Quoted 4 lines · Stephen Boyd

Ah yes. Forgot the quotes.

Subject: [PATCH] tags.sh: Add missing quotes

it's fixed, thanks.

Signature · 2 lines
Thanks,
Jike
author
#8 lore raw
Quoted 11 lines · Jike Song
Quoted 4 lines · Stephen Boyd

Ah yes. Forgot the quotes.

Subject: [PATCH] tags.sh: Add missing quotes

it's fixed, thanks.

--
Thanks,
Jike

Thanks for reporting and testing for this bug.

Signature · 9 lines
    """
    Keep It Simple,Stupid.
    """

Chinese Name: 白杨
Nick Name: Hamo
Homepage: http://hamobai.com/
GPG KEY ID: 0xA4691A33
Key fingerprint = 09D5 2D78 8E2B 0995 CF8E  4331 33C4 3D24 A469 1A33
author Acked-by
#9 lore raw
In reply to Stephen Boyd
Quoted 47 lines · Stephen Boyd
Quoted 8 lines · Jike Song

Seems broke cscope build:

$ make cscope
  GEN     cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

with V=1:

[snip]

Quoted 7 lines

+ cscope -b -f cscope.out
+ '[' -n ']'
+ LANG=C
+ sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

Ah yes. Forgot the quotes.

---->8------

Subject: [PATCH] tags.sh: Add missing quotes

When $remove_structs is empty a test for empty string will turn into test -n with no arguments meaning true. Add quotes so an empty string is tested and so that make cscope works again.

---
 scripts/tags.sh |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tags.sh +0 -0
index 0d6004e..cf7b12f 100755
@@ -254,6 +254,6 @@ case "$1" in

 esac

 # Remove structure forward declarations.

scripts/tags.sh +1 -1
-if [ -n $remove_structs ]; then
+if [ -n "$remove_structs" ]; then

    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 fi

Quoted 4 lines

--
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

Signature · 9 lines
    """
    Keep It Simple,Stupid.
    """

Chinese Name: 白杨
Nick Name: Hamo
Homepage: http://hamobai.com/
GPG KEY ID: 0xA4691A33
Key fingerprint = 09D5 2D78 8E2B 0995 CF8E  4331 33C4 3D24 A469 1A33
#10 lore raw
In reply to Stephen Boyd
Quoted 40 lines · Stephen Boyd
Quoted 8 lines · Jike Song

Seems broke cscope build:

$ make cscope
  GEN     cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

with V=1:

[snip]

Quoted 7 lines

+ cscope -b -f cscope.out
+ '[' -n ']'
+ LANG=C
+ sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' cscope
sed: can't read cscope: No such file or directory
make: *** [cscope] Error 2

Ah yes. Forgot the quotes.

---->8------

Subject: [PATCH] tags.sh: Add missing quotes

When $remove_structs is empty a test for empty string will turn into test -n with no arguments meaning true. Add quotes so an empty string is tested and so that make cscope works again.

---
 scripts/tags.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tags.sh +0 -0
index 0d6004e..cf7b12f 100755

scripts/tags.sh case "$1" in · line 259

Quoted 7 lines
scripts/tags.sh +1 -1
@@ -254,6 +254,6 @@ case "$1" in
 esac
 
 # Remove structure forward declarations.
-if [ -n $remove_structs ]; then
+if [ -n "$remove_structs" ]; then
     LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
 fi

Applied to kbuild.git#rc-fixes, thanks.

Michal