style: src: remove useless reference to 'int' in integral types

* src/AnnotationList.c, src/AnnotationList.h, src/InadequacyList.h,
* src/closure.c, src/closure.h, src/gram.c, src/gram.h, src/ielr.c,
* src/location.c, src/output.c, src/reader.c, src/relation.c,
* src/scan-code.l, src/scan-gram.l, src/tables.c, src/tables.h:
Prefer 'unsigned' to 'unsigned int'.  Likewise for long and short.
This commit is contained in:
Akim Demaille
2018-08-12 14:55:42 +02:00
parent e3b7c01820
commit 9a5c688ae4
16 changed files with 40 additions and 40 deletions

View File

@@ -275,7 +275,7 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
- 2]))
{
Sbitset items;
unsigned int rulei;
unsigned rulei;
for (rulei = s->items[self_item];
!item_number_is_rule_number (ritem[rulei]);
++rulei)

View File

@@ -25,7 +25,7 @@
# include "InadequacyList.h"
# include "state.h"
typedef unsigned int AnnotationIndex;
typedef unsigned AnnotationIndex;
/**
* A node in a list of annotations on a particular LR(0) state. Each

View File

@@ -31,7 +31,7 @@
* This must remain unsigned so that the overflow check in
* \c InadequacyList__new_conflict works properly.
*/
typedef unsigned long long int InadequacyListNodeCount;
typedef unsigned long long InadequacyListNodeCount;
/**
* For a conflict, each rule in the grammar can have at most one contributing

View File

@@ -168,7 +168,7 @@ set_fderives (void)
void
new_closure (unsigned int n)
new_closure (unsigned n)
{
itemset = xnmalloc (n, sizeof *itemset);

View File

@@ -27,7 +27,7 @@
data so that closure can be called. n is the number of elements to
allocate for itemset. */
void new_closure (unsigned int n);
void new_closure (unsigned n);
/* Given the kernel (aka core) of a state (a sorted vector of item numbers

View File

@@ -32,7 +32,7 @@
/* Comments for these variables are in gram.h. */
item_number *ritem = NULL;
unsigned int nritems = 0;
unsigned nritems = 0;
rule *rules = NULL;
rule_number nrules = 0;
@@ -126,7 +126,7 @@ rule_rhs_print_xml (rule const *r, FILE *out, int level)
void
ritem_print (FILE *out)
{
unsigned int i;
unsigned i;
fputs ("RITEM\n", out);
for (i = 0; i < nritems; ++i)
if (ritem[i] >= 0)
@@ -254,8 +254,8 @@ grammar_dump (FILE *out, const char *title)
{
rule const *rule_i = &rules[i];
item_number *rp = NULL;
unsigned int rhs_itemno = rule_i->rhs - ritem;
unsigned int rhs_count = 0;
unsigned rhs_itemno = rule_i->rhs - ritem;
unsigned rhs_count = 0;
/* Find the last RHS index in ritems. */
for (rp = rule_i->rhs; *rp >= 0; ++rp)
++rhs_count;

View File

@@ -115,7 +115,7 @@ extern int nvars;
typedef int item_number;
# define ITEM_NUMBER_MAX INT_MAX
extern item_number *ritem;
extern unsigned int nritems;
extern unsigned nritems;
/* There is weird relationship between OT1H item_number and OTOH
symbol_number and rule_number: we store the latter in

View File

@@ -49,7 +49,7 @@ static bitset
ielr_compute_ritem_sees_lookahead_set (void)
{
bitset result = bitset_create (nritems, BITSET_FIXED);
unsigned int i = nritems-1;
unsigned i = nritems-1;
while (i>0)
{
--i;
@@ -397,7 +397,7 @@ ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item,
top-level invocation), go get it. */
if (!lhs)
{
unsigned int i;
unsigned i;
for (i = s->items[item];
!item_number_is_rule_number (ritem[i]);
++i)
@@ -475,7 +475,7 @@ ielr_compute_annotation_lists (bitsetv follow_kernel_items,
AnnotationIndex *annotation_counts =
xnmalloc (nstates, sizeof *annotation_counts);
ContributionIndex max_contributions = 0;
unsigned int total_annotations = 0;
unsigned total_annotations = 0;
*inadequacy_listsp = xnmalloc (nstates, sizeof **inadequacy_listsp);
*annotation_listsp = xnmalloc (nstates, sizeof **annotation_listsp);
@@ -611,7 +611,7 @@ ielr_compute_lookaheads (bitsetv follow_kernel_items, bitsetv always_follows,
{
if (item_number_is_rule_number (ritem[t->items[t_item] - 2]))
{
unsigned int rule_item;
unsigned rule_item;
for (rule_item = t->items[t_item];
!item_number_is_rule_number (ritem[rule_item]);
++rule_item)

View File

@@ -37,7 +37,7 @@ static inline int
add_column_width (int column, char const *buf, size_t bufsize)
{
size_t width;
unsigned int remaining_columns = INT_MAX - column;
unsigned remaining_columns = INT_MAX - column;
if (buf)
{

View File

@@ -64,8 +64,8 @@ Name (char const *name, \
{ \
Type min = first; \
Type max = first; \
long int lmin; \
long int lmax; \
long lmin; \
long lmax; \
int i; \
int j = 1; \
\
@@ -97,7 +97,7 @@ Name (char const *name, \
MUSCLE_INSERT_LONG_INT (obstack_finish0 (&format_obstack), lmax); \
}
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_unsigned_int_table, unsigned int)
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_unsigned_int_table, unsigned)
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_int_table, int)
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_base_table, base_number)
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_rule_number_table, rule_number)
@@ -213,9 +213,9 @@ prepare_symbols (void)
static void
prepare_rules (void)
{
unsigned int *rline = xnmalloc (nrules, sizeof *rline);
unsigned *rline = xnmalloc (nrules, sizeof *rline);
symbol_number *r1 = xnmalloc (nrules, sizeof *r1);
unsigned int *r2 = xnmalloc (nrules, sizeof *r2);
unsigned *r2 = xnmalloc (nrules, sizeof *r2);
int *dprec = xnmalloc (nrules, sizeof *dprec);
int *merger = xnmalloc (nrules, sizeof *merger);
int *immediate = xnmalloc (nrules, sizeof *immediate);

View File

@@ -564,7 +564,7 @@ grammar_current_rule_predicate_append (const char *pred, location loc)
static void
packgram (void)
{
unsigned int itemno = 0;
unsigned itemno = 0;
rule_number ruleno = 0;
ritem = xnmalloc (nritems + 1, sizeof *ritem);

View File

@@ -34,10 +34,10 @@ relation_print (relation r, relation_node size, FILE *out)
for (i = 0; i < size; ++i)
{
fprintf (out, "%3lu: ", (unsigned long int) i);
fprintf (out, "%3lu: ", (unsigned long) i);
if (r[i])
for (j = 0; r[i][j] != END_NODE; ++j)
fprintf (out, "%3lu ", (unsigned long int) r[i][j]);
fprintf (out, "%3lu ", (unsigned long) r[i][j]);
fputc ('\n', out);
}
fputc ('\n', out);

View File

@@ -415,7 +415,7 @@ show_sub_messages (warnings warning,
/* Parse named or positional reference. In case of positional
references, can return negative values for $-n "deep" stack
accesses. */
static long int
static long
parse_ref (char *cp, symbol_list *rule, int rule_length,
int midrule_rhs_index, char *text, location text_loc,
char dollar_or_at)
@@ -432,7 +432,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
if (c_isdigit (*cp) || (*cp == '-' && c_isdigit (* (cp + 1))))
{
long int num = strtol (cp, &cp, 10);
long num = strtol (cp, &cp, 10);
if (1 - INT_MAX + rule_length <= num && num <= rule_length)
return num;
else

View File

@@ -96,7 +96,7 @@ gram_scanner_last_string_free (void)
}
static void handle_syncline (char *, location);
static unsigned long int scan_integer (char const *p, int base, location loc);
static unsigned long scan_integer (char const *p, int base, location loc);
static int convert_ucn_to_byte (char const *hex_text);
static void unexpected_eof (boundary, char const *);
static void unexpected_newline (boundary, char const *);
@@ -591,7 +591,7 @@ eqopt ([[:space:]]*=)?
<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>
{
\\[0-7]{1,3} {
unsigned long int c = strtoul (yytext + 1, NULL, 8);
unsigned long c = strtoul (yytext + 1, NULL, 8);
if (!c || UCHAR_MAX < c)
complain (loc, complaint, _("invalid number after \\-escape: %s"),
yytext+1);
@@ -601,7 +601,7 @@ eqopt ([[:space:]]*=)?
\\x[0-9abcdefABCDEF]+ {
verify (UCHAR_MAX < ULONG_MAX);
unsigned long int c = strtoul (yytext + 2, NULL, 16);
unsigned long c = strtoul (yytext + 2, NULL, 16);
if (!c || UCHAR_MAX < c)
complain (loc, complaint, _("invalid number after \\-escape: %s"),
yytext+1);
@@ -844,11 +844,11 @@ no_cr_read (FILE *fp, char *buf, size_t size)
| Scan NUMBER for a base-BASE integer at location LOC. |
`------------------------------------------------------*/
static unsigned long int
static unsigned long
scan_integer (char const *number, int base, location loc)
{
verify (INT_MAX < ULONG_MAX);
unsigned long int num = strtoul (number, NULL, base);
unsigned long num = strtoul (number, NULL, base);
if (INT_MAX < num)
{
@@ -871,7 +871,7 @@ static int
convert_ucn_to_byte (char const *ucn)
{
verify (UCHAR_MAX <= INT_MAX);
unsigned long int code = strtoul (ucn + 2, NULL, 16);
unsigned long code = strtoul (ucn + 2, NULL, 16);
/* FIXME: Currently we assume Unicode-compatible unibyte characters
on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On
@@ -926,7 +926,7 @@ static void
handle_syncline (char *args, location loc)
{
char *file;
unsigned long int lineno = strtoul (args, &file, 10);
unsigned long lineno = strtoul (args, &file, 10);
if (INT_MAX <= lineno)
{
complain (&loc, Wother, _("line number overflow"));

View File

@@ -83,7 +83,7 @@ int nvectors;
static base_number **froms;
static base_number **tos;
static unsigned int **conflict_tos;
static unsigned **conflict_tos;
static size_t *tally;
static base_number *width;
@@ -112,9 +112,9 @@ base_number *base = NULL;
base_number base_ninf = 0;
static base_number *pos = NULL;
static unsigned int *conflrow;
unsigned int *conflict_table;
unsigned int *conflict_list;
static unsigned *conflrow;
unsigned *conflict_table;
unsigned *conflict_list;
int conflict_list_cnt;
static int conflict_list_free;
@@ -394,7 +394,7 @@ save_row (state_number s)
/* Allocate non defaulted actions. */
base_number *sp1 = froms[s] = xnmalloc (count, sizeof *sp1);
base_number *sp2 = tos[s] = xnmalloc (count, sizeof *sp2);
unsigned int *sp3 = conflict_tos[s] =
unsigned *sp3 = conflict_tos[s] =
nondeterministic_parser ? xnmalloc (count, sizeof *sp3) : NULL;
/* Store non defaulted actions. */
@@ -670,7 +670,7 @@ pack_vector (vector_number vector)
size_t t = tally[i];
base_number *from = froms[i];
base_number *to = tos[i];
unsigned int *conflict_to = conflict_tos[i];
unsigned *conflict_to = conflict_tos[i];
aver (t != 0);

View File

@@ -122,8 +122,8 @@ extern base_number *base;
keep parser tables small. */
extern base_number base_ninf;
extern unsigned int *conflict_table;
extern unsigned int *conflict_list;
extern unsigned *conflict_table;
extern unsigned *conflict_list;
extern int conflict_list_cnt;
extern base_number *table;