[unix-pc.general] Cnews and gcc 1.36 on UNIXPC

todd@ivucsb.sba.ca.us (Todd Day) (12/02/89)

Usually, I have no trouble with Cnews when using the stock UNIXPC cc
compiler.  However, when I tried using gcc1.36, Cnews would claim that
all articles are duplicates (even happens during the regression test!).

Can anyone shed some light on this?

-- 
Todd Day  |  todd@ivucsb.sba.ca.us  |  ivucsb!todd@anise.acc.com
"A rubber hose is just as effective, and it doesn't leave any marks"
					-- Donna Reed

moraes@cs.toronto.edu (Mark Moraes) (12/02/89)

todd@ivucsb.sba.ca.us (Todd Day) writes:
>Usually, I have no trouble with Cnews when using the stock UNIXPC cc
>compiler.  However, when I tried using gcc1.36, Cnews would claim that
>all articles are duplicates (even happens during the regression test!).

>Can anyone shed some light on this?

I haven't seen this problem, but for a wild guess, are you using dbm
from a system library? gcc and cc differ on their convention for
returning dbm structs, and programs that use dbm should either use the
-fpcc-return option on gcc when compiling, (may not work in gcc
versions before 1.35, I think), or compile a version of
dbm/sdbm/gdbm/dbz/whatever with gcc and use that.

This also applies to any other routines that return structs, rather
than pointers to structs.

[Geoff Collyer also warns that you had better use gcc -traditional --
 he staunchly denies that C News is written in ANSI C, and insists
 that compiling C News with an ANSI C compiler (alleged or otherwise)
 will void your warranty...]

henry@utzoo.uucp (Henry Spencer) (12/03/89)

In article <1989Dec2.022346.436@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>Usually, I have no trouble with Cnews when using the stock UNIXPC cc
>compiler.  However, when I tried using gcc1.36, Cnews would claim that
>all articles are duplicates (even happens during the regression test!).
>
>Can anyone shed some light on this?

I'd suspect problems with the interface to the dbm library.  As I
understand it -- I haven't used gcc significantly -- gcc does *not*
use pcc-compatible conventions for calling struct-valued functions
unless told to.  The dbm interface includes some such functions.
-- 
Mars can wait:  we've barely   |     Henry Spencer at U of Toronto Zoology
started exploring the Moon.    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

rmtodd@servalan.uucp (Richard Todd) (12/03/89)

In article <1989Dec2.235241.6935@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>In article <1989Dec2.022346.436@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>>Usually, I have no trouble with Cnews when using the stock UNIXPC cc
>>compiler.  However, when I tried using gcc1.36, Cnews would claim that
>>all articles are duplicates (even happens during the regression test!).

>I'd suspect problems with the interface to the dbm library.  As I
>understand it -- I haven't used gcc significantly -- gcc does *not*
>use pcc-compatible conventions for calling struct-valued functions
>unless told to.  The dbm interface includes some such functions.

Yep, that's exactly what happens.  All history-file-related functions (like
checking whether articles are dupes or not) will not work if you forget to
use -fpcc-struct-return on the gcc command line.  With that, everything should
work fine; a friend of mine got C News running on an Encore Multimax with gcc,
and as I recall we didn't have to specify any flags to gcc except for 
-fpcc-struct-return and -traditional.  
--
Richard Todd	rmtodd@uokmax.ecn.uoknor.edu  rmtodd@chinet.chi.il.us
	rmtodd@servalan.uucp
Motorola Skates On Intel's Head!