Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Marián__VooDooMan__M
New Contributor II
103 Views

Feature request: ignore "#pragma intrinsic"

Greetings,

I use ICC 13 under MSVC 2012.

MSVC 2012 has construct:"#pragma intrinsic(fabs)" before function to let compiler know it should use intrinsic function "fabs" in this case in following function.

ICC doesn't know this #pragma, obviously it has command-line switches to automatically use intrinsic functions when possible. So I need to use following instead before function:

[cpp] #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) # pragma intrinsic(fabs) #endif [/cpp]

It would be cool if ICC would accept "#pragma intrinsic", and instead of raising compile warning would just ignore this pragma.

0 Kudos
7 Replies
Marián__VooDooMan__M
New Contributor II
103 Views

Marián "VooDooMan" Meravý wrote:

[cpp] #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) # pragma intrinsic(fabs) #endif [/cpp]

It would be cool if ICC would accept "#pragma intrinsic", and instead of raising compile warning would just ignore this pragma.

Just a side note, ICC raises warning "unknown pragma", and I don't want to globally disable this warning, so I need to use above preprocessor guard.

SKost
Valued Contributor II
103 Views

I support Marian's request and I'd like to add that a complete overhaul of different pragmas ( including Intel specific ) is needed because there are Too Many inconsistencies.
SKost
Valued Contributor II
103 Views

Here are additional technical details. Last week I completed a test related to using __cdecl, __stdcall and __fastcall calling conventions in the same project (!). It would be nice to have a pragma like, #pragma function ( FunctionName, calling convention ) An example of usage could look like: ... #pragma function ( AfxBeginThread, __stdcall ); ... A real problem happens when some project uses MFC function AfxBeginThread and project settings are set as follows: Project Property Pages -> Configuration Properties -> C/C++ Advanced -> Calling Convention = __fastcall ( /Gr ) Take into account that the AfxBeginThread is declared as follows: [ Afxwin.h ] ... // global helpers for threads CWinThread * AFXAPI AfxBeginThread( AFX_THREADPROC pfnThreadProc, LPVOID pParam, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL ); CWinThread * AFXAPI AfxBeginThread( CRuntimeClass* pThreadClass, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL ); ... [ Afxver_.h ] ... // AFXAPI is used on global public functions #ifndef AFXAPI #define AFXAPI __stdcall #endif ... So, there is a conflict between two calling convention specificators, the one which is declared for the function in the header and another one which is set in project settings.
SKost
Valued Contributor II
103 Views

Even if Intel and Microsoft C++ compilers have similar compilation outputs I think some improvements, or extensions, are needed to resolve all these issues related to usage of __cdecl, __stdcall and __fastcall calling conventions in the same project: ... Compiling with Intel(R) C++ Compiler XE 12.1.7.371 [IA-32]... (Intel C++ Environment) IccTestApp.cpp .\../../Common/PrtTests.cpp(28846): error: no instance of overloaded function "AfxBeginThread" matches the argument list argument types are: (RTuint (void *), CMyObject *, int, int, int) pThreadObj[0] = ( CWinThread * )AfxBeginThread( ThreadProc01, pMyObject[0], THREAD_PRIORITY_NORMAL, 1024, CREATE_SUSPENDED ); ^ .\../../Common/PrtTests.cpp(28847): error: no instance of overloaded function "AfxBeginThread" matches the argument list argument types are: (RTuint (void *), CMyObject *, int, int, int) pThreadObj[1] = AfxBeginThread( ThreadProc02, pMyObject[1], THREAD_PRIORITY_NORMAL, 1024, CREATE_SUSPENDED ); ^ .\../../Common/PrtTests.cpp(28848): error: no instance of overloaded function "AfxBeginThread" matches the argument list argument types are: (RTuint (void *), CMyObject *, int, int, int) pThreadObj[2] = AfxBeginThread( ThreadProc03, pMyObject[2], THREAD_PRIORITY_NORMAL, 1024, CREATE_SUSPENDED ); ^ .\../../Common/PrtTests.cpp(37761): error: argument of type "void (*)()" is incompatible with parameter of type "void (__cdecl *)()" CrtAtexit( AppExitFunction1 ); ^ .\../../Common/PrtTests.cpp(37762): error: argument of type "void (*)()" is incompatible with parameter of type "void (__cdecl *)()" CrtAtexit( AppExitFunction2 ); ^ compilation aborted for .\IccTestApp.cpp (code 2) IccTestApp - 5 error(s), 0 warning(s), 0 remark(s) ...
SKost
Valued Contributor II
103 Views

Microsoft C++ compiler output: ... Compiling... ScaLibTestApp.cpp c:\workenv\appsworkdev\common\prttests.cpp(28846) : error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types c:\vs.2005\vc\atlmfc\include\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' c:\vs.2005\vc\atlmfc\include\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' while trying to match the argument list '(RTuint (__fastcall *)(void *), CMyObject *, int, int, int)' c:\workenv\appsworkdev\common\prttests.cpp(28847) : error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types c:\vs.2005\vc\atlmfc\include\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' c:\vs.2005\vc\atlmfc\include\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' while trying to match the argument list '(RTuint (__fastcall *)(void *), CMyObject *, int, int, int)' c:\workenv\appsworkdev\common\prttests.cpp(28848) : error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types c:\vs.2005\vc\atlmfc\include\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' c:\vs.2005\vc\atlmfc\include\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' while trying to match the argument list '(RTuint (__fastcall *)(void *), CMyObject *, int, int, int)' c:\workenv\appsworkdev\common\prttests.cpp(37761) : error C2664: 'atexit' : cannot convert parameter 1 from 'void (__fastcall *)(void)' to 'void (__cdecl *)(void)' None of the functions with this name in scope match the target type c:\workenv\appsworkdev\common\prttests.cpp(37762) : error C2664: 'atexit' : cannot convert parameter 1 from 'void (__fastcall *)(void)' to 'void (__cdecl *)(void)' None of the functions with this name in scope match the target type c:\workenv\appsworkdev\appssca\scalibtestapp\scalibtestapp.cpp(26) : warning C4007: 'wmain' : must be '__cdecl' ScaLibTestApp - 5 error(s), 1 warning(s) ...
SKost
Valued Contributor II
103 Views

In overall, three test cases need to be considered: #pragma function ( AfxBeginThread, __stdcall ); #pragma function ( atexit, __cdecl ); #pragma function ( wmain, __cdecl ); Thanks in advance.
Marián__VooDooMan__M
New Contributor II
103 Views

@Intel

is this a DPD200042138 FR? or another, and which one?

TIA!