Search code examples
coracleoracle-pro-c

How to make Pro*C cope with #warning directives?


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 following: (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.


Solution

  • 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.