Oracle 7 - Compiler Warnings in Generated Code

From: James J. Yorton <yorton_at_bison.cig.mot.com>
Date: 21 Jan 1994 19:56:55 GMT
Message-ID: <2hpc27$b46_at_delphinium.cig.mot.com>


I hate to ask for assistance on something like this, but ...

I am continually getting the same set of compiler warnings on all my files which are preprocessed by Oracle. Once built, the code appears to work, but I don't like the idea of leaving the warnings in there.

Basically, I'm getting symbols which are 'const', on one side side of an assignment, and other side is a not 'const'. Manually deleting the 'const' keyword cleans it up, but why is Oracle generating code with warnings in it?

I've been searching books/manuals, and can't seem to find what I need to do to clean this up.

I get a clean pre-compile, and then I get warnings with the GNU gcc compiler.

I do not feel this is an issue with the GNU compiler because it is successfully flagging the inconsistency.

Pre-compiler options are:

	oraca=yes
	select_error=no
	sqlcheck=full
	CODE=ANSI_C
	userid=<my userid>


  • Begin Included Message -----

Pro*C: Release 1.5.7.0.1 - Production on Fri Jan 21 09:51:18 1994

Copyright (c) Oracle Corporation 1979, 1992. All rights reserved.

Precompiling retTime.pc
gcc -O -I <list deleted for brevity> -target sun4 -c retTime.c

retTime.c: In function `retrieveTimeEntries':
retTime.c:448: warning: assignment discards `const' from pointer target type
retTime.c:451: warning: assignment discards `const' from pointer target type
retTime.c:467: warning: passing arg 3 of `sqlcex' discards `const' from pointer 
target type
  • End Included Message ------

The generated code in question is:

static const short sqlcud0[] = ...
static const char *sq0001 = ...

static const struct sqlcxp sqlfpn = ...
extern void sqlcex(unsigned long *, struct sqlexd *, struct sqlcxp *);

static struct sqlexd {

	char   *stmt;
	short  *cud;

...
} sqlstm = {4,10}; /* no const here */ 443 /* SQL stmt #10 444 EXEC SQL OPEN timeentry_cursor;
   445 */
   446 {
   447          sqlora(&sqlctx, &oraca);
   448          sqlstm.stmt = sq0001;

...
...
451 sqlstm.cud = sqlcud0;
...
467 sqlcex(&sqlctx, &sqlstm, &sqlfpn);
   469 }

I know what the problem is, I just can seem to fix it even after RTFM. Please email responses.

------------------------------+------------------------------------
Jim Yorton                    | Voice:      +1 708-632-6695
Motorola Inc.                 |
General Systems Sector        | Internet:   yorton_at_cig.mot.com
Cellular Infrastructure Group | UUCP:       ...!uunet!motcid!yorton
Arlington Heights, IL USA | Received on Fri Jan 21 1994 - 20:56:55 CET

Original text of this message