Author: jilles
Date: Mon Aug 16 17:18:08 2010
New Revision: 211399
URL: http://svn.freebsd.org/changeset/base/211399

Log:
  sh: Get rid of unnecessary non-standard empty lists.
  
  POSIX does not allow constructs like:
    if cmd; then fi
    { }
  Add a colon dummy command, except in a test that verifies that such empty
  lists do not cause crashes when used as a function definition.

Modified:
  head/tools/regression/bin/sh/builtins/command3.0
  head/tools/regression/bin/sh/builtins/command5.0
  head/tools/regression/bin/sh/builtins/command6.0
  head/tools/regression/bin/sh/execution/func2.0
  head/tools/regression/bin/sh/set-e/elif1.0
  head/tools/regression/bin/sh/set-e/elif2.0
  head/tools/regression/bin/sh/set-e/if1.0
  head/tools/regression/bin/sh/set-e/if3.0
  head/tools/regression/bin/sh/set-e/while1.0
  head/tools/regression/bin/sh/set-e/while2.0

Modified: head/tools/regression/bin/sh/builtins/command3.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command3.0    Mon Aug 16 15:51:41 
2010        (r211398)
+++ head/tools/regression/bin/sh/builtins/command3.0    Mon Aug 16 17:18:08 
2010        (r211399)
@@ -4,6 +4,7 @@ command -v true
 command -v /bin/ls
 
 fun() {
+       :
 }
 command -v fun
 command -v break

Modified: head/tools/regression/bin/sh/builtins/command5.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command5.0    Mon Aug 16 15:51:41 
2010        (r211398)
+++ head/tools/regression/bin/sh/builtins/command5.0    Mon Aug 16 17:18:08 
2010        (r211399)
@@ -4,6 +4,7 @@ command -V true
 command -V /bin/ls
 
 fun() {
+       :
 }
 command -V fun
 command -V break

Modified: head/tools/regression/bin/sh/builtins/command6.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command6.0    Mon Aug 16 15:51:41 
2010        (r211398)
+++ head/tools/regression/bin/sh/builtins/command6.0    Mon Aug 16 17:18:08 
2010        (r211399)
@@ -5,6 +5,7 @@ command -pV true
 command -pV /bin/ls
 
 fun() {
+       :
 }
 command -pV fun
 command -pV break

Modified: head/tools/regression/bin/sh/execution/func2.0
==============================================================================
--- head/tools/regression/bin/sh/execution/func2.0      Mon Aug 16 15:51:41 
2010        (r211398)
+++ head/tools/regression/bin/sh/execution/func2.0      Mon Aug 16 17:18:08 
2010        (r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
+# The empty pairs of braces here are to test that this does not cause a crash.
 
 f() { }
 f

Modified: head/tools/regression/bin/sh/set-e/elif1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/elif1.0  Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/elif1.0  Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 set -e
 if false; then
+       :
 elif false; then
+       :
 fi

Modified: head/tools/regression/bin/sh/set-e/elif2.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/elif2.0  Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/elif2.0  Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 set -e
 if false; then
+       :
 elif false; false; then
+       :
 fi

Modified: head/tools/regression/bin/sh/set-e/if1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/if1.0    Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/if1.0    Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 if false; then
+       :
 fi

Modified: head/tools/regression/bin/sh/set-e/if3.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/if3.0    Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/if3.0    Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 if false; false; then
+       :
 fi

Modified: head/tools/regression/bin/sh/set-e/while1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/while1.0 Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/while1.0 Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 while false; do
+       :
 done

Modified: head/tools/regression/bin/sh/set-e/while2.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/while2.0 Mon Aug 16 15:51:41 2010        
(r211398)
+++ head/tools/regression/bin/sh/set-e/while2.0 Mon Aug 16 17:18:08 2010        
(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 while false; false; do
+       :
 done
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to