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
------------------------------------------------------------------------------
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