[m-rev.] diff: fix a build problem on freebsd

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Dec 2 01:39:24 AEDT 2010


Branches: main, 10.04

tools/make_spec_ho_call:
tools/make_spec_method_call:
 	Avoid portability problems with expr.

Julien.

Index: tools/make_spec_ho_call
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/make_spec_ho_call,v
retrieving revision 1.2
diff -u -r1.2 make_spec_ho_call
--- tools/make_spec_ho_call	15 Jul 2010 06:55:37 -0000	1.2
+++ tools/make_spec_ho_call	1 Dec 2010 14:38:02 -0000
@@ -124,7 +124,13 @@

      variants="$variants $variant"

-    spec_explicit_arg=`expr $spec_explicit_arg + 1`
+    # On some systems, e.g. FreeBSD, expr will treat a leading argument
+    # beginning with a minus sign as an option to the program rather than
+    # as a negative number.  Since the value of $spec_explicit_arg may be
+    # negative we arrange the arguments in the following so that first
+    # argument position is occupied by a positive number.
+    #
+    spec_explicit_arg=`expr 1 + $spec_explicit_arg`
  done

  # Create these files atomically.
Index: tools/make_spec_method_call
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/make_spec_method_call,v
retrieving revision 1.2
diff -u -r1.2 make_spec_method_call
--- tools/make_spec_method_call	15 Jul 2010 06:55:37 -0000	1.2
+++ tools/make_spec_method_call	1 Dec 2010 14:38:02 -0000
@@ -132,7 +132,13 @@

      variants="$variants $variant"

-    spec_explicit_arg=`expr $spec_explicit_arg + 1`
+    # On some systems, e.g. FreeBSD, expr will treat a leading argument
+    # beginning with a minus sign as an option to the program rather than
+    # as a negative number.  Since the value of $spec_explicit_arg may be
+    # negative we arrange the arguments in the following so that first
+    # argument position is occupied by a positive number.
+    #
+    spec_explicit_arg=`expr 1 + $spec_explicit_arg`
  done

  # Create these files atomically.


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list