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