Commit 78a0d70c by Zack Weinberg

frame.c (find_fde): Convert for loop to do-while so compiler sees it's always…

frame.c (find_fde): Convert for loop to do-while so compiler sees it's always executed at least once.

	* frame.c (find_fde): Convert for loop to do-while so compiler
	sees it's always executed at least once.
	* libgcc2.c (BBINBUFSIZE): Kill.
	(__bb_init_prg): Use fgets.
	(__bb_exit_trace_func): Don't paste strings.
	* unroll.c (unroll_loop): Initialize unroll_type, not
	unroll_number, and tweak logic to match.

	* i386.c (ix86_expand_int_movcc): Add explicit 'return 0' in
	all failure paths.
	(ix86_flags_dependant): Likewise.  Disentangle control flow.
	(ix86_sched_reorder): Break guts out to
	ix86_sched_reorder_pentium and ix86_sched_reorder_ppro.
	(ix86_sched_reorder_ppro): Initialize pair2 and insnp before
	any possible use.

	* i386.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Don't
	use string concatenation.  Don't save and restore esi.

	* fixinc/Makefile.in (fixincl.sh): Don't depend on inclhack.def.
	(machname.h): Remove script to separate file.  Use two-step
	sequence so target is not created if script fails.
	* fixinc/gen-machname.h: New file.  Handle case where no non-reserved
	identifiers are defined.
	* fixinc/fixlib.c (mn_get_regexps): Return a flag: if MN_NAME_PAT is
	an empty string, machine_name doesn't need to do anything at
	all.
	(is_cxx_header): Add more cases to regexp.
	* fixinc/fixlib.h: Update prototype.
	* fixinc/fixtests.c, fixinc/fixfixes.c: Update callers of
	mn_get_regexps.
	* fixinc/fixincl.c: Define NO_BOGOSITY.

	* fixinc/inclhack.def (no_double_slash, else_endif_label): Ifdef out.
	(hp_sysfile): Add missing comma.
	(math_exception): Put the wrapper ifdefs at the beginning and
	the end of the file.
	* fixinc/fixincl.x, fixinc/inclhack.sh: Regenerate.

