getopt-cdefs.in.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* getopt-on-non-glibc compatibility macros.
  2. Copyright (C) 1989-2017 Free Software Foundation, Inc.
  3. This file is part of gnulib.
  4. Unlike most of the getopt implementation, it is NOT shared
  5. with the GNU C Library.
  6. gnulib is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as
  8. published by the Free Software Foundation; either version 3 of
  9. the License, or (at your option) any later version.
  10. gnulib is distributed in the hope that it will be useful, but
  11. WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. General Public License for more details.
  14. You should have received a copy of the GNU General Public
  15. License along with gnulib; if not, see
  16. <http://www.gnu.org/licenses/>. */
  17. #ifndef _GETOPT_CDEFS_H
  18. #define _GETOPT_CDEFS_H 1
  19. /* This header should not be used directly; include getopt.h or
  20. unistd.h instead. It does not have a protective #error, because
  21. the guard macro for getopt.h in gnulib is not fixed. */
  22. /* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
  23. a number of the internal macros supplied to GNU libc's headers by
  24. sys/cdefs.h. Provide fallback definitions for all of them. */
  25. #if @HAVE_SYS_CDEFS_H@
  26. # include <sys/cdefs.h>
  27. #endif
  28. #ifndef __BEGIN_DECLS
  29. # ifdef __cplusplus
  30. # define __BEGIN_DECLS extern "C" {
  31. # else
  32. # define __BEGIN_DECLS /* nothing */
  33. # endif
  34. #endif
  35. #ifndef __END_DECLS
  36. # ifdef __cplusplus
  37. # define __END_DECLS }
  38. # else
  39. # define __END_DECLS /* nothing */
  40. # endif
  41. #endif
  42. #ifndef __GNUC_PREREQ
  43. # if defined __GNUC__ && defined __GNUC_VERSION__
  44. # define __GNUC_PREREQ(maj, min) \
  45. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  46. # else
  47. # define __GNUC_PREREQ(maj, min) 0
  48. # endif
  49. #endif
  50. #ifndef __THROW
  51. # if defined __cplusplus && __GNUC_PREREQ (2,8)
  52. # define __THROW throw ()
  53. # else
  54. # define __THROW
  55. # endif
  56. #endif
  57. #endif /* _GETOPT_CDEFS_H */