https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84890

            Bug ID: 84890
           Summary: Overly verbose notes for missing headers
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

As of gcc 8:

incomplete.c:4:17: error: ‘INT_MAX’ undeclared (first use in this function)
     int limit = INT_MAX;
                 ^~~~~~~
incomplete.c:4:17: note: ‘INT_MAX’ is defined in header ‘<limits.h>’; did you
forget to ‘#include <limits.h>’?

Reddit user "ramennoodle" comments:

> This seems redundantly verbose. Why not just:
> 
> incomplete.c:4:17: note: ‘INT_MAX’ is defined in header ‘<limits.h>
> 
> ?

I agree it's verbose, but maybe we should instead just lose the first part of
the note, and print:

incomplete.c:4:17: error: ‘INT_MAX’ undeclared (first use in this function)
     int limit = INT_MAX;
                 ^~~~~~~
incomplete.c:4:17: note: did you forget to ‘#include <limits.h>’?

Reply via email to