Re: HP-UX 11i compile failures
- From: Alexander Larsson <alexl redhat com>
- To: nautilus-list gnome org
- Subject: Re: HP-UX 11i compile failures
- Date: Fri, 18 Oct 2002 05:38:52 -0400 (EDT)
On Wed, 16 Oct 2002, Albert Chin wrote:
> Attempting to build 2.0.7 with the HP C compiler on 11i:
> cc: "nautilus-directory-async.c", line 1232: error 1721: Operands for
> < must be of arithmetic type or pointers to compatible types.
> cc: "nautilus-directory-async.c", line 1232: error 1563: Expression in
> if must be scalar.
> cc: "nautilus-directory-async.c", line 1235: error 1721: Operands for
> > must be of arithmetic type or pointers to compatible types.
> cc: "nautilus-directory-async.c", line 1235: error 1563: Expression
> > in if must be scalar.
> cc: "nautilus-directory-async.c", line 1239: error 1721: Operands
> > for < must be of arithmetic type or pointers to compatible types.
> cc: "nautilus-directory-async.c", line 1239: error 1563: Expression
> > in if must be scalar.
> cc: "nautilus-directory-async.c", line 1242: error 1721: Operands
> > for > must be of arithmetic type or pointers to compatible types.
> cc: "nautilus-directory-async.c", line 1242: error 1563: Expression
> > in if must be scalar.
> gmake[2]: *** [nautilus-directory-async.lo] Error 1
> gmake[2]: Leaving directory
> `/opt/build/nautilus-2.0.7/libnautilus-private'
>
> Problematic code:
> if (callback_a->callback.directory < callback_b->callback.directory) {
> return -1;
> }
> if (callback_a->callback.directory > callback_b->callback.directory) {
> return 1;
> }
>
> Should I cast to fix?
I'll let my commit speak for itself:
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5555
diff -u -p -r1.5555 ChangeLog
--- ChangeLog 16 Oct 2002 20:21:56 -0000 1.5555
+++ ChangeLog 18 Oct 2002 09:37:07 -0000
@@ -1,3 +1,8 @@
+2002-10-18 Alexander Larsson <alexl redhat com>
+
+ * libnautilus-private/nautilus-directory-async.c:
+ The HP-UX compiler is an anal retentive bastard.
+
2002-10-16 Alex Duggan <aldug astrolinux com>
* configure.in
require gnome-desktop >= 2.1.0 (fixes #95979)
Index: libnautilus-private/nautilus-directory-async.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-async.c,v
retrieving revision 1.192
diff -u -p -r1.192 nautilus-directory-async.c
--- libnautilus-private/nautilus-directory-async.c 18 Sep 2002 18:26:09 -0000 1.192
+++ libnautilus-private/nautilus-directory-async.c 18 Oct 2002 09:37:07 -0000
@@ -1229,10 +1229,16 @@ ready_callback_key_compare (gconstpointe
return 1;
}
if (callback_a->file == NULL) {
- if (callback_a->callback.directory < callback_b->callback.directory) {
+ /* ANSI C doesn't allow ordered compares of function pointers, so we cast them to
+ * normal pointers to make some overly pedantic compilers (*cough* HP-UX *cough*)
+ * compile this. Of course, on any compiler where ordered function pointers actually
+ * break this probably won't work, but at least it will compile on platforms where it
+ * works, but stupid compilers won't let you use it.
+ */
+ if ((void *)callback_a->callback.directory < (void *)callback_b->callback.directory) {
return -1;
}
- if (callback_a->callback.directory > callback_b->callback.directory) {
+ if ((void *)callback_a->callback.directory > (void *)callback_b->callback.directory) {
return 1;
}
} else {
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a globe-trotting overambitious senator who hides his scarred face behind
a mask. She's a violent French-Canadian mermaid with a song in her heart and a
spring in her step. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]