/*@null@*/ /*@only@*/ static char *obj_filename = NULL, *in_filename = NULL;
static int special_options = 0;
-static preproc *cur_preproc = NULL;
+/*@null@*/ /*@dependent@*/ static preproc *cur_preproc = NULL;
static int preproc_only = 0;
-static FILE *open_obj(void);
+/*@null@*/ /*@dependent@*/ static FILE *open_obj(void);
static void cleanup(sectionhead *sections);
/* Forward declarations: cmd line parser handlers */
};
/* version message */
-static const char version_msg[] = N_(
- "yasm " VERSION "\n"
- "Copyright (c) 2001-2002 Peter Johnson and other " PACKAGE " developers\n"
- "This program is free software; you may redistribute it under the terms\n"
- "of the GNU General Public License. Portions of this program are\n"
- "licensed under the GNU Lesser General Public License or the 3-clause\n"
- "BSD license; see individual file comments for details. This program\n"
- "has absolutely no warranty; not even for merchantability or fitness for\n"
- "a particular purpose.\n"
- "Compiled on " __DATE__ ".\n");
+/*@observer@*/ static const char *version_msg[] = {
+ N_("yasm " VERSION "\n"),
+ N_("Copyright (c) 2001-2002 Peter Johnson and other " PACKAGE " developers\n"),
+ N_("This program is free software; you may redistribute it under the\n"),
+ N_("terms of the GNU General Public License. Portions of this program\n"),
+ N_("are licensed under the GNU Lesser General Public License or the\n"),
+ N_("3-clause BSD license; see individual file comments for details.\n"),
+ N_("This program has absolutely no warranty; not even for\n"),
+ N_("merchantibility or fitness for a particular purpose.\n"),
+ N_("Compiled on " __DATE__ ".\n"),
+};
/* help messages */
-static const char help_head[] = N_(
+/*@observer@*/ static const char help_head[] = N_(
"usage: yasm [option]* file\n"
"Options:\n");
-static const char help_tail[] = N_(
+/*@observer@*/ static const char help_tail[] = N_(
"\n"
"Files are asm sources to be assembled.\n"
"\n"
{
/*@null@*/ FILE *in = NULL, *obj = NULL;
sectionhead *sections;
+ size_t i;
#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES)
setlocale(LC_MESSAGES, "");
countof(options, opt_option));
return EXIT_SUCCESS;
case SPECIAL_SHOW_VERSION:
- printf("%s", gettext(version_msg));
+ for (i=0; i<sizeof(version_msg)/sizeof(char *); i++)
+ printf("%s", gettext(version_msg[i]));
return EXIT_SUCCESS;
}
/* Open output (object) file */
obj = open_obj();
- if (!obj)
+ if (!obj) {
+ xfree(preproc_buf);
return EXIT_FAILURE;
+ }
/* If not already specified, default to yapp preproc. */
if (!cur_preproc)
if (OutputAllErrorWarning() > 0) {
if (obj != stdout)
remove(obj_filename);
+ xfree(preproc_buf);
return EXIT_FAILURE;
}
xfree(obj_filename);
+ xfree(preproc_buf);
return EXIT_SUCCESS;
}
# include <stdarg.h>
#endif
-#ifdef gettext_noop
-#define N_(String) gettext_noop(String)
-#else
-#define N_(String) (String)
-#endif
-
#include "globals.h"
#include "errwarn.h"
+#define MSG_MAXSIZE 1024
+
/* ALL warnings are disabled if this is nonzero. */
int warnings_disabled = 0;
/* Default enabled warnings. See errwarn.h for a list. */
unsigned long warning_flags =
- (1<<WARN_UNRECOGNIZED_CHAR);
+ (1UL<<WARN_UNRECOGNIZED_CHAR);
/* Total error count for entire assembler run.
* Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
unsigned long line;
/* FIXME: This should not be a fixed size. But we don't have vasprintf()
* right now. */
- char msg[1024];
+ char msg[MSG_MAXSIZE];
} errwarn;
/* Line number of the previous error. Set and checked by Error(). */
void
InternalError_(const char *file, unsigned int line, const char *message)
{
- fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
+ fprintf(stderr, _("INTERNAL ERROR at %s, line %u: %s\n"), file, line,
message);
#ifdef HAVE_ABORT
abort();
assert(we != NULL);
va_start(ap, fmt);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(we->msg, MSG_MAXSIZE, fmt, ap);
+#else
vsprintf(we->msg, fmt, ap);
+#endif
va_end(ap);
/*@-branchstate@*/
we->type = WE_WARNING;
we->line = line_index;
va_start(ap, fmt);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(we->msg, MSG_MAXSIZE, fmt, ap);
+#else
vsprintf(we->msg, fmt, ap);
+#endif
va_end(ap);
if (!errwarns) {
# include <stdarg.h>
#endif
-#ifdef gettext_noop
-#define N_(String) gettext_noop(String)
-#else
-#define N_(String) (String)
-#endif
-
#include "globals.h"
#include "errwarn.h"
+#define MSG_MAXSIZE 1024
+
/* ALL warnings are disabled if this is nonzero. */
int warnings_disabled = 0;
/* Default enabled warnings. See errwarn.h for a list. */
unsigned long warning_flags =
- (1<<WARN_UNRECOGNIZED_CHAR);
+ (1UL<<WARN_UNRECOGNIZED_CHAR);
/* Total error count for entire assembler run.
* Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
unsigned long line;
/* FIXME: This should not be a fixed size. But we don't have vasprintf()
* right now. */
- char msg[1024];
+ char msg[MSG_MAXSIZE];
} errwarn;
/* Line number of the previous error. Set and checked by Error(). */
void
InternalError_(const char *file, unsigned int line, const char *message)
{
- fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
+ fprintf(stderr, _("INTERNAL ERROR at %s, line %u: %s\n"), file, line,
message);
#ifdef HAVE_ABORT
abort();
assert(we != NULL);
va_start(ap, fmt);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(we->msg, MSG_MAXSIZE, fmt, ap);
+#else
vsprintf(we->msg, fmt, ap);
+#endif
va_end(ap);
/*@-branchstate@*/
we->type = WE_WARNING;
we->line = line_index;
va_start(ap, fmt);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(we->msg, MSG_MAXSIZE, fmt, ap);
+#else
vsprintf(we->msg, fmt, ap);
+#endif
va_end(ap);
if (!errwarns) {
/*@null@*/ /*@only@*/ static char *obj_filename = NULL, *in_filename = NULL;
static int special_options = 0;
-static preproc *cur_preproc = NULL;
+/*@null@*/ /*@dependent@*/ static preproc *cur_preproc = NULL;
static int preproc_only = 0;
-static FILE *open_obj(void);
+/*@null@*/ /*@dependent@*/ static FILE *open_obj(void);
static void cleanup(sectionhead *sections);
/* Forward declarations: cmd line parser handlers */
};
/* version message */
-static const char version_msg[] = N_(
- "yasm " VERSION "\n"
- "Copyright (c) 2001-2002 Peter Johnson and other " PACKAGE " developers\n"
- "This program is free software; you may redistribute it under the terms\n"
- "of the GNU General Public License. Portions of this program are\n"
- "licensed under the GNU Lesser General Public License or the 3-clause\n"
- "BSD license; see individual file comments for details. This program\n"
- "has absolutely no warranty; not even for merchantability or fitness for\n"
- "a particular purpose.\n"
- "Compiled on " __DATE__ ".\n");
+/*@observer@*/ static const char *version_msg[] = {
+ N_("yasm " VERSION "\n"),
+ N_("Copyright (c) 2001-2002 Peter Johnson and other " PACKAGE " developers\n"),
+ N_("This program is free software; you may redistribute it under the\n"),
+ N_("terms of the GNU General Public License. Portions of this program\n"),
+ N_("are licensed under the GNU Lesser General Public License or the\n"),
+ N_("3-clause BSD license; see individual file comments for details.\n"),
+ N_("This program has absolutely no warranty; not even for\n"),
+ N_("merchantibility or fitness for a particular purpose.\n"),
+ N_("Compiled on " __DATE__ ".\n"),
+};
/* help messages */
-static const char help_head[] = N_(
+/*@observer@*/ static const char help_head[] = N_(
"usage: yasm [option]* file\n"
"Options:\n");
-static const char help_tail[] = N_(
+/*@observer@*/ static const char help_tail[] = N_(
"\n"
"Files are asm sources to be assembled.\n"
"\n"
{
/*@null@*/ FILE *in = NULL, *obj = NULL;
sectionhead *sections;
+ size_t i;
#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES)
setlocale(LC_MESSAGES, "");
countof(options, opt_option));
return EXIT_SUCCESS;
case SPECIAL_SHOW_VERSION:
- printf("%s", gettext(version_msg));
+ for (i=0; i<sizeof(version_msg)/sizeof(char *); i++)
+ printf("%s", gettext(version_msg[i]));
return EXIT_SUCCESS;
}
/* Open output (object) file */
obj = open_obj();
- if (!obj)
+ if (!obj) {
+ xfree(preproc_buf);
return EXIT_FAILURE;
+ }
/* If not already specified, default to yapp preproc. */
if (!cur_preproc)
if (OutputAllErrorWarning() > 0) {
if (obj != stdout)
remove(obj_filename);
+ xfree(preproc_buf);
return EXIT_FAILURE;
}
xfree(obj_filename);
+ xfree(preproc_buf);
return EXIT_SUCCESS;
}