1 |
|
2002-12-12 Paul Eggert <eggert@twinsun.com> |
2 |
|
|
3 |
|
Remove unportable casts and storage allocation tricks. |
4 |
|
While we're at it, remove almost all casts, since they |
5 |
|
usually aren't needed and are a sign of trouble. |
6 |
|
|
7 |
|
* configure.ac (AC_CHECK_TYPES): Check for uintptr_t. |
8 |
|
|
9 |
|
* src/derives.c (derives_compute): Do not subtract NTOKENS from |
10 |
|
the pointer DSET returned by malloc; this isn't portable. |
11 |
|
Instead, always use DSET[i - NTOKENS] rather than DSET[i]. |
12 |
|
Similarly for DERIVES. |
13 |
|
* src/lalr.c (set_goto_map): Likewise, for GOTO_MAP and TEMP_MAP. |
14 |
|
* src/nullable.c (nullable_compute): Likewise, for RSETS and NULLABLE. |
15 |
|
* src/reduce.c (reduce_grammar_tables): Likewise, for nontermmap |
16 |
|
|
17 |
|
* src/derives.c (derives_compute): Do not bother invoking |
18 |
|
int_of_rule_number, since rule numbers are integers. |
19 |
|
|
20 |
|
* src/files.c (concat2, tr, compute_base_name): Use xmalloc (N) |
21 |
|
rather than XMALLOC (char, N). |
22 |
|
|
23 |
|
* src/files.c (filename_split): Rewrite to avoid cast. |
24 |
|
|
25 |
|
* src/gram.h (symbol_number_as_item_number, |
26 |
|
item_number_as_symbol_number, rule_number_as_item_number, |
27 |
|
item_number_as_rule_number): |
28 |
|
Now inline functions rather than macros, to avoid casts. |
29 |
|
* src/state.h (state_number_as_int): Likewise. |
30 |
|
* src/tables.c (state_number_to_vector_number, |
31 |
|
symbol_number_to_vector_number): Likewise. |
32 |
|
|
33 |
|
* src/gram.h (int_of_rule_number): Remove; no longer used. |
34 |
|
|
35 |
|
* src/lalr.c (add_lookback_edge): Use malloc rather than calloc, |
36 |
|
since the resulting storage is always stored into. |
37 |
|
|
38 |
|
* src/main.c (alloca) [C_ALLOCA]: Add decl here, the only place |
39 |
|
where it's needed. |
40 |
|
|
41 |
|
* src/muscle_tab.c (muscle_m4_output): |
42 |
|
Now inline. Return bool, not int. |
43 |
|
* src/state.c (state_compare): Likewise. |
44 |
|
* src/symtab.c (symbol_check_defined, |
45 |
|
symbol_check_alias_consistency, symbol_pack, symbol_translation, |
46 |
|
hash_compare_symbol, hash_symbol): |
47 |
|
Likewise. |
48 |
|
* src/uniqstr.c (uniqstr_print): Likewise. |
49 |
|
* src/muscle_tab.c (muscle_m4_output_processor): |
50 |
|
New function, to avoid casts. |
51 |
|
* src/state.c (state_comparator, stage_hasher): Likewise. |
52 |
|
* src/symtab.c (symbol_check_defined_processor, |
53 |
|
symbol_check_alias_consistency_processor, symbol_pack_processor, |
54 |
|
symbol_translation_processor, hash_symbol_comparator, |
55 |
|
hash_symbol_hasher): Likewise. |
56 |
|
* src/uniqstr.c (uniqstr_print_processor): Likewise. |
57 |
|
* src/muscle_tab.c (muscles_m4_output): |
58 |
|
Use new functions instead of casting old functions unportably. |
59 |
|
* src/state.c (state_hash_new): Likewise. |
60 |
|
* src/symtab.c (symbols_new, symbols_do, symbols_check_defined, |
61 |
|
symbols_token_translations_init): |
62 |
|
Likewise. |
63 |
|
* src/uniqstr.c (uniqstrs_new, hash_initialize, uniqstrs_do): Likewise. |
64 |
|
|
65 |
|
* src/output.c (GENERATE_MUSCLE_INSERT_TABLE): Use long local |
66 |
|
var instead of casting to long, to avoid casts. |
67 |
|
(prepare_states): Use MALLOC rather than alloca, so that we don't |
68 |
|
have to worry about alloca. |
69 |
|
* src/state.c (state_hash_lookup): Likewise. |
70 |
|
|
71 |
|
* src/scan-gram.l (<SC_ESCAPED_CHARACTER>"'"): Use unsigned char |
72 |
|
local var instead of casting to unsigned char, to avoid casts. |
73 |
|
|
74 |
|
* src/state.c (TRANSITIONS_ALLOC, ERRS_ALLOC, REDUCTIONS_ALLOC, |
75 |
|
STATE_ALLOC): Remove. |
76 |
|
(transitions_new, errs_new, reductions_new, state_new): Use malloc |
77 |
|
rather than calloc, and use offsetof to avoid allocating slightly |
78 |
|
too much storage. |
79 |
|
(state_new): Initialize all members. |
80 |
|
|
81 |
|
* src/state.c (state_hash): Use unsigned accumulator, not signed. |
82 |
|
|
83 |
|
* src/symtab.c (symbol_free): Remove; unused. |
84 |
|
(symbol_get): Remove cast in lhs of assignment. |
85 |
|
(symbols_do): Now static. Accept generic arguments, not |
86 |
|
hashing-related ones. |
87 |
|
|
88 |
|
* src/symtab.h: (NUMBER_UNDEFINED): Remove unnecessary cast. |
89 |
|
(symbol_processor): Remove. |
90 |
|
(symbols_do): Remove decl; now static. |
91 |
|
|
92 |
|
* src/system.h (alloca): Remove; decl no longer needed. |
93 |
|
(<stddef.h>): Include, for offsetof. |
94 |
|
(<inttypes.>, <stdint.h>): Include if available. |
95 |
|
(uintptr_t): New type, if system lacks it. |
96 |
|
(CALLOC, MALLOC, REALLOC): New macros. |
97 |
|
All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these |
98 |
|
new macros. |
99 |
|
|
100 |
|
* src/tables.c (table_size): Now int, to pacify GCC. |
101 |
|
(table_grow, table_ninf_remap): Use signed table size. |
102 |
|
(save_row): Don't bother initializing locals when not needed. |
103 |
|
(default_goto, goto_actions, pack_vector): Remove unnecessary casts. |
104 |
|
* src/uniqstr.c (hash_compare_uniqstr): Likewise. |
105 |
|
|
106 |
|
* src/vcg.h: Correct misspellings. |
107 |
|
|
108 |
|
* src/vcg_defaults.h (G_CMAX): Now INT_MAX. |
109 |
|
|
110 |
|
|
111 |
|
* src/getargs.c (getargs): Don't assume EOF == -1. |
112 |
|
|
113 |
2002-12-09 Paul Eggert <eggert@twinsun.com> |
2002-12-09 Paul Eggert <eggert@twinsun.com> |
114 |
|
|
115 |
Change identifier spellings to avoid collisions with names |
Change identifier spellings to avoid collisions with names |