[m-rev.] diff: avoid warnings in some sample programs

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Jan 7 17:37:54 AEDT 2011


Branches: main, 11.01

Fix up various problems in some of the samples that cause the compiler
to emit warnings.

samples/diff/Mmakefile:
 	Delete an old workaround for gcc 2.7.2 - we no longer support
 	gcc versions that old.

samples/diff/options.m:
samples/muz/muz.m:
samples/typecheck.m:
 	Avoid some Mercury compiler warnings.

Julien.

Index: samples/diff/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/diff/Mmakefile,v
retrieving revision 1.8
diff -u -r1.8 Mmakefile
--- samples/diff/Mmakefile	10 Mar 2003 14:25:44 -0000	1.8
+++ samples/diff/Mmakefile	7 Jan 2011 06:33:34 -0000
@@ -10,13 +10,3 @@
  MAIN_TARGET=all
  depend: diff.depend
  all: diff
-
-# Unfortunately, diff does not work quite properly when compiled with gcc
-# 2.7.2 under Digital Unix 3.2 due to a bug in gcc.  The bug was fixed
-# in 2.7.2.1, so feel free to comment out this line if you're using
-# an unbuggy compiler.
-#
-# BTW, the predicate which isn't compiled correctly is diff_out__show_file_2
-# in diff_out.m.
-CFLAGS=-O0
-
Index: samples/diff/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/diff/options.m,v
retrieving revision 1.3
diff -u -r1.3 options.m
--- samples/diff/options.m	28 Jun 2006 09:22:40 -0000	1.3
+++ samples/diff/options.m	7 Jan 2011 06:33:34 -0000
@@ -210,7 +210,7 @@

  %-----------------------------------------------------------------------------%

-:- pred option_defaults(option :: out, option_data :: out) is nondet.
+:- pred option_defaults(option::out, option_data::out) is multi.

  	% Output styles
  option_defaults(help,				bool(no)).
@@ -354,7 +354,7 @@
  %-----------------------------------------------------------------------------%

  options__get_option_ops(OptionOps) :-
-	OptionOps = option_ops(
+	OptionOps = option_ops_multi(
  		short_option,
  		long_option,
  		option_defaults,
Index: samples/muz/muz.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/muz/muz.m,v
retrieving revision 1.3
diff -u -r1.3 muz.m
--- samples/muz/muz.m	3 Jul 2006 07:25:47 -0000	1.3
+++ samples/muz/muz.m	7 Jan 2011 06:33:34 -0000
@@ -8,7 +8,7 @@
  % main author: philip

  :- module muz.
-:- pragma source_file("muz.cpp").
+%:- pragma source_file("muz.cpp").

  :- interface.
  :- import_module io.
@@ -25,7 +25,7 @@

  :- pred short_option(character::in, option::out) is semidet.
  :- pred long_option(string::in, option::out) is semidet.
-:- pred option_defaults(string::in, option::out, option_data::out) is nondet.
+:- pred option_defaults(string::in, option::out, option_data::out) is multi.

  :- type option
  	--->	abbreviate
@@ -75,7 +75,9 @@
  	{ MT = no, DT = "/usr/local/apps/muz/lib/toolkit.tex"
  	; MT = yes(DT)
  	},
-	{Option_Ops=option_ops(short_option, long_option, option_defaults(DT))},
+	{Option_Ops=
+		option_ops_multi(short_option, long_option, option_defaults(DT))
+	},
  	io__command_line_arguments(AL0),
  	{getopt__process_options(Option_Ops, AL0, AL, Maybe_Option_Table)},
  	( {Maybe_Option_Table = error(Message)},
@@ -118,8 +120,8 @@
  		% These two structures need to be rethought.
  		processFiles(IOResults, Abbrev, zpragmaInit, ZPragma,
  			finish(dict__init, [])-init_schema_table, Phase),
-		{set_zpragma(ZPragma, Flags0, Flags)},
-		( {Phase = finish(Dict, TP)-_} ->
+		{set_zpragma(ZPragma, Flags0, _Flags)},
+		( {Phase = finish(_Dict, _TP)-_} ->

  			{true}

Index: samples/muz/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/muz/typecheck.m,v
retrieving revision 1.3
diff -u -r1.3 typecheck.m
--- samples/muz/typecheck.m	3 Jul 2006 07:25:48 -0000	1.3
+++ samples/muz/typecheck.m	7 Jan 2011 06:33:34 -0000
@@ -199,7 +199,7 @@
  	getPtypes(P),
  	% For VarSource type see below or in ztype.m ---
  	% should use this to improve error messages!
-	{P0 = (pred(unbound(Expr, VarSource)::in, in, out) is det -->
+	{P0 = (pred(unbound(Expr, _VarSource)::in, in, out) is det -->
  		{Expr = _-VC}, terror(VC, [
  			s("Implicit type parameter not determined--"),
  				s("\n\tExpression: "), e(Expr)
--------------------------------------------------------------------------
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