HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
21 user(s) are online (10 user(s) are browsing Forum)

Members: 1
Guests: 20

human, more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Patch (cobc.c) for option -D: Check that we don't use other options starting with a small "d"
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
human
Posted on: 2009/10/21 5:31
Home away from home
Joined: 2007/5/15
From:
Posts: 967
Online
Patch (cobc.c) for option -D: Check that we don't use other options starting with a small "d"
cobc -debug
leads to checks for out-of-bounds, NULL addresses, ...

What does
cobc -Debug
do?

If it does nothing it should be blocked like the other params, Quote:
cobc: unrecognized option `-Fnotrunc'

human

Edit: Patch at the end of this thread
btiffin
Posted on: 2009/10/22 4:15
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 755
Re: What should -Debug do?
It passes ebug to the C compiler as a define. Shows up with -v. it looks like -Debug to gcc too. ;)

Cheers,
Brian
human
Posted on: 2009/10/22 5:38
Home away from home
Joined: 2007/5/15
From:
Posts: 967
Online
Re: What should -Debug do?
Can somebody please explain what this is good for (and whether we can remove this command line option because of the too easy possibility to mix it with the more important -debug)?

human
btiffin
Posted on: 2009/10/22 6:00
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 755
Re: What should -Debug do?
Well, it is a little hard on us, but it might save someone with cobc -DSTDIOBORKED simple.cob, for some weird or new platform.

Maybe...?

Cheers,
Brian
human
Posted on: 2009/10/29 10:43
Home away from home
Joined: 2007/5/15
From:
Posts: 967
Online
Re: What should -Debug do?
Yep, defines are important. A simple check does the trick (in cobc.c, process_command_line)
		case 'D':	/* -D */
			// Check that we don't use other options starting with a small "d"
			if (!strcmp(optarg, "ebug")) {
				fprintf (stderr, "Warning - passing '%s' to compiler, did you intended to use -debug?\n", optarg);
				fflush (stderr);
			}
#ifdef _MSC_VER
			strcat (cob_define_flags, "/D \"");
			strcat (cob_define_flags, optarg);
			strcat (cob_define_flags, "\" ");
#else
			strcat (cob_define_flags, "-D");
			strcat (cob_define_flags, optarg);
			strcat (cob_define_flags, " ");
#endif
			break;

human
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net