tags:

views:

1803

answers:

6

When I try to precompile a *.pc file that contains a #warning directive I recieve the following error:

PCC-S-02014, Encountered the symbol "warning" when expecting one of the followin g: (bla bla bla).

Can I somehow convince Pro*C to ignore the thing if it doesn't know what to do with it? I can't remove the #warning directive as it's used in a header file that I can't change and must include.

A: 

You can't. Pro*C only knows #if and #include. My best advice would be to preprocess the file as part of your build process to remove stuff Pro*C won't like. Something like

grep -v -E '^#(warning|pragma|define)' unchangeable.h >unchangeable.pc.h

My other advice would be to avoid the abomination which is Pro*C, but I'm guessing you're stuck with it...

Jon Bright
+2  A: 

According to the Pro*C/C++ Programmer's Guide (chapter 5 "Advanced Topics"), Pro*C silently ignores a number of preprocessor directives including #error and #pragma, but sadly not #warning. Since your warning directives are included in a header file, you might be able to use the ORA_PROC macro:

#ifndef  ORA_PROC
#include <irrelevant.h>
#endif

For some reason, Pro*C errors out if you try to hide a straight #warning that way, however.

Jon Ericson
A: 

Jons Ericsons answer is correct.

There is a second circumstance where you may need to use that trick.

Some versions of Pro*c can't deal with include files that don't have a file extension.

The ORA_PROC constant is one workable solution to that problem as well.

EvilTeach
A: 

/bin/make -f /css/hwmig/pcprg/proc9i32.mk PROCFLAGS="sqlcheck=SEMANTICS userid=cssd/india09" PCCSRC=bic I_SYM=include= pc1 proc sqlcheck=SEMANTICS userid=cssd/india09 iname=bic include=. include=/oracle/Ora92/precomp/public include=/oracle/Ora92/rdbms/public include=/oracle/Ora92/rdbms/demo include=/oracle/Ora92/plsql/public include=/oracle/Ora92/network/public

Pro*C/C++: Release 9.2.0.6.0 - Production on Tue Dec 2 14:05:38 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

System default option values taken from: /oracle/Ora92/precomp/admin/pcscfg.cfg

Syntax error at line 135, column 2, file /usr/include/standards.h: Error at line 135, column 2 in file /usr/include/standards.h

warning The -qdfp option is required to process DFP code in headers.

.1 PCC-S-02014, Encountered the symbol "warning" when expecting one of the followin g:

a numeric constant, newline, define, elif, else, endif, error, if, ifdef, ifndef, include, line, pragma, undef, an immediate preprocessor command, a C token, The symbol "newline," was substituted for "warning" to continue.

Syntax error at line 30, column 7, file bic.pc: Error at line 30, column 7 in file bic.pc FILE fp; ......1 PCC-S-02201, Encountered the symbol "" when expecting one of the following:

; , = ( [ The symbol ";" was substituted for "*" to continue.

Error at line 0, column 0 in file bic.pc PCC-F-02102, Fatal error while doing C preprocessing

A: 

Remove below two lines from /usr/include/standards.h

warning The -qdfp option is required to process DFP code in headers.

else

A: 

use option "parse=none" with proc

Ludwig