Re: IRIX compile problem aspell-0.60.2

Frank Everdij <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <[email protected]>
Quoting Kevin Atkinson <[email protected]>:

> On Fri, 18 Mar 2005, Frank Everdij wrote:
> > From an old KDE-development discussion on porting to IRIX i remembered
> something
> > about code not belonging in c++ source code files, but in header files.
> > Aapparently the namespace section in email.cpp should belong in a header,
> > atleast according to the MIPSPro compiler, so i spliced the source file
> into a
> > header part and code part:
> 
> That is very ugly and probably unnecessary.  It may be just the anonymous 
> namespace that is causing the problem.  Try simply commenting out the 
> "namespace {" and the closing "}" and see if that solved the problem.

You are correct. Removing the namespace { } in the three files did the trick.

> > cc-1070 CC: ERROR File = ./gen/static_filters.src.cpp, Line = 76
> >   The indicated type is incomplete.
> > 
> >     static KeyInfo nroff_options[] = {
> >                    ^
> > 
> > cc-1070 CC: ERROR File = ./gen/static_filters.src.cpp, Line = 103
> >   The indicated type is incomplete.
> > 
> >     static KeyInfo url_options[] = {
> >                    ^
> > 
> > 2 errors detected in the compilation of "lib/new_filter.cpp".
> > 
> > Probably the perl scripts in directory gen got confused and decided to
> refrain
> > from putting an option in there, which the MIPSPro compiler rejects.
> modifying
> > them to:
> 
> No those should be empty arrays.

I've removed the two empty arrays from the code and aspell compiles and runs
fine on my IRIX machine. I did have to make one more adjustment to two header
files and one source file, forgot them in the first patch i've posted...:

Making all in .
gmake[1]: Entering directory `/usr/local/src/aspell-0.60.2'
source='prog/aspell.cpp' object='prog/aspell.o' libtool=no \
DEPDIR=.deps depmode=sgi /bin/sh ./depcomp \
CC -DHAVE_CONFIG_H -I. -I. -I./gen  -I./gen -I./common -I./interfaces/cc/ -I./mo
dules/speller/default/ -DLOCALEDIR=\"/usr/nekoware/share/locale\" -I/usr/nekowar
e/include  -O3 -mips4 -n32 -c -o prog/aspell.o prog/aspell.cpp
cc-1153 CC: ERROR File = ./common/errors.hpp, Line = 17
  Declaration is incompatible with previous "aerror_other" (declared at line 234
          of "./interfaces/cc/aspell.h").

  extern "C" const ErrorInfo * const aerror_other;
                                     ^

cc-1153 CC: ERROR File = ./common/errors.hpp, Line = 18
  Declaration is incompatible with previous "aerror_operation_not_supported"
          (declared at line 235 of "./interfaces/cc/aspell.h").

  extern "C" const ErrorInfo * const aerror_operation_not_supported;

.. and 83 more of these. Looks like a header clash to me.
What i did was wrap up the "extern const struct" block in interfaces/cc/aspell.h
lines 234-318 between an #ifndef ASPELL_ERRORS_NO_C #endif and made sure the
define ASPELL_ERRORS_NO_C was set in aspell.cpp and checker_string.hpp. This
probably is a IRIX quirk, i don't know if people have noticed this on other
platforms...

So my entire IRIX patch now looks as follows:

--- interfaces/cc/aspell.h.save Sat Mar 19 15:03:04 2005
+++ interfaces/cc/aspell.h      Fri Mar 18 11:07:06 2005
@@ -230,7 +230,7 @@
 
 /******************************** errors ********************************/
 
-
+#ifndef ASPELL_ERRORS_NO_C
 extern const struct AspellErrorInfo * const aerror_other;
 extern const struct AspellErrorInfo * const aerror_operation_not_supported;
 extern const struct AspellErrorInfo * const   aerror_cant_copy;
@@ -316,7 +316,7 @@
 extern const struct AspellErrorInfo * const   aerror_bad_magic;
 extern const struct AspellErrorInfo * const aerror_expression;
 extern const struct AspellErrorInfo * const   aerror_invalid_expression;
-
+#endif /* ASPELL_ERRORS_NO_C */
 
 /******************************* speller *******************************/
 
--- prog/aspell.cpp.save        Sat Mar 19 15:00:42 2005
+++ prog/aspell.cpp     Fri Mar 18 11:09:12 2005
@@ -25,6 +25,7 @@
 # include <langinfo.h>
 #endif
 
+#define ASPELL_ERRORS_NO_C
 #include "aspell.h"
 
 #ifdef USE_FILE_INO
--- prog/checker_string.hpp.save        Sat Mar 19 15:06:44 2005
+++ prog/checker_string.hpp     Fri Mar 18 11:09:29 2005
@@ -6,6 +6,7 @@
 
 #include <stdio.h>
 
+#define ASPELL_ERRORS_NO_C
 #include "aspell.h"
 
 #include "vector.hpp"
--- common/string.hpp.save      Mon Nov 29 18:50:05 2004
+++ common/string.hpp   Sat Mar 19 11:01:11 2005
@@ -129,10 +129,10 @@
     }
 
     char & operator[] (size_t pos) {return begin_[pos];}
-    const char operator[] (size_t pos) const {return begin_[pos];}
+    char operator[] (size_t pos) const {return begin_[pos];}
 
     char & back() {return end_[-1];}
-    const char back() const {return end_[-1];}
+    char back() const {return end_[-1];}
 
     void clear() {end_ = begin_;}
 
@@ -492,7 +492,7 @@
 
 namespace std
 {
-  template<> static inline void swap(acommon::String & x, acommon::String & y) 
{return x.swap(y);}
+  template<> inline void swap(acommon::String & x, acommon::String & y) {return
 x.swap(y);}
 }
 
 #endif
--- modules/speller/default/affix.hpp.save      Fri Mar 18 09:58:10 2005
+++ modules/speller/default/affix.hpp   Sat Mar 19 11:18:36 2005
@@ -107,7 +107,7 @@
     {
       return expand(word,aff,buf,0);
     }
-    WordAff * expand_suffix(ParmString word, const unsigned char * new_aff,
+    WordAff * expand_suffix(ParmString word, const unsigned char * aff,
                             ObjStack &, int limit = INT_MAX,
                             unsigned char * new_aff = 0, WordAff * * * l = 0,
                             ParmString orig_word = 0) const;
--- modules/filter/tex.cpp.save Fri Mar 18 10:16:16 2005
+++ modules/filter/tex.cpp      Sat Mar 19 12:20:00 2005
@@ -25,7 +25,6 @@
 
 #include "gettext.h"
 
-namespace {
 
   using namespace acommon;
 
@@ -750,7 +749,6 @@
     FDEBUGCLOSE;
   }
 #endif
-}
 
 C_EXPORT 
 IndividualFilter * new_aspell_tex_filter() {return new TexFilter;}
--- modules/filter/sgml.cpp.save        Fri Mar 18 10:19:13 2005
+++ modules/filter/sgml.cpp     Sat Mar 19 12:19:33 2005
@@ -37,7 +37,6 @@
 //     N_("sgml file extensions")}
 //  };
 
-namespace {
 
   using namespace acommon;
 
@@ -507,7 +506,6 @@
 //     start = buf.pbegin();
 //     stop  = buf.pend() - 1;
 //   }
-}
 
 C_EXPORT IndividualFilter * new_aspell_sgml_filter() 
 {
--- modules/filter/email.cpp.save       Fri Dec  3 03:22:16 2004
+++ modules/filter/email.cpp    Sat Mar 19 12:19:07 2005
@@ -12,7 +12,6 @@
 #include "indiv_filter.hpp"
 #include "mutable_container.hpp"
 
-namespace {
 
   using namespace acommon;
 
@@ -105,7 +104,6 @@
       for (FilterChar * i = line_begin; i != cur; ++i)
        *i = ' ';
   }
-}
 
 C_EXPORT 
 IndividualFilter * new_aspell_email_filter() {

This wraps up my job as IRIX porter :) I hope this is useful for the developers
and folks over here. Thanks Kevin Gary and Jose for the helpful comments.

Frank

-- 
drs Frank Everdij  Email:[email protected]  Tel:01527-88202  Room:6.08
System Administrator for Structural Mechanics
Dept. of Civil Engineering TU Delft
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.