Oracle's pro*C compiler and gnu C (__builtin_va_list, __attribute__, etc)

泪湿孤枕 提交于 2019-12-10 18:32:57

问题


I'm compiling a database library with proC which converts the .ppc library file to a .c file that gcc can use. However, I'm getting a lot of errors in proC like the following

   PCC-S-02201, Encountered the symbol
"__ attribute__ " when expecting one of
the `following`

... 

   , Encountered the symbol
"__builtin_va_list" when expecting one of
the `following`

The missing symbols are from a chain of standard includes like stdio.h and stdlib.h. How do I get around this issue?

The library I'm compiling came from an old solaris system that we're now upgrading (to a new solaris 10 system) and the header files don't seem to use these symbols. e.g. the newer .h files has

typedef __builtin_va_list va_list

while the old .h files has

typedef void* va_list

There are a lot of things like this so I'm reluctant to go and fix all of them manually with a typedef


回答1:


Change PARSE param in your $ORACLE_HOME/precomp/admin/pcscfg.cfg to PARTIAL - it will use more relaxed C parsing so Pro*C don't bitch about C syntax it doesn't understand.




回答2:


You can achieve it also by including this preprocessor directive. Pro*C evaluates macros and replaces them

#ifdef ORA_PROC
#define __attribute__(x) 
#endif

I'm actually at home and can't verify exactly how it is defined in our code base, I will check it and complete it but it is like the above.

Update: so the exact code we use in our project is:

#if defined(ORA_PROC) || !defined(__GNUC__)
#define __attribute__(x)
typedef unsigned long long uint64_t;
typedef          long long  int64_t;
#define INLINE
#endif

For an unknown reason the preprocessor is unable to have 64 bits types defined so I define them directly so that it works. Our project is on Solaris 9 for SPARC and we compile with GCC 3.3.1 and GCC 3.4.2 and we use Oracle 10g



来源:https://stackoverflow.com/questions/2467200/oracles-proc-compiler-and-gnu-c-builtin-va-list-attribute-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!