Skip to content

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

@Rush

Description

@Rush

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions