diff options
author | Joel E. Denny <jdenny@clemson.edu> | 2009-12-29 12:43:26 -0500 |
---|---|---|
committer | Joel E. Denny <jdenny@clemson.edu> | 2009-12-29 15:39:56 -0500 |
commit | b8d19cf8c15a4ae78ad3e370e82ce8e9359194a0 (patch) | |
tree | 5d62a911650e44c5811f3104a4ad0f479c2d8a19 /src/AnnotationList.h | |
parent | df222dfaf4da6becae8665d344669eefc705d7f7 (diff) | |
download | bison-b8d19cf8c15a4ae78ad3e370e82ce8e9359194a0.tar.gz |
portability: `<' and `>' are not always defined on addresses.
Specifically, don't sort objects by their memory addresses when
they're not allocated in the same array or other object. Though
I haven't found a test case where that fails on my platform, C
says the behavior is undefined.
* src/AnnotationList.c (AnnotationList__insertInto): Remove
FIXME. Use new id field of InadequacyList nodes rather than
their memory addresses when sorting.
(AnnotationList__compute_from_inadequacies): Add
inadequacy_list_node_count argument to pass to
InadequacyList__new_conflict.
* src/AnnotationList.h
(AnnotationList__compute_from_inadequacies): Update prototype
and documentation for new argument.
* src/InadequacyList.c (InadequacyList__new_conflict): Add
node_count argument and use it to assign a unique ID.
* src/InadequacyList.h (InadequacyListNodeCount): New typedef.
(InadequacyList): Add id field.
(InadequacyList__new_conflict): Update prototype and
documentation for new argument.
* src/ielr.c (ielr_compute_annotation_lists): Update
AnnotationList__compute_from_inadequacies invocation.
(cherry picked from commit 2728ac7ecd663c4a60f94fe7ab7679a9e83ebcd0)
Diffstat (limited to 'src/AnnotationList.h')
-rw-r--r-- | src/AnnotationList.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/AnnotationList.h b/src/AnnotationList.h index 02d4a2be..a9876e16 100644 --- a/src/AnnotationList.h +++ b/src/AnnotationList.h @@ -82,6 +82,15 @@ typedef struct AnnotationList * computed by \c ielr_compute_auxiliary_tables. * - The size of each of \c annotation_lists and \c annotation_counts is * \c ::nstates. + * - If no \c InadequacyList nodes are currently allocated for the + * parser tables to which \c s belongs, then it is best if + * <tt>*inadequacy_list_node_count</tt> is zero to avoid overflow. + * Otherwise, <tt>*inadequacy_list_node_count</tt> has not been + * modified by any function except + * \c AnnotationList__compute_from_inadequacies since the invocation + * of \c AnnotationList__compute_from_inadequacies that constructed + * the first of the \c InadequacyList nodes currently allocated for + * those parser tables. * \post * - <tt>inadequacy_lists[s->number]</tt> now describes all inadequacies that * manifest in \c s. @@ -97,18 +106,14 @@ typedef struct AnnotationList * \c annotations_obstackp. */ void -AnnotationList__compute_from_inadequacies (state *s, - bitsetv follow_kernel_items, - bitsetv always_follows, - state ***predecessors, - bitset **item_lookahead_sets, - InadequacyList **inadequacy_lists, - AnnotationList **annotation_lists, - AnnotationIndex *annotation_counts, - ContributionIndex - *max_contributionsp, - struct obstack - *annotations_obstackp); +AnnotationList__compute_from_inadequacies ( + state *s, bitsetv follow_kernel_items, bitsetv always_follows, + state ***predecessors, bitset **item_lookahead_sets, + InadequacyList **inadequacy_lists, AnnotationList **annotation_lists, + AnnotationIndex *annotation_counts, + ContributionIndex *max_contributionsp, + struct obstack *annotations_obstackp, + InadequacyListNodeCount *inadequacy_list_node_count); /** * \pre |