aver: it is no longer "protected against NDEBUG"

Apply the same rules for aver as for assert: no side effects,
especially not important ones.

* src/AnnotationList.c, src/muscle-tab.c: Adjust aver uses to resist
to -DNDEBUG.
This commit is contained in:
Akim Demaille
2013-11-12 15:46:27 +01:00
parent 8d0b7cef7d
commit 458171e6df
2 changed files with 15 additions and 10 deletions

View File

@@ -541,9 +541,13 @@ AnnotationList__compute_from_inadequacies (
{ {
InadequacyList__prependTo (conflict_node, InadequacyList__prependTo (conflict_node,
&inadequacy_lists[s->number]); &inadequacy_lists[s->number]);
aver (AnnotationList__insertInto ( {
annotation_node, &annotation_lists[s->number], bool b =
s->nitems)); AnnotationList__insertInto (annotation_node,
&annotation_lists[s->number],
s->nitems);
aver (b);
}
/* This aver makes sure the /* This aver makes sure the
AnnotationList__computeDominantContribution check above AnnotationList__computeDominantContribution check above
does discard annotations in the simplest case of a S/R does discard annotations in the simplest case of a S/R

View File

@@ -299,8 +299,9 @@ muscle_location_grow (char const *key, location loc)
#define COMMON_DECODE(Value) \ #define COMMON_DECODE(Value) \
case '$': \ case '$': \
aver (*++(Value) == ']'); \ ++(Value); aver (*(Value) == '['); \
aver (*++(Value) == '['); \ ++(Value); aver (*(Value) == ']'); \
++(Value); aver (*(Value) == '['); \
obstack_sgrow (&muscle_obstack, "$"); \ obstack_sgrow (&muscle_obstack, "$"); \
break; \ break; \
case '@': \ case '@': \
@@ -349,7 +350,7 @@ location_decode (char const *value)
location loc; location loc;
aver (value); aver (value);
aver (*value == '['); aver (*value == '[');
aver (*++value == '['); ++value; aver (*value == '[');
while (*++value) while (*++value)
switch (*value) switch (*value)
{ {
@@ -360,16 +361,16 @@ location_decode (char const *value)
case ']': case ']':
{ {
char *boundary_str; char *boundary_str;
aver (*++value == ']'); ++value; aver (*value == ']');
boundary_str = obstack_finish0 (&muscle_obstack); boundary_str = obstack_finish0 (&muscle_obstack);
switch (*++value) switch (*++value)
{ {
case ',': case ',':
boundary_set_from_string (&loc.start, boundary_str); boundary_set_from_string (&loc.start, boundary_str);
obstack_free (&muscle_obstack, boundary_str); obstack_free (&muscle_obstack, boundary_str);
aver (*++value == ' '); ++value; aver (*value == ' ');
aver (*++value == '['); ++value; aver (*value == '[');
aver (*++value == '['); ++value; aver (*value == '[');
break; break;
case '\0': case '\0':
boundary_set_from_string (&loc.end, boundary_str); boundary_set_from_string (&loc.end, boundary_str);