🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50759

protoize

#50759
From: Josh Whitehouse
Date: Fri, 20 Aug 1993 14:59
53 lines
2074 bytes
I posted this once, but it disappeared.  Oh well.

I have a project I inherited with ~300,000 lines of sloppy non ANSI C code
in about 250 files.  I want to make this code ANSI compliant in preparation
for a conversion to C++, at which point, hopefully, I can reuse much of this
code.  In switching to GNUC gcc version 2.4.5 from the SUN C compiler under
SunOs 4.1.1, I discovered protoize, which does a great job of generating
ANSI function declarations for old C code.  However, it doesn't do two
things I would like it to, or I am missing some options.

	a) generate a prototype at the top of a source file if a function
	   is used/explicitly declared before the true declaration at the
	   beginning of a function.

		Example:

		(before protoize)
		void foo() {
			bar();
		};
		
		static void bar() {
		};

		(after protoize)
		void foo(void) {
			bar();
		}
		static bar(void) {
		};

		There is no prototype, even using the -l option with protoize, and
		the compiler still bitches.

	b) detect a function declaration with the wrong return type. 

		Example:

		foo() {
			long l;
			return l;
		};

		this isn't caught by protoize, either.  I haven't run it through
		lint to see the results there, but I am sure lint will catch it.

It would be very time consuming to do ~250 modules by hand, so I was wondering
if there was something to help with this along with protoize... Any suggestions?

All advice appreciated.

JOSH
		
Technical Details
Message-ID: <1993Aug20.145911.22248@lehman.com>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!psinntp!lehman.com!phoenix!josh

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,184ee68ef8c59032,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-08-20 09:30:43 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!psinntp!lehman.com!phoenix!josh
From: josh@phoenix.shearson.com (Josh Whitehouse)
Subject: protoize
Message-ID: <1993Aug20.145911.22248@lehman.com>
Sender: news@lehman.com (News)
Reply-To: josh@phoenix.shearson.com
Organization: Sun Microsystems, Inc.
Date: Fri, 20 Aug 1993 14:59:11 GMT
Lines: 55