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

cmark 1.2.0 doesn't compile with Visual Studio #20

Open
cmb69 opened this issue Dec 3, 2019 · 2 comments
Open

cmark 1.2.0 doesn't compile with Visual Studio #20

cmb69 opened this issue Dec 3, 2019 · 2 comments

Comments

@cmb69
Copy link

cmb69 commented Dec 3, 2019

Syntax like

cmark/src/block.c

Lines 89 to 95 in c71ebe2

php_cmark_assert_type(value, IS_STRING, 0,
#if PHP_VERSION_ID >= 70400
return &EG(uninitialized_zval),
#else
return,
#endif
"fence expected to be string");

isn't supported by Visual Studio compilers (and maybe others as well). The problem is that the php_cmark_assert_type macro gets resolved before the conditional compilation, and is expanded on a single line, yielding invalid syntax.

Maybe it's best to rewrite this as:

 #if PHP_VERSION_ID >= 70400 
 			php_cmark_assert_type(value, IS_STRING, 0, return &EG(uninitialized_zval), "fence expected to be string"); 
 #else 
 			php_cmark_assert_type(value, IS_STRING, 0, return, "fence expected to be string"); 
 #endif 
@cmb69
Copy link
Author

cmb69 commented Aug 1, 2024

Since I've just stumbled upon this issue again, I've tried with the new VS preprocessor, and got C5101:

use of preprocessor directive in function-like macro argument list is undefined behavior

Note that makes it impossible to build this extension with VS (and maybe other compiler tool chains) as of PHP 7.4.0 cmark 1.2.0.

@macintoshplus
Copy link

I can buil for PHP 8 and VS16 with a patch from #24 and some other change to fix the build.
But some change break the build for PHP 7.4.

The DLL: https://phpext.phptools.online/extension/text/cmark-360

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