This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: libgloss/debug.h and mem_err
- From: Joel Sherrill <joel dot sherrill at OARcorp dot com>
- To: "J. Johnston" <jjohnstn at redhat dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Tue, 16 Apr 2002 15:19:17 -0500
- Subject: Re: libgloss/debug.h and mem_err
- Organization: OAR Corporation
- References: <3CBC5397.CE46A2F6@OARcorp.com> <3CBC852F.DC4D8889@redhat.com>
- Reply-to: joel dot sherrill at OARcorp dot com
"J. Johnston" wrote:
>
> Joel Sherrill wrote:
> >
> > debug.h thinks mem_err is not volatile.
> >
> > All the files that have mem_err seem to think it is.
> >
> > [joel@mail libgloss]$ grep mem_err */*.c | grep int
> > mips/lsi33k-stub.c:static volatile int mem_err = 0;
> > sparc/sparc-stub.c:static volatile int mem_err = 0;
> > sparc/sparcl-stub.c:static volatile int mem_err = 0;
> > sparc/sparclet-stub.c:static volatile int mem_err = 0;
> >
> > This patch fixes it for the sparc. I have not tried the
> > mips yet but if it included debug.h, I would think it
> > would have the same problem.
> >
> > What's the right fix? This works for sparc:
> >
>
> Could you describe the bug that you originally saw?
The sparc-elf target doesn't compile because is says the
the type conflicts.
> The variable mem_err is being used in two different scopes.
> In the stub files, it is declared as static which means it is file-scope.
> In the header file, it is being declared global. Are you seeing a warning
> that the file-scope variable is over-riding the global declaration of the
> same name?
I can't really see why it is debug.h since it appears to be a static
variable most of the time. Maybe the right solution is to take it
out of debug.h.
I am not sure what the right fix is. But sparc and debug.h
should agree on it somehow.
> -- Jeff J.
>
>
> > Index: debug.h
> > ===================================================================
> > RCS file: /cvs/src/src/libgloss/debug.h,v
> > retrieving revision 1.1
> > diff -u -r1.1 debug.h
> > --- debug.h 17 Mar 2000 22:48:49 -0000 1.1
> > +++ debug.h 16 Apr 2002 16:42:52 -0000
> > @@ -77,7 +77,7 @@
> > * indicate to caller of mem2hex or hex2mem that there has been an
> > error.
> > * 0 means ok, 1 means error
> > */
> > -extern int mem_err;
> > +extern volatile int mem_err;
> >
> > /*
> > * indicate whether the debug vectors have been initialized
> >
--joel