summaryrefslogtreecommitdiffstats
path: root/gl/getopt-cdefs.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/getopt-cdefs.in.h')
-rw-r--r--gl/getopt-cdefs.in.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/gl/getopt-cdefs.in.h b/gl/getopt-cdefs.in.h
new file mode 100644
index 00000000..b6dd913c
--- /dev/null
+++ b/gl/getopt-cdefs.in.h
@@ -0,0 +1,66 @@
1/* getopt-on-non-glibc compatibility macros.
2 Copyright (C) 1989-2022 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
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#ifndef _GETOPT_CDEFS_H
21#define _GETOPT_CDEFS_H 1
22
23/* This header should not be used directly; include getopt.h or
24 unistd.h instead. It does not have a protective #error, because
25 the guard macro for getopt.h in gnulib is not fixed. */
26
27/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
28 a number of the internal macros supplied to GNU libc's headers by
29 sys/cdefs.h. Provide fallback definitions for all of them. */
30#if @HAVE_SYS_CDEFS_H@
31# include <sys/cdefs.h>
32#endif
33
34#ifndef __BEGIN_DECLS
35# ifdef __cplusplus
36# define __BEGIN_DECLS extern "C" {
37# else
38# define __BEGIN_DECLS /* nothing */
39# endif
40#endif
41#ifndef __END_DECLS
42# ifdef __cplusplus
43# define __END_DECLS }
44# else
45# define __END_DECLS /* nothing */
46# endif
47#endif
48
49#ifndef __GNUC_PREREQ
50# if defined __GNUC__ && defined __GNUC_VERSION__
51# define __GNUC_PREREQ(maj, min) \
52 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
53# else
54# define __GNUC_PREREQ(maj, min) 0
55# endif
56#endif
57
58#ifndef __THROW
59# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
60# define __THROW throw ()
61# else
62# define __THROW
63# endif
64#endif
65
66#endif /* _GETOPT_CDEFS_H */