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

Ocaml files define the 'inline' macro #7071

Closed
vicuna opened this issue Dec 2, 2015 · 7 comments
Closed

Ocaml files define the 'inline' macro #7071

vicuna opened this issue Dec 2, 2015 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Dec 2, 2015

Original bug ID: 7071
Reporter: modlfo
Status: closed (set by @xavierleroy on 2017-02-16T14:18:31Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.03.0+dev / +beta1
Category: platform support (windows, cross-compilation, etc)

Bug description

I'm using the MSVC port (VS2013 64 bits) of ocaml on windows. I have an external function that includes <caml/memory.h>. This file (and many others) have the following code:

#ifdef _MSC_VER
#define inline _inline
#endif

For which I get the following error:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xkeycheck.h(250) : fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

Steps to reproduce

Compile a program with an external function in Windows (VS2013 64 bits) and include:

#include <caml/alloc.h>
#include <caml/mlvalues.h>
#include <caml/memory.h>

Additional information

As a workaround is possible to define _ALLOW_KEYWORD_MACROS to ignore the error. But it would be better if the code does not define inline.

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: modlfo

I forgot to mention that I'm using ocaml 4.03.0+trunk.

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: @gasche

I am a bit confused as I see no such define in the .h files of my copy of trunk. Some were introduced recently in byterun/{extern,intern,memory}.c, are those the files you are talking about?

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: modlfo

This is the commit that added those defines:

a9ef642

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: @gasche

Those define are in .c files, not in .h files. How can you observe them from a file including memory.h?

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: @xavierleroy

Is the source file (the one that includes <caml/memory.h>) C or C++ ?

(The #define inline should indeed be turned off for C++.)

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: modlfo

You are right, the .c files have nothingto do with it. It comes from the "config.h" file which includes "m.h" and that one has the definition.

This is the full error I get:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xkeycheck.h(203) : warning C4005: 'inline' : macro redefinition
c:\ocaml-4.03.0\lib\caml\config.h(60) : see previous definition of 'inline'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xkeycheck.h(250) : fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

@vicuna
Copy link
Author

vicuna commented Dec 6, 2015

Comment author: @xavierleroy

I got no reply to my "C or C++?" question. Assuming it is a C++ issue, commit [trunk 6414662] ought to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant