[news.software.b] 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!

smaug@eng.umd.edu (Kurt Lidl) (12/05/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!).
>>
>>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.

[This is exactly the behavior I experienced when I was running
C News with the default Sun dbm libraries.  Thanks to Felix Lee for
the fix -- it got me up and running in the first place.]

Our current setup of C News on our sun 3 systems was built using gcc v1.35.
Here are my compiler invocation lines:

CC= gcc
COPTS= -O -traditional -fpcc-struct-return

In addition to this, I use the dbz routines that have appeared here
lately.  (I suppose that actually, since I am now not confined by the
system dbm routines, I could drop the -fpcc-struct-return flag... Oh
well.  This works well.)

My personal advice for someone who is going to run C News is to
add the dbz routines to the libcnews.a and link with that.  No more
special dbm libraries, and just one library to have to link the
nntp stuff with...  But, I didn't write the software, so this is only
an opinion.
--
/* Kurt J. Lidl (smaug@eng.umd.edu) | X Windows: Power Tools */
/* UUCP: uunet!eng.umd.edu!smaug    | for Power Fools        */