Re: Re: GNU Aspell 0.60-pre1 Now Available

Kevin Atkinson <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <Pine.LNX.4.44.0407240800200.3060-100000@kevin-p3.atkinson.dhs.org>
On Thu, 22 Jul 2004, James Lee wrote:

> On 16/07/04, 03:56:58, Kevin Atkinson <[email protected]> wrote
> regarding GNU Aspell 0.60-pre1 Now Available:
> 
> > The first official pre-release of GNU Aspell 0.60 is now available
> 
> I have built 0.60-pre1 using SunPro C++ Studio 8 Compiler (version
> 5.5) and have the following comments.  There are a number of other
> small changes needed for the SunPro compiler but those below I think
> can improve aspell generally.

Ok see below.  If the other changes are minor I would like to include 
those two.  Please email be privately if you want to work on getting Aspell 
to compile with SunPro C++ without any additional modifications.

> (1) The definition of get_dynamic_filter is different in two places,
> there is an extra "const" in the statements in ./lib/new_filter.cpp.
> This causes linking to fail as the mangled name is different.
> I simply removed the const qualifier from the declarations in
> new_filter.cpp.  I suggest the definition is made in a header and
> the const requirement applied as needed, ie, either it is const or
> it's not but it's not optional.
> 
> -  PosibErr<const ConfigModule *> get_dynamic_filter(...
> +  PosibErr<ConfigModule *> get_dynamic_filter(...

This is already fixed. 

> (2) __attribute__ is not defined.

I wrapped these in "#ifdef __GNUC_".

> (3) The "#ifndef __SUNPRO_CC" in ./common/parm_string.hpp is counter
> productive.  I removed this and everything is fine.  The changes
> recently made to string.hpp smoothed out all the ambiguities we were
> seeing.

Ok removed

> (4) Variable arrays are not allowed.  I modified ./common/vararray.hpp
> to be as follows, perhaps some configure test or an #ifdef for
> compiler capability should be used.
> 
>   class MallocPtr {
>    public:
>     void * ptr;
>     MallocPtr() : ptr(0) {};
>     ~MallocPtr() {if (ptr) free(ptr);}
>   };
> 
> #define VARARRAY(type, name, num) \
>   acommon::MallocPtr name##_data;\
>   name##_data.ptr = malloc(sizeof(type) * (num)); \
>   type * name = (type *)name##_data.ptr
> 
> #define VARARRAYM(type, name, num, max) VARARRAY(type, name, num)

I added a conditional test and tested it to make sure it would work with 
the malloc case.

> (6) Arrays with no or zero length are not allowed.  These I changed
> to be 1 element.  I have not counted what extra allocation it causes,
> so far I've done what is needed to get a clean compile and a working
> system.
> 
> --- ./common/objstack.hpp.orig  2004-06-02 08:54:04.000000000 -0400
> +++ ./common/objstack.hpp       2004-07-16 10:50:14.254716000 -0400
> @@ -14,7 +14,7 @@
>    struct Node
>    {
>      Node * next;
> -    byte data[];
> +    unsigned char data[1];
>    };
>    size_t chunk_size;
>    size_t min_align;

Just changed this one.  sizeof never used.

> --- ./common/convert.cpp.orig   2004-07-14 07:45:54.000000000 -0400
> +++ ./common/convert.cpp        2004-07-16 11:21:04.747611000 -0400
> @@ -190,7 +190,7 @@
>      unsigned width;
>      unsigned size;
>      T * end;
> -    T data[];
> +    T data[1];
>    };
> 
>    template <class T, class From>

sizeof used.  Added a member struct_size to reflect the "proper" size.

> (7) There is an ambiguity as to whether "log(double)" or "log(long
> double)" should be used in ./common/convert.cpp.  This is because the
> args of the call are integer and it's not clear whether the implicit
> type cast should be to double or long double.  I type cast as double.
> 
> -    int sz = 1 << (unsigned)floor(log(size <= 1 ? 1 : size -
> 1)/log(2.0));
> +    int sz = 1 << (unsigned)floor(log((double) (size <= 1 ? 1 : size -
> 1))/log(2.0));

Does "size <= 1 ? 1.0 : size - 1" work OK?  That how I changed it.

-- 
http://kevin.atkinson.dhs.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.