Two Pass Pre-Processing Problem

Two Pass Pre-Processing Problem

mary_monahan的头像

I am trying to port some code to Linux using your compiler. Currently, the make process takes as input a C++ program with imbedded SQL. It does a pre-process run (-E) against the file so all the current includes are expanded. It takes that output and does a DB2 prep and bind. It takes the output file from the DB2 prep which now has another include listed and then does the real compile. The problem is that the original includes caused ydefs.h to be expanded into the program, but the protective #define _YVALS is not there. The DB2 include causes stddefs.h to be included which causes yvals.h to be included again. Consequently, I am getting the error:

invalid redeclaration of type name "_Mbstatet" (declared at line 260 of "/opt/intel/compiler70/ia32/include/yvals.h")

Do you have any suggestions on how I can prevent this from happening?

7 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
mary_monahan的头像

I went ahead and added -D_YVALS to the preprocessing step. The only problem is that caused an error during the preprocessing because limits.h expects BITS_BYTE to be set to 8 and that is normally done in _YVALS. I am going to add the BITS_BYTE define, but this seems like a long term maintenance problem that will pop up every time the compiler changes.

I must admit, I am confused that this type of problem did not show up under AIX or SUN. Is there some way of turning off an error if a redefine is redefining to the original value?

mary_monahan的头像

I have been doing a lot of research on this. I think the reason this stuff is building on the other platforms is that they are allowing benign redeclarations of typedef's which is apparently an ANSI C extension. Is this supported in the V7 Intel compiler?

mary_monahan的头像

Forgot to mention that I have tried the -Xa option, and it still didn't work.

GaneshRao (Intel)的头像

Mary_Monahan -
I can swear that I posted a reply yesterday. I guess I didnt hit the Post Message button. Sorry.

>long term maintenance problem that will pop up every time the compiler
Short term solution:
Intel compiler users a config file (text file) everytime it loads. This would be icc.cfg and icpc.cfg. These are located in the bin directory. This would be a good was to add any additional flags you want here. This will be system wide.

But I think we should resolve the problem more elegently.

Could you preprocess a .i reproducer file and attach it to a testcase on Premier.intel.com? I'd like to actually see the problem...

Thanks!
Ganesh

mary_monahan的头像

Hi Ganesh,

My team lead, John Dorak, sent in the problem to Premier support today. He asked me for example file so I presume he has added it to the report.

The global config file doesn't solve the maintenance problem I was concerned about. I had the idea that if I could figure out what #defines could be added before the compilation I could stop the include file that was added after the pre-processing from expanding out typedefs that were put in the file already in the preprocessing. But, even if I could figure out all the #defines, it doesn't work because the #include needs to be put before references to objects that were defined by DB2 but after the expansion of stddef.h in the preprocessed file. This would be hard to do dynamically - especially since stddef.h is usually brought in by other includes.

What I really need is for the compiler to recognize that the duplicate typedef is exactly the same as the original and not post a hard failure. I believe the reason this system can compile under Solaris and AIX is that they consider this a benign redeclaration and do not terminate processing.

GaneshRao (Intel)的头像

Thanks. I will look for the .i file.

Regards,
Ganesh

登陆并发表评论。