[Bug c/81404] suggested hints for standard C macros should avoid GCC predefined macros

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 11 15:40:00 GMT 2017


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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-10-11
                 CC|                            |dmalcolm at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this.

Confirmed.

Presumably we should print something like:

a.c:1:9: error: ‘INT_MAX’ undeclared here (not in a function)
 int i = INT_MAX;
         ^~~~~~~
a.c:1:9: note: 'INT_MAX' is defined in header '<limits.h>'; did you forget to
'#include <limits.h>'?
+#include <limits.h>

(note the fix-it hint)

FWIW this looks close to being covered by this (not-yet-in-trunk) patch:
  https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00438.html

(Presumably we'd want it for the C++ FE also; presumably recommending <climits>
rather than <limits.h> there)


More information about the Gcc-bugs mailing list