2011/9/22 Ruben Van Boxem <[email protected]>
> 2011/9/21 Ruben Van Boxem <[email protected]>
>
>> Hi,
>>
>> I'm running into this compiler error when building Qt 4.8 with my 4.6
>> std::thread toolchain:
>>
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp: In function
>>> 'QDateTimePrivate::Spec utcToLocal(QDate&, QTime&)':
>>>
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4069:18: error:
>>> expected unqualified-id before '=' token
>>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4014:12:
>>> warning: unused variable 'secsSince1Jan1970UTC' [-Wunused-variable]
>>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp: In function
>>> 'void localToUtc(QDate&, QTime&, int)':
>>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4163:18: error:
>>> expected unqualified-id before '=' token
>>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4116:12:
>>> warning: unused variable 'secsSince1Jan1970UTC' [-Wunused-variable]
>>
>>
>> I'm assuming the problem lies in the definition of localtime_r and
>> gmtime_r. I can't get Clang to compile the file due to a PCH issue,
>> otherwise I'd try to get a better error message :(
>>
>> Ruben
>>
>
> I got Clang to ignore Qt's PCH files, and it output a largely different
> error:
>
> clang++ -ct -g -Wall -frtti -fexceptions -mthreads -DQT_SHARED
>> -DQT_THREAD_SUPPORT -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_BUILD_CORE_LIB
>> -DQT_NO_USING_NAMESPACE -DQT_MAKEDLL -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT
>> -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -D_USE_MATH_DEFINES
>> -DQLIBRARYINFO_EPOCROOT -DHB_EXPORT=Q_CORE_EXPORT -DQT_DLL -DQT_HAVE_MMX
>> -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2
>> -I"..\..\include" -I"..\..\include\QtCore" -I"tmp\rcc\debug_shared" -I"tmp"
>> -I"global" -I"m:\Development\Source\Qt\tools\shared"
>> -I"m:\Development\Source\Qt\src\3rdparty\zlib"
>> -I"m:\Development\Source\Qt\src\3rdparty\harfbuzz\src"
>> -I"m:\Development\Source\Qt\src\3rdparty\md5"
>> -I"m:\Development\Source\Qt\src\3rdparty\md4" -I"..\..\include\ActiveQt"
>> -I"tmp\moc\debug_shared" -I"m:\Development\Source\Qt\src\corelib" -I"."
>> -I"m:\Development\Source\Qt\mkspecs\win32-g++" -o
>> tmp\obj\debug_shared\qdatetime.o
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp
>>
> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4069:18: error:
>> cannot initialize a variable of type 'struct tm *' with an rvalue of type
>> 'void'
>> brokenDown = localtime_r(&secsSince1Jan1970UTC, &res);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\pthread.h:411:47:
>> note: expanded from:
>> #define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm = \
>>
>> ^
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4069:18: error:
>> expected unqualified-id
>> brokenDown = localtime_r(&secsSince1Jan1970UTC, &res);
>> ^
>> M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\pthread.h:413:52:
>> note: expanded from:
>> tm = localtime((_Time));\
>> ^
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4069:16: error:
>> assigning to 'tm *' from incompatible type 'void';
>> brokenDown = localtime_r(&secsSince1Jan1970UTC, &res);
>> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4163:18: error:
>> cannot initialize a variable of type 'struct tm *' with an rvalue of type
>> 'void'
>> brokenDown = gmtime_r(&secsSince1Jan1970UTC, &res);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\pthread.h:421:47:
>> note: expanded from:
>> #define gmtime_r(_Time,_Tm) ({ struct tm *___tmp_tm = \
>>
>> ^
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4163:18: error:
>> expected unqualified-id
>> brokenDown = gmtime_r(&secsSince1Jan1970UTC, &res);
>> ^
>> M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\pthread.h:423:52:
>> note: expanded from:
>> tm = gmtime((_Time)); \
>> ^
>> m:\Development\Source\Qt\src\corelib\tools\qdatetime.cpp:4163:16: error:
>> assigning to 'tm *' from incompatible type 'void';
>> brokenDown = gmtime_r(&secsSince1Jan1970UTC, &res);
>> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 191 warnings and 6 errors generated.
>>
>
> The functions aren't returning anything, and this probably is the root
> cause of the issue. Note that this error message is only for informational
> purposes; I got the original error with GCC.
>
> Ruben
>
As is mostly the case with these things, you see the error just when you
post more info. Below is a patch for pthread.h (note the paths in the patch
are messed up, but still, easy enough to fix the two typo's manually :)
686-w64-mingw32\include\pthread.h
--- mingw64\x86_64-w64-mingw32\include\pthread.h 2011-09-22
11:14:01.251000000 +0200
+++ mingw32\i686-w64-mingw32\include\pthread.h 2011-09-21
14:00:46.000000000 +0200
@@ -410,7 +410,7 @@ int WINPTHREAD_AP
#undef localtime_r
#define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm; \
pthread_testcancel(); \
- ___tmp_tm =
localtime((_Time));\
+ tm = localtime((_Time));\
if (___tmp_tm) { \
*(_Tm) = *___tmp_tm; \
___tmp_tm = (_Tm); \
@@ -420,7 +420,7 @@ int WINPTHREAD_AP
#undef gmtime_r
#define gmtime_r(_Time,_Tm) ({ struct tm *___tmp_tm; \
pthread_testcancel(); \
- ___tmp_tm =
gmtime((_Time)); \
+ tm = gmtime((_Time)); \
if (___tmp_tm) { \
*(_Tm) = *___tmp_tm; \
___tmp_tm = (_Tm); \
Please review and apply, thanks!
Ruben
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public