From-SVN: r31744
parent f2321837
...@@ -4917,7 +4917,7 @@ ix86_expand_int_movcc (operands) ...@@ -4917,7 +4917,7 @@ ix86_expand_int_movcc (operands)
{ {
/* Try a few things more with specific constants and a variable. */ /* Try a few things more with specific constants and a variable. */
optab op = NULL; optab op;
rtx var, orig_out, out, tmp; rtx var, orig_out, out, tmp;
if (optimize_size) if (optimize_size)
...@@ -4933,6 +4933,8 @@ ix86_expand_int_movcc (operands) ...@@ -4933,6 +4933,8 @@ ix86_expand_int_movcc (operands)
operands[3] = constm1_rtx, op = and_optab; operands[3] = constm1_rtx, op = and_optab;
else if (INTVAL (operands[2]) == -1) else if (INTVAL (operands[2]) == -1)
operands[3] = const0_rtx, op = ior_optab; operands[3] = const0_rtx, op = ior_optab;
else
return 0; /* FAIL */
} }
else if (GET_CODE (operands[3]) == CONST_INT) else if (GET_CODE (operands[3]) == CONST_INT)
{ {
...@@ -4941,9 +4943,10 @@ ix86_expand_int_movcc (operands) ...@@ -4941,9 +4943,10 @@ ix86_expand_int_movcc (operands)
operands[2] = constm1_rtx, op = and_optab; operands[2] = constm1_rtx, op = and_optab;
else if (INTVAL (operands[3]) == -1) else if (INTVAL (operands[3]) == -1)
operands[2] = const0_rtx, op = ior_optab; operands[2] = const0_rtx, op = ior_optab;
else
return 0; /* FAIL */
} }
else
if (op == NULL)
return 0; /* FAIL */ return 0; /* FAIL */
orig_out = operands[0]; orig_out = operands[0];
...@@ -5901,17 +5904,21 @@ ix86_flags_dependant (insn, dep_insn, insn_type) ...@@ -5901,17 +5904,21 @@ ix86_flags_dependant (insn, dep_insn, insn_type)
set = SET_DEST (XVECEXP (PATTERN (dep_insn), 0, 0)); set = SET_DEST (XVECEXP (PATTERN (dep_insn), 0, 0));
set2 = SET_DEST (XVECEXP (PATTERN (dep_insn), 0, 0)); set2 = SET_DEST (XVECEXP (PATTERN (dep_insn), 0, 0));
} }
else
return 0;
if (GET_CODE (set) != REG || REGNO (set) != FLAGS_REG)
return 0;
if (set && GET_CODE (set) == REG && REGNO (set) == FLAGS_REG)
{
/* This test is true if the dependant insn reads the flags but /* This test is true if the dependant insn reads the flags but
not any other potentially set register. */ not any other potentially set register. */
if (reg_overlap_mentioned_p (set, PATTERN (insn)) if (!reg_overlap_mentioned_p (set, PATTERN (insn)))
&& (!set2 || !reg_overlap_mentioned_p (set2, PATTERN (insn)))) return 0;
return 1;
}
if (set2 && reg_overlap_mentioned_p (set2, PATTERN (insn)))
return 0; return 0;
return 1;
} }
/* A subroutine of ix86_adjust_cost -- return true iff INSN has a memory /* A subroutine of ix86_adjust_cost -- return true iff INSN has a memory
...@@ -6208,41 +6215,28 @@ ix86_pent_find_pair (e_ready, ready, type, first) ...@@ -6208,41 +6215,28 @@ ix86_pent_find_pair (e_ready, ready, type, first)
return bestinsnp; return bestinsnp;
} }
/* We are about to being issuing insns for this clock cycle. /* Subroutines of ix86_sched_reorder. */
Override the default sort algorithm to better slot instructions. */
int void
ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var) ix86_sched_reorder_pentium (ready, e_ready)
FILE *dump ATTRIBUTE_UNUSED;
int sched_verbose ATTRIBUTE_UNUSED;
rtx *ready; rtx *ready;
int n_ready, clock_var ATTRIBUTE_UNUSED; rtx *e_ready;
{ {
rtx *e_ready = ready + n_ready - 1; enum attr_pent_pair pair1, pair2;
rtx *insnp; rtx *insnp;
int i;
if (n_ready < 2)
goto out;
switch (ix86_cpu)
{
default:
goto out;
case PROCESSOR_PENTIUM:
/* This wouldn't be necessary if Haifa knew that static insn ordering /* This wouldn't be necessary if Haifa knew that static insn ordering
is important to which pipe an insn is issued to. So we have to make is important to which pipe an insn is issued to. So we have to make
some minor rearrangements. */ some minor rearrangements. */
{
enum attr_pent_pair pair1, pair2;
pair1 = ix86_safe_pent_pair (*e_ready); pair1 = ix86_safe_pent_pair (*e_ready);
/* If the first insn is non-pairable, let it be. */ /* If the first insn is non-pairable, let it be. */
if (pair1 == PENT_PAIR_NP) if (pair1 == PENT_PAIR_NP)
goto out; return;
pair2 = PENT_PAIR_NP; pair2 = PENT_PAIR_NP;
insnp = 0;
/* If the first insn is UV or PV pairable, search for a PU /* If the first insn is UV or PV pairable, search for a PU
insn to go with. */ insn to go with. */
...@@ -6276,7 +6270,7 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var) ...@@ -6276,7 +6270,7 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var)
} }
if (pair2 == PENT_PAIR_NP) if (pair2 == PENT_PAIR_NP)
goto out; return;
/* Found something! Decide if we need to swap the order. */ /* Found something! Decide if we need to swap the order. */
if (pair1 == PENT_PAIR_PV || pair2 == PENT_PAIR_PU if (pair1 == PENT_PAIR_PV || pair2 == PENT_PAIR_PU
...@@ -6286,18 +6280,22 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var) ...@@ -6286,18 +6280,22 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var)
ix86_reorder_insn (insnp, e_ready); ix86_reorder_insn (insnp, e_ready);
else else
ix86_reorder_insn (insnp, e_ready - 1); ix86_reorder_insn (insnp, e_ready - 1);
} }
break;
case PROCESSOR_PENTIUMPRO: void
{ ix86_sched_reorder_ppro (ready, e_ready)
rtx *ready;
rtx *e_ready;
{
rtx decode[3]; rtx decode[3];
enum attr_ppro_uops cur_uops; enum attr_ppro_uops cur_uops;
int issued_this_cycle; int issued_this_cycle;
rtx *insnp;
int i;
/* At this point .ppro.decode contains the state of the three /* At this point .ppro.decode contains the state of the three
decoders from last "cycle". That is, those insns that were decoders from last "cycle". That is, those insns that were
actually independant. But here we're scheduling for the actually independent. But here we're scheduling for the
decoder, and we may find things that are decodable in the decoder, and we may find things that are decodable in the
same cycle. */ same cycle. */
...@@ -6367,7 +6365,35 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var) ...@@ -6367,7 +6365,35 @@ ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var)
if (issued_this_cycle == 0) if (issued_this_cycle == 0)
issued_this_cycle = 1; issued_this_cycle = 1;
ix86_sched_data.ppro.issued_this_cycle = issued_this_cycle; ix86_sched_data.ppro.issued_this_cycle = issued_this_cycle;
} }
/* We are about to being issuing insns for this clock cycle.
Override the default sort algorithm to better slot instructions. */
int
ix86_sched_reorder (dump, sched_verbose, ready, n_ready, clock_var)
FILE *dump ATTRIBUTE_UNUSED;
int sched_verbose ATTRIBUTE_UNUSED;
rtx *ready;
int n_ready;
int clock_var ATTRIBUTE_UNUSED;
{
rtx *e_ready = ready + n_ready - 1;
if (n_ready < 2)
goto out;
switch (ix86_cpu)
{
default:
break;
case PROCESSOR_PENTIUM:
ix86_sched_reorder_pentium (ready, e_ready);
break;
case PROCESSOR_PENTIUMPRO:
ix86_sched_reorder_ppro (ready, e_ready);
break; break;
} }
......
...@@ -1288,11 +1288,11 @@ typedef struct ix86_args { ...@@ -1288,11 +1288,11 @@ typedef struct ix86_args {
Note that function `__bb_trace_ret' must not change the Note that function `__bb_trace_ret' must not change the
machine state, especially the flag register. To grant machine state, especially the flag register. To grant
this, you must output code to save and restore registers this, you must output code to save and restore registers
either in this macro or in the macros MACHINE_STATE_SAVE_RET either in this macro or in the macros MACHINE_STATE_SAVE
and MACHINE_STATE_RESTORE_RET. The last two macros will be and MACHINE_STATE_RESTORE. The last two macros will be
used in the function `__bb_trace_ret', so you must make used in the function `__bb_trace_ret', so you must make
sure that the function prologue does not change any sure that the function prologue does not change any
register prior to saving it with MACHINE_STATE_SAVE_RET. register prior to saving it with MACHINE_STATE_SAVE.
else if profiling_block_flag != 0: else if profiling_block_flag != 0:
...@@ -1324,20 +1324,21 @@ emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \ ...@@ -1324,20 +1324,21 @@ emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \
On the i386 the initialization code at the begin of On the i386 the initialization code at the begin of
function `__bb_trace_func' contains a `sub' instruction function `__bb_trace_func' contains a `sub' instruction
therefore we handle save and restore of the flag register therefore we handle save and restore of the flag register
in the BLOCK_PROFILER macro. */ in the BLOCK_PROFILER macro.
Note that ebx, esi, and edi are callee-save, so we don't have to
preserve them explicitly. */
#define MACHINE_STATE_SAVE(ID) \ #define MACHINE_STATE_SAVE(ID) \
do { \ do { \
register int eax_ __asm__("eax"); \ register int eax_ __asm__("eax"); \
register int ecx_ __asm__("ecx"); \ register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \ register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \ __asm__ __volatile__ ("\
__asm__ __volatile__ ( \ push{l} %0\n\t\
"push{l} %0\n\t" \ push{l} %1\n\t\
"push{l} %1\n\t" \ push{l} %2" \
"push{l} %2\n\t" \ : : "r"(eax_), "r"(ecx_), "r"(edx_)); \
"push{l} %3" \
: : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
} while (0); } while (0);
#define MACHINE_STATE_RESTORE(ID) \ #define MACHINE_STATE_RESTORE(ID) \
...@@ -1345,13 +1346,11 @@ do { \ ...@@ -1345,13 +1346,11 @@ do { \
register int eax_ __asm__("eax"); \ register int eax_ __asm__("eax"); \
register int ecx_ __asm__("ecx"); \ register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \ register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \ __asm__ __volatile__ ("\
__asm__ __volatile__ ( \ pop{l} %2\n\t\
"pop{l} %3\n\t" \ pop{l} %1\n\t\
"pop{l} %2\n\t" \ pop{l} %0" \
"pop{l} %1\n\t" \ : "=r"(eax_), "=r"(ecx_), "=r"(edx_)); \
"pop{l} %0" \
: "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
} while (0); } while (0);
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
......
# Makefile for GNU compilers. # Makefile for GNU compilers.
# Copyright (C) 1998, 1999 Free Software Foundation, Inc. # Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
#This file is part of GNU CC. #This file is part of GNU CC.
...@@ -101,7 +101,8 @@ fixincl.x: fixincl.tpl inclhack.def ...@@ -101,7 +101,8 @@ fixincl.x: fixincl.tpl inclhack.def
inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl
cd $(srcdir) ; ./genfixes $@ cd $(srcdir) ; ./genfixes $@
fixincl.sh: inclhack.def inclhack.tpl # fixinc.sh, unlike the other two, has _no_ dependency on the .def file.
fixincl.sh: inclhack.tpl
cd $(srcdir) ; ./genfixes $@ cd $(srcdir) ; ./genfixes $@
clean: clean:
...@@ -137,15 +138,6 @@ Makefile: Makefile.in ../config.status ...@@ -137,15 +138,6 @@ Makefile: Makefile.in ../config.status
cd .. \ cd .. \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# Black magic.
# Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
machname.h: ../specs machname.h: ../specs
@tr -s '\040\011' '\012\012' < ../specs | \ $(SHELL) $(srcdir)/gen-machname.h < ../specs > machname.T
sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$$/\1/p' | sort -u | \ mv -f machname.T machname.h
grep -v '^_[_A-Z]' > mn.T
@echo "Forbidden identifiers: `tr '\012' ' ' <mn.T`"
@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' > mn.T2
@echo '' >>mn.T2
@sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' < mn.T2 > machname.h
@-rm -f mn.T mn.T2
...@@ -566,7 +566,11 @@ FIX_PROC_HEAD( machine_name_fix ) ...@@ -566,7 +566,11 @@ FIX_PROC_HEAD( machine_name_fix )
char scratch[SCRATCHSZ]; char scratch[SCRATCHSZ];
size_t len; size_t len;
mn_get_regexps (&label_re, &name_re, "machine_name_fix"); if (mn_get_regexps (&label_re, &name_re, "machine_name_fix"))
/* This platform doesn't need this fix. We can only get here if
someone is running fixfixes by hand, but let's be polite. */
goto done;
scratch[0] = '_'; scratch[0] = '_';
scratch[1] = '_'; scratch[1] = '_';
......
...@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */
#include "server.h" #include "server.h"
#define NO_BOGOSITY
/* Quality Assurance Marker :-) /* Quality Assurance Marker :-)
Any file that contains this string is presumed to have Any file that contains this string is presumed to have
......
...@@ -122,7 +122,11 @@ is_cxx_header (fname, text) ...@@ -122,7 +122,11 @@ is_cxx_header (fname, text)
tSCC cxxpat[] = "\ tSCC cxxpat[] = "\
extern[ \t]*\"C\\+\\+\"|\ extern[ \t]*\"C\\+\\+\"|\
-\\*-[ \t]*([mM]ode:[ \t]*)?[cC]\\+\\+[; \t]*-\\*-|\ -\\*-[ \t]*([mM]ode:[ \t]*)?[cC]\\+\\+[; \t]*-\\*-|\
template[ \t]*<"; template[ \t]*<|\
^[ \t]*class[ \t]|\
(public|private|protected):|\
^[ \t]*#[ \t]*pragma[ \t]+(interface|implementation)\
";
static regex_t cxxre; static regex_t cxxre;
static int compiled; static int compiled;
...@@ -187,12 +191,16 @@ static regex_t mn_name_re; ...@@ -187,12 +191,16 @@ static regex_t mn_name_re;
static int mn_compiled = 0; static int mn_compiled = 0;
void int
mn_get_regexps( label_re, name_re, who ) mn_get_regexps( label_re, name_re, who )
regex_t **label_re; regex_t **label_re;
regex_t **name_re; regex_t **name_re;
tCC *who; tCC *who;
{ {
/* Maybe we don't need to do this fix at all? */
if (mn_name_pat[0] == '\0')
return 1;
if (! mn_compiled) if (! mn_compiled)
{ {
compile_re (mn_label_pat, &mn_label_re, 1, "label pattern", who); compile_re (mn_label_pat, &mn_label_re, 1, "label pattern", who);
...@@ -201,4 +209,5 @@ mn_get_regexps( label_re, name_re, who ) ...@@ -201,4 +209,5 @@ mn_get_regexps( label_re, name_re, who )
} }
*label_re = &mn_label_re; *label_re = &mn_label_re;
*name_re = &mn_name_re; *name_re = &mn_name_re;
return 0;
} }
...@@ -99,6 +99,6 @@ char * load_file_data _P_(( FILE* fp )); ...@@ -99,6 +99,6 @@ char * load_file_data _P_(( FILE* fp ));
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext )); t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext ));
void compile_re _P_(( tCC* pat, regex_t* re, int match, void compile_re _P_(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 )); tCC *e1, tCC *e2 ));
void mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re, int mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re,
tCC *who )); tCC *who ));
#endif /* FIXINCLUDES_FIXLIB_H */ #endif /* FIXINCLUDES_FIXLIB_H */
...@@ -275,7 +275,8 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_test ) ...@@ -275,7 +275,8 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_test )
regmatch_t match[2]; regmatch_t match[2];
tCC *base, *limit; tCC *base, *limit;
mn_get_regexps(&label_re, &name_re, "machine_name_test"); if (mn_get_regexps(&label_re, &name_re, "machine_name_test"))
return SKIP_FIX;
for (base = text; for (base = text;
regexec (label_re, base, 2, match, 0) == 0; regexec (label_re, base, 2, match, 0) == 0;
......
#! /bin/sh
# Copyright (C) 2000 Free Software Foundation, Inc.
# This file is part of GNU CC.
# GNU CC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# GNU CC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This script extracts from the specs file all the predefined macros
# that are not in the C89 reserved namespace (the reserved namespace
# is all identifiers beginnning with two underscores or one underscore
# followed by a capital letter). The specs file is on standard input.
# A #define for a regular expression to find any of those macros in a
# header file is written to standard output.
# Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
# tr ' ' '\n' is, alas, not portable.
tr -s '\040\011' '\012\012' |
sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$/\1/p' |
sort -u > mn.T
if grep -v '^_[_A-Z]' mn.T > mn.U
then
echo "Forbidden identifiers: `tr '\012' ' ' <mn.U`" >&2
sed 's/^/\\\\</; s/$/\\\\>/' <mn.U | tr '\012' '|' > mn.V
echo '' >>mn.V
sed 's/^/#define MN_NAME_PAT "/; s/|$/"/' < mn.V
else
echo "No forbidden identifiers defined by this target" >&2
echo '#define MN_NAME_PAT ""'
fi
rm -f mn.[TUV]
exit 0
...@@ -765,6 +765,7 @@ fix = { ...@@ -765,6 +765,7 @@ fix = {
}; };
#ifdef OLD_CPP
/* /*
* Remove the double-slash comments. The "double_slash" test will * Remove the double-slash comments. The "double_slash" test will
* try to ignore C++ headers by checking for "CC/", "xx/" and "++/" * try to ignore C++ headers by checking for "CC/", "xx/" and "++/"
...@@ -776,6 +777,7 @@ fix = { ...@@ -776,6 +777,7 @@ fix = {
c_test = "double_slash"; c_test = "double_slash";
c_fix = "no_double_slash"; c_fix = "no_double_slash";
}; };
#endif
/* /*
...@@ -811,6 +813,7 @@ fix = { ...@@ -811,6 +813,7 @@ fix = {
}; };
#ifdef OLD_CPP
/* /*
* Fix else and endif directives that contain non-commentary text * Fix else and endif directives that contain non-commentary text
*/ */
...@@ -824,6 +827,7 @@ fix = { ...@@ -824,6 +827,7 @@ fix = {
c_test = "else_endif_label"; c_test = "else_endif_label";
c_fix = "else_endif_label"; c_fix = "else_endif_label";
}; };
#endif
/* /*
...@@ -846,7 +850,7 @@ fix = { ...@@ -846,7 +850,7 @@ fix = {
hackname = hp_sysfile; hackname = hp_sysfile;
files = sys/file.h; files = sys/file.h;
select = "HPUX_SOURCE"; select = "HPUX_SOURCE";
sed = 's/(\.\.\.)/(struct file * ...)/'; sed = 's/(\.\.\.)/(struct file *, ...)/';
}; };
...@@ -1282,88 +1286,23 @@ fix = { ...@@ -1282,88 +1286,23 @@ fix = {
* the class exception defined in the C++ file std/stdexcept.h. We * the class exception defined in the C++ file std/stdexcept.h. We
* redefine it to __math_exception. This is not a great fix, but I * redefine it to __math_exception. This is not a great fix, but I
* haven't been able to think of anything better. * haven't been able to think of anything better.
* Note that we have to put the #ifdef/#endif blocks at beginning
* and end of file, because fixproto runs after us and may insert
* additional references to struct exception.
*/ */
fix = { fix = {
hackname = math_exception; hackname = math_exception;
files = math.h; files = math.h;
select = "struct exception"; select = "struct exception";
bypass = "We have a problem when using C\\+\\+"; bypass = "We have a problem when using C\\+\\+";
sed = "/struct exception/i\\\n" sed = "1i\\\n"
"#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n"
"#endif\n";
sed = "/struct exception/a\\\n"
"#ifdef __cplusplus\\\n"
"#undef exception\\\n"
"#endif\n";
#ifdef MATH_EXCEPTION_FIXED
sed = "/matherr/i\\\n"
"#ifdef __cplusplus\\\n" "#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n" "#define exception __math_exception\\\n"
"#endif\n"; "#endif\n";
sed = "$a\\\n"
sed = "/matherr/a\\\n"
"#ifdef __cplusplus\\\n" "#ifdef __cplusplus\\\n"
"#undef exception\\\n" "#undef exception\\\n"
"#endif\n"; "#endif\n";
I think this patch needs some more thinking.
This is from SVR4.2 (With '#' replaced with '@').
Perhaps we could do without the "/matherr/a" entries?
Can we bypass the entire fix if someone was astute
enough to have '#ifdef __cplusplus' anywhere in the file?
We can definitely do without the "/matherr/a" entries. They are
there to cover the case where matherr is declared with no prototype
-- extern int matherr(); -- but we don't need a fix then since there
is no reference to struct exception.
Bypassing on "#ifdef __cplusplus" is too optimistic, but I've stuck
in a bypass for the comment in the glibc 2.1 header that indicates
awareness of the problem. Hmm. Could we use a shell test that did
cpp -D__cplusplus | grep "struct exception" ?
*** /usr/include/math.h Fri Apr 3 18:54:59 1998
--- math.h Sun May 9 07:28:58 1999
***************
*** 25,31 ****
--- 25,37 ----
@ifndef __cplusplus
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
struct exception
+ @ifdef __cplusplus
+ @undef exception
+ @endif
{
int type;
char *name;
***************
*** 34,40 ****
--- 40,58 ----
double retval;
};
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
extern int matherr(struct exception *);
+ @ifdef __cplusplus
+ @undef exception
+ @endif
+ @ifdef __cplusplus
+ @undef exception
+ @endif
@endif /*__cplusplus*/
#endif
}; };
fix = { fix = {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 115 fixup scripts. # This script contains 113 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
...@@ -1264,22 +1264,6 @@ struct rusage; ...@@ -1264,22 +1264,6 @@ struct rusage;
# #
# Fix No_Double_Slash
#
if ${FIXTESTS} ${file} double_slash
then
fixlist="${fixlist}
no_double_slash"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} no_double_slash < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of c_test 'if'
#
# Fix Ecd_Cursor # Fix Ecd_Cursor
# #
case "${file}" in ./sunwindow/win_lock.h | \ case "${file}" in ./sunwindow/win_lock.h | \
...@@ -1330,22 +1314,6 @@ extern "C"\ ...@@ -1330,22 +1314,6 @@ extern "C"\
# #
# Fix End_Else_Label
#
if ${FIXTESTS} ${file} else_endif_label
then
fixlist="${fixlist}
end_else_label"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} else_endif_label < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of c_test 'if'
#
# Fix Hp_Inline # Fix Hp_Inline
# #
case "${file}" in ./sys/spinlock.h ) case "${file}" in ./sys/spinlock.h )
...@@ -1379,7 +1347,7 @@ extern "C"\ ...@@ -1379,7 +1347,7 @@ extern "C"\
then infile=${file} then infile=${file}
else infile=${DESTFILE} ; fi else infile=${DESTFILE} ; fi
sed -e 's/(\.\.\.)/(struct file * ...)/' \ sed -e 's/(\.\.\.)/(struct file *, ...)/' \
< $infile > ${DESTDIR}/fixinc.tmp < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE} rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
...@@ -2060,12 +2028,12 @@ static __inline__ double fake_hypot (x, y)\ ...@@ -2060,12 +2028,12 @@ static __inline__ double fake_hypot (x, y)\
then infile=${file} then infile=${file}
else infile=${DESTFILE} ; fi else infile=${DESTFILE} ; fi
sed -e '/struct exception/i\ sed -e '1i\
#ifdef __cplusplus\ #ifdef __cplusplus\
#define exception __math_exception\ #define exception __math_exception\
#endif #endif
' \ ' \
-e '/struct exception/a\ -e '$a\
#ifdef __cplusplus\ #ifdef __cplusplus\
#undef exception\ #undef exception\
#endif #endif
......
...@@ -610,12 +610,14 @@ find_fde (void *pc) ...@@ -610,12 +610,14 @@ find_fde (void *pc)
{ {
fde **p = ob->fde_array; fde **p = ob->fde_array;
for (; *p; ++p) do
{ {
f = search_fdes (*p, pc); f = search_fdes (*p, pc);
if (f) if (f)
break; break;
p++;
} }
while (*p);
} }
else else
f = search_fdes (ob->fde_begin, pc); f = search_fdes (ob->fde_begin, pc);
......
...@@ -1881,11 +1881,6 @@ __bb_fork_func (void) ...@@ -1881,11 +1881,6 @@ __bb_fork_func (void)
#define BBINBUFSIZE 500 #define BBINBUFSIZE 500
/* BBINBUFSIZE-1 with double quotes. We could use #BBINBUFSIZE or
"BBINBUFSIZE" but want to avoid trouble with preprocessors. */
#define BBINBUFSIZESTR "499"
struct bb_edge struct bb_edge
{ {
struct bb_edge *next; struct bb_edge *next;
...@@ -2163,8 +2158,8 @@ found: ; ...@@ -2163,8 +2158,8 @@ found: ;
struct bb_edge *bucket = bb_hashbuckets[i]; struct bb_edge *bucket = bb_hashbuckets[i];
for ( ; bucket; bucket = bucket->next ) for ( ; bucket; bucket = bucket->next )
{ {
fprintf (file, "Jump from block 0x%.*lx to " fprintf (file,
"block 0x%.*lx executed %*lu time(s)\n", "Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n",
addr_len, bucket->src_addr, addr_len, bucket->src_addr,
addr_len, bucket->dst_addr, addr_len, bucket->dst_addr,
cnt_len, bucket->count); cnt_len, bucket->count);
...@@ -2235,8 +2230,12 @@ __bb_init_prg (void) ...@@ -2235,8 +2230,12 @@ __bb_init_prg (void)
if (!(file = fopen ("bb.in", "r"))) if (!(file = fopen ("bb.in", "r")))
return; return;
while(fscanf (file, " %" BBINBUFSIZESTR "s ", buf) != EOF) while(fgets (buf, BBINBUFSIZE, file) != 0)
{ {
i = strlen (buf);
if (buf[i] == '\n')
buf[i--] = '\0';
p = buf; p = buf;
if (*p == '-') if (*p == '-')
{ {
......
...@@ -234,7 +234,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p) ...@@ -234,7 +234,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
{ {
int i, j; int i, j;
unsigned HOST_WIDE_INT temp; unsigned HOST_WIDE_INT temp;
int unroll_number = 1; int unroll_number;
rtx copy_start, copy_end; rtx copy_start, copy_end;
rtx insn, sequence, pattern, tem; rtx insn, sequence, pattern, tem;
int max_labelno, max_insnno; int max_labelno, max_insnno;
...@@ -248,7 +248,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p) ...@@ -248,7 +248,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
rtx start_label; rtx start_label;
struct iv_class *bl; struct iv_class *bl;
int splitting_not_safe = 0; int splitting_not_safe = 0;
enum unroll_types unroll_type; enum unroll_types unroll_type = UNROLL_NAIVE;
int loop_preconditioned = 0; int loop_preconditioned = 0;
rtx safety_label; rtx safety_label;
/* This points to the last real insn in the loop, which should be either /* This points to the last real insn in the loop, which should be either
...@@ -437,7 +437,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p) ...@@ -437,7 +437,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
/* Default case, calculate number of times to unroll loop based on its /* Default case, calculate number of times to unroll loop based on its
size. */ size. */
if (unroll_number == 1) if (unroll_type == UNROLL_NAIVE)
{ {
if (8 * insn_count < MAX_UNROLLED_INSNS) if (8 * insn_count < MAX_UNROLLED_INSNS)
unroll_number = 8; unroll_number = 8;
...@@ -445,8 +445,6 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p) ...@@ -445,8 +445,6 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
unroll_number = 4; unroll_number = 4;
else else
unroll_number = 2; unroll_number = 2;
unroll_type = UNROLL_NAIVE;
} }
/* Now we know how many times to unroll the loop. */ /* Now we know how many times to unroll the loop. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment