I need to programmatically query the Portland Group C compiler version in order to conditionally compile code which uses the new inline assembly support added in version 6.1.
I cannot find a version query macro anywhere in the PGI documentation or verbose compile output - is there a macro hiding somewhere that can be used to check the compiler version? (eg gcc has GNUC, GNUC_MINOR, GNUC_PATCHLEVEL, etc)
No, it doesn’t appear that we do. But that’s a good idea. I’ve entered a
feature request, and for your tracking purposes, it is TPR 3791
Thanks - having that in future versions would definitely be helpful, but it obviously doesn’t help me with my immediate problem (especially since I’m trying to detect the difference between 6.1 and releases before 6.1).
Is there any other way to detect from the preprocessor whether I’m using 6.1 or newer? (eg any other random predefined preprocessor tokens that happen to first appear in 6.1?)
I see in the version 6.2-3 release that these compiler versioning macros are NOT available for the c++ compiler. Is that an oversight, or is there a reason not to? I could really use this facility in the c++ compiler as well.
Thanks for pointed this out. This was an oversite. I’ve reopened the feature request (TPR#3791) have have asked our compiler engineers to add these macros to C++.