You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use latest win_flex.exe, the code produced, even in --wincompat mode contains lines like:
/* flex integer type definitions */
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN
Unfortunately, Visual Studio does not set STDC_VERSION but has inttypes.h. Because the #else part of the code is used, duplicate macros for e.g. INT8_MIN will exist (and raise an compiler warning or even error if C4005 is marked as error, as was done in our case). Example:
1> c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdint.h(48): error C4005: 'INT8_MIN': macro redefinition
1> t:\obj.dbg.winx64\lib\sql\libsql_c\sqllex.cpp(57): note: see previous definition of 'INT8_MIN'
1> c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdint.h(49): error C4005: 'INT16_MIN': macro redefinition
1> t:\obj.dbg.winx64\lib\sql\libsql_c\sqllex.cpp(60): note: see previous definition of 'INT16_MIN'
Can you please enhance this macro and add a check on _MSCVER? The inttypes.h file is (at least) in any Windows 10 SDK. The other approach is to include stdint.h, which is - at least - existent for Visual Studio 2017 and later.
Any other suggestions are welcome.
The text was updated successfully, but these errors were encountered:
Many thanks. I now did a similar solution by not including any system header file. One of our own header files was included and that one included some system headers. The real cause is that Visual Studio does not adhere to C99 (or later) but still has its own stdint,h and/or inttypes.h.
I was not aware of mentioned issue, but that indeed addresses the same. Sorry for creating this duplicate.
However, the issue was created in mid 2018, but 2.6.5 seems not (yet) released. I took latest version, which was 2.6.4.
When I use latest win_flex.exe, the code produced, even in --wincompat mode contains lines like:
Unfortunately, Visual Studio does not set STDC_VERSION but has inttypes.h. Because the #else part of the code is used, duplicate macros for e.g. INT8_MIN will exist (and raise an compiler warning or even error if C4005 is marked as error, as was done in our case). Example:
Can you please enhance this macro and add a check on _MSCVER? The inttypes.h file is (at least) in any Windows 10 SDK. The other approach is to include stdint.h, which is - at least - existent for Visual Studio 2017 and later.
Any other suggestions are welcome.
The text was updated successfully, but these errors were encountered: