Crosscompiling + DeskLib: style includes

Antony Sidwell antony at isparp.co.uk
Sun Mar 7 10:26:12 PST 2004


I was compiling some code with the current CVS version of the
cross-compiler, and noticed that it no longer handles includes like:
#include "DeskLib:Wimp.h"
by resolving them against e.g. DESKLIB_PATH.

The following diff is how I reimplemented it, which seems to work OK.
I'm not very familiar with the code though, so I'm not certain it's the
best solution or even that it is technically correct. :)


Index: gcc/gcc/Makefile.in
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/gcc/gcc/Makefile.in,v
retrieving revision 1.21
diff -b -u -r1.21 Makefile.in
--- gcc/gcc/Makefile.in	6 Jan 2004 20:32:30 -0000	1.21
+++ gcc/gcc/Makefile.in	6 Mar 2004 11:41:51 -0000
@@ -45,7 +45,7 @@
 LIBDEPS = $(gccobjdir)/prefix.o
 
 ifeq (${STAGE},stage1)
-RISCOS_OBJS=
+RISCOS_OBJS= $(gccobjdir)/config/arm/rname.o
 else
 RISCOS_OBJS = $(gccobjdir)/config/arm/rname.o $(gccobjdir)/config/arm/riscos.o endif
Index: gcc/gcc/cpplib.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/gcc/gcc/cpplib.c,v
retrieving revision 1.5
diff -b -u -r1.5 cpplib.c
--- gcc/gcc/cpplib.c	2 Nov 2003 12:55:30 -0000	1.5
+++ gcc/gcc/cpplib.c	6 Mar 2004 11:41:54 -0000
@@ -649,6 +649,28 @@
       return NULL;
     }
 
+#ifdef CROSS_COMPILE
+  {
+    unsigned char *token_mem;
+    unsigned char tmp[1024];
+    int tmp_len;
+    extern char *riscos_to_unix (const char *, char *);
+
+    riscos_to_unix(header->val.str.text, tmp);
+    tmp_len = strlen(tmp);
+
+    if (strcmp(header->val.str.text, tmp) != 0)
+    {
+      token_mem = _cpp_unaligned_alloc (pfile, tmp_len + 1);
+      memcpy (token_mem, tmp, tmp_len);
+      token_mem[tmp_len] = '\0';
+
+      header->val.str.text = token_mem;
+      header->val.str.len = tmp_len;
+    }
+  }
+#endif
+
   return header;
 }

-- 
Antony Sidwell.




More information about the gcc mailing list