fchmod-tests, fchmodat tests, lchmod tests: Add more tests.
[gnulib.git] / lib / getopt-cdefs.in.h
blobb9a879aff63c35bfab1439757bcc5fb1ca388191
1 /* getopt-on-non-glibc compatibility macros.
2 Copyright (C) 1989-2021 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 Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser 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>
33 #endif
35 #ifndef __BEGIN_DECLS
36 # ifdef __cplusplus
37 # define __BEGIN_DECLS extern "C" {
38 # else
39 # define __BEGIN_DECLS /* nothing */
40 # endif
41 #endif
42 #ifndef __END_DECLS
43 # ifdef __cplusplus
44 # define __END_DECLS }
45 # else
46 # define __END_DECLS /* nothing */
47 # endif
48 #endif
50 #ifndef __GNUC_PREREQ
51 # if defined __GNUC__ && defined __GNUC_VERSION__
52 # define __GNUC_PREREQ(maj, min) \
53 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
54 # else
55 # define __GNUC_PREREQ(maj, min) 0
56 # endif
57 #endif
59 #ifndef __THROW
60 # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
61 # define __THROW throw ()
62 # else
63 # define __THROW
64 # endif
65 #endif
67 #endif /* _GETOPT_CDEFS_H */