#define PRINTF_LIKE(FCN) \
void FCN (const char *format, ...) \
__attribute__ ((__format__ (__printf__, 1, 2)))
+#define PRINTF_INDENT_LIKE(FCN) \
+ void FCN (unsigned int indent, const char *format, ...) \
+ __attribute__ ((__format__ (__printf__, 2, 3)))
#define PRINTF_WHERE_LIKE(FCN) \
void FCN (const char *file, unsigned int line, const char *format, ...) \
__attribute__ ((__format__ (__printf__, 3, 4)))
-#define PRINTF_INDENT_LIKE(FCN) \
+#define PRINTF_WHERE_INDENT_LIKE(FCN) \
void FCN (const char *file, unsigned int line, unsigned int indent, \
const char *format, ...) \
__attribute__ ((__format__ (__printf__, 4, 5)))
#else /* __GNUC__ < 2 || defined(VMS) */
#define PRINTF_LIKE(FCN) void FCN (const char *format, ...)
-#define PRINTF_WHERE_LIKE(FCN) void FCN (const char *file, \
- unsigned int line, \
+#define PRINTF_INDENT_LIKE(FCN) void FCN (unsigned int indent, \
const char *format, ...)
-#define PRINTF_INDENT_LIKE(FCN) void FCN (const char *file, \
+#define PRINTF_WHERE_LIKE(FCN) void FCN (const char *file, \
unsigned int line, \
- unsigned int indent, \
const char *format, ...)
+#define PRINTF_WHERE_INDENT_LIKE(FCN) void FCN (const char *file, \
+ unsigned int line, \
+ unsigned int indent, \
+ const char *format, ...)
#endif /* __GNUC__ < 2 || defined(VMS) */
PRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN;
PRINTF_LIKE (as_tsktsk);
PRINTF_LIKE (as_warn);
+PRINTF_INDENT_LIKE (as_info);
PRINTF_WHERE_LIKE (as_bad_where);
PRINTF_WHERE_LIKE (as_warn_where);
-PRINTF_INDENT_LIKE (as_info_where);
+PRINTF_WHERE_INDENT_LIKE (as_info_where);
void set_identify_name (const char *);
void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
}
}
+/* The common portion of as_info, and as_info_where. */
+
+static void
+as_info_internal (const char *file, unsigned int line, unsigned int indent,
+ const char *buffer)
+{
+ if (file == NULL)
+ file = as_where_top (&line);
+
+ if (file)
+ {
+ if (line != 0)
+ fprintf (stderr, "%s:%u: %*s%s%s\n",
+ file, line, (int)indent, "", _("Info: "), buffer);
+ else
+ fprintf (stderr, "%s: %s%s\n", file, _("Info: "), buffer);
+ }
+ else
+ fprintf (stderr, "%s%s\n", _("Info: "), buffer);
+}
+
+/* Send to stderr a string as a information, and locate information
+ in input file(s). */
+
+void
+as_info (unsigned int indent, const char *format, ...)
+{
+ if (flag_no_information)
+ return;
+
+ va_list args;
+ char buffer[2000];
+
+ va_start (args, format);
+ vsnprintf (buffer, sizeof (buffer), format, args);
+ va_end (args);
+ as_info_internal (NULL, 0, indent, buffer);
+}
+
/* Send to stderr a string as information, with location data passed in.
Note that for now this is not intended for general use. */
va_start (args, format);
vsnprintf (buffer, sizeof (buffer), format, args);
va_end (args);
- fprintf (stderr, "%s:%u: %*s%s%s\n",
- file, line, (int)indent, "", _("Info: "), buffer);
+ as_info_internal (file, line, indent, buffer);
}
/* The common portion of as_warn, as_warn_where, and as_tsktsk. */