oracle 如何让 Pro*C 处理 #warning 指令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:02:09  来源:igfitidea点击:

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

coracleoracle-pro-c

提问by Maximilian

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

当我尝试预编译包含 #warning 指令的 *.pc 文件时,我收到以下错误:

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

PCC-S-02014,在预期以下情况之一时遇到符号“警告”:(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 #warningdirective as it's used in a header file that I can't change and must include.

如果 Pro*C 不知道如何处理它,我能否以某种方式说服它忽略它?我无法删除该#warning指令,因为它在我无法更改且必须包含的头文件中使用。

回答by Jon Ericson

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:

根据Pro*C/C++ 程序员指南(第 5 章“高级主题”),Pro*C 默默地忽略了许多预处理器指令,包括 #error 和 #pragma,但遗憾的是没有 #warning。由于您的警告指令包含在头文件中,您或许可以使用 ORA_PROC 宏:

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

但是,出于某种原因,如果您尝试以这种方式隐藏直接的 #warning,Pro*C 会出错。

回答by Ludwig

use option parse=nonewith proc

使用parse=noneproc选项

回答by Jon Bright

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

你不能。Pro*C 只知道#if 和#include。我最好的建议是将文件作为构建过程的一部分进行预处理,以删除 Pro*C 不喜欢的内容。就像是

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

我的另一个建议是避免 Pro*C 的可憎之处,但我猜你已经坚持下去了......

回答by EvilTeach

Jons Ericsons answer is correct.

Jons Ericssons 的回答是正确的。

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.

某些版本的 Pro*c 无法处理没有文件扩展名的包含文件。

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

ORA_PROC 常量也是该问题的一种可行解决方案。

回答by EvilTeach

/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

/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

Pro*C/C++:9.2.0.6.0 版 - 2008 年 12 月 2 日星期二 14:05:38 发布

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

版权所有 (c) 1982、2002,甲骨文公司。版权所有。

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

系统默认选项值取自:/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

第 135 行第 2 列文件 /usr/include/standards.h 处的语法错误:文件 /usr/include/standards.h 中第 135 行第 2 列处的语法错误

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

警告 -qdfp 选项需要处理标头中的 DFP 代码。

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

.1 PCC-S-02014,在预期以下 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.

数字常量、换行符、define、elif、else、endif、错误、if、ifdef、ifndef、include、line、pragma、undef、立即预处理器命令、C 标记、符号“换行符”被替换为“警告” “ 接着说。

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:

文件 bic.pc 第 30 行第 7 列的语法错误:文件 bic.pc 文件fp中第 30 行第 7 列的错误 ......1 PCC-S-02201,在预期以下情况之一时遇到符号“”:

; , = ( [ 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

文件 bic.pc PCC-F-02102 中第 0 行第 0 列出错,进行 C 预处理时发生致命错误

回答by EvilTeach

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

从 /usr/include/standards.h 中删除以下两行

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

警告 -qdfp 选项需要处理标头中的 DFP 代码。

else

别的

回答by yijy

Modify /usr/include/standards.h.
Delete the line #warning The -qdfp option is required to process DFP code in headers.The proc does not support the #warning,just #else#ifetc.

修改/usr/include/standards.h.
删除该行#warning The -qdfp option is required to process DFP code in headers.proc 不支持#warning,只是#else#if等。