trivial diff: runtime/machdeps/regtest.c bug fix

Fergus Henderson fjh at hydra.cs.mu.oz.au
Thu Nov 13 22:13:09 AEDT 1997


Estimated hours taken: 0.25

Fix a bug reported by Bas De Becker <basde.bakker at pica.nl>.

runtime/machdeps/regtest.c:
	Move #include statements after the global register variable
	declaration, to avoid problems on systems which define
	inline functions in the system header files.

Index: regtest.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/machdeps/regtest.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- regtest.c	1997/07/27 15:09:11	1.3
+++ regtest.ccvs diff: [22:12:43] obtained lock in /home/staff/zs/imp/mercury/runtime/machdeps
Index: regtest.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/machdeps/regtest.c,v
retrieving revision 1.3
diff -u -u -r1.3 regtest.c
--- regtest.c	1997/07/27 15:09:11	1.3
+++ regtest.c	1997/11/13 11:06:19
@@ -9,15 +9,21 @@
 ** call the C standard library
 */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
 #ifndef REG	/* the register to test */
 #error "regtest.c must be compiled with -DREG=\"<register name>\""
 #endif
 
 register unsigned r __asm__(REG);
+
+/*
+** Any #includes must come *after* the global register variable declaration,
+** because some systems define inline functions in header files, and gcc
+** requires that global register variable declarations precede all
+** function definitions.
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
 
 FILE *f;
 
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list