[m-rev.] trivial diff: parenthesize macro args

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 24 19:49:47 AEDT 2004


Estimated hours taken: 0.25
Branches: main

runtime/mercury_type_tables.c:
	Add parentheses around macro parameters, to ensure that the
	resulting macro expansions are properly parenthesized if the
	macro arguments are themselves expresssions.

Workspace: /mnt/ceres/home/ceres/fjh/mercury
Index: runtime/mercury_type_tables.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_tables.c,v
retrieving revision 1.9
diff -u -d -r1.9 mercury_type_tables.c
--- runtime/mercury_type_tables.c	24 Oct 2003 03:09:51 -0000	1.9
+++ runtime/mercury_type_tables.c	12 Feb 2004 06:29:50 -0000
@@ -50,25 +50,26 @@
 					MR_TypeClassDecl type_class_decl);
 
 #define	type_names_match(tc1, module_name, type_name, arity)		\
-	( MR_streq(MR_type_ctor_name(tc1), type_name)			\
-	&& MR_streq(MR_type_ctor_module_name(tc1), module_name)		\
-	&& tc1->MR_type_ctor_arity == arity)
+	( MR_streq(MR_type_ctor_name(tc1), (type_name))			\
+	&& MR_streq(MR_type_ctor_module_name(tc1), (module_name))	\
+	&& (tc1)->MR_type_ctor_arity == (arity))
 
 #define	type_names_match_ctor(tc1, tc2)					\
 	( MR_streq(MR_type_ctor_name(tc1), MR_type_ctor_name(tc2))	\
 	&& MR_streq(MR_type_ctor_module_name(tc1),			\
 		MR_type_ctor_module_name(tc2))				\
-	&& tc1->MR_type_ctor_arity == tc2->MR_type_ctor_arity )
+	&& (tc1)->MR_type_ctor_arity == (tc2)->MR_type_ctor_arity )
 
 #define	class_names_match(tc_id1, module_name, class_name, arity)	\
-	( MR_streq(tc_id1->MR_tc_id_name, class_name)			\
-	&& MR_streq(tc_id1->MR_tc_id_module_name, module_name)		\
-	&& tc_id1->MR_tc_id_arity == arity)
+	( MR_streq(tc_id1->MR_tc_id_name, (class_name))			\
+	&& MR_streq(tc_id1->MR_tc_id_module_name, (module_name))	\
+	&& tc_id1->MR_tc_id_arity == (arity))
 
 #define	class_names_match_id(tc_id1, tc_id2)				\
-	( MR_streq(tc_id1->MR_tc_id_name, tc_id2->MR_tc_id_name)	\
-	&& MR_streq(tc_id1->MR_tc_id_module_name, tc_id2->MR_tc_id_module_name)\
-	&& tc_id1->MR_tc_id_arity == tc_id2->MR_tc_id_arity)
+	( MR_streq((tc_id1)->MR_tc_id_name, (tc_id2)->MR_tc_id_name)	\
+	&& MR_streq((tc_id1)->MR_tc_id_module_name,			\
+		(tc_id2)->MR_tc_id_module_name)				\
+	&& (tc_id1)->MR_tc_id_arity == (tc_id2)->MR_tc_id_arity)
 
 void
 MR_register_type_ctor_info(MR_TypeCtorInfo type_ctor_info)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list