X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbuiltin.c;h=5e36ab35b5c98bedfa942f5e0091ff588548b66f;hb=refs%2Fheads%2Ftizen_7.0_base;hp=632ef79424429e32f3aef3b7cb0c9be19fc9d936;hpb=7be93f2d05131d061bd4790ae33c8d50f50010d7;p=platform%2Fupstream%2Fm4.git
diff --git a/src/builtin.c b/src/builtin.c
index 632ef79..5e36ab3 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1,7 +1,7 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 1989-1994, 2000, 2004, 2006-2011 Free Software
- Foundation, Inc.
+ Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016-2017, 2020-2021
+ Free Software Foundation, Inc.
This file is part of GNU M4.
@@ -16,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
*/
/* Code for all builtin macros, initialization of symbol table, and
@@ -26,6 +26,7 @@
#include "execute.h"
#include "memchr2.h"
+#include "progname.h"
#include "regex.h"
#include "spawn-pipe.h"
#include "wait-process.h"
@@ -173,7 +174,7 @@ static predefined const predefined_tab[] =
| Find the builtin, which lives on ADDR. |
`----------------------------------------*/
-const builtin *
+const builtin * ATTRIBUTE_PURE
find_builtin_by_addr (builtin_func *func)
{
const builtin *bp;
@@ -191,7 +192,7 @@ find_builtin_by_addr (builtin_func *func)
| placeholder builtin. |
`----------------------------------------------------------*/
-const builtin *
+const builtin * ATTRIBUTE_PURE
find_builtin_by_name (const char *name)
{
const builtin *bp;
@@ -260,11 +261,8 @@ set_macro_sequence (const char *regexp)
msg = re_compile_pattern (regexp, strlen (regexp), ¯o_sequence_buf);
if (msg != NULL)
- {
- M4ERROR ((EXIT_FAILURE, 0,
- "--warn-macro-sequence: bad regular expression `%s': %s",
- regexp, msg));
- }
+ m4_failure (0, _("--warn-macro-sequence: bad regular expression `%s': %s"),
+ regexp, msg);
re_set_registers (¯o_sequence_buf, ¯o_sequence_regs,
macro_sequence_regs.num_regs,
macro_sequence_regs.start, macro_sequence_regs.end);
@@ -319,14 +317,14 @@ define_user_macro (const char *name, const char *text, symbol_lookup mode)
tmp = defn[offset];
defn[offset] = '\0';
M4ERROR ((warning_status, 0,
- "Warning: definition of `%s' contains sequence `%s'",
+ _("Warning: definition of `%s' contains sequence `%s'"),
name, defn + macro_sequence_regs.start[0]));
defn[offset] = tmp;
}
}
if (offset == -2)
M4ERROR ((warning_status, 0,
- "error checking --warn-macro-sequence for macro `%s'",
+ _("error checking --warn-macro-sequence for macro `%s'"),
name));
}
}
@@ -387,13 +385,13 @@ bad_argc (token_data *name, int argc, int min, int max)
{
if (!suppress_warnings)
M4ERROR ((warning_status, 0,
- "Warning: too few arguments to builtin `%s'",
+ _("Warning: too few arguments to builtin `%s'"),
TOKEN_DATA_TEXT (name)));
isbad = true;
}
else if (max > 0 && argc > max && !suppress_warnings)
M4ERROR ((warning_status, 0,
- "Warning: excess arguments to builtin `%s' ignored",
+ _("Warning: excess arguments to builtin `%s' ignored"),
TOKEN_DATA_TEXT (name)));
return isbad;
@@ -414,7 +412,7 @@ numeric_arg (token_data *macro, const char *arg, int *valuep)
{
*valuep = 0;
M4ERROR ((warning_status, 0,
- "empty string treated as 0 in builtin `%s'",
+ _("empty string treated as 0 in builtin `%s'"),
TOKEN_DATA_TEXT (macro)));
}
else
@@ -424,17 +422,17 @@ numeric_arg (token_data *macro, const char *arg, int *valuep)
if (*endp != '\0')
{
M4ERROR ((warning_status, 0,
- "non-numeric argument to builtin `%s'",
+ _("non-numeric argument to builtin `%s'"),
TOKEN_DATA_TEXT (macro)));
return false;
}
- if (isspace (to_uchar (*arg)))
+ if (c_isspace (*arg))
M4ERROR ((warning_status, 0,
- "leading whitespace ignored in builtin `%s'",
+ _("leading whitespace ignored in builtin `%s'"),
TOKEN_DATA_TEXT (macro)));
else if (errno == ERANGE)
M4ERROR ((warning_status, 0,
- "numeric overflow detected in builtin `%s'",
+ _("numeric overflow detected in builtin `%s'"),
TOKEN_DATA_TEXT (macro)));
}
return true;
@@ -551,7 +549,7 @@ define_macro (int argc, token_data **argv, symbol_lookup mode)
if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT)
{
M4ERROR ((warning_status, 0,
- "Warning: %s: invalid macro name ignored", ARG (0)));
+ _("Warning: %s: invalid macro name ignored"), ARG (0)));
return;
}
@@ -584,13 +582,13 @@ define_macro (int argc, token_data **argv, symbol_lookup mode)
}
static void
-m4_define (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_define (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
define_macro (argc, argv, SYMBOL_INSERT);
}
static void
-m4_undefine (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_undefine (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int i;
if (bad_argc (argv[0], argc, 2, -1))
@@ -600,13 +598,13 @@ m4_undefine (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
}
static void
-m4_pushdef (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_pushdef (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
define_macro (argc, argv, SYMBOL_PUSHDEF);
}
static void
-m4_popdef (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_popdef (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int i;
if (bad_argc (argv[0], argc, 2, -1))
@@ -702,7 +700,7 @@ static void
dump_symbol (symbol *sym, void *arg)
{
struct dump_symbol_data *data = (struct dump_symbol_data *) arg;
- if (!SYMBOL_SHADOWED (sym) && SYMBOL_TYPE (sym) != TOKEN_VOID)
+ if (SYMBOL_TYPE (sym) != TOKEN_VOID)
{
obstack_blank (data->obs, sizeof (symbol *));
data->base = (symbol **) obstack_base (data->obs);
@@ -751,7 +749,7 @@ m4_dumpdef (struct obstack *obs, int argc, token_data **argv)
dump_symbol (s, &data);
else
M4ERROR ((warning_status, 0,
- "undefined macro `%s'", TOKEN_DATA_TEXT (argv[i])));
+ _("undefined macro `%s'"), TOKEN_DATA_TEXT (argv[i])));
}
}
@@ -814,7 +812,7 @@ m4_builtin (struct obstack *obs, int argc, token_data **argv)
if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT)
{
M4ERROR ((warning_status, 0,
- "Warning: %s: invalid macro name ignored", ARG (0)));
+ _("Warning: %s: invalid macro name ignored"), ARG (0)));
return;
}
@@ -822,7 +820,7 @@ m4_builtin (struct obstack *obs, int argc, token_data **argv)
bp = find_builtin_by_name (name);
if (bp->func == m4_placeholder)
M4ERROR ((warning_status, 0,
- "undefined builtin `%s'", name));
+ _("undefined builtin `%s'"), name));
else
{
int i;
@@ -855,7 +853,7 @@ m4_indir (struct obstack *obs, int argc, token_data **argv)
if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT)
{
M4ERROR ((warning_status, 0,
- "Warning: %s: invalid macro name ignored", ARG (0)));
+ _("Warning: %s: invalid macro name ignored"), ARG (0)));
return;
}
@@ -863,7 +861,7 @@ m4_indir (struct obstack *obs, int argc, token_data **argv)
s = lookup_symbol (name, SYMBOL_LOOKUP);
if (s == NULL || SYMBOL_TYPE (s) == TOKEN_VOID)
M4ERROR ((warning_status, 0,
- "undefined macro `%s'", name));
+ _("undefined macro `%s'"), name));
else
{
int i;
@@ -894,7 +892,7 @@ m4_defn (struct obstack *obs, int argc, token_data **argv)
if (bad_argc (argv[0], argc, 2, -1))
return;
- assert (0 < argc && argc <= INT_MAX);
+ assert (0 < argc);
for (i = 1; i < (unsigned) argc; i++)
{
const char *arg = ARG((int) i);
@@ -913,11 +911,11 @@ m4_defn (struct obstack *obs, int argc, token_data **argv)
case TOKEN_FUNC:
b = SYMBOL_FUNC (s);
if (b == m4_placeholder)
- M4ERROR ((warning_status, 0, "\
-builtin `%s' requested by frozen file is not supported", arg));
+ M4ERROR ((warning_status, 0, _("\
+builtin `%s' requested by frozen file is not supported"), arg));
else if (argc != 2)
M4ERROR ((warning_status, 0,
- "Warning: cannot concatenate builtin `%s'",
+ _("Warning: cannot concatenate builtin `%s'"),
arg));
else
push_macro (b);
@@ -944,7 +942,7 @@ builtin `%s' requested by frozen file is not supported", arg));
static int sysval;
static void
-m4_syscmd (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_syscmd (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
const char *cmd = ARG (1);
int status;
@@ -967,7 +965,7 @@ m4_syscmd (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
#endif
prog_args[2] = cmd;
errno = 0;
- status = execute (ARG (0), SYSCMD_SHELL, (char **) prog_args, false,
+ status = execute (ARG (0), SYSCMD_SHELL, prog_args, NULL, false,
false, false, false, true, false, &sig_status);
if (sig_status)
{
@@ -977,7 +975,7 @@ m4_syscmd (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
else
{
if (status == 127 && errno)
- M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd));
+ M4ERROR ((warning_status, errno, _("cannot run command `%s'"), cmd));
sysval = status;
}
}
@@ -1010,18 +1008,24 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv)
#endif
prog_args[2] = cmd;
errno = 0;
- child = create_pipe_in (ARG (0), SYSCMD_SHELL, (char **) prog_args,
+ child = create_pipe_in (ARG (0), SYSCMD_SHELL, prog_args, NULL,
NULL, false, true, false, &fd);
if (child == -1)
{
- M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd));
+ M4ERROR ((warning_status, errno, _("cannot run command `%s'"), cmd));
sysval = 127;
return;
}
+#if OS2
+ /* On OS/2 kLIBC, fdopen() creates a stream in a mode of a file descriptor.
+ So include "t" to open a stream in a text mode explicitly on OS/2. */
+ pin = fdopen (fd, "rt");
+#else
pin = fdopen (fd, "r");
+#endif
if (pin == NULL)
{
- M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd));
+ M4ERROR ((warning_status, errno, _("cannot run command `%s'"), cmd));
sysval = 127;
close (fd);
return;
@@ -1044,7 +1048,7 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv)
obstack_blank_fast (obs, len);
}
if (ferror (pin) || fclose (pin))
- M4ERROR ((EXIT_FAILURE, errno, "cannot read pipe"));
+ m4_failure (errno, _("cannot read pipe"));
errno = 0;
status = wait_subprocess (child, ARG (0), false, true, true, false,
&sig_status);
@@ -1056,14 +1060,14 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv)
else
{
if (status == 127 && errno)
- M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd));
+ M4ERROR ((warning_status, errno, _("cannot run command `%s'"), cmd));
sysval = status;
}
}
static void
-m4_sysval (struct obstack *obs, int argc M4_GNUC_UNUSED,
- token_data **argv M4_GNUC_UNUSED)
+m4_sysval (struct obstack *obs, int argc MAYBE_UNUSED,
+ token_data **argv MAYBE_UNUSED)
{
shipout_int (obs, sysval);
}
@@ -1091,7 +1095,7 @@ m4_eval (struct obstack *obs, int argc, token_data **argv)
if (radix < 1 || radix > (int) strlen (digits))
{
M4ERROR ((warning_status, 0,
- "radix %d in builtin `%s' out of range",
+ _("radix %d in builtin `%s' out of range"),
radix, ARG (0)));
return;
}
@@ -1101,13 +1105,13 @@ m4_eval (struct obstack *obs, int argc, token_data **argv)
if (min < 0)
{
M4ERROR ((warning_status, 0,
- "negative width to builtin `%s'", ARG (0)));
+ _("negative width to builtin `%s'"), ARG (0)));
return;
}
if (!*ARG (1))
M4ERROR ((warning_status, 0,
- "empty string treated as 0 in builtin `%s'", ARG (0)));
+ _("empty string treated as 0 in builtin `%s'"), ARG (0)));
else if (evaluate (ARG (1), &value))
return;
@@ -1151,7 +1155,12 @@ m4_incr (struct obstack *obs, int argc, token_data **argv)
if (!numeric_arg (argv[0], ARG (1), &value))
return;
- shipout_int (obs, value + 1);
+ /* Minimize undefined C behavior on overflow. This code assumes
+ that the implementation-defined overflow when casting unsigned to
+ signed is a silent twos-complement wrap-around. */
+ uint32_t v = value;
+ int32_t w = v + 1;
+ shipout_int (obs, w);
}
static void
@@ -1165,7 +1174,12 @@ m4_decr (struct obstack *obs, int argc, token_data **argv)
if (!numeric_arg (argv[0], ARG (1), &value))
return;
- shipout_int (obs, value - 1);
+ /* Minimize undefined C behavior on overflow. This code assumes
+ that the implementation-defined overflow when casting unsigned to
+ signed is a silent twos-complement wrap-around. */
+ uint32_t v = value;
+ int32_t w = v - 1;
+ shipout_int (obs, w);
}
/* This section contains the macros "divert", "undivert" and "divnum" for
@@ -1177,7 +1191,7 @@ m4_decr (struct obstack *obs, int argc, token_data **argv)
`-----------------------------------------------------------------*/
static void
-m4_divert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_divert (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int i = 0;
@@ -1210,7 +1224,7 @@ m4_divnum (struct obstack *obs, int argc, token_data **argv)
`------------------------------------------------------------------*/
static void
-m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_undivert (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int i, file;
FILE *fp;
@@ -1222,11 +1236,11 @@ m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
for (i = 1; i < argc; i++)
{
file = strtol (ARG (i), &endp, 10);
- if (*endp == '\0' && !isspace (to_uchar (*ARG (i))))
+ if (*endp == '\0' && !c_isspace (*ARG (i)))
insert_diversion (file);
else if (no_gnu_extensions)
M4ERROR ((warning_status, 0,
- "non-numeric argument to builtin `%s'", ARG (0)));
+ _("non-numeric argument to builtin `%s'"), ARG (0)));
else
{
fp = m4_path_search (ARG (i), NULL);
@@ -1235,11 +1249,11 @@ m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
insert_file (fp);
if (fclose (fp) == EOF)
M4ERROR ((warning_status, errno,
- "error undiverting `%s'", ARG (i)));
+ _("error undiverting `%s'"), ARG (i)));
}
else
M4ERROR ((warning_status, errno,
- "cannot undivert `%s'", ARG (i)));
+ _("cannot undivert `%s'"), ARG (i)));
}
}
}
@@ -1254,7 +1268,7 @@ m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
`-----------------------------------------------------------*/
static void
-m4_dnl (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_dnl (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
if (bad_argc (argv[0], argc, 1, 1))
return;
@@ -1280,7 +1294,7 @@ m4_shift (struct obstack *obs, int argc, token_data **argv)
`--------------------------------------------------------------------------*/
static void
-m4_changequote (struct obstack *obs M4_GNUC_UNUSED, int argc,
+m4_changequote (struct obstack *obs MAYBE_UNUSED, int argc,
token_data **argv)
{
if (bad_argc (argv[0], argc, 1, 3))
@@ -1297,7 +1311,7 @@ m4_changequote (struct obstack *obs M4_GNUC_UNUSED, int argc,
`-----------------------------------------------------------------*/
static void
-m4_changecom (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_changecom (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
if (bad_argc (argv[0], argc, 1, 3))
return;
@@ -1315,7 +1329,7 @@ m4_changecom (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
`---------------------------------------------------------------*/
static void
-m4_changeword (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_changeword (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
if (bad_argc (argv[0], argc, 2, 2))
return;
@@ -1349,7 +1363,7 @@ include (int argc, token_data **argv, bool silent)
{
if (!silent)
{
- M4ERROR ((warning_status, errno, "cannot open `%s'", ARG (1)));
+ M4ERROR ((warning_status, errno, _("cannot open `%s'"), ARG (1)));
retcode = EXIT_FAILURE;
}
return;
@@ -1364,7 +1378,7 @@ include (int argc, token_data **argv, bool silent)
`------------------------------------------------*/
static void
-m4_include (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_include (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
include (argc, argv, false);
}
@@ -1374,7 +1388,7 @@ m4_include (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
`----------------------------------*/
static void
-m4_sinclude (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_sinclude (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
include (argc, argv, true);
}
@@ -1412,14 +1426,14 @@ mkstemp_helper (struct obstack *obs, const char *me, const char *pattern,
fd = mkstemp (name);
if (fd < 0)
{
- M4ERROR ((0, errno, "%s: cannot create tempfile `%s'", me, pattern));
+ M4ERROR ((0, errno, _("%s: cannot create tempfile `%s'"), me, pattern));
obstack_free (obs, obstack_finish (obs));
}
else
{
close (fd);
/* Remove NUL, then finish quote. */
- obstack_blank (obs, -1);
+ obstack_blank_fast (obs, -1);
obstack_grow (obs, rquote.string, rquote.length);
}
}
@@ -1447,7 +1461,7 @@ m4_maketemp (struct obstack *obs, int argc, token_data **argv)
int i;
int len2;
- M4ERROR ((warning_status, 0, "recommend using mkstemp instead"));
+ M4ERROR ((warning_status, 0, _("recommend using mkstemp instead")));
for (i = len; i > 1; i--)
if (str[i - 1] != 'X')
break;
@@ -1528,8 +1542,8 @@ m4___program__ (struct obstack *obs, int argc, token_data **argv)
| argument, or 0 if no arguments are present. |
`----------------------------------------------------------*/
-static void M4_GNUC_NORETURN
-m4_m4exit (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+static void
+m4_m4exit (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int exit_code = EXIT_SUCCESS;
@@ -1540,7 +1554,7 @@ m4_m4exit (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
if (exit_code < 0 || exit_code > 255)
{
M4ERROR ((warning_status, 0,
- "exit status out of range: `%d'", exit_code));
+ _("exit status out of range: `%d'"), exit_code));
exit_code = EXIT_FAILURE;
}
/* Change debug stream back to stderr, to force flushing debug stream and
@@ -1616,7 +1630,7 @@ m4_traceon (struct obstack *obs, int argc, token_data **argv)
`------------------------------------------------------------------------*/
static void
-m4_traceoff (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_traceoff (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
symbol *s;
int i;
@@ -1639,7 +1653,7 @@ m4_traceoff (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
`------------------------------------------------------------------*/
static void
-m4_debugmode (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_debugmode (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
int new_debug_level;
int change_flag;
@@ -1664,7 +1678,7 @@ m4_debugmode (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
if (new_debug_level < 0)
M4ERROR ((warning_status, 0,
- "Debugmode: bad debug flags: `%s'", ARG (1)));
+ _("Debugmode: bad debug flags: `%s'"), ARG (1)));
else
{
switch (change_flag)
@@ -1696,7 +1710,7 @@ m4_debugmode (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
`-------------------------------------------------------------------------*/
static void
-m4_debugfile (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
+m4_debugfile (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
{
if (bad_argc (argv[0], argc, 1, 2))
return;
@@ -1705,7 +1719,7 @@ m4_debugfile (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
debug_set_output (NULL);
else if (!debug_set_output (ARG (1)))
M4ERROR ((warning_status, errno,
- "cannot set debug file `%s'", ARG (1)));
+ _("cannot set debug file `%s'"), ARG (1)));
}
/* This section contains text processing macros: "len", "index",
@@ -1971,12 +1985,11 @@ substitute (struct obstack *obs, const char *victim, const char *repl,
case '0':
if (!substitute_warned)
{
- M4ERROR ((warning_status, 0, "\
-Warning: \\0 will disappear, use \\& instead in replacements"));
+ M4ERROR ((warning_status, 0, _("\
+Warning: \\0 will disappear, use \\& instead in replacements")));
substitute_warned = 1;
}
- /* Fall through. */
-
+ FALLTHROUGH;
case '&':
obstack_grow (obs, victim + regs->start[0],
regs->end[0] - regs->start[0]);
@@ -1988,7 +2001,7 @@ Warning: \\0 will disappear, use \\& instead in replacements"));
ind = ch -= '0';
if (regs->num_regs - 1 <= ind)
M4ERROR ((warning_status, 0,
- "Warning: sub-expression %d not present", ch));
+ _("Warning: sub-expression %d not present"), ch));
else if (regs->end[ch] > 0)
obstack_grow (obs, victim + regs->start[ch],
regs->end[ch] - regs->start[ch]);
@@ -1997,7 +2010,7 @@ Warning: \\0 will disappear, use \\& instead in replacements"));
case '\0':
M4ERROR ((warning_status, 0,
- "Warning: trailing \\ ignored in replacement"));
+ _("Warning: trailing \\ ignored in replacement")));
return;
default:
@@ -2063,7 +2076,7 @@ m4_regexp (struct obstack *obs, int argc, token_data **argv)
if (msg != NULL)
{
M4ERROR ((warning_status, 0,
- "bad regular expression: `%s': %s", regexp, msg));
+ _("bad regular expression: `%s': %s"), regexp, msg));
free_pattern_buffer (&buf, ®s);
return;
}
@@ -2075,7 +2088,7 @@ m4_regexp (struct obstack *obs, int argc, token_data **argv)
if (startpos == -2)
M4ERROR ((warning_status, 0,
- "error matching regular expression `%s'", regexp));
+ _("error matching regular expression `%s'"), regexp));
else if (argc == 3)
shipout_int (obs, startpos);
else if (startpos >= 0)
@@ -2123,7 +2136,7 @@ m4_patsubst (struct obstack *obs, int argc, token_data **argv)
if (msg != NULL)
{
M4ERROR ((warning_status, 0,
- "bad regular expression `%s': %s", regexp, msg));
+ _("bad regular expression `%s': %s"), regexp, msg));
free (buf.buffer);
return;
}
@@ -2145,7 +2158,7 @@ m4_patsubst (struct obstack *obs, int argc, token_data **argv)
if (matchpos == -2)
M4ERROR ((warning_status, 0,
- "error matching regular expression `%s'", regexp));
+ _("error matching regular expression `%s'"), regexp));
else if (offset < length)
obstack_grow (obs, victim + offset, length - offset);
break;
@@ -2189,11 +2202,11 @@ m4_patsubst (struct obstack *obs, int argc, token_data **argv)
`--------------------------------------------------------------------*/
void
-m4_placeholder (struct obstack *obs M4_GNUC_UNUSED, int argc,
+m4_placeholder (struct obstack *obs MAYBE_UNUSED, int argc,
token_data **argv)
{
- M4ERROR ((warning_status, 0, "\
-builtin `%s' requested by frozen file is not supported", ARG (0)));
+ M4ERROR ((warning_status, 0, _("\
+builtin `%s' requested by frozen file is not supported"), ARG (0)));
}
/*-------------------------------------------------------------------.
@@ -2230,7 +2243,7 @@ expand_user_macro (struct obstack *obs, symbol *sym,
}
else
{
- for (i = 0; isdigit (to_uchar (*text)); text++)
+ for (i = 0; c_isdigit (*text); text++)
i = i*10 + (*text - '0');
}
if (i < argc)