/* messages.c - error reporter -
- Copyright (C) 1987-2019 Free Software Foundation, Inc.
+ Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
/* Support routines. */
-void
-sprint_value (char *buf, valueT val)
-{
- if (sizeof (val) <= sizeof (long))
- {
- sprintf (buf, "%ld", (long) val);
- return;
- }
- if (sizeof (val) <= sizeof (bfd_vma))
- {
- sprintf_vma (buf, val);
- return;
- }
- abort ();
-}
-
#define HEX_MAX_THRESHOLD 1024
#define HEX_MIN_THRESHOLD -(HEX_MAX_THRESHOLD)
offsetT max,
const char *file,
unsigned line,
- int bad)
+ bool bad)
{
const char * err;
abort ();
/* xgettext:c-format */
- err = _("%s out of domain (%" BFD_VMA_FMT "d is not a multiple of %" \
- BFD_VMA_FMT "d)");
+ err = _("%s out of domain (%" PRId64
+ " is not a multiple of %" PRId64 ")");
+
if (bad)
- as_bad_where (file, line, err, prefix, val, right);
+ as_bad_where (file, line, err, prefix, (int64_t) val, (int64_t) right);
else
- as_warn_where (file, line, err, prefix, val, right);
- return;
+ as_warn_where (file, line, err, prefix, (int64_t) val, (int64_t) right);
}
-
- 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)
+ else 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 (%" BFD_VMA_FMT "d is not between %" \
- BFD_VMA_FMT "d and %" BFD_VMA_FMT "d)");
+ /* xgettext:c-format. */
+ err = _("%s out of range (%" PRId64
+ " is not between %" PRId64 " and %" PRId64 ")");
if (bad)
- as_bad_where (file, line, err, prefix, val, min, max);
+ as_bad_where (file, line, err, prefix,
+ (int64_t) val, (int64_t) min, (int64_t) max);
else
- as_warn_where (file, line, err, prefix, val, min, max);
+ as_warn_where (file, line, err, prefix,
+ (int64_t) val, (int64_t) min, (int64_t) 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, (bfd_vma) val);
- sprintf_vma (min_buf, (bfd_vma) min);
- sprintf_vma (max_buf, (bfd_vma) max);
-
/* xgettext:c-format. */
- err = _("%s out of range (0x%s is not between 0x%s and 0x%s)");
+ err = _("%s out of range (0x%" PRIx64
+ " is not between 0x%" PRIx64 " and 0x%" PRIx64 ")");
if (bad)
- as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf);
+ as_bad_where (file, line, err, prefix,
+ (int64_t) val, (int64_t) min, (int64_t) max);
else
- as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf);
+ as_warn_where (file, line, err, prefix,
+ (int64_t) val, (int64_t) min, (int64_t) max);
}
}
const char *file,
unsigned line)
{
- as_internal_value_out_of_range (prefix, value, min, max, file, line, 0);
+ as_internal_value_out_of_range (prefix, value, min, max, file, line, false);
}
void
const char *file,
unsigned line)
{
- as_internal_value_out_of_range (prefix, value, min, max, file, line, 1);
+ as_internal_value_out_of_range (prefix, value, min, max, file, line, true);
}