Re: RFS: ustr (updated package)
On Sat, Nov 03, 2007 at 05:36:29PM +0100, Bernd Zeimetz wrote:
> James Antill wrote:
> > Bernd Zeimetz <bernd@bzed.de> writes:
> >
> >> James Antill wrote:
> >>> That code is basically:
> >>>
> >>> extern inline size_t ustr_xi__pow2(int use_big, unsigned char len)
> >>> {
> >>> static const unsigned char map_big_pow2[4] = {2, 4, 8, 16};
> >>> static const unsigned char map_pow2[4] = {0, 1, 2, 4};
> >>>
> >>> ...so I'm pretty sure it's correct as is, and the version of GCC
> >>> used is giving out false warnings.
> >> I doubt that.
> >> http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00182.html
> >
> > From the above email:
> >
> > This patch makes GCC's inline function support more like the C99
> > support. To be precise, it implements 6.7.4 paragraph 3
> >
> > ISO 9899:1999, 6.7.4 paragraph 3 says:
> >
> > An inline definition of a function with external linkage shall not
> > contain a definition of a modifiable object with static storage
> > duration, and shall not contain a reference to an identifier with
> > internal linkage.
> >
> > ...as both of the declarations are "static const", 6.7.4#3 doesn't
> > apply.
>
>
> As the gcc 4.3 on my laptop is pretty old now, and the recent package is
> missing some Dependencies yet, could somebody (like the maintainer)
> please keep an eye on this and report against gcc if appropriate?
I have setup gcc-4.3 from experimental on a sid xen guest.
The warning is emitted for example on following (simplified) code:
extern inline char func( int arg )
{
static const char foomap[4] = {2, 4, 8, 16};
return foomap[arg & 3];
}
I have red several times the ISO paragraph :). It seems to me, that
paragraph applies to this situation.
IMHO foomap is `reference to an identifier with internal linkage'.
Or no? :)
I'm not expert for C in such depth...
Cheers
--
Zito
Reply to: