Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
messages.c File Reference
#include "as.h"

Go to the source code of this file.

Defines

#define HEX_MAX_THRESHOLD   1024
#define HEX_MIN_THRESHOLD   -(HEX_MAX_THRESHOLD)

Functions

static void identify (char *)
static void as_show_where (void)
static void as_warn_internal (char *, unsigned int, char *)
static void as_bad_internal (char *, unsigned int, char *)
int had_warnings (void)
int had_errors (void)
void as_tsktsk (char *format, va_alist) const
void as_warn (char *format, va_alist) const
void as_warn_where (char *file, unsigned int line, const char *format, va_alist)
void as_bad (char *format, va_alist) const
void as_bad_where (char *file, unsigned int line, const char *format, va_alist)
void as_fatal (char *format, va_alist)
void as_assert (const char *file, int line, const char *fn)
void as_abort (const char *file, int line, const char *fn)
void sprint_value (char *buf, valueT val)
static void as_internal_value_out_of_range (char *prefix, offsetT val, offsetT min, offsetT max, char *file, unsigned line, int bad)
void as_warn_value_out_of_range (char *prefix, offsetT value, offsetT min, offsetT max, char *file, unsigned line)
void as_bad_value_out_of_range (char *prefix, offsetT value, offsetT min, offsetT max, char *file, unsigned line)

Variables

static int warning_count
static int error_count

Define Documentation

#define HEX_MAX_THRESHOLD   1024

Definition at line 442 of file messages.c.

Definition at line 443 of file messages.c.


Function Documentation

void as_abort ( const char *  file,
int  line,
const char *  fn 
)

Definition at line 411 of file messages.c.

{
  as_show_where ();
  if (fn)
    fprintf (stderr, _("Internal error, aborting at %s line %d in %s\n"),
            file, line, fn);
  else
    fprintf (stderr, _("Internal error, aborting at %s line %d\n"),
            file, line);
  fprintf (stderr, _("Please report this bug.\n"));
  xexit (EXIT_FAILURE);
}

Here is the call graph for this function:

void as_assert ( const char *  file,
int  line,
const char *  fn 
)

Definition at line 394 of file messages.c.

{
  as_show_where ();
  fprintf (stderr, _("Internal error!\n"));
  if (fn)
    fprintf (stderr, _("Assertion failure in %s at %s line %d.\n"),
            fn, file, line);
  else
    fprintf (stderr, _("Assertion failure at %s line %d.\n"), file, line);
  fprintf (stderr, _("Please report this bug.\n"));
  xexit (EXIT_FAILURE);
}

Here is the call graph for this function:

void as_bad ( char *  format,
va_alist   
) const

Definition at line 297 of file messages.c.

{
  va_list args;
  char buffer[2000];

  va_start (args);
  vsnprintf (buffer, sizeof (buffer), format, args);
  va_end (args);

  as_bad_internal ((char *) NULL, 0, buffer);
}

Here is the call graph for this function:

static void as_bad_internal ( char *  file,
unsigned int  line,
char *  buffer 
) [static]

Definition at line 257 of file messages.c.

