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

syntax error: 'constant' compilation failure with MSVC 2015 #63

Closed
tkelman opened this issue Dec 16, 2015 · 8 comments
Closed

syntax error: 'constant' compilation failure with MSVC 2015 #63

tkelman opened this issue Dec 16, 2015 · 8 comments
Assignees

Comments

@tkelman
Copy link
Contributor

tkelman commented Dec 16, 2015

Leaving this as a to-do, mostly for myself. AppVeyor here looks like it's running the newest MSVC it can find, but I think this failure only happens when some other header gets included before utf8proc.h.
ref https://ci.appveyor.com/project/tkelman/julia/build/1.0.688

 /c/projects/julia/deps/srccache/libuv/compile cl -nologo -MD -Z7 -ftls-model=global-dynamic -D_WIN32_WINNT=0x0502 -I../support   -I/c/projects/julia/usr/include -I/c/projects/julia/usr/include  -DLIBRARY_EXPORTS -DUTF8PROC_EXPORTS  -c string.c -o /c/projects/julia/src/flisp/string.o
cl : Command line warning D9002 : ignoring unknown option '-ftls-model=global-dynamic' 
string.c
c:\projects\julia\usr\include\utf8proc.h(95): error C2059: syntax error: 'constant' 
make[2]: *** [/c/projects/julia/src/flisp/string.o] Error 2

This happens when I compile Julia as C, but not when I compile as C++. MSVC 2015 is the first version with enough C99 support to make this easily possible. Probably need to change some of the ifdefs to be version-specific to avoid a collision with C99 true/false.

@tkelman tkelman self-assigned this Dec 16, 2015
@tkelman
Copy link
Contributor Author

tkelman commented Jul 14, 2016

x-ref https://github.com/JuliaLang/utf8proc/pull/55/files#r70891071 which is preventing me from easily testing this in combination with julia at the moment (fixed by #79)

@tkelman
Copy link
Contributor Author

tkelman commented Jul 16, 2016

There's a chance this may have gone away, but now I'm getting a whole bunch of

<repeating many times starting at line 6594>
c:\projects\julia\deps\build\utf8proc\utf8proc_data.c(13419): warning C4245: 'initializing': conversion from 'int' to 'utf8proc_uint16_t', signed/unsigned mismatch
c:\projects\julia\deps\build\utf8proc\utf8proc_data.c(13420): warning C4245: 'initializing': conversion from 'int' to 'utf8proc_uint16_t', signed/unsigned mismatch
utf8proc.c(169): warning C4242: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(172): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(178): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(183): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(196): warning C4242: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(199): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(209): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data
utf8proc.c(214): warning C4244: '=': conversion from 'utf8proc_int32_t' to 'utf8proc_uint8_t', possible loss of data

@stevengj
Copy link
Member

Looking at the corresponding source lines warnings look innocuous—the conversions from int32 to int8 are guarded by explicit checks on the value of the integer being converted, for example—though of course it would be good to get rid of them.

@stevengj
Copy link
Member

Closing this as the original error seems to be gone. The remaining warnings are #86.

@tkelman
Copy link
Contributor Author

tkelman commented Jan 7, 2017

I think this was fixed by 59334e4. If whatever Julia file had included stdbool.h before utf8proc.h, then it might have conflicts. If anyone ever tries to build Julia with MSVC pre-2013 they may have some issues, but LLVM's requirements would probably be a more serious blocker to that.

@stevengj
Copy link
Member

stevengj commented Jan 7, 2017

utf8proc itself should be okay with MSVC pre-2013 now, I think; that's what the _MSC_VER < 1800 is for.

@tkelman
Copy link
Contributor Author

tkelman commented Jan 7, 2017

But possibly not if something else were to have defined true/false before including utf8proc.h, maybe? Not sure it's enough of a problem to worry about.

@stevengj
Copy link
Member

stevengj commented Jan 7, 2017

I doubt it's something we should worry about; they can always define __bool_true_false_are_defined to follow the C99 spec. Also, any reasonable definition of true/false would be some form of 1/0 anyway, so the worst they will get is a warning.

(They would get an error if they define true/false variables, e.g. via an enum, after utf8proc.h, but they would also get this error if they do #include <stdbool.h>.)

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

No branches or pull requests

2 participants