xref: /dflybsd-src/gnu/usr.bin/grep/libgreputils/arg-nonnull.h (revision 4ce1b01662e01b4aeb3dbaf5e68504c3aa2a1581)
1*4ce1b016SDaniel Fojt /* A C macro for declaring that specific arguments must not be NULL.
2*4ce1b016SDaniel Fojt    Copyright (C) 2009-2020 Free Software Foundation, Inc.
3*4ce1b016SDaniel Fojt 
4*4ce1b016SDaniel Fojt    This program is free software: you can redistribute it and/or modify it
5*4ce1b016SDaniel Fojt    under the terms of the GNU General Public License as published
6*4ce1b016SDaniel Fojt    by the Free Software Foundation; either version 3 of the License, or
7*4ce1b016SDaniel Fojt    (at your option) any later version.
8*4ce1b016SDaniel Fojt 
9*4ce1b016SDaniel Fojt    This program is distributed in the hope that it will be useful,
10*4ce1b016SDaniel Fojt    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*4ce1b016SDaniel Fojt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*4ce1b016SDaniel Fojt    General Public License for more details.
13*4ce1b016SDaniel Fojt 
14*4ce1b016SDaniel Fojt    You should have received a copy of the GNU General Public License
15*4ce1b016SDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
16*4ce1b016SDaniel Fojt 
1756a835a5SJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
1856a835a5SJohn Marino    that the values passed as arguments n, ..., m must be non-NULL pointers.
1956a835a5SJohn Marino    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
2056a835a5SJohn Marino #ifndef _GL_ARG_NONNULL
2156a835a5SJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
2256a835a5SJohn Marino #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
2356a835a5SJohn Marino # else
2456a835a5SJohn Marino #  define _GL_ARG_NONNULL(params)
2556a835a5SJohn Marino # endif
2656a835a5SJohn Marino #endif
27