This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fixincl.x: Undeclared identifier SIZE_TYPE.
- To: Geoff Keating <geoffk at cygnus dot com>, "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: fixincl.x: Undeclared identifier SIZE_TYPE.
- From: Bruce Korb <bkorb at sco dot COM>
- Date: Mon, 24 Jul 2000 09:04:32 -0700
- CC: gcc-patches at gcc dot gnu dot org, Bruce Korb <bkorb at sco dot COM>
- Organization: Santa Cruz Operations
- References: <200007211556.LAA29942@caip.rutgers.edu> <39788322.2137DAA9@sco.com> <jm7lafbaz8.fsf@envy.cygnus.com>
- Reply-To: Bruce Korb <bkorb at gnu dot org>
Geoff Keating wrote:
> > #include "tm.h"
> >
> > sould read the generated file 'tm.h' which will #include the
> > file that should define SIZE_TYPE. So, your breakage is
> > curious to me. However, since reading more
Hi guys,
After our discussions last week, I now think the "right thing"
is the attached patch. I'm going home with the flu, so if you
guys think it is the right thing, too, then someone please apply
it. Otherwise, I will later in the week. :-(
Later,
Bruce
2000-07-24 Bruce Korb <bkorb@gnu.org>
* fixincl/fixfixes.c(emit_gnu_type): rewrote to *rely* on GCC
defining the __xxx_TYPE__ macros.
* fixincl/fixincl.tpl(gnu_type_map): now obsolete
* fixincl/fixlib.h: don't need to include "tm.h" anymore
* fixincl/inclhack.def(type_map): now obsolete
*** fixfixes.c.ori Mon Jul 24 08:34:10 2000
--- fixfixes.c Mon Jul 24 08:51:41 2000
***************
*** 135,194 ****
emit_gnu_type ( text, rm )
const char* text;
regmatch_t* rm;
{
! extern t_gnu_type_map gnu_type_map[];
! extern int gnu_type_map_ct;
!
! const char* pzt = text + rm[GTYPE_SE_CT].rm_so;
! t_gnu_type_map* p_tm = gnu_type_map;
! int ct = gnu_type_map_ct;
fwrite (text, rm[0].rm_so, 1, stdout);
- text += rm[0].rm_eo;
! for (;;)
! {
! if (strncmp (pzt, p_tm->pz_type, p_tm->type_name_len) == 0)
! break;
! #ifdef DEBUG
! if (--ct <= 0)
! return (const char*)NULL;
! #else
! if (--ct <= 0)
! return text;
! #endif
! p_tm++;
! }
/*
! * Now print out the reformed typedef
*/
{
tSCC z_fmt[] = "\
- #ifndef __%s_TYPE__\n#define __%s_TYPE__ %s\n#endif\n\
- \
#if !defined(_GCC_%s_T)%s\n\
! \
! #define _GCC_%s_T\ntypedef __%s_TYPE__ %s_t;\n#endif\n";
! const char* pz_guard;
! /*
! * We magically know that the first entry and only the first
! * entry needs guarding against __cplusplus (it is "wchar_t").
! * If others wind up needing similar special treatment, then
! * go look into inclhack.def. This code, obviously, works closely
! * with that file :-)
! */
! pz_guard = (p_tm == gnu_type_map) ? " && ! defined(__cplusplus)" : "";
! printf (z_fmt, p_tm->pz_TYPE, p_tm->pz_TYPE, p_tm->pz_gtype,
! p_tm->pz_TYPE, pz_guard,
! p_tm->pz_TYPE, p_tm->pz_TYPE, p_tm->pz_type);
}
! return text;
}
/*
--- 135,177 ----
emit_gnu_type ( text, rm )
const char* text;
regmatch_t* rm;
{
! char z_TYPE[ 64 ];
! char z_type[ 64 ];
fwrite (text, rm[0].rm_so, 1, stdout);
! {
! char* ps = text + rm[1].rm_so;
! char* pe = text + rm[1].rm_eo;
! char* pd = z_type;
! char* pD = z_TYPE;
! while (ps < pe)
! *(pD++) = toupper( *(pd++) = *(ps++) );
!
! *pD = *pd = NUL;
! }
/*
! * Now print out the reformed typedef,
! * with a C++ guard for WCHAR
*/
{
tSCC z_fmt[] = "\
#if !defined(_GCC_%s_T)%s\n\
! #define _GCC_%s_T\n\
! typedef __%s_TYPE__ %s_t;\n\
! #endif\n";
! const char* pz_guard = (strcmp (z_type, "wchar") == 0)
! ? " && ! defined(__cplusplus)" : "";
! printf (z_fmt, z_TYPE, pz_guard, z_TYPE, z_TYPE, z_type);
}
! return text += rm[0].rm_eo;
}
/*
***************
*** 693,738 ****
compile_re (pz_pat, &re, 1, "gnu type typedef", "gnu_type_fix");
while (regexec (&re, text, GTYPE_SE_CT+1, rm, 0) == 0)
{
- #ifndef DEBUG
text = emit_gnu_type (text, rm);
- #else
- tSCC z_mismatch[] = "``%s'' mismatched:\n";
-
- /*
- * Make sure we matched *all* subexpressions
- */
- if (rm[GTYPE_SE_CT].rm_so == -1)
- {
- int i;
-
- fprintf (stderr, z_mismatch, pz_pat);
-
- for (i=0; i <= GTYPE_SE_CT; i++)
- {
- if (rm[i].rm_so != -1)
- {
- fprintf( stderr, "%4d: ``", i );
- fwrite( text + rm[i].rm_so, rm[i].rm_eo - rm[i].rm_so,
- 1, stderr );
- fputs( "''\n", stderr );
- }
- else
- {
- fprintf( stderr, "%4d: BROKEN\n", i );
- }
- }
- exit (EXIT_BROKEN);
- }
-
- text = emit_gnu_type (text, rm);
- if (text == NULL)
- {
- fprintf (stderr, z_mismatch, pz_pat);
- exit (EXIT_BROKEN);
- }
- #endif
}
/*
* Dump out the rest of the file
--- 676,684 ----
*** fixincl.tpl.ori Mon Jul 24 08:34:18 2000
--- fixincl.tpl Mon Jul 24 08:38:49 2000
***************
*** 202,224 ****
a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[=
/fix=]
};
-
- #define GNU_TYPE_CT [=_eval type_map _count =]
- int gnu_type_map_ct = GNU_TYPE_CT;
-
- /*
- * The following table depends upon XXX_TYPE being #define-d to the
- * correct string via defines in a header file pointed to by the
- * generated file "tm.h".
- */
- t_gnu_type_map gnu_type_map[ GNU_TYPE_CT ] = {[=
-
- _FOR type_map ,
-
- =]
- { [=_EVAL type_map _len=], "[=type_map=]", "[=type_map _up=]", [=
- type_map _up=]_TYPE }[=
-
- /type_map=]
- };
--- 202,205 ----
*** fixlib.h.ori Mon Jul 24 08:34:23 2000
--- fixlib.h Mon Jul 24 08:54:24 2000
***************
*** 32,41 ****
#include "gnu-regex.h"
#include "machname.h"
#include "libiberty.h"
- #include "tm.h"
-
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
--- 32,39 ----
***************
*** 148,156 ****
Everything you ever wanted to know about how to apply
a particular fix (which files, how to qualify them,
how to actually make the fix, etc...)
! NB: the FD_ defines are BIT FLAGS
*/
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
--- 146,155 ----
Everything you ever wanted to know about how to apply
a particular fix (which files, how to qualify them,
how to actually make the fix, etc...)
! NB: the FD_ defines are BIT FLAGS, even though
! some are mutually exclusive
*/
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
*** inclhack.def.ori Mon Jul 24 08:34:41 2000
--- inclhack.def Mon Jul 24 08:39:35 2000
***************
*** 2518,2533 ****
/*
* Fix these files to use the same types that we think they should.
- * Each type must be present in two places: the select clause
- * and a "type_map" entry below. The types mapped to are found from
- * the "tm.h" header, which is a generated file that refers to
- * a header in the gcc/config/ tree. Keep these in sync!!
- *
- * Also, "wchar" is first and known to need guarding against __cplusplus.
- * Keep *that* in mind, too, when hacking the gnu_type_fix routine
- * in fixfixes.c.
*/
fix = {
hackname = gnu_types;
files = "sys/types.h";
--- 2518,2525 ----
***************
*** 2543,2554 ****
test_text = "typedef long int ptrdiff_t; /* long int */\n"
"typedef uint_t size_t; /* uint_t */\n"
"typedef ushort_t wchar_t; /* ushort_t */";
};
-
- type_map = wchar;
- type_map = ptrdiff;
- type_map = size;
/*
* Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
--- 2535,2542 ----