summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0e16927)
* tests/actions.at, tests/calc.at, tests/conflicts.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/input.at,
* tests/named-refs.at, tests/regression.at, tests/torture.at,
* tests/local.at:
Prefer assert to abort.
AT_LOC.last_line = AT_LOC.last_column = AT_LOC.first_line + 9;
])[
AT_LOC.last_line = AT_LOC.last_column = AT_LOC.first_line + 9;
])[
- if (! (0 <= c && c <= strlen (source)))
- abort ();
+ assert (0 <= c && c <= strlen (source));
if (source[c])
printf ("sending: '%c'", source[c]);
else
if (source[c])
printf ("sending: '%c'", source[c]);
else
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_CALC_MAIN],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_CALC_MAIN],
-[#include <stdlib.h> /* abort */
#if HAVE_UNISTD_H
# include <unistd.h>
#else
#if HAVE_UNISTD_H
# include <unistd.h>
#else
status = ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([[&result, &count]])[);
if (fclose (input))
perror ("fclose");
status = ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([[&result, &count]])[);
if (fclose (input))
perror ("fclose");
- if (global_result != result)
- abort ();
- if (global_count != count)
- abort ();
+ assert (global_result == result);
+ assert (global_count == count);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define YYERROR_VERBOSE 1
]AT_YYERROR_DEFINE[
#define YYERROR_VERBOSE 1
]AT_YYERROR_DEFINE[
yylex (void)
{
static size_t toknum;
yylex (void)
{
static size_t toknum;
- if (! (toknum <= strlen (input)))
- abort ();
+ assert (toknum <= strlen (input));
return input[toknum++];
}
return input[toknum++];
}
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- if (argc != 2)
- abort ();
if (!freopen (argv[1], "r", stdin))
return 3;
return yyparse ();
if (!freopen (argv[1], "r", stdin))
return 3;
return yyparse ();
- if (feof (stdin))
- abort ();
+ assert (!feof (stdin));
c = getchar ();
switch (c)
{
c = getchar ();
switch (c)
{
{
buffer[i++] = c;
colNum += 1;
{
buffer[i++] = c;
colNum += 1;
- if (i == sizeof buffer - 1)
- abort ();
+ assert (i != sizeof buffer - 1);
c = getchar ();
}
while (isalnum (c) || c == '_');
c = getchar ();
}
while (isalnum (c) || c == '_');
%{
#include <stdio.h>
#include <stdlib.h>
%{
#include <stdio.h>
#include <stdlib.h>
#define YYSTYPE int
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
#define YYSTYPE int
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
- if (feof (stdin))
- abort ();
+ assert (!feof (stdin));
ch = getchar ();
if (ch == EOF)
return 0;
ch = getchar ();
if (ch == EOF)
return 0;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
%}
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
%}
- if (feof (stdin))
- abort ();
+ assert (!feof (stdin));
switch (fscanf (input, " %1[a-z,]", buf))
{
case 1:
switch (fscanf (input, " %1[a-z,]", buf))
{
case 1:
}
if (fscanf (input, "%49s", buf) != 1)
return 0;
}
if (fscanf (input, "%49s", buf) != 1)
return 0;
- if (sizeof buf - 1 <= strlen (buf))
- abort ();
+ assert (strlen (buf) < sizeof buf - 1);
s = (char *) malloc (strlen (buf) + 1);
strcpy (s, buf);
yylval = s;
s = (char *) malloc (strlen (buf) + 1);
strcpy (s, buf);
yylval = s;
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
static int MergeRule (int x0, int x1);
]AT_YYERROR_DECLARE[
static int MergeRule (int x0, int x1);
]AT_YYERROR_DECLARE[
int yylex (void)
{
char inp[3];
int yylex (void)
{
char inp[3];
- if (feof (stdin))
- abort ();
+ assert (!feof (stdin));
if (fscanf (input, "%2s", inp) == EOF)
return 0;
switch (inp[0])
if (fscanf (input, "%2s", inp) == EOF)
return 0;
switch (inp[0])
static int merge (YYSTYPE, YYSTYPE);
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static int merge (YYSTYPE, YYSTYPE);
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
{
static int const input[] = { PARENT_RHS_AFTER, 0 };
static size_t toknum;
{
static int const input[] = { PARENT_RHS_AFTER, 0 };
static size_t toknum;
- if (! (toknum < sizeof input / sizeof *input))
- abort ();
+ assert (toknum < sizeof input / sizeof *input);
if (input[toknum] == PARENT_RHS_AFTER)
parent_rhs_after_value = 1;
return input[toknum++];
if (input[toknum] == PARENT_RHS_AFTER)
parent_rhs_after_value = 1;
return input[toknum++];
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
{
static char const input[] = "ab";
static size_t toknum;
{
static char const input[] = "ab";
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
%{
#include <stdlib.h>
#include <stdio.h>
%{
#include <stdlib.h>
#include <stdio.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
{
static char const input[] = "abcdddd";
static size_t toknum;
{
static char const input[] = "abcdddd";
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static int lookahead_value = 0;
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static int lookahead_value = 0;
{
static char const input[] = "ab";
static size_t toknum;
{
static char const input[] = "ab";
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
if (input[toknum] == 'b')
lookahead_value = 1;
return input[toknum++];
if (input[toknum] == 'b')
lookahead_value = 1;
return input[toknum++];
static void
yyerror (YYLTYPE *locp, char const *msg)
static void
yyerror (YYLTYPE *locp, char const *msg)
{
static char const input[] = "ab";
static size_t toknum;
{
static char const input[] = "ab";
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
lvalp->dummy = 0;
llocp->first_line = llocp->last_line = 2;
llocp->first_column = toknum + 1;
lvalp->dummy = 0;
llocp->first_line = llocp->last_line = 2;
llocp->first_column = toknum + 1;
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
%}
/* %{ and %} can be here too. */
%}
/* %{ and %} can be here too. */
#output "; /* "
*/
static size_t toknum;
#output "; /* "
*/
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
yylval = value_as_yystype (input[toknum]);
return input[toknum++];
}
yylval = value_as_yystype (input[toknum]);
return input[toknum++];
}
])
m4_define([AT_YYLEX_DEFINE],
])
m4_define([AT_YYLEX_DEFINE],
-[[#include <stdlib.h> /* abort */
static
]AT_YYLEX_PROTOTYPE[
{
static
]AT_YYLEX_PROTOTYPE[
{
static size_t toknum = 0;
int res;
]AT_USE_LEX_ARGS[;
static size_t toknum = 0;
int res;
]AT_USE_LEX_ARGS[;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
res = input[toknum++];
]$2[;]AT_LOCATION_IF([[
]AT_LOC_FIRST_LINE[ = ]AT_LOC_LAST_LINE[ = 1;
res = input[toknum++];
]$2[;]AT_LOCATION_IF([[
]AT_LOC_FIRST_LINE[ = ]AT_LOC_LAST_LINE[ = 1;
}
status = yyparse ();
fclose (input);
}
status = yyparse ();
fclose (input);
- if (global_result != result)
- abort ();
- if (global_count != count)
- abort ();
+ assert (global_result == result);
+ assert (global_count == count);
static int
yylex (AT_LALR1_CC_IF([int *lval], [void]))
[{
static int
yylex (AT_LALR1_CC_IF([int *lval], [void]))
[{
};
static size_t toknum;
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
};
static size_t toknum;
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
- if (! (toknum < sizeof tokens / sizeof *tokens))
- abort ();
+ assert (toknum < sizeof tokens / sizeof *tokens);
return tokens[toknum++];
}]
return tokens[toknum++];
}]
static int
yylex (]AT_LALR1_CC_IF([int *lval], [void])[)
{
static int
yylex (]AT_LALR1_CC_IF([int *lval], [void])[)
{
};
static size_t toknum;
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
};
static size_t toknum;
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
- if (! (toknum < sizeof tokens / sizeof *tokens))
- abort ();
+ assert (toknum < sizeof tokens / sizeof *tokens);
return tokens[toknum++];
}
return tokens[toknum++];
}
%{
#include <stdio.h>
#include <stdlib.h>
%{
#include <stdio.h>
#include <stdlib.h>
#define MAX $max
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
#define MAX $max
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
- exp { if (\@S|@1 != 0) abort (); \$\$ = \@S|@1; }
-| input exp { if (\@S|@2 != \@S|@1 + 1) abort (); \$\$ = \@S|@2; }
+ exp { assert (\@S|@1 == 0); \$\$ = \@S|@1; }
+| input exp { assert (\@S|@2 == \@S|@1 + 1); \$\$ = \@S|@2; }
]AT_YYERROR_DEFINE[
static int
yylex (void)
]AT_YYERROR_DEFINE[
static int
yylex (void)
static int counter = 1;
if (counter <= MAX)
return counter++;
static int counter = 1;
if (counter <= MAX)
return counter++;
- if (counter++ != MAX + 1)
- abort ();
+ assert (counter++ == MAX + 1);
static int counter = 1;
if (counter > MAX)
{
static int counter = 1;
if (counter > MAX)
{
- if (counter++ != MAX + 1)
- abort ();
+ assert (counter++ == MAX + 1);
return 0;
}
if (return_token)
return 0;
}
if (return_token)
exp: WAIT_FOR_EOF exp | ;
%%
]AT_YYERROR_DEFINE[
exp: WAIT_FOR_EOF exp | ;
%%
]AT_YYERROR_DEFINE[
static int
yylex (void)
{
static int
yylex (void)
{
- if (yylval < 0)
- abort ();
if (yylval--)
return WAIT_FOR_EOF;
else
if (yylval--)
return WAIT_FOR_EOF;
else
{
char *endp;
YYSTYPE yylval_init;
{
char *endp;
YYSTYPE yylval_init;
- if (argc != 2)
- abort ();
yylval_init = strtol (argv[1], &endp, 10);
yylval_init = strtol (argv[1], &endp, 10);
- if (! (argv[1] != endp
- && 0 <= yylval_init && yylval_init <= INT_MAX
- && errno != ERANGE))
- abort ();
+ assert (argv[1] != endp);
+ assert (0 <= yylval_init);
+ assert (yylval_init <= INT_MAX);
+ assert (errno != ERANGE);
yydebug = 1;
{
int count;
yydebug = 1;
{
int count;
[[ new_status = yypull_parse (ps);
]],
[[ new_status = yyparse ();
[[ new_status = yypull_parse (ps);
]],
[[ new_status = yyparse ();
-]])[ if (count > 0 && new_status != status)
- abort ();
+]])[ assert (0 <= count || new_status == status);
status = new_status;
}
]m4_bmatch([$2], [%push-],
status = new_status;
}
]m4_bmatch([$2], [%push-],