octave-maintainers
[Top][All Lists]
Advanced

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

Re: Creating a Snapshot


From: William Poetra Yoga Hadisoeseno
Subject: Re: Creating a Snapshot
Date: Tue, 30 May 2006 10:07:14 +0800

Uh, this is a problem with gcc 3.4.x I think. The solution (it's in
the mailing list IIRC) is to use X_CAST there, which is just:

#define X_CAST(T, E) (T) (E)

It will generate a warning (old-style cast) but not an error.

John: Today I got this error (I'm using gcc-3.4.6) (the /root/dev
thingy is just my habit)

g++ -c  -fPIC -I. -I/root/dev/octave/octave/src -I.. -I../liboctave
-I../src -I../libcruft/misc -I/root/dev/octave/octave
-I/root/dev/octave/octave/liboctave -I/root/dev/octave/octave/src
-I/root/dev/octave/octave/libcruft/misc  -DHAVE_CONFIG_H -mieee-fp
-Wall -W -Wshadow -Wold-style-cast -O2
/root/dev/octave/octave/src/load-path.cc -o pic/load-path.o
/root/dev/octave/octave/src/load-path.cc: In member function `void
load_path::do_set(const std::string&)':
/root/dev/octave/octave/src/load-path.cc:427: error: ISO C++ forbids
casting between pointer-to-function and pointer-to-object
make: *** [pic/load-path.o] Error 1

Since gcc 3.4.x forbids the cast using reinterpret_cast, we can't use
it here (but gcc 4.? allows it). I propose adding a macro
"unwind_protect_fptr", which is basically "unwind_protect_ptr" but
with the old-style cast instead of reinterpret_cast, like this:

#define unwind_protect_fptr(p) \
 unwind_protect::save_ptr ((void **) (&(p)), \
                           (void *) (p))

Then, in load-path.cc we use:

 unwind_protect_fptr (add_hook);

This works, and generates a warning instead of an error:

g++ -c  -fPIC -I. -I/root/dev/octave/octave/src -I.. -I../liboctave
-I../src -I../libcruft/misc -I/root/dev/octave/octave
-I/root/dev/octave/octave/liboctave -I/root/dev/octave/octave/src
-I/root/dev/octave/octave/libcruft/misc  -DHAVE_CONFIG_H -mieee-fp
-Wall -W -Wshadow -Wold-style-cast -O2
/root/dev/octave/octave/src/load-path.cc -o pic/load-path.o
/root/dev/octave/octave/src/load-path.cc: In member function `void
load_path::do_set(const std::string&)':
/root/dev/octave/octave/src/load-path.cc:427: warning: use of old-style cast
/root/dev/octave/octave/src/load-path.cc:427: warning: use of old-style cast

What do you think? I haven't created a diff yet because I can't access
the CVS repository (connection timed out). Btw, the www.octave.org
website isn't accessible, either.

On 5/23/06, Bill Denney <address@hidden> wrote:
On Tue, 23 May 2006, John W. Eaton wrote:

> Please let me know whether this avoids the problem you were seeing.

Thanks for that.  It does fix the problem I was seeing.  I have now gotten
to another:

dynamic-ld.cc: In member function `bool octave_dynamic_loader::do_load(const
    std::string&, const std::string&)':
dynamic-ld.cc:268: error: ISO C++ forbids casting between pointer-to-function
    and pointer-to-object
make[2]: *** [dynamic-ld.o] Error 1
make[2]: Leaving directory `/tmp/octave/src'
make[1]: *** [src] Error 2
make[1]: Leaving directory `/tmp/octave'
make: *** [all] Error 2

Bill

--
"Too much of anything is bad for you.  You just have to make sure you
don't have too much of whatever.  Glue might be an exception."
   -- on Slashdot




--
William Poetra Yoga Hadisoeseno


reply via email to

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