rely* on GCC defining the __xxx_TYPE__ macros
From-SVN: r35288
This commit is contained in:
parent
1e12ab9b73
commit
71e06bdeed
6 changed files with 31 additions and 123 deletions
|
@ -1,3 +1,11 @@
|
|||
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
|
||||
|
||||
Thu Jul 27 11:54:17 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* cpp.texi: Append a trailing full-stop to xrefs where needed.
|
||||
|
|
|
@ -136,58 +136,41 @@ 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;
|
||||
char z_TYPE[ 64 ];
|
||||
char z_type[ 64 ];
|
||||
|
||||
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;
|
||||
{
|
||||
const char* ps = text + rm[1].rm_so;
|
||||
const char* pe = text + rm[1].rm_eo;
|
||||
char* pd = z_type;
|
||||
char* pD = z_TYPE;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (--ct <= 0)
|
||||
return (const char*)NULL;
|
||||
#else
|
||||
if (--ct <= 0)
|
||||
return text;
|
||||
#endif
|
||||
p_tm++;
|
||||
}
|
||||
while (ps < pe)
|
||||
*(pD++) = toupper( *(pd++) = *(ps++) );
|
||||
|
||||
*pD = *pd = NUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now print out the reformed typedef
|
||||
* Now print out the reformed typedef,
|
||||
* with a C++ guard for WCHAR
|
||||
*/
|
||||
{
|
||||
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";
|
||||
#define _GCC_%s_T\n\
|
||||
typedef __%s_TYPE__ %s_t;\n\
|
||||
#endif\n";
|
||||
|
||||
const char* pz_guard;
|
||||
const char* pz_guard = (strcmp (z_type, "wchar") == 0)
|
||||
? " && ! defined(__cplusplus)" : "";
|
||||
|
||||
/*
|
||||
* 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);
|
||||
printf (z_fmt, z_TYPE, pz_guard, z_TYPE, z_TYPE, z_type);
|
||||
}
|
||||
|
||||
return text;
|
||||
return text += rm[0].rm_eo;
|
||||
}
|
||||
|
||||
|
||||
|
@ -694,44 +677,7 @@ FIX_PROC_HEAD( 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
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -203,22 +203,3 @@ _FOR fix ",\n" =]
|
|||
|
||||
/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=]
|
||||
};
|
||||
|
|
|
@ -5795,17 +5795,3 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
|
|||
X11_SPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
|
||||
aX11_SprintfTests, apzX11_SprintfPatch }
|
||||
};
|
||||
|
||||
#define GNU_TYPE_CT 3
|
||||
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 ] = {
|
||||
{ 5, "wchar", "WCHAR", WCHAR_TYPE },
|
||||
{ 7, "ptrdiff", "PTRDIFF", PTRDIFF_TYPE },
|
||||
{ 4, "size", "SIZE", SIZE_TYPE }
|
||||
};
|
||||
|
|
|
@ -33,8 +33,6 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "machname.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
#include "tm.h"
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
|
@ -149,7 +147,8 @@ typedef struct patch_desc tPatchDesc;
|
|||
a particular fix (which files, how to qualify them,
|
||||
how to actually make the fix, etc...)
|
||||
|
||||
NB: the FD_ defines are BIT FLAGS
|
||||
NB: the FD_ defines are BIT FLAGS, even though
|
||||
some are mutually exclusive
|
||||
|
||||
*/
|
||||
#define FD_MACH_ONLY 0x0000
|
||||
|
|
|
@ -2519,14 +2519,6 @@ fix = {
|
|||
|
||||
/*
|
||||
* 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;
|
||||
|
@ -2545,10 +2537,6 @@ fix = {
|
|||
"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}
|
||||
|
|
Loading…
Add table
Reference in a new issue