Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling with MinGW due to usage of MS-specific __except keyword #3586

Closed
Rush opened this issue Jul 17, 2019 · 4 comments · Fixed by #3601
Closed

Error when compiling with MinGW due to usage of MS-specific __except keyword #3586

Rush opened this issue Jul 17, 2019 · 4 comments · Fixed by #3601

Comments

@Rush
Copy link

@Rush Rush commented Jul 17, 2019

Please use this template for reporting suspected bugs or requests for help.

Issue description

Trying to compile libzmq with MinGW - the issue is fairly obvious. __except should not have gone through a code review as it's a Microsoft specific extension.

https://github.com/zeromq/libzmq/blame/aac3cd4d93d288b29b71806c2478a947d66238b6/src/thread.cpp#L136

src/thread.cpp:128: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(push)                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                             
src/thread.cpp:129: warning: ignoring #pragma warning  [-Wunknown-pragmas]                                                                                                                                                                                   
 #pragma warning(disable : 6320 6322)                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                             
src/thread.cpp:138: warning: ignoring #pragma warning  [-Wunknown-pragmas]                                                                                                                                                                                   
 #pragma warning(pop)                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                             
src/thread.cpp: In member function 'void zmq::thread_t::applyThreadName()':                                                                                                                                                                                  
src/thread.cpp:136:5: error: expected 'catch' before '__except'                                                                                                                                                                                              
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
     ^~~~~~~~                                                                                                                                                                                                                                                
src/thread.cpp:136:5: error: expected '(' before '__except'                                                                                                                                                                                                  
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
     ^~~~~~~~                                                                                                                                                                                                                                                
     (                                                                                                                                                                                                                                                       
src/thread.cpp:136:5: error: expected type-specifier before '__except'                                                                                                                                                                                       
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
     ^~~~~~~~                                                                                                                                                                                                                                                
src/thread.cpp:136:13: error: expected ')' before '(' token                                                                                                                                                                                                  
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
     ~~~~~~~~^~                                                                                                                                                                                                                                              
             )                                                                                                                                                                                                                                               
src/thread.cpp:136:14: error: expected '{' before '(' token                                                                                                                                                                                                  
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
              ^                                                                                                                                                                                                                                              
src/thread.cpp:136:44: error: expected ';' before '{' token                                                                                                                                                                                                  
     __except (EXCEPTION_CONTINUE_EXECUTION) {                                                                                                                                                                                                               
                                            ^~                                                                                                                                                                                                               
                                            ;                          

Environment

  • libzmq version (commit hash if unreleased):
  • OS: Docker / openSUSE Leap 15.1

Minimal test code / Steps to reproduce the issue

Can provide a Dockerfile upon request.

@bluca

This comment has been minimized.

Copy link
Member

@bluca bluca commented Jul 18, 2019

Interesting that the mingw build test did not catch this:

https://ci.appveyor.com/project/zeromq/libzmq/builds/26024001/job/cp8r6o28y931toy2

Could you please send a PR to fix it?

@Rush

This comment has been minimized.

Copy link
Author

@Rush Rush commented Jul 18, 2019

@bluca Sorry, it's obvious why it doesn't compile but I am not a ZeroMQ contributor and not entirely sure why __except was used so can't say I know the right fix.

Fortunately it worked fine with the previous version 4.3.1 and only 4.3.2 is broken.

I can give the fix fix a try if no other person shows up Perhaps the original author @moretromain could give this a shot?

I'll be happy to test.

@TomzBench

This comment has been minimized.

Copy link

@TomzBench TomzBench commented Aug 9, 2019

Not sure if this is related. But I get this error when on "latest_release" branch. So when switching to master and compiling with mingw I get the error below because it does not like storing a function pointer into a (void*)

C:\...\libzmq\src\thread.cpp:150: error: invalid conversion from 'int (*)(EXCEPTION_RECORD*, void*, CONTEXT*, void*) {aka int (*)(_EXCEPTION_RECORD*, void*, _CONTEXT*, void*)}' to 'void*' [-fpermissive] rec.Handler = continue_execution; ^~~~~~~~~~~~~~~~~~

@bluca

This comment has been minimized.

Copy link
Member

@bluca bluca commented Aug 10, 2019

Could you please send a PR to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.