{
  ++error_count;

  if (file == NULL)
    as_where (&file, &line);

  identify (file);
  if (file)
    fprintf (stderr, "%s:%u: ", file, line);
  fprintf (stderr, _("Error: "));
  fputs (buffer, stderr);
  (void) putc ('\n', stderr);
#ifndef NO_LISTING
  listing_error (buffer);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void as_bad_value_out_of_range ( char *  prefix,
offsetT  value,
offsetT  min,
offsetT  max,
char *  file,
unsigned  line 
)

Definition at line 511 of file messages.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void as_bad_where ( char *  file,
unsigned int  line,
const char *  format,
va_alist   
)

Definition at line 332 of file messages.c.

{
  va_list args;
  char buffer[2000];

  va_start (args);
  vsnprintf (buffer, sizeof (buffer), format, args);
  va_end (args);

  as_bad_internal (file, line, buffer);
}

Here is the call graph for this function:

void as_fatal ( char *  format,
va_alist   
)

Definition at line 374 of file messages.c.

{
  va_list args;

  as_show_where ();
  va_start (args);
  fprintf (stderr, _("Fatal error: "));
  vfprintf (stderr, format, args);
  (void) putc ('\n', stderr);
  va_end (args);
  xexit (EXIT_FAILURE);
}

Here is the call graph for this function:

static void as_internal_value_out_of_range ( char *  prefix,
offsetT  val,
offsetT  min,
offsetT  max,
char *  file,
unsigned  line,
int  bad 
) [static]

Definition at line 446 of file messages.c.

{
  const char * err;

  if (prefix == NULL)
    prefix = "";

  if (   val < HEX_MAX_THRESHOLD
      && min < HEX_MAX_THRESHOLD
      && max < HEX_MAX_THRESHOLD
      && val > HEX_MIN_THRESHOLD
      && min > HEX_MIN_THRESHOLD
      && max > HEX_MIN_THRESHOLD)
    {
      /* xgettext:c-format  */
      err = _("%s out of range (%d is not between %d and %d)");

      if (bad)
       as_bad_where (file, line, err,
                    prefix, (int) val, (int) min, (int) max);
      else
       as_warn_where (file, line, err,
                     prefix, (int) val, (int) min, (int) max);
    }
  else
    {
      char val_buf [sizeof (val) * 3 + 2];
      char min_buf [sizeof (val) * 3 + 2];
      char max_buf [sizeof (val) * 3 + 2];

      if (sizeof (val) > sizeof (bfd_vma))
       abort ();

      sprintf_vma (val_buf, val);
      sprintf_vma (min_buf, min);
      sprintf_vma (max_buf, max);

      /* xgettext:c-format.  */
      err = _("%s out of range (0x%s is not between 0x%s and 0x%s)");

      if (bad)
       as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf);
      else
       as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void as_show_where ( void  ) [static]

Definition at line 108 of file messages.c.

{
  char *file;
  unsigned int line;

  as_where (&file, &line);
  identify (file);
  if (file)
    fprintf (stderr, "%s:%u: ", file, line);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void as_tsktsk ( char *  format,
va_alist   
) const

Definition at line 139 of file messages.c.

{
  va_list args;

  as_show_where ();
  va_start (args);
  vfprintf (stderr, format, args);
  va_end (args);
  (void) putc ('\n', stderr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void as_warn ( char *  format,
va_alist   
) const

Definition at line 197 of file messages.c.

{
  va_list args;
  char buffer[2000];

  if (!flag_no_warnings)
    {
      va_start (args);
      vsnprintf (buffer, sizeof (buffer), format, args);
      va_end (args);
      as_warn_internal ((char *) NULL, 0, buffer);
    }
}

Here is the call graph for this function:

static void as_warn_internal ( char *  file,
unsigned int  line,
char *  buffer 
) [static]

Definition at line 156 of file messages.c.

{
  ++warning_count;

  if (file == NULL)
    as_where (&file, &line);

  identify (file);
  if (file)
    fprintf (stderr, "%s:%u: ", file, line);
  fprintf (stderr, _("Warning: "));
  fputs (buffer, stderr);
  (void) putc ('\n', stderr);
#ifndef NO_LISTING
  listing_warning (buffer);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void as_warn_value_out_of_range ( char *  prefix,
offsetT  value,
offsetT  min,
offsetT  max,
char *  file,
unsigned  line 
)

Definition at line 500 of file messages.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void as_warn_where ( char *  file,
unsigned int  line,
const char *  format,
va_alist   
)

Definition at line 235 of file messages.c.

{
  va_list args;
  char buffer[2000];

  if (!flag_no_warnings)
    {
      va_start (args);
      vsnprintf (buffer, sizeof (buffer), format, args);
      va_end (args);
      as_warn_internal (file, line, buffer);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int had_errors ( void  )

Definition at line 100 of file messages.c.

{
  return error_count;
}

Here is the caller graph for this function:

int had_warnings ( void  )

Definition at line 89 of file messages.c.

{
  return warning_count;
}

Here is the caller graph for this function:

static void identify ( char *  file) [static]

Definition at line 66 of file messages.c.

{
  static int identified;

  if (identified)
    return;
  identified++;

  if (!file)
    {
      unsigned int x;
      as_where (&file, &x);
    }

  if (file)
    fprintf (stderr, "%s: ", file);
  fprintf (stderr, _("Assembler messages:\n"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void sprint_value ( char *  buf,
valueT  val 
)

Definition at line 427 of file messages.c.

{
  if (sizeof (val) <= sizeof (long))
    {
      sprintf (buf, "%ld", (long) val);
      return;
    }
  if (sizeof (val) <= sizeof (bfd_vma))
    {
      sprintf_vma (buf, val);
      return;
    }
  abort ();
}

Here is the caller graph for this function:


Variable Documentation

int error_count [static]

Definition at line 97 of file messages.c.

int warning_count [static]

Definition at line 86 of file messages.c.