unused-parameter.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* A C macro for declaring that specific function parameters are not used.
  2. Copyright (C) 2008-2013 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. /* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
  14. declarations for parameters that are not used. This helps to reduce
  15. warnings, such as from GCC -Wunused-parameter. The syntax is as follows:
  16. type param _GL_UNUSED_PARAMETER
  17. or more generally
  18. param_decl _GL_UNUSED_PARAMETER
  19. For example:
  20. int param _GL_UNUSED_PARAMETER
  21. int *(*param)(void) _GL_UNUSED_PARAMETER
  22. Other possible, but obscure and discouraged syntaxes:
  23. int _GL_UNUSED_PARAMETER *(*param)(void)
  24. _GL_UNUSED_PARAMETER int *(*param)(void)
  25. */
  26. #ifndef _GL_UNUSED_PARAMETER
  27. # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  28. # define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
  29. # else
  30. # define _GL_UNUSED_PARAMETER
  31. # endif
  32. #endif