diff options
author | Gary Benson <gbenson@redhat.com> | 2014-08-04 12:04:02 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2014-08-29 10:53:35 +0100 |
commit | e3d6ba5d322d871004e84b936e6509749a350325 (patch) | |
tree | 975cbc463db136ec939958962a4947b17832c568 | |
parent | 075c703382f5bed4ec0976dd11f3b5b694ce3cb1 (diff) | |
download | gdb-e3d6ba5d322d871004e84b936e6509749a350325.zip gdb-e3d6ba5d322d871004e84b936e6509749a350325.tar.gz gdb-e3d6ba5d322d871004e84b936e6509749a350325.tar.bz2 |
Move internal_{,v}warning to common/errors.[ch]
This commit moves internal_warning and internal_vwarning into
common/errors.[ch].
gdb/ChangeLog:
* common/errors.h (internal_warning): New declaration.
(internal_vwarning): Likewise.
* common/errors.c (internal_warning): New function.
* utils.h (internal_warning): Don't declare.
(internal_vwarning): Likewise.
* utils.c (internal_warning): Removed.
gdb/gdbserver/ChangeLog:
* utils.c (internal_vwarning): New function.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/common/errors.c | 12 | ||||
-rw-r--r-- | gdb/common/errors.h | 15 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/gdbserver/utils.c | 11 | ||||
-rw-r--r-- | gdb/utils.c | 10 | ||||
-rw-r--r-- | gdb/utils.h | 7 |
7 files changed, 51 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 341e303..4ce6d87 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2014-08-29 Gary Benson <gbenson@redhat.com> + * common/errors.h (internal_warning): New declaration. + (internal_vwarning): Likewise. + * common/errors.c (internal_warning): New function. + * utils.h (internal_warning): Don't declare. + (internal_vwarning): Likewise. + * utils.c (internal_warning): Removed. + +2014-08-29 Gary Benson <gbenson@redhat.com> + * main.c (captured_main): Use warning during startup. Prefix startup warning messages with command name. diff --git a/gdb/common/errors.c b/gdb/common/errors.c index 7d0bb6e..d6e17a8 100644 --- a/gdb/common/errors.c +++ b/gdb/common/errors.c @@ -59,3 +59,15 @@ internal_error (const char *file, int line, const char *fmt, ...) internal_verror (file, line, fmt, ap); va_end (ap); } + +/* See common/errors.h. */ + +void +internal_warning (const char *file, int line, const char *fmt, ...) +{ + va_list ap; + + va_start (ap, fmt); + internal_vwarning (file, line, fmt, ap); + va_end (ap); +} diff --git a/gdb/common/errors.h b/gdb/common/errors.h index 4e6c2b3..88d77e5 100644 --- a/gdb/common/errors.h +++ b/gdb/common/errors.h @@ -58,6 +58,21 @@ extern void internal_error (const char *file, int line, extern void internal_verror (const char *file, int line, const char *fmt, va_list args) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0); + +/* An internal problem was detected, but the requested operation can + still proceed. Internal warnings indicate programming errors as + opposed to more general issues beyond the application's control. + A warning message is constructed using a printf- or vprintf-style + argument list. The function "internal_vwarning" must be provided + by the client. */ + +extern void internal_warning (const char *file, int line, + const char *fmt, ...) + ATTRIBUTE_PRINTF (3, 4); + +extern void internal_vwarning (const char *file, int line, + const char *fmt, va_list args) + ATTRIBUTE_PRINTF (3, 0); /* Like "error", but the error message is constructed by combining diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 2b63ca3..56ef86c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2014-08-29 Gary Benson <gbenson@redhat.com> + + * utils.c (internal_vwarning): New function. + 2014-08-28 Gary Benson <gbenson@redhat.com> * utils.h (fatal): Remove declaration. diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c index 0c2af05..244e114 100644 --- a/gdb/gdbserver/utils.c +++ b/gdb/gdbserver/utils.c @@ -110,6 +110,17 @@ internal_verror (const char *file, int line, const char *fmt, va_list args) exit (1); } +/* Report a problem internal to GDBserver. */ + +void +internal_vwarning (const char *file, int line, const char *fmt, va_list args) +{ + fprintf (stderr, "\ +%s:%d: A problem internal to " TOOLNAME " has been detected.\n", file, line); + vfprintf (stderr, fmt, args); + fprintf (stderr, "\n"); +} + /* Convert a CORE_ADDR into a HEX string, like %lx. The result is stored in a circular static buffer, NUMCELLS deep. */ diff --git a/gdb/utils.c b/gdb/utils.c index 9785a61..4da9501 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -823,16 +823,6 @@ internal_vwarning (const char *file, int line, const char *fmt, va_list ap) internal_vproblem (&internal_warning_problem, file, line, fmt, ap); } -void -internal_warning (const char *file, int line, const char *string, ...) -{ - va_list ap; - - va_start (ap, string); - internal_vwarning (file, line, string, ap); - va_end (ap); -} - static struct internal_problem demangler_warning_problem = { "demangler-warning", 1, internal_problem_ask, 0, internal_problem_no }; diff --git a/gdb/utils.h b/gdb/utils.h index 62888a7..c1948eb 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -286,13 +286,6 @@ extern char *warning_pre_print; extern void error_stream (struct ui_file *) ATTRIBUTE_NORETURN; -extern void internal_vwarning (const char *file, int line, - const char *, va_list ap) - ATTRIBUTE_PRINTF (3, 0); - -extern void internal_warning (const char *file, int line, - const char *, ...) ATTRIBUTE_PRINTF (3, 4); - extern void demangler_vwarning (const char *file, int line, const char *, va_list ap) ATTRIBUTE_PRINTF (3, 0); |