nanogui: Several fixes to get around compile failures
Subject:
Several fixes to get around compile failures
From:
"Paul Bartholomew" ####@####.####
Date:
6 Jul 2005 20:36:58 +0100
Message-Id: <BAY108-F1336D528943AA24C5DE42DEFD90@phx.gbl>
Hello -
I'm getting compile failures in both "Fedora Core + GCC 4.0", and TI's "Code
Composer Studio" DSP environments. Both in "microwin" and "nxlib" (using
latest code from CVS, as of today (July 6th, 2005)).
I've fixed several source files to avoid these errors. The description/"cvs
diff" outputs are below.
BTW, is this the correct place to submit changes? Can I get direct CVS
(write) access instead?
Thanks,
- Paul B.
::::::::::::::::::::::::::::::::::::::::::::::::::::
Here are the changes
::::::::::::::::::::::::::::::::::::::::::::::::::::
=============
MICROWINDOWS:
=============
-----------------------------------------------------------------------------------------------------------
1. GCC 4.0 complains about *static* redefinition of "abs()" function in
'src/mwin/winevent.c'.
Solution: either make it non-static, or rename it to function name that
doesn't conflict with
std library
-----------------------------------------------------------------------------------------------------------
Here's the first solution (make it non-static; NOTE: could cause link
error/conflict with system function):
Index: winevent.c
===================================================================
RCS file: /usr/cvs/microwin/src/mwin/winevent.c,v
retrieving revision 1.8
diff -b -r1.8 winevent.c
23c23
< static int
---
>int
Here's the second solution (rename it to local unique name (leaving it
'static')):
Index: winevent.c
===================================================================
RCS file: /usr/cvs/microwin/src/mwin/winevent.c,v
retrieving revision 1.8
diff -b -r1.8 winevent.c
24c24
< abs(int n)
---
>my_abs(int n)
157,158c157,158
< abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK &&
< abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK)
---
> my_abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK &&
> my_abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK)
-----------------------------------------------------------------------------------------------------------
2. Use "ALLOCA()" macro instead of "alloca()" in "mwin/winlib/medit.c":
-----------------------------------------------------------------------------------------------------------
Index: medit.c
===================================================================
RCS file: /usr/cvs/microwin/src/mwin/winlib/medit.c,v
retrieving revision 1.3
diff -b -r1.3 medit.c
794c794
< dispBuffer = alloca (LEN_MLEDIT_BUFFER+1);
---
> dispBuffer = ALLOCA (LEN_MLEDIT_BUFFER+1);
======
NXLIB:
======
-----------------------------------------------------------------------------------------------------------
1. Fix Makefile to use local keysymdef.h (instead of from $(X11_INCLUDE),
which is no longer defined):
-----------------------------------------------------------------------------------------------------------
Index: Makefile
===================================================================
RCS file: /usr/cvs/nxlib/Makefile,v
retrieving revision 1.4
diff -b -r1.4 Makefile
11a12
>MWIN=../microwin/src
123c124
< perl ./keymap.pl $(X11_INCLUDE)/X11 > ./keysymstr.h
---
> perl ./keymap.pl . > ./keysymstr.h
-----------------------------------------------------------------------------------------------------------
2. Include local copy of "Xlib.h" in Xresource.h (instead of <X11/Xlib.h>):
-----------------------------------------------------------------------------------------------------------
Index: Xresource.h
===================================================================
RCS file: /usr/cvs/nxlib/Xresource.h,v
retrieving revision 1.1
diff -b -r1.1 Xresource.h
55c55
< #include <X11/Xlib.h>
---
>#include "Xlib.h"
-----------------------------------------------------------------------------------------------------------
3. Include "stdarg.h" instead of (deprecated) "varargs.h" (fixes gcc 4.0
error):
-----------------------------------------------------------------------------------------------------------
Index: Xlcint.h
===================================================================
RCS file: /usr/cvs/nxlib/Xlcint.h,v
retrieving revision 1.2
diff -b -r1.2 Xlcint.h
74c74
< #include "varargs.h"
---
>#include "stdarg.h"
-----------------------------------------------------------------------------------------------------------
3. Use correct structure name in 'next' element of 'struct sstruct' (TI DSP
compiler found this):
-----------------------------------------------------------------------------------------------------------
Index: Selection.c
===================================================================
RCS file: /usr/cvs/nxlib/Selection.c,v
retrieving revision 1.2
diff -b -r1.2 Selection.c
16c16
< struct ssstruct *next;
---
> struct sstruct *next;