xref: /dflybsd-src/gnu/usr.bin/grep/libgreputils/unused-parameter.h (revision 4ce1b01662e01b4aeb3dbaf5e68504c3aa2a1581)
1*4ce1b016SDaniel Fojt /* A C macro for declaring that specific function parameters are not used.
2*4ce1b016SDaniel Fojt    Copyright (C) 2008-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 
17e54473e5SJohn Marino /* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
18e54473e5SJohn Marino    declarations for parameters that are not used.  This helps to reduce
19e54473e5SJohn Marino    warnings, such as from GCC -Wunused-parameter.  The syntax is as follows:
20e54473e5SJohn Marino        type param _GL_UNUSED_PARAMETER
21e54473e5SJohn Marino    or more generally
22e54473e5SJohn Marino        param_decl _GL_UNUSED_PARAMETER
23e54473e5SJohn Marino    For example:
24e54473e5SJohn Marino        int param _GL_UNUSED_PARAMETER
25e54473e5SJohn Marino        int *(*param)(void) _GL_UNUSED_PARAMETER
26e54473e5SJohn Marino    Other possible, but obscure and discouraged syntaxes:
27e54473e5SJohn Marino        int _GL_UNUSED_PARAMETER *(*param)(void)
28e54473e5SJohn Marino        _GL_UNUSED_PARAMETER int *(*param)(void)
29e54473e5SJohn Marino  */
30e54473e5SJohn Marino #ifndef _GL_UNUSED_PARAMETER
31e54473e5SJohn Marino # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
32e54473e5SJohn Marino #  define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
33e54473e5SJohn Marino # else
34e54473e5SJohn Marino #  define _GL_UNUSED_PARAMETER
35e54473e5SJohn Marino # endif
36e54473e5SJohn Marino #endif
37