Global register variables and stdio.h?!?

Marko Schuetz marko at king.ki.informatik.uni-frankfurt.de
Tue Jul 28 18:33:36 AEST 1998


[I am resending this: it seems not to have made it to the list.]

I am trying to compile mercury on FreeBSD-stable (before
2.2.6-RELEASE) using gcc 2.7.2.1. Mercury tries to use global register
variables, but I get the error:

[...]
gmake[1]: Entering directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime'
MERCURY_C_INCL_DIR=. ../scripts/mgnuc --grade asm_fast.gc --no-ansi -I../runtime -I../boehm_gc -g   -c label.c -o label.o
In file included from regs.h:67,
                 from imp.h:36,
                 from label.c:19:
machdeps/i386_regs.h:61: global register variable follows a function definition
machdeps/i386_regs.h:62: global register variable follows a function definition
machdeps/i386_regs.h:67: global register variable follows a function definition
gmake[1]: *** [label.o] Error 1
gmake[1]: Leaving directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime'
gmake: *** [runtime] Error 2

I checked the preprocessor output and found that there is only one
function definition which is included from stdio.h:

static __inline int __sputc(int _c, FILE *_p) {
        if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
                return (*_p->_p++ = _c);
        else
                return (__swbuf(_c, _p));
}

I know I can disable use of global register veriables, but that only 
seems to be a quick fix and not the correct solution. What is the
correct solution: is a newer version of gcc available that perhaps
allows function definitions preceding global register variable
declarations or is this not a function definition in more recent
FreeBSD versions? What other alternatives are there better than
disabling global register variables?

Marko

To Unsubscribe: send mail to majordomo at FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




More information about the users mailing list