This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make -Wcoverage-mismatch behavior sane.

On 29 April 2010 18:29, Neil Vachharajani <> wrote:
> We only want to print this message if *warning* (not an error) was
> emitted. ?We also only want to do it once. ?If the current warning was
> just emitted as an error, errorcount will be non-zero and this will be
> skipped. ?The inhibit_warnings portion of this condition was removed
> because as I mentioned above, I've wrapped all the code in a condition
> based on the return value of warning_at.

Hum, I see. Still it feels quite fragile. I would prefer something like:

+	  if (diagnostic_kind (global_dc, OPT_Wcoverage_mismatch) == DK_WARNING
             && !warned) {
             warned = true;

But I see that there is no such function in diagnostic.h. I think it
could be useful for other cases. This is a possible implementation:

Index: gcc/diagnostic.h
--- gcc/diagnostic.h    (revision 158822)
+++ gcc/diagnostic.h    (working copy)
@@ -215,6 +215,12 @@
 extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *,
                                                    int /* optidx */,
                                                    diagnostic_t /* kind */);
+static inline diagnostic_t
+diagnostic_kind (diagnostic_context *context, int option_index)
+    return context->classify_diagnostic[option_index];
 extern bool diagnostic_report_diagnostic (diagnostic_context *,
                                          diagnostic_info *);

I am not saying that you need to do this, you should wait until a
maintainer decides about the patch.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]