aspell-devel
[Top][All Lists]
Advanced

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

[aspell-devel] aspell build on Tru64 UNIX, follow-up notes


From: Tim Mooney
Subject: [aspell-devel] aspell build on Tru64 UNIX, follow-up notes
Date: Fri, 9 Apr 2004 20:32:34 -0500 (CDT)

[I'm not subscribed to the list, please Cc: me on any responses to this]

As I reported last week, I needed a simple patch to get the library part
of aspell to build on Tru64 UNIX 5.1b with the vendor C++ compiler.  That
patch was included in the original email.

Because of the problem Albert Chin-A-Young mentioned in his followup to
my email, I haven't been successful in getting the `aspell' binary to
link.

I did mention that there were a few warnings during the compile of the
library and other bits, and I promised to send those along.  Here they
are.



1) Every time primes.hpp is included, the cxx compiler warns:

cxx: Warning: primes.hpp, line 95: statement is unreachable
      const_reverse_iterator operator-- (int) {return const_iterator::operator++
(1); return *this;}
--------------------------------------------------------------------------------
-----^


It's right -- the second return is unreachable.  I imagine this is a
cut-n-paste-o from the code just above, that handles operator++.  My guess
is the

        return *this;

should just go, but I'm not offering a patch since I'm not *certain*
that's the correct solution.


------------------------------------------------------------------


2) In common/posib_err.cpp, there is a warning:

cxx: Warning: posib_err.cpp, line 49: pointless comparison of unsigned integer
          with zero
      assert(0 <= ip && ip < inf->num_parms);
------^


The compiler is correct -- the first part of the assertion is useless,
since the line immediately above the assert is:

      unsigned int ip = *s - '0' - 1;

Getting rid of the

        0 <= ip

would get rid of the warning.


------------------------------------------------------------------


3) In common/posib_err.cpp, there are two other warnings regarding
assertions:

cxx: Warning: posib_err.cpp, line 93: conversion from pointer to smaller integer
    assert (err_);
----^
cxx: Warning: posib_err.cpp, line 102: conversion from pointer to smaller 
integer
    assert (err_);
----^



Similar warnings happen in a few other areas were assert() is used.  All
of them happen because assert() is defined as taking an integer
"truth expression", and on LP64 systems a pointer has to be lopped in half
to turn it into an integer.

The fix is to add a

        != NULL

to turn the argument into assert() into an integer expression.  The patch
is


diff -ur aspell-0.50.5.orig/common/posib_err.cpp 
aspell-0.50.5/common/posib_err.cpp
--- aspell-0.50.5.orig/common/posib_err.cpp     2002-11-29 01:14:35.000000000 
-0600
+++ aspell-0.50.5/common/posib_err.cpp  2004-04-08 19:10:23.000000000 -0500
@@ -90,7 +90,7 @@
   }

   void PosibErrBase::handle_err() const {
-    assert (err_);
+    assert (err_ != NULL);
     assert (!err_->handled);
     fputs("Unhandled Error: ", stderr);
     fputs(err_->err->mesg, stderr);
@@ -99,7 +99,7 @@
   }

   Error * PosibErrBase::release() {
-    assert (err_);
+    assert (err_ != NULL);
     assert (err_->refcount <= 1);
     --err_->refcount;
     Error * tmp;
diff -ur aspell-0.50.5.orig/lib/new_filter.cpp aspell-0.50.5/lib/new_filter.cpp
--- aspell-0.50.5.orig/lib/new_filter.cpp       2002-08-12 18:10:18.000000000 
-0500
+++ aspell-0.50.5/lib/new_filter.cpp    2004-04-08 19:22:22.000000000 -0500
@@ -145,7 +145,7 @@
     while ( (filter_name = els.next()) != 0)
     {
       FilterEntry * f = find_individual_filter(filter_name);
-      assert(f); //FIXME: Return Error Condition
+      assert(f != NULL); //FIXME: Return Error Condition

       if (use_decoder && f->decoder && (ifilter = f->decoder())) {
        RET_ON_ERR_SET(ifilter->setup(config), bool, keep);



------------------------------------------------------------------


4) Problem is basically the same as #3 above, but it happens in three
cases where assert(dynamic_cast...) is used.  I believe the fix is the
same as above, just add ``!= NULL'':


diff -ur aspell-0.50.5.orig/modules/speller/default/speller_impl.cpp 
aspell-0.50.5/modules/speller/default/speller_impl.cpp
--- aspell-0.50.5.orig/modules/speller/default/speller_impl.cpp 2004-01-30 
19:06:07.000000000 -0600
+++ aspell-0.50.5/modules/speller/default/speller_impl.cpp      2004-04-08 
19:29:11.000000000 -0500
@@ -398,19 +398,19 @@
       }
       break;
     case personal_id:
-      assert(dynamic_cast<WritableWordSet *>(to_change->data_set));
+      assert(dynamic_cast<WritableWordSet *>(to_change->data_set) != NULL);
       to_change->use_to_check = true;
       to_change->use_to_suggest = true;
       to_change->save_on_saveall = true;
       break;
     case session_id:
-      assert(dynamic_cast<WritableWordSet *>(to_change->data_set));
+      assert(dynamic_cast<WritableWordSet *>(to_change->data_set) != NULL);
       to_change->use_to_check = true;
       to_change->use_to_suggest = true;
       to_change->save_on_saveall = false;
       break;
     case personal_repl_id:
-      assert (dynamic_cast<BasicReplacementSet *>(to_change->data_set));
+      assert (dynamic_cast<BasicReplacementSet *>(to_change->data_set) != 
NULL);
       to_change->use_to_check = false;
       to_change->use_to_suggest = true;
       to_change->save_on_saveall = config_->retrieve_bool("save-repl");




------------------------------------------------------------------

There are two warnings for data.cpp, but they're spurious: a non-void
function calls abort() in apparently serious error cases, rather than
returning something, and the compiler complains about a missing return.


There is also a warning in vector_hash-t.hpp:


cxx: Warning: vector_hash-t.hpp, line 59: statement either is unreachable or
          causes unreachable code
    if (!parms_.is_multi && !j.at_end())
----^


I'm not familiar enough with the code to comment on that, but I thought
I would mention it.

Thanks!

Tim
-- 
Tim Mooney                              address@hidden
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164




reply via email to

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