[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avoid gcc compiler warning
From: |
Ralf Wildenhues |
Subject: |
Re: avoid gcc compiler warning |
Date: |
Mon, 29 Sep 2008 20:24:55 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi Eric,
* Eric Blake wrote on Mon, Sep 29, 2008 at 01:58:41PM CEST:
> According to Ralf Wildenhues on 9/26/2008 10:03 AM:
> >>
> >> cc1: warnings being treated as errors
> >> ../ltdl/loaders/loadlibrary.c: In function 'vm_open':
> >> ../ltdl/loaders/loadlibrary.c:159: error: the address of 'wpath' will
> >> always
> >> evaluate as 'true'
> >>
> >> Applying this trivial patch (wchar was declared as an array):
> >
> > This patch is not really defensive programming, right?
> > (The declaration is a screenful away, and we've had unwary
> > copying of code from one function to another before.)
>
> Suggestions on how to approach this, then?
Nothing that immediately jumps to mind; sorry.
> Maybe declare wpath with
> alloca, so that it is a pointer rather than an array (MAX_PATH is 260, so
> it is safe to stack allocate whether directly or via alloca)?
That cure sounds worse than the disease, so to speak: alloca is
less portable and I'd prefer not to have to use it; and it makes
little sense to obfuscate the code just to please the compiler.
I guess we can leave it the way it is now; one refinement would be for
you to use '-Werror -Wno-error=address', because that particular warning
is not really worthy of being seen as an error.
Cheers,
Ralf