AaronNGray / winflexbison

Windows Visual Studio 2015 Version of winflexbision
http://sourceforge.net/projects/winflexbison/
4 stars 4 forks source link

VC++ compiler error C4146 in position.hh #2

Open mckenzig opened 7 years ago

mckenzig commented 7 years ago

c:\Program Files (x86)\Microsoft Visual Studio 14.0>win_flex --version win_flex 2.5.37

C:\Program Files (x86)\Microsoft Visual Studio 14.0>win_bison --version bison (GNU Bison) 3.0.4 Written by Robert Corbett and Richard Stallman.

Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\Program Files (x86)\Microsoft Visual Studio 14.0>ver

Microsoft Windows [Version 10.0.10586]

C:\Program Files (x86)\Microsoft Visual Studio 14.0>cl --version Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86

Generates this code:

private: /// Compute max(min, lhs+rhs) (provided min <= lhs). static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min) { return (0 < rhs || -static_cast(rhs) < lhs < --- compiler error C4146 ? rhs + lhs : min); }

Severity Code Description Project File Line Suppression State Error C4146 unary minus operator applied to unsigned type, result still unsigned core c:\users\grant\documents\visual studio 2015\projects\json\core\position.hh 111

Code being compiled:

http://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html

mckenzig commented 7 years ago
error
lexxmark commented 7 years ago

I will look into it...

lexxmark commented 7 years ago

C4146 is a warning. It seems you have "Treat warnings as error" option is ON in C++ compiler options. You can turn it off. To completely get rid of these warnings we should address this issue to the original developers of GNU Bison http://savannah.gnu.org/projects/bison/