aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-01-17 23:19:29 +0000
committerRichard Stallman <rms@gnu.org>1992-01-17 23:19:29 +0000
commit34e567536c877b47a1d055aa73420d66d1c4d7ae (patch)
treeb384e599fc3ef596a91e50d7389cf9fa3720fbfa /gcc
parent6c65299b5eb54054e639c3f2523e30542fe25555 (diff)
downloadgcc-34e567536c877b47a1d055aa73420d66d1c4d7ae.zip
gcc-34e567536c877b47a1d055aa73420d66d1c4d7ae.tar.gz
gcc-34e567536c877b47a1d055aa73420d66d1c4d7ae.tar.bz2
*** empty log message ***
From-SVN: r204
Diffstat (limited to 'gcc')
-rw-r--r--gcc/global.c26
-rw-r--r--gcc/integrate.c2
-rw-r--r--gcc/optabs.c287
-rw-r--r--gcc/print-tree.c2
-rw-r--r--gcc/protoize.c524
5 files changed, 475 insertions, 366 deletions
diff --git a/gcc/global.c b/gcc/global.c
index c016d38..25df390 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -1,5 +1,5 @@
/* Allocate registers for pseudo-registers that span basic blocks.
- Copyright (C) 1987-1991 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1991 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -394,9 +394,17 @@ global_alloc (file)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (reg_allocno[i] < 0 && reg_renumber[i] >= 0)
{
- local_reg_n_refs[reg_renumber[i]] += reg_n_refs[i];
- local_reg_live_length[reg_renumber[i]] += reg_live_length[i];
+ int regno = reg_renumber[i];
+ int endregno = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (i));
+ int j;
+
+ for (j = regno; j < endregno; j++)
+ {
+ local_reg_n_refs[j] += reg_n_refs[i];
+ local_reg_live_length[j] += reg_live_length[i];
+ }
}
+
/* We can't override local-alloc for a reg used not just by local-alloc. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (regs_ever_live[i])
@@ -1016,8 +1024,16 @@ find_reg (allocno, losers, all_regs_p, accept_call_clobbered, retrying)
than it would be used by this one allocno! */
int k;
for (k = 0; k < max_regno; k++)
- if (reg_renumber[k] == i)
- reg_renumber[k] = -1;
+ if (reg_renumber[k] >= 0)
+ {
+ int regno = reg_renumber[k];
+ int endregno
+ = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (k));
+
+ if (i >= regno && i < endregno)
+ reg_renumber[k] = -1;
+ }
+
best_reg = i;
break;
}
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 72170a8..6e50650 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -1,5 +1,5 @@
/* Procedure integration for GNU CC.
- Copyright (C) 1988, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index d83d1eb..9092c95 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1,5 +1,5 @@
/* Expand the basic unary and binary arithmetic operations, for GNU compiler.
- Copyright (C) 1987-1991 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1992 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -189,7 +189,6 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
{
enum mode_class class;
enum machine_mode wider_mode;
- enum machine_mode submode = mode_for_size (BITS_PER_WORD, MODE_INT, 0);
register rtx temp;
int commutative_op = 0;
int shift_op = (binoptab->code == ASHIFT
@@ -219,10 +218,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
op0 = force_reg (mode, op0);
if (CONSTANT_P (op1) && preserve_subexpressions_p () && rtx_cost (op1) > 2)
- op1 = force_reg ((shift_op
- ? mode_for_size (BITS_PER_WORD, MODE_INT, 0)
- : mode),
- op1);
+ op1 = force_reg (shift_op ? word_mode : mode, op1);
#if 0 /* Turned off because it seems to be a kludgy method. */
/* If subtracting integer from pointer, and the pointer has a special mode,
@@ -341,7 +337,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
&& class == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && binoptab->handlers[(int) submode].insn_code != CODE_FOR_nothing)
+ && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -358,7 +354,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
for (i = 0; i < GET_MODE_BITSIZE (mode) / BITS_PER_WORD; i++)
{
rtx target_piece = operand_subword (target, i, 1, mode);
- rtx x = expand_binop (submode, binoptab,
+ rtx x = expand_binop (word_mode, binoptab,
operand_subword_force (op0, i, mode),
operand_subword_force (op1, i, mode),
target_piece, unsignedp, methods);
@@ -382,10 +378,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if ((binoptab == add_optab || binoptab == sub_optab)
&& class == MODE_INT
&& GET_MODE_SIZE (mode) >= 2 * UNITS_PER_WORD
- && binoptab->handlers[(int) submode].insn_code != CODE_FOR_nothing)
+ && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
{
int i;
- rtx carry_tmp = gen_reg_rtx (submode);
+ rtx carry_tmp = gen_reg_rtx (word_mode);
optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
rtx carry_in, carry_out;
@@ -417,7 +413,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
rtx x;
/* Main add/subtract of the input operands. */
- x = expand_binop (submode, binoptab,
+ x = expand_binop (word_mode, binoptab,
op0_piece, op1_piece,
target_piece, unsignedp, methods);
if (x == 0)
@@ -426,11 +422,11 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (i + 1 < nwords)
{
/* Store carry from main add/subtract. */
- carry_out = gen_reg_rtx (submode);
+ carry_out = gen_reg_rtx (word_mode);
carry_out = emit_store_flag (carry_out,
binoptab == add_optab ? LTU : GTU,
x, op0_piece,
- submode, 1, normalizep);
+ word_mode, 1, normalizep);
if (!carry_out)
break;
}
@@ -438,7 +434,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (i > 0)
{
/* Add/subtract previous carry to main result. */
- x = expand_binop (submode,
+ x = expand_binop (word_mode,
normalizep == 1 ? binoptab : otheroptab,
x, carry_in,
target_piece, 1, methods);
@@ -453,9 +449,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
binoptab == add_optab
? LTU : GTU,
x, carry_in,
- submode, 1, normalizep);
+ word_mode, 1, normalizep);
/* Logical-ior the two poss. carry together. */
- carry_out = expand_binop (submode, ior_optab,
+ carry_out = expand_binop (word_mode, ior_optab,
carry_out, carry_tmp,
carry_out, 0, methods);
if (!carry_out)
@@ -486,19 +482,19 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
because we are not operating on one word at a time.
The multiplication proceeds as follows:
- _______________________
- [__op0_high_|__op0_low__]
- _______________________
- * [__op1_high_|__op1_low__]
- _______________________________________________
- _______________________
-(1) [__op0_low__*__op1_low__]
- _______________________
-(2a) [__op0_low__*__op1_high_]
- _______________________
-(2b) [__op0_high_*__op1_low__]
- _______________________
-(3) [__op0_high_*__op1_high_]
+ _______________________
+ [__op0_high_|__op0_low__]
+ _______________________
+ * [__op1_high_|__op1_low__]
+ _______________________________________________
+ _______________________
+ (1) [__op0_low__*__op1_low__]
+ _______________________
+ (2a) [__op0_low__*__op1_high_]
+ _______________________
+ (2b) [__op0_high_*__op1_low__]
+ _______________________
+ (3) [__op0_high_*__op1_high_]
This gives a 4-word result. Since we are only interested in the
@@ -533,8 +529,8 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (binoptab == smul_optab
&& class == MODE_INT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && smul_optab->handlers[(int) submode].insn_code != CODE_FOR_nothing
- && add_optab->handlers[(int) submode].insn_code != CODE_FOR_nothing
+ && smul_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
+ && add_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
&& ((umul_widen_optab->handlers[(int) mode].insn_code
!= CODE_FOR_nothing)
|| (smul_widen_optab->handlers[(int) mode].insn_code
@@ -578,32 +574,32 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
rtx wordm1 = gen_rtx (CONST_INT, VOIDmode, BITS_PER_WORD - 1);
product = expand_binop (mode, smul_widen_optab, op0_low, op1_low,
target, 1, OPTAB_DIRECT);
- op0_xhigh = expand_binop (submode, lshr_optab, op0_low, wordm1,
+ op0_xhigh = expand_binop (word_mode, lshr_optab, op0_low, wordm1,
0, 1, OPTAB_DIRECT);
if (op0_xhigh)
- op0_xhigh = expand_binop (submode, add_optab, op0_high, op0_xhigh,
- op0_xhigh, 0, OPTAB_DIRECT);
+ op0_xhigh = expand_binop (word_mode, add_optab, op0_high,
+ op0_xhigh, op0_xhigh, 0, OPTAB_DIRECT);
else
{
- op0_xhigh = expand_binop (submode, ashr_optab, op0_low, wordm1,
+ op0_xhigh = expand_binop (word_mode, ashr_optab, op0_low, wordm1,
0, 0, OPTAB_DIRECT);
if (op0_xhigh)
- op0_xhigh = expand_binop (submode, sub_optab, op0_high,
+ op0_xhigh = expand_binop (word_mode, sub_optab, op0_high,
op0_xhigh, op0_xhigh, 0,
OPTAB_DIRECT);
}
- op1_xhigh = expand_binop (submode, lshr_optab, op1_low, wordm1,
+ op1_xhigh = expand_binop (word_mode, lshr_optab, op1_low, wordm1,
0, 1, OPTAB_DIRECT);
if (op1_xhigh)
- op1_xhigh = expand_binop (SImode, add_optab, op1_high, op1_xhigh,
- op1_xhigh, 0, OPTAB_DIRECT);
+ op1_xhigh = expand_binop (word_mode, add_optab, op1_high,
+ op1_xhigh, op1_xhigh, 0, OPTAB_DIRECT);
else
{
- op1_xhigh = expand_binop (submode, ashr_optab, op1_low, wordm1,
+ op1_xhigh = expand_binop (word_mode, ashr_optab, op1_low, wordm1,
0, 0, OPTAB_DIRECT);
if (op1_xhigh)
- op1_xhigh = expand_binop (SImode, sub_optab, op1_high,
+ op1_xhigh = expand_binop (word_mode, sub_optab, op1_high,
op1_xhigh, op1_xhigh, 0,
OPTAB_DIRECT);
}
@@ -623,21 +619,21 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
{
rtx product_piece;
rtx product_high = operand_subword (product, high, 1, mode);
- rtx temp = expand_binop (submode, binoptab, op0_low, op1_xhigh, 0,
+ rtx temp = expand_binop (word_mode, binoptab, op0_low, op1_xhigh, 0,
0, OPTAB_DIRECT);
if (temp)
{
- product_piece = expand_binop (submode, add_optab, temp,
+ product_piece = expand_binop (word_mode, add_optab, temp,
product_high, product_high,
0, OPTAB_LIB_WIDEN);
if (product_piece != product_high)
emit_move_insn (product_high, product_piece);
- temp = expand_binop (submode, binoptab, op1_low, op0_xhigh, 0,
+ temp = expand_binop (word_mode, binoptab, op1_low, op0_xhigh, 0,
0, OPTAB_DIRECT);
- product_piece = expand_binop (submode, add_optab, temp,
+ product_piece = expand_binop (word_mode, add_optab, temp,
product_high, product_high,
0, OPTAB_LIB_WIDEN);
if (product_piece != product_high)
@@ -674,9 +670,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if the libcall is cse'd or moved. */
emit_library_call (binoptab->handlers[(int) mode].libfunc,
1, mode, 2, op0, mode, op1,
- (shift_op
- ? mode_for_size (BITS_PER_WORD, MODE_INT, 0)
- : mode));
+ (shift_op ? word_mode : mode));
insns = get_insns ();
end_sequence ();
@@ -701,15 +695,12 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
methods = (methods == OPTAB_LIB_WIDEN ? OPTAB_LIB : OPTAB_DIRECT);
- /* Widening is now independent of specific machine modes.
- It is assumed that widening may be performed to any
- higher numbered mode in the same mode class. */
+ /* Look for a wider mode of the same class for which it appears we can do
+ the operation. */
if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
{
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- ((int) wider_mode < (int) MAX_MACHINE_MODE
- && GET_MODE_CLASS (wider_mode) == class);
+ for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
if ((binoptab->handlers[(int) wider_mode].insn_code
@@ -720,53 +711,39 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
rtx xop0 = op0, xop1 = op1;
int no_extend = 0;
- /* For certain operations, we need not actually extend
+ /* For certain integer operations, we need not actually extend
the narrow operands, as long as we will truncate
the results to the same narrowness. */
- if (binoptab == ior_optab || binoptab == and_optab
- || binoptab == xor_optab
- || binoptab == add_optab || binoptab == sub_optab
- || binoptab == smul_optab
- || binoptab == ashl_optab || binoptab == lshl_optab)
+ if ((binoptab == ior_optab || binoptab == and_optab
+ || binoptab == xor_optab
+ || binoptab == add_optab || binoptab == sub_optab
+ || binoptab == smul_optab
+ || binoptab == ashl_optab || binoptab == lshl_optab)
+ && class == MODE_INT)
no_extend = 1;
- if (GET_MODE (xop0) != VOIDmode
- && GET_MODE_BITSIZE (wider_mode) <= HOST_BITS_PER_INT)
- {
- if (no_extend)
- {
- temp = force_reg (GET_MODE (xop0), xop0);
- xop0 = gen_rtx (SUBREG, wider_mode, temp, 0);
- }
- else
- {
- temp = gen_reg_rtx (wider_mode);
- convert_move (temp, xop0, unsignedp);
- xop0 = temp;
- }
- }
- if (GET_MODE (xop1) != VOIDmode
- && GET_MODE_BITSIZE (wider_mode) <= HOST_BITS_PER_INT)
- {
- if (no_extend)
- {
- temp = force_reg (GET_MODE (xop1), xop1);
- xop1 = gen_rtx (SUBREG, wider_mode, temp, 0);
- }
- else
- {
- temp = gen_reg_rtx (wider_mode);
- convert_move (temp, xop1, unsignedp);
- xop1 = temp;
- }
- }
+ /* If an operand is a constant integer, we might as well
+ convert it since that is more efficient than using a SUBREG,
+ unlike the case for other operands. */
+
+ if (no_extend && GET_MODE (xop0) != VOIDmode)
+ xop0 = gen_rtx (SUBREG, wider_mode,
+ force_reg (GET_MODE (xop0), xop0), 0);
+ else
+ xop0 = convert_to_mode (wider_mode, xop0, unsignedp);
+
+ if (no_extend && GET_MODE (xop1) != VOIDmode)
+ xop1 = gen_rtx (SUBREG, wider_mode,
+ force_reg (GET_MODE (xop1), xop1), 0);
+ else
+ xop1 = convert_to_mode (wider_mode, xop1, unsignedp);
temp = expand_binop (wider_mode, binoptab, xop0, xop1, 0,
unsignedp, methods);
if (temp)
{
- if (class == MODE_FLOAT)
+ if (class != MODE_INT)
{
if (target == 0)
target = gen_reg_rtx (mode);
@@ -940,8 +917,7 @@ expand_twoval_binop (binoptab, op0, op1, targ0, targ1, unsignedp)
if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
{
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_CLASS (wider_mode) == class;
+ for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
if (binoptab->handlers[(int) wider_mode].insn_code
@@ -991,7 +967,6 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
{
enum mode_class class;
enum machine_mode wider_mode;
- enum machine_mode submode = mode_for_size (BITS_PER_WORD, MODE_INT, 0);
register rtx temp;
rtx last = get_last_insn ();
rtx pat;
@@ -1053,7 +1028,7 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
if (unoptab == one_cmpl_optab
&& class == MODE_INT
&& GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && unoptab->handlers[(int) submode].insn_code != CODE_FOR_nothing)
+ && unoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
{
int i;
rtx insns;
@@ -1067,7 +1042,7 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
for (i = 0; i < GET_MODE_BITSIZE (mode) / BITS_PER_WORD; i++)
{
rtx target_piece = operand_subword (target, i, 1, mode);
- rtx x = expand_unop (submode, unoptab,
+ rtx x = expand_unop (word_mode, unoptab,
operand_subword_force (op0, i, mode),
target_piece, unsignedp);
if (target_piece != x)
@@ -1107,32 +1082,41 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
{
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_CLASS (wider_mode) == class;
+ for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
if ((unoptab->handlers[(int) wider_mode].insn_code
!= CODE_FOR_nothing)
|| unoptab->handlers[(int) wider_mode].libfunc)
{
- if (GET_MODE (op0) != VOIDmode
- && GET_MODE_BITSIZE (wider_mode) <= HOST_BITS_PER_INT)
- {
- temp = gen_reg_rtx (wider_mode);
- convert_move (temp, op0, unsignedp);
- op0 = temp;
- }
+ rtx xop0 = op0;
+
+ /* For certain operations, we need not actually extend
+ the narrow operand, as long as we will truncate the
+ results to the same narrowness. */
+
+ if ((unoptab == neg_optab || unoptab == one_cmpl_optab)
+ && class == MODE_INT)
+ xop0 = gen_rtx (SUBREG, wider_mode, force_reg (mode, xop0), 0);
+ else
+ xop0 = convert_to_mode (wider_mode, xop0, unsignedp);
- target = expand_unop (wider_mode, unoptab, op0, 0, unsignedp);
- if (class == MODE_FLOAT)
+ temp = expand_unop (wider_mode, unoptab, xop0, 0, unsignedp);
+
+ if (temp)
{
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, temp, 0);
- return target;
+ if (class != MODE_INT)
+ {
+ if (target == 0)
+ target = gen_reg_rtx (mode);
+ convert_move (target, temp, 0);
+ return target;
+ }
+ else
+ return gen_lowpart (mode, temp);
}
else
- return gen_lowpart (mode, target);
+ delete_insns_since (last);
}
}
}
@@ -1563,8 +1547,7 @@ emit_cmp_insn (x, y, comparison, size, mode, unsignedp, align)
if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
{
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_CLASS (wider_mode) == class;
+ for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
if (cmp_optab->handlers[(int) wider_mode].insn_code
@@ -1695,8 +1678,7 @@ emit_float_lib_cmp (x, y, comparison)
{
enum machine_mode wider_mode;
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_CLASS (wider_mode) == MODE_FLOAT;
+ for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
if ((cmp_optab->handlers[(int) wider_mode].insn_code
@@ -1863,21 +1845,18 @@ gen_move_insn (x, y)
}
/* Tables of patterns for extending one integer mode to another. */
-static enum insn_code zero_extend_codes[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
-static enum insn_code sign_extend_codes[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
+static enum insn_code extendtab[MAX_MACHINE_MODE][MAX_MACHINE_MODE][2];
-/* Return nonzero if it's possible to extend FROM_MODE to TO_MODE.
- UNSIGNEDP specifies zero-extension instead of sign-extension.
+/* Return the insn code used to extend FROM_MODE to TO_MODE.
+ UNSIGNEDP specifies zero-extension instead of sign-extension. If
+ no such operation exists, CODE_FOR_nothing will be returned. */
- Actually, the value is the instruction code for the extension pattern. */
-
-int
+enum insn_code
can_extend_p (to_mode, from_mode, unsignedp)
enum machine_mode to_mode, from_mode;
int unsignedp;
{
- return ((unsignedp ? zero_extend_codes : sign_extend_codes)
- [(int) to_mode][(int) from_mode]);
+ return extendtab[(int) to_mode][(int) from_mode][unsignedp];
}
/* Generate the body of an insn to extend Y (with mode MFROM)
@@ -1889,97 +1868,99 @@ gen_extend_insn (x, y, mto, mfrom, unsignedp)
enum machine_mode mto, mfrom;
int unsignedp;
{
- return (GEN_FCN ((unsignedp ? zero_extend_codes : sign_extend_codes)
- [(int)mto][(int)mfrom])
- (x, y));
+ return (GEN_FCN (extendtab[(int) mto][(int) mfrom][unsignedp]) (x, y));
}
static void
init_extends ()
{
- bzero (sign_extend_codes, sizeof sign_extend_codes);
- bzero (zero_extend_codes, sizeof zero_extend_codes);
+ enum insn_code *p;
+
+ for (p = extendtab[0][0];
+ p < extendtab[0][0] + sizeof extendtab / sizeof extendtab[0][0][0];
+ p++)
+ *p = CODE_FOR_nothing;
#ifdef HAVE_extendditi2
if (HAVE_extendditi2)
- sign_extend_codes[(int) TImode][(int) DImode] = CODE_FOR_extendditi2;
+ extendtab[(int) TImode][(int) DImode][0] = CODE_FOR_extendditi2;
#endif
#ifdef HAVE_extendsiti2
if (HAVE_extendsiti2)
- sign_extend_codes[(int) TImode][(int) SImode] = CODE_FOR_extendsiti2;
+ extendtab[(int) TImode][(int) SImode][0] = CODE_FOR_extendsiti2;
#endif
#ifdef HAVE_extendhiti2
if (HAVE_extendhiti2)
- sign_extend_codes[(int) TImode][(int) HImode] = CODE_FOR_extendhiti2;
+ extendtab[(int) TImode][(int) HImode][0] = CODE_FOR_extendhiti2;
#endif
#ifdef HAVE_extendqiti2
if (HAVE_extendqiti2)
- sign_extend_codes[(int) TImode][(int) QImode] = CODE_FOR_extendqiti2;
+ extendtab[(int) TImode][(int) QImode][0] = CODE_FOR_extendqiti2;
#endif
#ifdef HAVE_extendsidi2
if (HAVE_extendsidi2)
- sign_extend_codes[(int) DImode][(int) SImode] = CODE_FOR_extendsidi2;
+ extendtab[(int) DImode][(int) SImode][0] = CODE_FOR_extendsidi2;
#endif
#ifdef HAVE_extendhidi2
if (HAVE_extendhidi2)
- sign_extend_codes[(int) DImode][(int) HImode] = CODE_FOR_extendhidi2;
+ extendtab[(int) DImode][(int) HImode][0] = CODE_FOR_extendhidi2;
#endif
#ifdef HAVE_extendqidi2
if (HAVE_extendqidi2)
- sign_extend_codes[(int) DImode][(int) QImode] = CODE_FOR_extendqidi2;
+ extendtab[(int) DImode][(int) QImode][0] = CODE_FOR_extendqidi2;
#endif
#ifdef HAVE_extendhisi2
if (HAVE_extendhisi2)
- sign_extend_codes[(int) SImode][(int) HImode] = CODE_FOR_extendhisi2;
+ extendtab[(int) SImode][(int) HImode][0] = CODE_FOR_extendhisi2;
#endif
#ifdef HAVE_extendqisi2
if (HAVE_extendqisi2)
- sign_extend_codes[(int) SImode][(int) QImode] = CODE_FOR_extendqisi2;
+ extendtab[(int) SImode][(int) QImode][0] = CODE_FOR_extendqisi2;
#endif
#ifdef HAVE_extendqihi2
if (HAVE_extendqihi2)
- sign_extend_codes[(int) HImode][(int) QImode] = CODE_FOR_extendqihi2;
+ extendtab[(int) HImode][(int) QImode][0] = CODE_FOR_extendqihi2;
#endif
#ifdef HAVE_zero_extendditi2
if (HAVE_zero_extendsiti2)
- zero_extend_codes[(int) TImode][(int) DImode] = CODE_FOR_zero_extendditi2;
+ extendtab[(int) TImode][(int) DImode][1] = CODE_FOR_zero_extendditi2;
#endif
#ifdef HAVE_zero_extendsiti2
if (HAVE_zero_extendsiti2)
- zero_extend_codes[(int) TImode][(int) SImode] = CODE_FOR_zero_extendsiti2;
+ extendtab[(int) TImode][(int) SImode][1] = CODE_FOR_zero_extendsiti2;
#endif
#ifdef HAVE_zero_extendhiti2
if (HAVE_zero_extendhiti2)
- zero_extend_codes[(int) TImode][(int) HImode] = CODE_FOR_zero_extendhiti2;
+ extendtab[(int) TImode][(int) HImode][1] = CODE_FOR_zero_extendhiti2;
#endif
#ifdef HAVE_zero_extendqiti2
if (HAVE_zero_extendqiti2)
- zero_extend_codes[(int) TImode][(int) QImode] = CODE_FOR_zero_extendqiti2;
+ extendtab[(int) TImode][(int) QImode][1] = CODE_FOR_zero_extendqiti2;
#endif
#ifdef HAVE_zero_extendsidi2
if (HAVE_zero_extendsidi2)
- zero_extend_codes[(int) DImode][(int) SImode] = CODE_FOR_zero_extendsidi2;
+ extendtab[(int) DImode][(int) SImode][1] = CODE_FOR_zero_extendsidi2;
#endif
#ifdef HAVE_zero_extendhidi2
if (HAVE_zero_extendhidi2)
- zero_extend_codes[(int) DImode][(int) HImode] = CODE_FOR_zero_extendhidi2;
+ extendtab[(int) DImode][(int) HImode][1] = CODE_FOR_zero_extendhidi2;
#endif
#ifdef HAVE_zero_extendqidi2
if (HAVE_zero_extendqidi2)
- zero_extend_codes[(int) DImode][(int) QImode] = CODE_FOR_zero_extendqidi2;
+ extendtab[(int) DImode][(int) QImode][1] = CODE_FOR_zero_extendqidi2;
#endif
#ifdef HAVE_zero_extendhisi2
if (HAVE_zero_extendhisi2)
- zero_extend_codes[(int) SImode][(int) HImode] = CODE_FOR_zero_extendhisi2;
+ extendtab[(int) SImode][(int) HImode][1] = CODE_FOR_zero_extendhisi2;
#endif
#ifdef HAVE_zero_extendqisi2
if (HAVE_zero_extendqisi2)
- zero_extend_codes[(int) SImode][(int) QImode] = CODE_FOR_zero_extendqisi2;
+ extendtab[(int) SImode][(int) QImode][1] = CODE_FOR_zero_extendqisi2;
#endif
#ifdef HAVE_zero_extendqihi2
if (HAVE_zero_extendqihi2)
- zero_extend_codes[(int) HImode][(int) QImode] = CODE_FOR_zero_extendqihi2;
+ extendtab[(int) HImode][(int) QImode][1] = CODE_FOR_zero_extendqihi2;
#endif
}
@@ -2421,7 +2402,7 @@ init_floattab ()
}
/* Generate code to convert FROM to floating point
- and store in TO. FROM must be fixed point.
+ and store in TO. FROM must be fixed point and not VOIDmode.
UNSIGNEDP nonzero means regard FROM as unsigned.
Normally this is done by correcting the final value
if it is negative. */
@@ -2435,6 +2416,10 @@ expand_float (to, from, unsignedp)
register rtx target = to;
enum machine_mode fmode, imode;
+ /* Crash now, because we won't be able to decide which mode to use. */
+ if (GET_MODE (from) == VOIDmode)
+ abort ();
+
/* Look for an insn to do the conversion. Do it in the specified
modes if possible; otherwise convert either input, output or both to
wider mode. If the integer mode is wider than the mode of FROM,
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index ff5aacb..50983a9 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1,5 +1,5 @@
/* Prints out tree in human readable form - GNU C-compiler
- Copyright (C) 1990 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of GNU CC.
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 5d4e3f1..b74c3d4 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -2,7 +2,7 @@
and Computer Technology Corporation (MCC). The author's current
E-mail address is <rfg@ncd.com>.
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -34,29 +34,28 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define VOLATILE
#endif
-/* It is incorrect to include config.h here, because this file is being
- compiled for the target, and hence definitions concerning only the host
- do not apply. Instead we include tconfig.h, which is the xm file
- *for the target*, which also includes the tm.h file *for the target*.
- This way, we get definitions of POSIX, USG and VMS for the target. */
+#ifndef __STDC__
+#define const
+#endif
-#include "tconfig.h"
+#include "config.h"
-/* The documentation says to use TARGET_POSIX, so check for it as well
- as POSIX. */
-#if defined(TARGET_POSIX) && !defined(POSIX)
-#define POSIX
+#ifdef POSIX /* We should be able to define _POSIX_SOURCE unconditionally,
+ but some systems respond in buggy ways to it,
+ including Sunos 4.1.1. Which we don't classify as POSIX. */
+/* In case this is a POSIX system with an ANSI C compiler,
+ ask for definition of all POSIX facilities. */
+#define _POSIX_SOURCE
#endif
+#if 0
+/* Users are not supposed to use _POSIX_SOURCE to say the
+ system is a POSIX system. That is not what _POSIX_SOURCE means! -- rms */
/* If the user asked for POSIX via _POSIX_SOURCE, turn on POSIX code. */
#if defined(_POSIX_SOURCE) && !defined(POSIX)
#define POSIX
#endif
-
-/* On a POSIX system, request definition of all the POSIX facilities. */
-#if defined(POSIX) && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
+#endif /* 0 */
#include <stdio.h>
#include <ctype.h>
@@ -64,14 +63,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/dir.h>
+#if ! defined (USG) || defined (SVR4)
#include <sys/wait.h>
+#endif
#include <setjmp.h>
#include "gvarargs.h"
#include "getopt.h"
#ifndef PATH_MAX /* <limits.h> defines this on most POSIX systems. */
#include <sys/param.h>
-#define PATH_MAX MAXPATHLEN
/* Sometimes <sys/param.h> defines these macros. */
#undef CHAR_BIT
#undef CHAR_MAX
@@ -95,14 +95,6 @@ extern int errno;
extern char *sys_errlist[];
extern char *version_string;
-#if defined(POSIX)
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-
/* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
with POSIX 1003.1-1990), e.g. Ultrix 4.2, might not have
const qualifiers in the prototypes in the system include files.
@@ -110,17 +102,39 @@ extern char *version_string;
calls to the following functions. To eliminate these warnings we
provide the following #defines. */
-#if (_POSIX_VERSION < 199009)
+#define my_access(file,flag) access((char *)file, flag)
+#define my_stat(file,pkt) stat((char *)file, pkt)
+#define my_execvp(prog,argv) execvp((char *)prog, (char **)argv)
+#define my_link(file1, file2) link((char *)file1, (char *)file2)
+#define my_unlink(file) unlink((char *)file)
+#define my_open(file, mode, flag) open((char *)file, mode, flag)
+#define my_chmod(file, mode) chmod((char *)file, mode)
+
+#if !(defined (USG) || defined (VMS) || defined (POSIX))
+#define GUESSPATHLEN (MAXPATHLEN + 1)
+#else /* (defined (USG) || defined (VMS) || defined (POSIX)) */
+/* We actually use this as a starting point, not a limit. */
+#define GUESSPATHLEN 200
+#endif /* (defined (USG) || defined (VMS) || defined (POSIX)) */
-#define access(file,flag) access((char *)file, flag)
-#define stat(file,pkt) stat((char *)file, pkt)
-#define execvp(prog,argv) execvp((char *)prog, (char **)argv)
-#define link(file1, file2) link((char *)file1, (char *)file2)
-#define unlink(file) unlink((char *)file)
-#define open(file, mode, flag) open((char *)file, mode, flag)
-#define chmod(file, mode) chmod((char *)file, mode)
+/* Aliases for pointers to void.
+ These were made to facilitate compilation with other compilers. */
-#endif /* (_POSIX_VERSION < 199009) */
+#ifdef __STDC__
+typedef void * pointer_type;
+typedef const void * const_pointer_type;
+#else
+typedef char * pointer_type;
+typedef char * const_pointer_type;
+#endif
+
+#if defined(POSIX)
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <string.h>
#else /* !defined(POSIX) */
@@ -137,61 +151,58 @@ extern char *version_string;
the few exceptions to the general rule here. */
#if !(defined (USG) || defined (VMS))
-extern char *getwd (char *);
+extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#else /* (defined (USG) || defined (VMS)) */
-extern char *getcwd (char *, size_t);
+extern char *getcwd ();
#endif /* (defined (USG) || defined (VMS)) */
/* Declaring stat or __flsbuf with a prototype
causes conflicts with system headers on some systems. */
#ifndef abort
-extern VOLATILE void abort (void);
+extern VOLATILE void abort ();
#endif
-extern int kill(int, int);
-extern int creat (const char *, int);
-extern int open (const char *, int, ...);
+extern int kill();
+extern int creat ();
#if 0 /* These conflict with stdio.h on some systems. */
extern int fprintf (FILE *, const char *, ...);
extern int printf (const char *, ...);
#endif /* 0 */
-extern void exit (int);
-extern void *malloc (size_t);
-extern void *realloc (void *, size_t);
-extern void free (void *);
-extern int read (int, void *, size_t);
-extern int write (int, const void *, size_t);
-extern int close (int);
-extern int link (const char *, const char *);
-extern int unlink (const char *);
-extern int fflush (FILE *);
-extern int atoi (const char *);
-extern int access (const char *, int);
-extern int puts (const char *);
-extern int fputs (const char *, FILE *);
-extern int fputc (int, FILE *);
-extern int execvp (const char *, char *const *);
-extern int setjmp (jmp_buf);
-extern void longjmp (jmp_buf, int);
-
-extern char * strcat(char *, const char *);
-extern int strcmp(const char *, const char *);
-extern char * strcpy(char *, const char *);
+extern void exit ();
+extern pointer_type malloc ();
+extern pointer_type realloc ();
+extern void free ();
+extern int read ();
+extern int write ();
+extern int close ();
+extern int fflush ();
+extern int atoi ();
+extern int puts ();
+extern int fputs ();
+extern int fputc ();
+#if 0 /* Causes trouble on some systems that define setjmp as a macro. */
+extern int setjmp ();
+extern void longjmp ();
+#endif
+
+extern char * strcat();
+extern int strcmp();
+extern char * strcpy();
#if 0 /* size_t from sys/types.h may fail to match GCC.
If so, we would get a warning from this.
So do without the prototype. */
extern size_t strlen(const char *);
#endif
-extern int strncmp(const char *, const char *, size_t);
-extern char * strncpy(char *, const char *, size_t);
-extern char * strrchr(const char *, int);
+extern int strncmp();
+extern char * strncpy();
+extern char * strrchr();
#if !(defined (USG) || defined (VMS))
-extern int vfork (void);
+extern int vfork ();
#define fork vfork
#else
-extern int fork (void);
+extern int fork ();
#endif /* !(defined (USG) || defined (VMS)) */
#endif /* !defined(POSIX) */
@@ -200,15 +211,13 @@ extern int fork (void);
#define NONCONST
-/* Aliases for pointers to void.
- These were made to facilitate compilation with other compilers. */
-
-typedef void * pointer_type;
-typedef const void * const_pointer_type;
-
-/* Define a STRINGIFY macro that's right for ANSI C. */
+/* Define a STRINGIFY macro that's right for ANSI or traditional C. */
+#ifdef __STDC__
#define STRINGIFY(STRING) #STRING
+#else
+#define STRINGIFY(STRING) "STRING"
+#endif
/* POSIX systems will not have definitions for WIFEXITED or WEXITSTATUS.
Define them correctly and so that they work for all environments. */
@@ -471,22 +480,22 @@ static int errors = 0;
/* ??? These comments should say what the flag mean as well as the options
that set them. */
-static int version_flag = 0; /* set by -V option */
-static int quiet_flag = 0; /* set by -q option */
-#if 0
-static int force_flag = 0; /* set by -f option */
-#endif
-static int nochange_flag = 0; /* set by -n option */
-static int nosave_flag = 0; /* set by -N option */
-static int keep_flag = 0; /* set by -k option */
-static const char ** compile_params = 0; /* set by -c option */
+static int version_flag = 0; /* Print our version number. */
+static int quiet_flag = 0; /* Don't print messages normally. */
+static int nochange_flag = 0; /* Don't convert, just say what files
+ we would have converted. */
+static int nosave_flag = 0; /* Don't save the old version. */
+static int keep_flag = 0; /* Don't delete the .X files. */
+static const char ** compile_params = 0; /* Option string for gcc. */
#ifdef UNPROTOIZE
-static const char *indent_string = " "; /* set by -i option */
+static const char *indent_string = " "; /* Indentation for newly
+ inserted parm decls. */
#else /* !defined(UNPROTOIZE) */
-static int local_flag = 0; /* set by -l option */
+static int local_flag = 0; /* Insert new local decls (when?). */
static int global_flag = 0; /* set by -g option */
-static int cplusplus_flag = 0; /* set by -C option */
-static const char* nondefault_syscalls_dir = 0; /* set by -B option */
+static int cplusplus_flag = 0; /* Rename converted files to *.C. */
+static const char* nondefault_syscalls_dir = 0; /* Dir to look for
+ SYSCALLS.c.X in. */
#endif /* !defined(UNPROTOIZE) */
/* An index into the compile_params array where we should insert the filename
@@ -602,16 +611,18 @@ static char * saved_repl_write_ptr;
/* Forward declaration. */
-static const char *shortpath (const char *cwd, const char *filename);
+static const char *shortpath ();
/* Allocate some space, but check that the allocation was successful. */
static pointer_type
-xmalloc (size_t byte_count)
+xmalloc (byte_count)
+ size_t byte_count;
{
pointer_type rv;
- if ((rv = malloc (byte_count)) == NULL)
+ rv = malloc (byte_count);
+ if (rv == NULL)
{
fprintf (stderr, "\n%s: fatal error: can't allocate %u more bytes of memory\n",
pname, byte_count);
@@ -625,11 +636,14 @@ xmalloc (size_t byte_count)
/* Reallocate some space, but check that the reallocation was successful. */
static pointer_type
-xrealloc (pointer_type old_space, size_t byte_count)
+xrealloc (old_space, byte_count)
+ pointer_type old_space;
+ size_t byte_count;
{
pointer_type rv;
- if ((rv = realloc (old_space, byte_count)) == NULL)
+ rv = realloc (old_space, byte_count);
+ if (rv == NULL)
{
fprintf (stderr, "\n%s: fatal error: can't allocate %u more bytes of memory\n",
pname, byte_count);
@@ -645,7 +659,8 @@ xrealloc (pointer_type old_space, size_t byte_count)
is non-null. */
static void
-xfree (const_pointer_type p)
+xfree (p)
+ const_pointer_type p;
{
if (p)
free ((NONCONST pointer_type) p);
@@ -654,7 +669,9 @@ xfree (const_pointer_type p)
/* Make a copy of a string INPUT with size SIZE. */
static char *
-savestring (const char *input, int size)
+savestring (input, size)
+ const char *input;
+ int size;
{
char *output = (char *) xmalloc (size + 1);
strcpy (output, input);
@@ -674,7 +691,8 @@ fancy_abort ()
/* Make a duplicate of a given string in a newly allocated area. */
static char *
-dupstr (const char *s)
+dupstr (s)
+ const char *s;
{
return strcpy ((char *) xmalloc (strlen (s) + 1), s);
}
@@ -683,7 +701,9 @@ dupstr (const char *s)
allocated area. */
static char *
-dupnstr (const char *s, size_t n)
+dupnstr (s, n)
+ const char *s;
+ size_t n;
{
char *ret_val = strncpy ((char *) xmalloc (n + 1), s, n);
@@ -695,7 +715,9 @@ dupnstr (const char *s, size_t n)
does not occur within s1. Assume neither s1 nor s2 are null pointers. */
static const char *
-substr (const char *s1, const char *const s2)
+substr (s1, s2)
+ const char *s1;
+ const char *const s2;
{
for (; *s1 ; s1++)
{
@@ -716,7 +738,7 @@ outer:
/* Get setup to recover in case the edit we are about to do goes awry. */
void
-save_pointers (void)
+save_pointers ()
{
saved_clean_read_ptr = clean_read_ptr;
saved_repl_write_ptr = repl_write_ptr;
@@ -726,7 +748,7 @@ save_pointers (void)
too confusing in the source code we are trying to edit. */
void
-restore_pointers (void)
+restore_pointers ()
{
clean_read_ptr = saved_clean_read_ptr;
repl_write_ptr = saved_repl_write_ptr;
@@ -734,8 +756,9 @@ restore_pointers (void)
/* Return true if the given character is a legal identifier character. */
-inline static int
-is_id_char (char ch)
+static int
+is_id_char (ch)
+ char ch;
{
return (isalnum (ch) || (ch == '_') || (ch == '$'));
}
@@ -744,7 +767,7 @@ is_id_char (char ch)
exit with non-zero status. */
static void
-usage (void)
+usage ()
{
#ifdef UNPROTOIZE
fprintf (stderr, "%s: usage '%s [ -VqfnkN ] [ -i <istring> ] [ filename ... ]'\n",
@@ -761,7 +784,8 @@ usage (void)
include directories. */
static int
-in_system_include_dir (const char *path)
+in_system_include_dir (path)
+ const char *path;
{
struct default_include *p;
@@ -785,7 +809,7 @@ file_could_be_converted (const char *path)
{
char *const dir_name = (char *) alloca (strlen (path) + 1);
- if (access (path, R_OK))
+ if (my_access (path, R_OK))
return 0;
{
@@ -799,7 +823,7 @@ file_could_be_converted (const char *path)
abort (); /* Should have been an absolutized filename. */
}
- if (access (path, W_OK))
+ if (my_access (path, W_OK))
return 0;
return 1;
@@ -833,7 +857,7 @@ file_normally_convertable (const char *path)
abort (); /* Should have been an absolutized filename. */
}
- if (access (path, R_OK))
+ if (my_access (path, R_OK))
{
if (!quiet_flag)
fprintf (stderr, "%s: warning: no read access for file `%s'\n",
@@ -841,7 +865,7 @@ file_normally_convertable (const char *path)
return 0;
}
- if (access (path, W_OK))
+ if (my_access (path, W_OK))
{
if (!quiet_flag)
fprintf (stderr, "%s: warning: no write access for file `%s'\n",
@@ -849,7 +873,7 @@ file_normally_convertable (const char *path)
return 0;
}
- if (access (dir_name, W_OK))
+ if (my_access (dir_name, W_OK))
{
if (!quiet_flag)
fprintf (stderr, "%s: warning: no write access for dir containing `%s'\n",
@@ -867,7 +891,8 @@ file_normally_convertable (const char *path)
file. Return false otherwise. */
static int
-is_syscalls_file (const file_info *fi_p)
+is_syscalls_file (fi_p)
+ const file_info *fi_p;
{
return (substr (fi_p->hash_entry->symbol, syscalls_filename) != NULL);
}
@@ -884,7 +909,8 @@ is_syscalls_file (const file_info *fi_p)
by connect_defs_and_decs(). */
static int
-needs_to_be_converted (const file_info *file_p)
+needs_to_be_converted (file_p)
+ const file_info *file_p;
{
const def_dec_info *ddp;
@@ -922,7 +948,8 @@ needs_to_be_converted (const file_info *file_p)
that should be converted. */
static int
-directory_specified_p (const char *name)
+directory_specified_p (name)
+ const char *name;
{
struct string_list *p;
@@ -937,7 +964,8 @@ directory_specified_p (const char *name)
/* Return 1 if the file named NAME should be excluded from conversion. */
static int
-file_excluded_p (const char *name)
+file_excluded_p (name)
+ const char *name;
{
struct string_list *p;
int len = strlen (name);
@@ -954,9 +982,13 @@ file_excluded_p (const char *name)
STRING is the new element value, and REST holds the remaining elements. */
static struct string_list *
-string_list_cons (char *string, struct string_list *rest)
+string_list_cons (string, rest)
+ char *string;
+ struct string_list *rest;
{
- struct string_list *temp = xmalloc (sizeof (struct string_list));
+ struct string_list *temp
+ = (struct string_list *) xmalloc (sizeof (struct string_list));
+
temp->next = rest;
temp->name = string;
return temp;
@@ -972,7 +1004,9 @@ string_list_cons (char *string, struct string_list *rest)
argument. */
static void
-visit_each_hash_node (const hash_table_entry *hash_tab_p, void (*func) (const hash_table_entry *))
+visit_each_hash_node (hash_tab_p, func)
+ const hash_table_entry *hash_tab_p;
+ void (*func)();
{
const hash_table_entry *primary;
@@ -993,7 +1027,9 @@ visit_each_hash_node (const hash_table_entry *hash_tab_p, void (*func) (const ha
called. */
static hash_table_entry *
-add_symbol (hash_table_entry *p, const char *s)
+add_symbol (p, s)
+ hash_table_entry *p;
+ const char *s;
{
p->hash_next = NULL;
p->symbol = dupstr (s);
@@ -1008,7 +1044,9 @@ add_symbol (hash_table_entry *p, const char *s)
hash table entry for the given name. */
static hash_table_entry *
-lookup (hash_table_entry *hash_tab_p, const char *search_symbol)
+lookup (hash_tab_p, search_symbol)
+ hash_table_entry *hash_tab_p;
+ const char *search_symbol;
{
int hash_value = 0;
const char *search_symbol_char_p = search_symbol;
@@ -1038,8 +1076,9 @@ lookup (hash_table_entry *hash_tab_p, const char *search_symbol)
Also, since we are not using this record anymore, free up all of the
stuff it pointed to. */
-inline static void
-free_def_dec (def_dec_info *p)
+static void
+free_def_dec (p)
+ def_dec_info *p;
{
xfree (p->ansi_decl);
@@ -1065,7 +1104,8 @@ free_def_dec (def_dec_info *p)
return a pointer to the unexpanded copy. Otherwise return NULL. */
static char *
-unexpand_if_needed (const char *aux_info_line)
+unexpand_if_needed (aux_info_line)
+ const char *aux_info_line;
{
static char *line_buf = 0;
static int line_buf_size = 0;
@@ -1147,7 +1187,9 @@ continue_outer: ;
NULL. */
static char *
-abspath (const char *cwd, const char *rel_filename)
+abspath (cwd, rel_filename)
+ const char *cwd;
+ const char *rel_filename;
{
/* Setup the current working directory as needed. */
const char *cwd2 = (cwd) ? cwd : cwd_buffer;
@@ -1250,7 +1292,9 @@ abspath (const char *cwd, const char *rel_filename)
subpart of the original filename is actually a symbolic link. */
static const char *
-shortpath (const char *cwd, const char *filename)
+shortpath (cwd, filename)
+ const char *cwd;
+ const char *filename;
{
char *rel_buffer;
char *rel_buf_p;
@@ -1302,12 +1346,10 @@ shortpath (const char *cwd, const char *filename)
--rel_buf_p;
if (*(rel_buf_p-1) == '/')
*--rel_buf_p = '\0';
- if (strlen (rel_buffer) > strlen (filename))
+ if (strlen (rel_buffer) > (unsigned) strlen (filename))
strcpy (rel_buffer, filename);
return rel_buffer;
}
- /* NOTREACHED */
- return 0; /* Prevent warnings for old versions of GCC. */
}
/* Lookup the given filename in the hash table for filenames. If it is a
@@ -1316,7 +1358,9 @@ shortpath (const char *cwd, const char *filename)
that record with some reasonable values. */
static file_info *
-find_file (char *filename, int do_not_stat)
+find_file (filename, do_not_stat)
+ char *filename;
+ int do_not_stat;
/* FILENAME was const, but that causes a warning on AIX when calling stat.
That is probably a bug in AIX, but might as well avoid the warning. */
{
@@ -1337,7 +1381,7 @@ find_file (char *filename, int do_not_stat)
stat_buf.st_mtime = (time_t) 0;
else
{
- if (stat (filename, &stat_buf) == -1)
+ if (my_stat (filename, &stat_buf) == -1)
{
fprintf (stderr, "%s: error: can't get status of `%s': %s\n",
pname, shortpath (NULL, filename), sys_errlist[errno]);
@@ -1357,7 +1401,7 @@ find_file (char *filename, int do_not_stat)
messed up. */
static void
-aux_info_corrupted (void)
+aux_info_corrupted ()
{
fprintf (stderr, "\n%s: fatal error: aux info file corrupted at line %d\n",
pname, current_aux_info_lineno);
@@ -1367,8 +1411,9 @@ aux_info_corrupted (void)
/* ??? This comment is vague. Say what the condition is for. */
/* Check to see that a condition is true. This is kind of like an assert(). */
-inline static void
-check_aux_info (int cond)
+static void
+check_aux_info (cond)
+ int cond;
{
if (! cond)
aux_info_corrupted ();
@@ -1379,7 +1424,8 @@ check_aux_info (int cond)
return a pointer to it. */
static const char *
-find_corresponding_lparen (const char *p)
+find_corresponding_lparen (p)
+ const char *p;
{
const char *q;
int paren_depth;
@@ -1405,7 +1451,9 @@ find_corresponding_lparen (const char *p)
file was created. If so, return non-zero, else return zero. */
static int
-referenced_file_is_newer (const char *l, time_t aux_info_mtime)
+referenced_file_is_newer (l, aux_info_mtime)
+ const char *l;
+ time_t aux_info_mtime;
{
const char *p;
file_info *fi_p;
@@ -1451,7 +1499,9 @@ referenced_file_is_newer (const char *l, time_t aux_info_mtime)
pertaining to this particular function name. */
static void
-save_def_or_dec (const char *l, int is_syscalls)
+save_def_or_dec (l, is_syscalls)
+ const char *l;
+ int is_syscalls;
{
const char *p;
const char *semicolon_p;
@@ -1638,7 +1688,7 @@ save_def_or_dec (const char *l, int is_syscalls)
/* p now points to the leftmost character of the function name. */
{
- char fn_string[past_fn - p + 1];
+ char *fn_string = (char *) alloca (past_fn - p + 1);
strncpy (fn_string, p, (size_t) (past_fn - p));
fn_string[past_fn-p] = '\0';
@@ -1827,9 +1877,10 @@ save_def_or_dec (const char *l, int is_syscalls)
adding a final group of options like '-fgen-aux-info -S -o /dev/null'. */
static void
-munge_compile_params (const char *params_list)
+munge_compile_params (params_list)
+ const char *params_list;
{
- const char *temp_params[strlen (params_list) + 10];
+ char **temp_params = (char **) alloca (strlen (params_list) + 10);
int param_count = 0;
const char *param;
@@ -1881,7 +1932,8 @@ munge_compile_params (const char *params_list)
/* Make a copy of the compile_params in heap space. */
- compile_params = xmalloc (sizeof (char *) * (param_count+1));
+ compile_params
+ = (char **) xmalloc (sizeof (char *) * (param_count+1));
memcpy (compile_params, temp_params, sizeof (char *) * param_count);
}
@@ -1889,7 +1941,8 @@ munge_compile_params (const char *params_list)
file to go with a specific base source file. */
static int
-gen_aux_info_file (const char *base_filename)
+gen_aux_info_file (base_filename)
+ const char *base_filename;
{
int child_pid;
@@ -1948,7 +2001,7 @@ gen_aux_info_file (const char *base_filename)
}
else
{
- if (execvp (compile_params[0], (char *const *) compile_params))
+ if (my_execvp (compile_params[0], (char *const *) compile_params))
{
fprintf (stderr, "%s: error: execvp returned: %s\n",
pname, sys_errlist[errno]);
@@ -1962,7 +2015,10 @@ gen_aux_info_file (const char *base_filename)
Save all of the important stuff for later. */
static void
-process_aux_info_file (const char *base_source_filename, int keep_it, int is_syscalls)
+process_aux_info_file (base_source_filename, keep_it, is_syscalls)
+ const char *base_source_filename;
+ int keep_it;
+ int is_syscalls;
{
char *const aux_info_filename
= (char *) alloca (strlen (base_source_filename)
@@ -1987,7 +2043,7 @@ start_over: ;
int retries = 0;
retry:
- if (access (aux_info_filename, R_OK) == -1)
+ if (my_access (aux_info_filename, R_OK) == -1)
{
if (errno == ENOENT && retries == 0)
{
@@ -2018,7 +2074,7 @@ retry:
/* Get some status information about this aux_info file. */
- if (stat (aux_info_filename, &stat_buf) == -1)
+ if (my_stat (aux_info_filename, &stat_buf) == -1)
{
fprintf (stderr, "%s: error: can't get status of aux info file `%s': %s\n",
pname, shortpath (NULL, aux_info_filename),
@@ -2045,7 +2101,7 @@ retry:
/* Open the aux_info file. */
- if ((aux_info_file = open (aux_info_filename, O_RDONLY, 0444 )) == -1)
+ if ((aux_info_file = my_open (aux_info_filename, O_RDONLY, 0444 )) == -1)
{
fprintf (stderr, "%s: error: can't open aux info file `%s' for reading: %s\n",
pname, shortpath (NULL, aux_info_filename),
@@ -2088,7 +2144,7 @@ retry:
fails for some reason, don't even worry about it. */
if (!keep_it)
- if (unlink (aux_info_filename) == -1)
+ if (my_unlink (aux_info_filename) == -1)
fprintf (stderr, "%s: error: can't delete aux info file `%s': %s\n",
pname, shortpath (NULL, aux_info_filename),
sys_errlist[errno]);
@@ -2136,7 +2192,7 @@ retry:
if (referenced_file_is_newer (aux_info_p, aux_info_mtime))
{
free (aux_info_base);
- if (unlink (aux_info_filename) == -1)
+ if (my_unlink (aux_info_filename) == -1)
{
fprintf (stderr, "%s: error: can't delete file `%s': %s\n",
pname, shortpath (NULL, aux_info_filename),
@@ -2191,7 +2247,8 @@ retry:
function implements the -C option. */
static void
-rename_c_file (const hash_table_entry *hp)
+rename_c_file (hp)
+ const hash_table_entry *hp;
{
const char *filename = hp->symbol;
int last_char_index = strlen (filename) - 1;
@@ -2209,7 +2266,7 @@ rename_c_file (const hash_table_entry *hp)
strcpy (new_filename, filename);
new_filename[last_char_index] = 'C';
- if (link (filename, new_filename) == -1)
+ if (my_link (filename, new_filename) == -1)
{
fprintf (stderr, "%s: warning: can't link file `%s' to `%s': %s\n",
pname, shortpath (NULL, filename),
@@ -2218,7 +2275,7 @@ rename_c_file (const hash_table_entry *hp)
return;
}
- if (unlink (filename) == -1)
+ if (my_unlink (filename) == -1)
{
fprintf (stderr, "%s: warning: can't delete file `%s': %s\n",
pname, shortpath (NULL, filename), sys_errlist[errno]);
@@ -2238,7 +2295,8 @@ rename_c_file (const hash_table_entry *hp)
order here. */
static void
-reverse_def_dec_list (const hash_table_entry *hp)
+reverse_def_dec_list (hp)
+ const hash_table_entry *hp;
{
file_info *file_p = hp->fip;
const def_dec_info *prev = NULL;
@@ -2279,7 +2337,9 @@ reverse_def_dec_list (const hash_table_entry *hp)
contains all of the correct prototypes for system functions. */
static const def_dec_info *
-find_extern_def (const def_dec_info *head, const def_dec_info *user)
+find_extern_def (head, user)
+ const def_dec_info *head;
+ const def_dec_info *user;
{
const def_dec_info *dd_p;
const def_dec_info *extern_def_p = NULL;
@@ -2408,13 +2468,13 @@ find_extern_def (const def_dec_info *head, const def_dec_info *user)
{
/* Why copy this string into `needed' at all?
Why not just use user->ansi_decl without copying? */
- char needed[strlen (user->ansi_decl) + 1];
+ char *needed = (char *) alloca (strlen (user->ansi_decl) + 1);
char *p;
strcpy (needed, user->ansi_decl);
p = (NONCONST char *) substr (needed, user->hash_entry->symbol)
+ strlen (user->hash_entry->symbol) + 2;
- strcpy (p, "???);");
+ strcpy (p, "??\?);");
fprintf (stderr, "%s: %d: `%s' used but missing from SYSCALLS\n",
shortpath (NULL, file), user->line,
@@ -2434,7 +2494,8 @@ find_extern_def (const def_dec_info *head, const def_dec_info *user)
from the def_dec_info record pointer which is passed in. */
static const def_dec_info *
-find_static_definition (const def_dec_info *user)
+find_static_definition (user)
+ const def_dec_info *user;
{
const def_dec_info *head = user->hash_entry->ddip;
const def_dec_info *dd_p;
@@ -2483,7 +2544,8 @@ find_static_definition (const def_dec_info *user)
more details. */
static void
-connect_defs_and_decs (const hash_table_entry *hp)
+connect_defs_and_decs (hp)
+ const hash_table_entry *hp;
{
const def_dec_info *dd_p;
const def_dec_info *extern_def_p = NULL;
@@ -2607,7 +2669,8 @@ connect_defs_and_decs (const hash_table_entry *hp)
original source line number that the given pointer points into. */
static int
-identify_lineno (const char *clean_p)
+identify_lineno (clean_p)
+ const char *clean_p;
{
int line_num = 1;
const char *scan_p;
@@ -2621,7 +2684,8 @@ identify_lineno (const char *clean_p)
/* Issue an error message and give up on doing this particular edit. */
static void
-declare_source_confusing (const char *clean_p)
+declare_source_confusing (clean_p)
+ const char *clean_p;
{
if (!quiet_flag)
{
@@ -2640,8 +2704,10 @@ declare_source_confusing (const char *clean_p)
code is in fact true. If not, issue an error message and give up on
converting this particular source file. */
-inline static void
-check_source (int cond, const char *clean_p)
+static void
+check_source (cond, clean_p)
+ int cond;
+ const char *clean_p;
{
if (!cond)
declare_source_confusing (clean_p);
@@ -2663,7 +2729,8 @@ check_source (int cond, const char *clean_p)
of the in-core cleaned buffer again. */
static const char *
-seek_to_line (int n)
+seek_to_line (n)
+ int n;
{
if (n < last_known_line_number)
abort ();
@@ -2682,7 +2749,8 @@ seek_to_line (int n)
to the next non-whitepace character which follows it. */
static const char *
-forward_to_next_token_char (const char *ptr)
+forward_to_next_token_char (ptr)
+ const char *ptr;
{
for (++ptr; isspace (*ptr); check_source (++ptr < clean_text_limit, 0))
continue;
@@ -2694,7 +2762,9 @@ forward_to_next_token_char (const char *ptr)
buffer ultimately go through here. */
static void
-output_bytes (const char *str, size_t len)
+output_bytes (str, len)
+ const char *str;
+ size_t len;
{
if ((repl_write_ptr + 1) + len >= repl_text_limit)
{
@@ -2713,7 +2783,8 @@ output_bytes (const char *str, size_t len)
the current output buffer. */
static void
-output_string (const char *str)
+output_string (str)
+ const char *str;
{
output_bytes (str, strlen (str));
}
@@ -2738,7 +2809,8 @@ output_string (const char *str)
byte pointed to by the argument pointer `p'. */
static void
-output_up_to (const char *p)
+output_up_to (p)
+ const char *p;
{
size_t copy_length = (size_t) (p - clean_read_ptr);
const char *copy_start = orig_text_base+(clean_read_ptr-clean_text_base)+1;
@@ -2757,7 +2829,8 @@ output_up_to (const char *p)
otherwise. */
static int
-other_variable_style_function (const char *ansi_header)
+other_variable_style_function (ansi_header)
+ const char *ansi_header;
{
#ifdef UNPROTOIZE
@@ -2795,8 +2868,9 @@ other_variable_style_function (const char *ansi_header)
below. */
static void
-edit_fn_declaration (const def_dec_info *def_dec_p,
- const char *volatile clean_text_p)
+edit_fn_declaration (def_dec_p, clean_text_p)
+ const def_dec_info *def_dec_p;
+ const char *VOLATILE clean_text_p;
{
const char *start_formals;
const char *end_formals;
@@ -3010,7 +3084,10 @@ edit_fn_declaration (const def_dec_info *def_dec_p,
function doesn't match the one expected). */
static int
-edit_formals_lists (const char *end_formals, unsigned f_list_count, const def_dec_info *def_dec_p)
+edit_formals_lists (end_formals, f_list_count, def_dec_p)
+ const char *end_formals;
+ unsigned int f_list_count;
+ const def_dec_info *def_dec_p;
{
const char *start_formals;
int depth;
@@ -3117,7 +3194,8 @@ edit_formals_lists (const char *end_formals, unsigned f_list_count, const def_de
*/
static const char *
-find_rightmost_formals_list (const char *clean_text_p)
+find_rightmost_formals_list (clean_text_p)
+ const char *clean_text_p;
{
const char *end_formals;
@@ -3145,10 +3223,41 @@ find_rightmost_formals_list (const char *clean_text_p)
continue;
end_formals--;
+#ifdef UNPROTOIZE
+
/* Now scan backwards while looking for the right end of the rightmost
formals list associated with this function definition. */
- for (;;)
+ {
+ char ch;
+ const char *l_brace_p;
+
+ /* Look leftward and try to find a right-paren. */
+
+ while (*end_formals != ')')
+ {
+ if (isspace (*end_formals))
+ while (isspace (*end_formals))
+ check_source (--end_formals > clean_read_ptr, 0);
+ else
+ check_source (--end_formals > clean_read_ptr, 0);
+ }
+
+ ch = *(l_brace_p = forward_to_next_token_char (end_formals));
+ /* Since we are unprotoizing an ANSI-style (prototyped) function
+ definition, there had better not be anything (except whitespace)
+ between the end of the ANSI formals list and the beginning of the
+ function body (i.e. the '{'). */
+
+ check_source (ch == '{', l_brace_p);
+ }
+
+#else /* !defined(UNPROTOIZE) */
+
+ /* Now scan backwards while looking for the right end of the rightmost
+ formals list associated with this function definition. */
+
+ while (1)
{
char ch;
const char *l_brace_p;
@@ -3166,18 +3275,6 @@ find_rightmost_formals_list (const char *clean_text_p)
ch = *(l_brace_p = forward_to_next_token_char (end_formals));
-#ifdef UNPROTOIZE
-
- /* Since we are unprotoizing an ANSI-style (prototyped) function
- definition, there had better not be anything (except whitespace)
- between the end of the ANSI formals list and the beginning of the
- function body (i.e. the '{'). */
-
- check_source (ch == '{', l_brace_p);
- break;
-
-#else /* !defined(UNPROTOIZE) */
-
/* Since it is possible that we found a right paren before the starting
'{' of the body which IS NOT the one at the end of the real K&R
formals list (say for instance, we found one embedded inside one of
@@ -3196,11 +3293,10 @@ find_rightmost_formals_list (const char *clean_text_p)
looking. */
check_source (--end_formals > clean_read_ptr, 0);
+ }
#endif /* !defined(UNPROTOIZE) */
- }
-
return end_formals;
}
@@ -3216,7 +3312,9 @@ find_rightmost_formals_list (const char *clean_text_p)
parameter type checking. */
static void
-add_local_decl (const def_dec_info *def_dec_p, const char *clean_text_p)
+add_local_decl (def_dec_p, clean_text_p)
+ const def_dec_info *def_dec_p;
+ const char *clean_text_p;
{
const char *start_of_block;
const char *function_to_edit = def_dec_p->hash_entry->symbol;
@@ -3322,7 +3420,9 @@ add_local_decl (const def_dec_info *def_dec_p, const char *clean_text_p)
and then insert the new explicit declaration at that point in the file. */
static void
-add_global_decls (const file_info *file_p, const char *clean_text_p)
+add_global_decls (file_p, clean_text_p)
+ const file_info *file_p;
+ const char *clean_text_p;
{
const def_dec_info *dd_p;
const char *scan_p;
@@ -3411,7 +3511,9 @@ add_global_decls (const file_info *file_p, const char *clean_text_p)
separate routine above. */
static void
-edit_fn_definition (const def_dec_info *def_dec_p, const char *clean_text_p)
+edit_fn_definition (def_dec_p, clean_text_p)
+ const def_dec_info *def_dec_p;
+ const char *clean_text_p;
{
const char *end_formals;
const char *function_to_edit = def_dec_p->hash_entry->symbol;
@@ -3553,7 +3655,9 @@ edit_fn_definition (const def_dec_info *def_dec_p, const char *clean_text_p)
into whitespace. Also, whiteout string and character literals. */
static void
-do_cleaning (char *new_clean_text_base, char *new_clean_text_limit)
+do_cleaning (new_clean_text_base, new_clean_text_limit)
+ char *new_clean_text_base;
+ char *new_clean_text_limit;
{
char *scan_p;
int non_whitespace_since_newline = 0;
@@ -3653,7 +3757,8 @@ regular:
and return a pointer to it. */
static const char *
-careful_find_l_paren (const char *p)
+careful_find_l_paren (p)
+ const char *p;
{
const char *q;
int paren_depth;
@@ -3691,7 +3796,8 @@ careful_find_l_paren (const char *p)
I will probably try to do this in a later version though. */
static void
-scan_for_missed_items (const file_info *file_p)
+scan_for_missed_items (file_p)
+ const file_info *file_p;
{
static const char *scan_p;
const char *limit = clean_text_limit - 3;
@@ -3747,7 +3853,7 @@ scan_for_missed_items (const file_info *file_p)
goto not_missed;
{
- char func_name[id_length + 1];
+ char *func_name = (char *) alloca (id_length + 1);
static const char * const stmt_keywords[]
= { "if", "while", "for", "switch", "return", 0 };
const char * const *stmt_keyword;
@@ -3805,7 +3911,8 @@ scan_for_missed_items (const file_info *file_p)
preprocessor directives make the editing a whole lot easier. */
static void
-edit_file (const hash_table_entry *hp)
+edit_file (hp)
+ const hash_table_entry *hp;
{
struct stat stat_buf;
const file_info *file_p = hp->fip;
@@ -3848,18 +3955,17 @@ edit_file (const hash_table_entry *hp)
/* Let the user know what we are up to. */
if (nochange_flag)
- puts (shortpath (NULL, convert_filename));
+ fprintf (stderr, "%s: would convert file `%s'\n",
+ pname, shortpath (NULL, convert_filename));
else
- {
- fprintf (stderr, "%s: converting file `%s'\n",
- pname, shortpath (NULL, convert_filename));
- fflush (stderr);
- }
+ fprintf (stderr, "%s: converting file `%s'\n",
+ pname, shortpath (NULL, convert_filename));
+ fflush (stderr);
/* Find out the size (in bytes) of the original file. */
/* The cast avoids an erroneous warning on AIX. */
- if (stat ((char *)convert_filename, &stat_buf) == -1)
+ if (my_stat ((char *)convert_filename, &stat_buf) == -1)
{
fprintf (stderr, "%s: error: can't get status for file `%s': %s\n",
pname, shortpath (NULL, convert_filename), sys_errlist[errno]);
@@ -3893,7 +3999,7 @@ edit_file (const hash_table_entry *hp)
/* Open the file to be converted in READ ONLY mode. */
- if ((input_file = open (convert_filename, O_RDONLY, 0444)) == -1)
+ if ((input_file = my_open (convert_filename, O_RDONLY, 0444)) == -1)
{
fprintf (stderr, "%s: error: can't open file `%s' for reading: %s\n",
pname, shortpath (NULL, convert_filename),
@@ -4038,7 +4144,7 @@ edit_file (const hash_table_entry *hp)
strcpy (new_filename, convert_filename);
strcat (new_filename, save_suffix);
- if (link (convert_filename, new_filename) == -1)
+ if (my_link (convert_filename, new_filename) == -1)
{
if (errno == EEXIST)
{
@@ -4060,7 +4166,7 @@ edit_file (const hash_table_entry *hp)
}
}
- if (unlink (convert_filename) == -1)
+ if (my_unlink (convert_filename) == -1)
{
fprintf (stderr, "%s: error: can't delete file `%s': %s\n",
pname, shortpath (NULL, convert_filename), sys_errlist[errno]);
@@ -4103,7 +4209,7 @@ edit_file (const hash_table_entry *hp)
/* Change the mode of the output file to match the original file. */
/* The cast avoids an erroneous warning on AIX. */
- if (chmod ((char *)convert_filename, stat_buf.st_mode) == -1)
+ if (my_chmod ((char *)convert_filename, stat_buf.st_mode) == -1)
fprintf (stderr, "%s: error: can't change mode of file `%s': %s\n",
pname, shortpath (NULL, convert_filename), sys_errlist[errno]);
@@ -4118,7 +4224,7 @@ edit_file (const hash_table_entry *hp)
in the command line. */
static void
-do_processing (void)
+do_processing ()
{
const char * const *base_pp;
const char * const * const end_pps
@@ -4145,18 +4251,18 @@ do_processing (void)
{
syscalls_absolute_filename
= (char *) xmalloc (strlen (nondefault_syscalls_dir)
- + strlen (syscalls_filename) + 1);
+ + strlen (syscalls_filename) + 2);
strcpy (syscalls_absolute_filename, nondefault_syscalls_dir);
}
else
{
syscalls_absolute_filename
= (char *) xmalloc (strlen (default_syscalls_dir)
- + strlen (syscalls_filename) + 1);
+ + strlen (syscalls_filename) + 2);
strcpy (syscalls_absolute_filename, default_syscalls_dir);
}
- syscalls_len = strlen (syscalls_filename);
+ syscalls_len = strlen (syscalls_absolute_filename);
if (*(syscalls_absolute_filename + syscalls_len - 1) != '/')
{
*(syscalls_absolute_filename + syscalls_len++) = '/';
@@ -4232,7 +4338,9 @@ static struct option longopts[] =
};
int
-main (int argc, char **const argv)
+main (argc, argv)
+ int argc;
+ char **const argv;
{
int longind;
int c;
@@ -4242,7 +4350,7 @@ main (int argc, char **const argv)
pname = pname ? pname+1 : argv[0];
/* Read the working directory, avoiding arbitrary limit. */
- size = 100;
+ size = GUESSPATHLEN;
while (1)
{
char *value;