This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: 3.4 PATCH: Don't use #include "file.h" for system headers in Ada
Arnaud Charlet writes:
> > AFAIKT, adadecode.c is only linked into gnat1, so the ctype.h can be
> > removed (since system.h already includes safe-ctype.h) and the single
> > instance of isdigit converted to ISDIGIT.
>
> adadecode.c is designed to be used anywhere an Ada decoder is needed,
> so you need to keep the include <ctype.h> when not building gcc.
I couldn't see that from what is included in FSF GNAT.
The following patch bootstrapped without regressions on mips-sgi-irix6.5.
Ok for mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Wed Nov 12 22:34:36 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* adadecode.c: Only include ctype.h if IN_GCC.
(__gnat_decode): Use ISDIGIT from safe-ctype.h.
Index: gcc/ada/adadecode.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/adadecode.c,v
retrieving revision 1.8
diff -u -p -r1.8 adadecode.c
--- gcc/ada/adadecode.c 12 Nov 2003 21:29:28 -0000 1.8
+++ gcc/ada/adadecode.c 21 Nov 2003 16:24:38 -0000
@@ -35,10 +35,11 @@
#include "system.h"
#else
#include <stdio.h>
+#include <ctype.h>
+#define ISDIGIT(c) isdigit(c)
#define PARMS(ARGS) ARGS
#endif
-#include <ctype.h>
#include "adadecode.h"
static void add_verbose (const char *, char *);
@@ -207,7 +208,7 @@ __gnat_decode (const char *coded_name, c
int n_digits = 0;
if (len > 1)
- while (isdigit ((int) ada_name[(int) len - 1 - n_digits]))
+ while (ISDIGIT ((int) ada_name[(int) len - 1 - n_digits]))
n_digits++;
/* Check if we have $ or __ before digits. */