This post, unlike my others, doesn’t revolve around a problem I resolved, but I don’t think Kev has a blog, so I’ll take the credit.
I’m also going to include a link sugested by Allyn for those interested in understanding C a little better.
The problem began after the operating system was upgraded on the development box (AIX) and various programs we have developed fail to compile:
++++++ progName.pc ++++++
/oracle/app/oracle/product/10.2.0/bin/proc sqlcheck=full userid=***** include=../Einclude include=/opt/IBMvast/primitiv dbms=v8 MODE=ORACLE CODE=ANSI_C CHAR_MAP=string LTYPE=NONE LINES=YES DEFINE=_LONG_LONG iname=progName.pc
Pro*C/C++: Release 10.2.0.3.0 – Production on Thu Feb 2 11:58:12 2017
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /oracle/app/oracle/product/10.2.0/precomp/admin/pcscfg.cfg
Syntax error at line 647, column 34, file /usr/include/openssl/crypto.h: Error at line 647, column 34 in file /usr/include/openssl/crypto.h int CRYPTO_memcmp(const volatile void a, const volatile void b, size_t len); ……………………………1
PCC-S-02201, Encountered the symbol “void” when expecting one of the following:
, ( ) [
The symbol “,” was substituted for “void” to continue.
Syntax error at line 647, column 58, file /usr/include/openssl/crypto.h: Error at line 647, column 58 in file /usr/include/openssl/crypto.h int CRYPTO_memcmp(const volatile void a, const volatile void b, size_t len); …………………………………………………1
PCC-S-02201, Encountered the symbol “void” when expecting one of the following:
, ( ) [
The symbol “,” was substituted for “void” to continue.
Syntax error at line 256, column 24, file /usr/include/openssl/bio.h: Error at line 256, column 24 in file /usr/include/openssl/bio.h void BIO_set_flags(BIO b, int flags);
…………………..1
PCC-S-02201, Encountered the symbol “” when expecting one of the following:
, )
So an operating system upgrade causes compilation errors?
Actually, the errors are only seen in the pre-compiler, not in the compiler. I don’t know if the AIX C compiler would have issues with this but I would hope not.
Several people worked on the investigation.
I tried using the 11g verion of Pro*C, but the error persisted.
I didn’t have access to a 12c Pre-compiler at work, so I am unable to confirm if the same issue would be present.
The issue was traced by a coligue to changes in the openssl header files, where various prototypes had been changed.
Reverting to the old versions allowed the programs to compile sucessfully.
The issue appears to be a failure of the Pro*C compiler to sucessfully process some of the newer C syntax.
My colligue, not only solved the problem, but found the git hub repository where the change was discussed and debated.
https://github.com/openssl/openssl/pull/102
The issue was that the prototype was changed in opensl/crypto.h so that:
int CRYPTO_memcmp(const void in_a, const void in_b, size_t len)
became:
int CRYPTO_memcmp(const volatile void in_a, const volatile void in_b, size_t len)
The link explains that the motive for the change was to stop the GNU C compiler from optimising code that could theoretically allow unencripted values beins stored in memory.
As we weren’t using this function, and we weren’t using the GNU compiler, we felt it safe to revert this change back.
Ultimately, it is perhaps useful to understand the concept of the const volatile, which is explained in this interesting article suggested by my coligue:
http://www.embedded.com/electronics-blogs/barr-code/4236917/1/Combining-C-s-volatile-and-const-keywords
Enjoy!