sim: mips: merge mips64vr4300 with existing multi-run build
[binutils-gdb.git] / gdb / complaints.h
index 68c79bd6d0a1f99994805b976bca082d6ad1db88..02c8c2c558be6a9de966deb41529074a28322ae3 100644 (file)
@@ -31,6 +31,15 @@ extern void complaint_internal (const char *fmt, ...)
 
 extern int stop_whining;
 
+/* Return true if complaints are enabled.  This can be used to guard code
+   that is used only to decide whether to issue a complaint.  */
+
+static inline bool
+have_complaint ()
+{
+  return stop_whining > 0;
+}
+
 /* 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
@@ -38,7 +47,7 @@ extern int stop_whining;
 #define complaint(FMT, ...)                                    \
   do                                                           \
     {                                                          \
-      if (stop_whining > 0)                                    \
+      if (have_complaint ())                                   \
        complaint_internal (FMT, ##__VA_ARGS__);                \
     }                                                          \
   while (0)