aboutsummaryrefslogtreecommitdiff
path: root/gdb/complaints.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-04-08 14:33:35 -0600
committerTom Tromey <tromey@adacore.com>2020-04-08 14:47:58 -0600
commita00caa12790706017c9331ad984b4f6b102db1b6 (patch)
tree00de3d01df99db0d4e16e5f392661fafecdf7ed3 /gdb/complaints.h
parentd41b524f45fa1f02716bc41f64fb85a42dcec164 (diff)
downloadfsf-binutils-gdb-a00caa12790706017c9331ad984b4f6b102db1b6.zip
fsf-binutils-gdb-a00caa12790706017c9331ad984b4f6b102db1b6.tar.gz
fsf-binutils-gdb-a00caa12790706017c9331ad984b4f6b102db1b6.tar.bz2
Fix up complaints.h for namespace use
If 'complaint' is used in a namespace context, it will fail because 'stop_whining' is only declared at the top level. This patch fixes this problem in a simple way, by moving the declaration of 'stop_whining' out of the macro and to the top-level. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * complaints.h (stop_whining): Declare at top-level. (complaint): Don't declare stop_whining.
Diffstat (limited to 'gdb/complaints.h')
-rw-r--r--gdb/complaints.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/complaints.h b/gdb/complaints.h
index b3bb406..6ad056d 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -25,6 +25,10 @@
extern void complaint_internal (const char *fmt, ...)
ATTRIBUTE_PRINTF (1, 2);
+/* This controls whether complaints are emitted. */
+
+extern int stop_whining;
+
/* Register a complaint. This is a macro around complaint_internal to
avoid computing complaint's arguments when complaints are disabled.
Running FMT via gettext [i.e., _(FMT)] can be quite expensive, for
@@ -32,8 +36,6 @@ extern void complaint_internal (const char *fmt, ...)
#define complaint(FMT, ...) \
do \
{ \
- extern int stop_whining; \
- \
if (stop_whining > 0) \
complaint_internal (FMT, ##__VA_ARGS__); \
} \