* [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics
@ 2012-11-04 11:16 Mischa Jonker
2012-11-04 11:39 ` Arnout Vandecappelle
2012-11-04 12:08 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Mischa Jonker @ 2012-11-04 11:16 UTC (permalink / raw)
To: buildroot
The problem has to do with const-correctness. This has been resolved
for various architectures, but not for the generic case.
Signed-off-by: Mischa Jonker <mischa.jonker@synopsys.com>
---
package/qt/qt-fix-const-atomics.patch | 50 +++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
create mode 100644 package/qt/qt-fix-const-atomics.patch
diff --git a/package/qt/qt-fix-const-atomics.patch b/package/qt/qt-fix-const-atomics.patch
new file mode 100644
index 0000000..6485356
--- /dev/null
+++ b/package/qt/qt-fix-const-atomics.patch
@@ -0,0 +1,50 @@
+From d4d07dac01796b2aa0fb501c14865cab7e42b3a9 Mon Sep 17 00:00:00 2001
+From: Mischa Jonker <mischa.jonker@synopsys.com>
+Date: Sun, 4 Nov 2012 11:42:04 +0100
+Subject: [PATCH] Fix const-related build error in generic atomic ops
+
+It's still not entirely const-correct though. In all other architectures
+this is obfuscated through the use of inline asm (which the compiler
+doesn't check). This patch obfuscates through const_cast
+---
+ src/corelib/arch/generic/qatomic_generic_unix.cpp | 8 ++++----
+ src/corelib/arch/qatomic_generic.h | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/corelib/arch/generic/qatomic_generic_unix.cpp b/src/corelib/arch/generic/qatomic_generic_unix.cpp
+index 1c6cbf0..6fce81d 100644
+--- a/src/corelib/arch/generic/qatomic_generic_unix.cpp
++++ b/src/corelib/arch/generic/qatomic_generic_unix.cpp
+@@ -85,13 +85,13 @@ int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd)
+
+ Q_CORE_EXPORT
+ bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value,
+- void *expectedValue,
+- void *newValue)
++ const void *expectedValue,
++ const void *newValue)
+ {
+ bool returnValue = false;
+ pthread_mutex_lock(&qAtomicMutex);
+ if (*_q_value == expectedValue) {
+- *_q_value = newValue;
++ *_q_value = const_cast<void*>(newValue);
+ returnValue = true;
+ }
+ pthread_mutex_unlock(&qAtomicMutex);
+diff --git a/src/corelib/arch/qatomic_generic.h b/src/corelib/arch/qatomic_generic.h
+index 621a767..4c14679 100644
+--- a/src/corelib/arch/qatomic_generic.h
++++ b/src/corelib/arch/qatomic_generic.h
+@@ -105,7 +105,7 @@ Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int);
+ Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int);
+ Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int);
+
+-Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *);
++Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, const void *, const void *);
+ Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *);
+ Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff);
+
+--
+1.7.0.4
+
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics
2012-11-04 11:16 [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics Mischa Jonker
@ 2012-11-04 11:39 ` Arnout Vandecappelle
2012-11-04 12:08 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2012-11-04 11:39 UTC (permalink / raw)
To: buildroot
On 11/04/12 12:16, Mischa Jonker wrote:
> The problem has to do with const-correctness. This has been resolved
> for various architectures, but not for the generic case.
>
> Signed-off-by: Mischa Jonker<mischa.jonker@synopsys.com>
Looks like a horrible hack, but since there's nothing better upstream:
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
(untested)
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics
2012-11-04 11:16 [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics Mischa Jonker
2012-11-04 11:39 ` Arnout Vandecappelle
@ 2012-11-04 12:08 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2012-11-04 12:08 UTC (permalink / raw)
To: buildroot
>>>>> "Mischa" == Mischa Jonker <mischa.jonker@synopsys.com> writes:
Mischa> The problem has to do with const-correctness. This has been resolved
Mischa> for various architectures, but not for the generic case.
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-04 12:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-04 11:16 [Buildroot] [PATCH] QT: Fix build for architectures using generic atomics Mischa Jonker
2012-11-04 11:39 ` Arnout Vandecappelle
2012-11-04 12:08 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox