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

            Bug ID: 80685
           Summary: -Wnonnull-compare warns based on builtin declaration
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coypu at sdf dot org
  Target Milestone: ---

Hi, I'm building a libc.

It doesn't use __attribute__((nonnull)) anywhere in stdio.h and other headers,
instead asserts in a convoluted way that the arguments aren't NULL.

Building with gcc -Werror -Wall etc. I get lots of warnings about these NULL
checks:

/usr/src/lib/libc/../../common/lib/libc/string/strncat.c: In function
'strncat':
/usr/src/lib/libc/../../common/lib/libc/string/strncat.c:63:2: error: nonnull
argument 'dst' compared to NULL [-Werror=nonnull-compare]
  _DIAGASSERT(dst != NULL);
  ^

I believe that warning may be bogus, feel free to close if you disagree.

Reply via email to