Closed degaart closed 3 years ago
The change makes sense however this assumes that C++11 means having these headers, which could be false. I think VC++ for instance added these headers much later :disappointed:. I think I'll cut the release without this change for the time being.
C++11 includes C99 and stdint.h per the standard:
For compatibility with the C standard library and the C Unicode TR, the C++ standard library provides the 25 C headers, as shown in Table 154.
Where Table 154 includes stdint.h
The problem lies with VC++ not adhering to the standard by lying about it's C++11 support.
I propose if possible, to check for _MSC_VER :
`
`
Edit: Another possibility which may reduce the likelihood of bugs/incompatibilities may be to add a macro FREETDS_USE_STDINT. That way, I can work around the problem by defining just that macro before including freetds headers.
`
`
Testing the
#if (!defined(_MSC_VER) && defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
it seems to work
@degaart can you provide a commit or at least give the email address so I can create a commit?
Pull request created
I'm having issues compiling Qt 4.8.4 using macOS Ventura 11.3 :
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.Debug all
clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.9 -I/usr/local/opt/openssl@1.0/include -g -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_SHARED -I../../../../mkspecs/unsupported/macx-clang-libc++ -I. -I../../../../include/QtCore -I../../../../include/QtSql -I../../../../include -I.moc/debug-shared -o .obj/debug-shared/main.o main.cpp
In file included from main.cpp:50:
In file included from ./../../../sql/drivers/tds/qsql_tds.h:60:
In file included from /usr/local/include/sybfront.h:23:
In file included from /usr/local/include/sybdb.h:31:
/usr/local/include/tds_sysdep_public.h:61:28: error: typedef redefinition with different types ('long' vs 'long long')
typedef signed long int64_t; /* 64-bit int */
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int64_t.h:30:33: note: previous definition is here
typedef long long int64_t;
^
In file included from main.cpp:50:
In file included from ./../../../sql/drivers/tds/qsql_tds.h:60:
In file included from /usr/local/include/sybfront.h:23:
In file included from /usr/local/include/sybdb.h:31:
/usr/local/include/tds_sysdep_public.h:62:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
typedef unsigned long uint64_t; /* 64-bit int */
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types/_uint64_t.h:31:28: note: previous definition is here
typedef unsigned long long uint64_t;
^
2 errors generated.
__cplusplus
is defined but its value is 199711L
:
<built-in>:378:21: note: expanded from here
#define __cplusplus 199711L
I found these implementations inside macOS SDKs :
@freddy77 ping
Can you try a more recent C++ version ? It's 2023
sadly clang++ uses c++98 by default
@qkdreyer you can add -std=c++11
Can you try a more recent C++ version ? It's 2023
Speaking of 2023, let's get rid of these integer typedefs from tds_sysdep_public.h
. Everyone ought to use at least a C99 compiler these days.
@degaart yes, probably the rule should be now the opposite. Assume we have stdint.h
unless we found some issues.
Hello,
Freetds defines int64t etc... when \_STDCVERSION_\ is not defined. But clang++ and g++ do not define it. Which causes problem when the standard system include files redefines them. Example on macOS 10.14, Apple clang version 11.0.0 (clang-1100.0.33.17):
Maybe in tds_sysdep_public.h, freetds should first check for __cplusplus >= 201103L in tds_sysdep_public.h, and if it's defined, include stdint.h. Something like: