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

Win32 compile errors #8

Closed
CaptainZippy opened this issue May 10, 2015 · 4 comments
Closed

Win32 compile errors #8

CaptainZippy opened this issue May 10, 2015 · 4 comments
Assignees
Labels

Comments

@CaptainZippy
Copy link

Hi, great to see the new project structure & hosting! Have you any interest in making pegtl work on win32? Here's a quick sample of some of the issues I found:

Warnings:

  • not all control paths return a value (unhex_char, unescape_c)
  • a number of warnings about buffer overruns (see the end for a sample)

Most other issues seem to be related to partial c++11 support.

  • inline namespace not supported (ascii.hh)
  • pegtl\examples\json_build_one.cc(93): error C2783: 'std::shared_ptr<_Ty> std::make_shared(_Types &&...)' : could not deduce template argument for '_Ty'

11>s:\source\pegtl\pegtl\internal\rule_conjunction.hh(21): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 4
11>s:\source\pegtl\pegtl\internal\rule_conjunction.hh(21): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 5
11>s:\source\pegtl\pegtl\internal\sor.hh(26): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 4
11>s:\source\pegtl\pegtl\internal\sor.hh(26): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 4
11>s:\source\pegtl\pegtl\internal\rule_conjunction.hh(21): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 4
11>s:\source\pegtl\pegtl\internal\rule_conjunction.hh(21): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 5
11>s:\source\pegtl\pegtl\internal\rule_conjunction.hh(21): warning C4789: buffer '' of size 4 bytes will be overrun; 1 bytes will be written starting at offset 6

@samhocevar
Copy link
Contributor

Note from another Win32 user: the warnings only occur in Debug builds as far as I know. In Release builds, once the optimiser kicks in, it understands that the buffers aren’t actually used at all, and the warnings disappear.

If you’re trying to build PEGTL with Visual Studio 2013, I believe it’s basically hopeless. There is no way VS2013 can understand the code. From my last attempts, here are the necessary features that are missing: nullptr, constructor inheritance, deleted default members, SFINAE based on decltype, templated "using", template template parameters.

If you are using Visual Studio 2015, the code should compile just fine. I have a forked repository with a .sln and the necessary .vcxproj.

@ColinH ColinH self-assigned this May 11, 2015
@ColinH ColinH added the wontfix label May 11, 2015
@ColinH
Copy link
Member

ColinH commented May 11, 2015

Assuming that Sam's post explains what's going on I'm closing this issue; we are however following up on this and will send a bug report in the direction of MS regarding the wrong warning.

The new PEGTL will never work on VS2013, but we are interested in VS2015 compatibility, and thanks to previous help and feedback from Sam it does actually work now.

@ColinH ColinH closed this as completed May 11, 2015
@CaptainZippy
Copy link
Author

Thanks for the explanation. If it wasn't a big deal, it would be nice not to have to rely on newer C++ features but I appreciate that there is a tradeoff and working around missing features can be pretty tedious.

@d-frey
Copy link
Member

d-frey commented May 13, 2015

In order to report to problem towards Microsoft: Could you please check if the following program produces the same warning in Debug-mode? And if it can be reduced further? TIA!

void dummy( int ) {}

template< int... Is >
void test()
{
  using swallow = bool[];
  (void)swallow{ ( dummy( Is ), true )... };
}

int main()
{
  test< 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 >();
}

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

No branches or pull requests

4 participants