bug-gperf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gperf] gperf behaviour with "-G -E" options


From: Bruno Haible
Subject: Re: [bug-gperf] gperf behaviour with "-G -E" options
Date: Sun, 16 Jan 2011 17:00:41 +0100
User-agent: KMail/1.9.9

Hello,

Julian Zubek wrote:
> I have encountered strange behaviour of gperf 3.0.4 which I believe is a bug.
> With switch "-E" constants are defined as an enum inside a lookup function:
> it allows having multiple hash tables defined in one file. However with "-G 
> -E"
> that enum is put outside function definition which makes it no better than
> defining constants trough "#define".

You are right that something is odd here. On one hand, the purpose of "-G"
is that the programmer can reuse the array / table for additional code, and
for this reason it is OK that the enum { ... } is at global scope when "-G -E"
are used. On the other hand, the documentation says
  "`-E'
   `--enum'
        Define constant values using an enum local to the lookup function
        rather than with #defines.  This also means that different lookup
        functions can reside in the same file."
but with -G and -E together, no two different lookup functions can reside in
the same compilation unit.

I've resolved the dilemma by adding an option --constants-prefix, that allows
you to avoid the identifier collisions even when -G and -E are in use together.
<http://savannah.gnu.org/projects/gperf>

Thanks for the report!

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]