view gcc/testsuite/g++.dg/warn/nonnull1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Test that "nonnull" attribute works for C++.
// Origin: Joseph Myers <jsm@polyomino.org.uk>
// { dg-do compile }
// { dg-options "-Wall" }

// The "nonnull" attribute is thoroughly tested for C, so here we
// simply test that it works at all, as at one point the relevant
// checking code was only called for C.

extern void f (char *) __attribute__((nonnull));

void
g ()
{
  f (0); // { dg-warning "null" "null argument" }
}