Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7093 Discussions

_Mkl_Api(...) and similar macros should not add a semicolon when evaluated

DenizBahadir
New Contributor I
1,603 Views

I am just looking through the new MKL 2023.0.0 release and notice the following:

 

Some headers, e.g. `mkl.h` and `mkl_pardiso.h` (but only in the Windows version, see this bug report ) define macros `_Mkl_Api`, `_mkl_api` and `_MKL_API`, which are defined in such a way that they evaluate to function declarations for their arguments.

However, sadly they also append a semicolon to the function declarations they evaluate to. That should be avoided!

 

For one, this leads to inconsistent usage of the macros: Sometimes those are written in the header files with an extra semicolon at the end, sometimes without. See, for example, this small excerpt from the (Windows version of) `mkl_pardiso.h`:

 

...
_Mkl_Api(void,pardiso_handle_delete,( const char*, MKL_INT *));
_Mkl_Api(void,PARDISO_HANDLE_DELETE,( const char*, MKL_INT *));

/* oneMKL Progress routine */
#ifndef _MKL_PARDISO_PIVOT_H_
#define _MKL_PARDISO_PIVOT_H_
_Mkl_Api(int,MKL_PARDISO_PIVOT, ( const double* aii, double* bii, const double* eps ))
_Mkl_Api(int,MKL_PARDISO_PIVOT_,( const double* aii, double* bii, const double* eps ))
...

 

Even worse, this will very likely make some compilers print unnecessary warnings (that might even be treated as errors) about superfluous semicolons (e.g. for lines 2 and 3 of the excerpt above).

 

Second, it is generally recommended not to include semicolons within macros that are used as statements. (See, for example, this recommendation here.)

Labels (1)
0 Kudos
1 Solution
ShanmukhS_Intel
Moderator
1,227 Views

Hi Deniz,

 

Thank you for your patience. The issue raised by you has been fixed in version 2023.2.

Please download it and let us know if this resolves your issue. Please check the release notes for the features and bug fixes.

 

Best Regards,

Shanmukh.SS

 

View solution in original post

7 Replies
ShanmukhS_Intel
Moderator
1,544 Views

Hi Deniz,


Thanks for posting on Intel Communities.


Thanks for your suggestions. We will get back to you soon with an update.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
1,525 Views

Hi Deniz Bahadir,

 

Thanks for sharing the feedback. We have informed the development team regarding the same and they are working on it. We will get back to you soon with an update!

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
1,303 Views

Hi Deniz,

 

This is to kindly inform you that our developer team is working on moving semicolons from _mkl_api, _MKL_API, and _Mkl_Api macros to function declarations to avoid accidental double semicolons.

 

Regrets for the delay in response.

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
1,289 Views

Hi Deniz,


Thank you for your patience. This is to kindly inform you that the issue raised by you would be fixed in upcoming releases.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
1,228 Views

Hi Deniz,

 

Thank you for your patience. The issue raised by you has been fixed in version 2023.2.

Please download it and let us know if this resolves your issue. Please check the release notes for the features and bug fixes.

 

Best Regards,

Shanmukh.SS

 

DenizBahadir
New Contributor I
1,219 Views

Thanks, @ShanmukhS_Intel.

The problem indeed seems to be fixed with version 2023.2.

 

Just one note:

The file `mkl_pardiso.h` still contains the definition for a macro `_Mkl_Deprecated_Api` that also ends in a semicolon.

Luckily, that macro seems not to be used, but your developers should for consistency probably remove that semicolon, too. (Or just remove that unused macro.)

 

Now, it would be great if you could still consider adding parameter names to the function declarations / macro-invocations [1] and use the same header for the Linux platform as well [2].

0 Kudos
ShanmukhS_Intel
Moderator
1,168 Views

Hi Deniz,

 

Thanks for accepting the solution. It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.

 

Now, it would be great if you could still consider adding parameter names to the function declarations / macro-invocations [1] and use the same header for the Linux platform as well [2].

>>Regarding the other threads, We would like to inform you that you could track the progress of the fix in the respective community cases mentioned in the hyperlinks shared by you.

 

Best Regards,

Shanmukh.SS

 

0 Kudos
Reply