Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Add warning macro
Browse files Browse the repository at this point in the history
Not every problem in the world is fatal, so add a warning for those
not-quite-right situations.
  • Loading branch information
zlandau committed Dec 12, 2013
1 parent 8e99cab commit 685a07b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions common.c
Expand Up @@ -47,3 +47,12 @@ void common_fatal_file(const char *file, int lineno, int ret)
else
common_fatal(file, lineno, "too few bytes read from file");
}

void common_warning(const char *file, int lineno, const char *format, ...)
{
va_list vargs;
va_start(vargs, format);
fprintf(stderr, "atosl: warning: %s:%d: ", file, lineno);
vfprintf(stderr, format, vargs);
fprintf(stderr, "\n");
}
3 changes: 3 additions & 0 deletions common.h
Expand Up @@ -34,6 +34,9 @@ void common_fatal_usage(const char *file, int lineno, const char *format, ...);
#define fatal_file(args...) common_fatal_file(__FILE__, __LINE__, args)
void common_fatal_file(const char *file, int lineno, int ret);

#define warning(args...) common_warning(__FILE__, __LINE__, args)
void common_warning(const char *file, int lineno, const char *format, ...);

#define DWARF_ASSERT(ret, err) \
do { \
if (ret == DW_DLV_ERROR) { \
Expand Down

0 comments on commit 685a07b

Please sign in to comment.