1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091
|
/* config-h.in. Generated from configure.ac by autoheader. */
/* Witness that <config.h> has been included. */
#define _GL_CONFIG_H_INCLUDED 1
/* Define to 1 if you have the 'argz_add' function. */
#undef HAVE_ARGZ_ADD
/* Define to 1 if you have the 'argz_append' function. */
#undef HAVE_ARGZ_APPEND
/* Define to 1 if you have the 'argz_count' function. */
#undef HAVE_ARGZ_COUNT
/* Define to 1 if you have the 'argz_create_sep' function. */
#undef HAVE_ARGZ_CREATE_SEP
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define to 1 if you have the 'argz_insert' function. */
#undef HAVE_ARGZ_INSERT
/* Define to 1 if you have the 'argz_next' function. */
#undef HAVE_ARGZ_NEXT
/* Define to 1 if you have the 'argz_stringify' function. */
#undef HAVE_ARGZ_STRINGIFY
/* Define to 1 if you have the 'closedir' function. */
#undef HAVE_CLOSEDIR
/* Define to 1 if you have the declaration of 'cygwin_conv_path', and to 0 if
you don't. */
#undef HAVE_DECL_CYGWIN_CONV_PATH
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the GNU dld library. */
#undef HAVE_DLD
/* Define to 1 if you have the <dld.h> header file. */
#undef HAVE_DLD_H
/* Define to 1 if you have the 'dlerror' function. */
#undef HAVE_DLERROR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
/* Define to 1 if the system has the type 'error_t'. */
#undef HAVE_ERROR_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the libdl library or equivalent. */
#undef HAVE_LIBDL
/* Define if libdlloader will be built on this platform */
#undef HAVE_LIBDLLOADER
/* Define to 1 if you have the <mach-o/dyld.h> header file. */
#undef HAVE_MACH_O_DYLD_H
/* Define to 1 if you have the 'opendir' function. */
#undef HAVE_OPENDIR
/* Define if libtool can extract symbol lists from object files. */
#undef HAVE_PRELOADED_SYMBOLS
/* Define to 1 if you have the 'readdir' function. */
#undef HAVE_READDIR
/* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the 'strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the 'strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <sys/dl.h> header file. */
#undef HAVE_SYS_DL_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* This value is set to 1 to indicate that the system argz facility works */
#undef HAVE_WORKING_ARGZ
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#undef LTDL_DLOPEN_DEPLIBS
/* Define to the system default library search path. */
#undef LT_DLSEARCH_PATH
/* The archive extension */
#undef LT_LIBEXT
/* The archive prefix */
#undef LT_LIBPREFIX
/* Define to the extension used for runtime loadable modules, say, ".so". */
#undef LT_MODULE_EXT
/* Define to the name of the environment variable that determines the run-time
module search path. */
#undef LT_MODULE_PATH_VAR
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Define to the shared library suffix, say, ".dylib". */
#undef LT_SHARED_EXT
/* Define to the shared archive member specification, say "(shr.o)". */
#undef LT_SHARED_LIB_MEMBER
/* Define if dlsym() requires a leading underscore in symbol names. */
#undef NEED_USCORE
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* True if the compiler says it groks GNU C version MAJOR.MINOR.
Except that
- clang groks GNU C 4.2, even on Windows, where it does not define
__GNUC__.
- The OpenMandriva-modified clang compiler pretends that it groks
GNU C version 13.1, but it doesn't: It does not support
__attribute__ ((__malloc__ (f, i))), nor does it support
__attribute__ ((__warning__ (message))) on a function redeclaration.
- Users can make clang lie as well, through the -fgnuc-version option. */
#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__
# define _GL_GNUC_PREREQ(major, minor) \
((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
#elif defined __clang__
/* clang really only groks GNU C 4.2. */
# define _GL_GNUC_PREREQ(major, minor) \
((major) < 4 + ((minor) <= 2))
#else
# define _GL_GNUC_PREREQ(major, minor) 0
#endif
/* The _Noreturn keyword of C11. */
#ifndef _Noreturn
# if (defined __cplusplus \
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|| (defined _MSC_VER && 1900 <= _MSC_VER)) \
&& 0)
/* [[noreturn]] is not practically usable, because with it the syntax
extern _Noreturn void func (...);
would not be valid; such a declaration would only be valid with 'extern'
and '_Noreturn' swapped, or without the 'extern' keyword. However, some
AIX system header files and several gnulib header files use precisely
this syntax with 'extern'. */
# define _Noreturn [[noreturn]]
# elif (defined __clang__ && __clang_major__ < 16 \
&& defined _GL_WORK_AROUND_LLVM_BUG_59792)
/* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
that rare LLVM bug, though you may get many false-alarm warnings. */
# define _Noreturn
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| (!defined __STRICT_ANSI__ \
&& (_GL_GNUC_PREREQ (4, 7) \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))))
/* _Noreturn works as-is. */
# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn
# endif
#endif
/* Define so that glibc/gnulib argp.h does not typedef error_t. */
#undef __error_t_defined
/* The _GL_ASYNC_SAFE marker should be attached to functions that are
signal handlers (for signals other than SIGABRT, SIGPIPE) or can be
invoked from such signal handlers. Such functions have some restrictions:
* All functions that it calls should be marked _GL_ASYNC_SAFE as well,
or should be listed as async-signal-safe in POSIX
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04>
section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in
particular, are NOT async-signal-safe.
* All memory locations (variables and struct fields) that these functions
access must be marked 'volatile'. This holds for both read and write
accesses. Otherwise the compiler might optimize away stores to and
reads from such locations that occur in the program, depending on its
data flow analysis. For example, when the program contains a loop
that is intended to inspect a variable set from within a signal handler
while (!signal_occurred)
;
the compiler is allowed to transform this into an endless loop if the
variable 'signal_occurred' is not declared 'volatile'.
Additionally, recall that:
* A signal handler should not modify errno (except if it is a handler
for a fatal signal and ends by raising the same signal again, thus
provoking the termination of the process). If it invokes a function
that may clobber errno, it needs to save and restore the value of
errno. */
#define _GL_ASYNC_SAFE
/* Attributes. */
/* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if
<config.h> gets included once again after <sys/cdefs.h>, __has_attribute(x)
expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all
attributes. */
#ifndef _GL_HAS_ATTRIBUTE
# if (defined __has_attribute \
&& (!defined __clang_minor__ \
|| (defined __apple_build_version__ \
? 7000000 <= __apple_build_version__ \
: 5 <= __clang_major__)))
# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
# else
# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3)
# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95)
# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1)
# define _GL_ATTR_diagnose_if 0
# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3)
# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1)
# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0)
# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7)
# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6)
# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
# ifdef _ICC
# define _GL_ATTR_may_alias 0
# else
# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3)
# endif
# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
# define _GL_ATTR_reproducible 0 /* not yet supported, as of GCC 14 */
# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
# define _GL_ATTR_unsequenced 0 /* not yet supported, as of GCC 14 */
# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
# endif
#endif
/* Use __has_c_attribute if available. However, do not use with
pre-C23 GCC, which can issue false positives if -Wpedantic. */
#if (defined __has_c_attribute \
&& ! (_GL_GNUC_PREREQ (4, 6) \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710))
# define _GL_HAVE___HAS_C_ATTRIBUTE 1
#else
# define _GL_HAVE___HAS_C_ATTRIBUTE 0
#endif
/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
syntax, in function declarations. There are two problems here.
(Last tested with gcc/g++ 14 and clang/clang++ 18.)
1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
in any order.
=========================== foo.c = foo.cc ===========================
__attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
[[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
======================================================================
This gives a syntax error
- in C mode with gcc
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and
- in C++ mode with clang++ version < 16, and
- in C++ mode, inside extern "C" {}, still in newer clang++ versions
<https://github.com/llvm/llvm-project/issues/101990>.
*/
/* Define if, in a function declaration, the attributes in bracket syntax
[[...]] must come before the attributes in __attribute__((...)) syntax.
If this is defined, it is best to avoid the bracket syntax, so that the
various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any
order. */
#ifdef __cplusplus
# if defined __clang__
# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
# endif
#else
# if defined __GNUC__ && !defined __clang__
# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
# endif
#endif
/*
2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
- without 'extern', in C as well as in C++,
- with 'extern', in C,
- with 'extern "C"', in C++
in the same position. That is, we don't want to be forced to use a
macro which arranges for the attribute to come before 'extern' in
one case and after 'extern' in the other case, because such a macro
would make the source code of .h files pretty ugly.
=========================== foo.c = foo.cc ===========================
#ifdef __cplusplus
# define CC "C"
#else
# define CC
#endif
#define ND [[__nodiscard__]]
#define WUR __attribute__((__warn_unused_result__))
#ifdef __cplusplus
extern "C" {
#endif
// gcc clang g++ clang++
ND int foo (int);
int ND foo (int); // warn error warn error
int foo ND (int);
int foo (int) ND; // warn error warn error
WUR int foo (int);
int WUR foo (int);
int fo1 WUR (int); // error error error error
int foo (int) WUR;
#ifdef __cplusplus
}
#endif
// gcc clang g++ clang++
ND extern CC int foo (int); // error error
extern CC ND int foo (int); // error error
extern CC int ND foo (int); // warn error warn error
extern CC int foo ND (int);
extern CC int foo (int) ND; // warn error warn error
WUR extern CC int foo (int); // warn
extern CC WUR int foo (int);
extern CC int WUR foo (int);
extern CC int foo WUR (int); // error error error error
extern CC int foo (int) WUR;
ND EXTERN_C_FUNC int foo (int); // error error
EXTERN_C_FUNC ND int foo (int);
EXTERN_C_FUNC int ND foo (int); // warn error warn error
EXTERN_C_FUNC int foo ND (int);
EXTERN_C_FUNC int foo (int) ND; // warn error warn error
WUR EXTERN_C_FUNC int foo (int); // warn
EXTERN_C_FUNC WUR int foo (int);
EXTERN_C_FUNC int WUR foo (int);
EXTERN_C_FUNC int fo2 WUR (int); // error error error error
EXTERN_C_FUNC int foo (int) WUR;
======================================================================
So, if we insist on using the 'extern' keyword ('extern CC' idiom):
* If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
in both C and C++, there is one available position:
- between the function name and the parameter list.
* If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
in both C and C++, there are several available positions:
- before the return type,
- between return type and function name,
- at the end of the declaration.
* If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
__attribute__((...)) syntax in C++, there is no available position:
it would need to come before 'extern' in C but after 'extern "C"'
in C++.
* If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
to bracket syntax [[...]] in C++, there is one available position:
- before the return type.
Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
omits the 'extern' keyword:
* If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
in both C and C++, there are two available positions:
- before the return type,
- between the function name and the parameter list.
* If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
in both C and C++, there are several available positions:
- before the return type,
- between return type and function name,
- at the end of the declaration.
* If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
__attribute__((...)) syntax in C++, there is one available position:
- before the return type.
* If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
to bracket syntax [[...]] in C++, there is one available position:
- before the return type.
The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
put the attributes before the return type. This works regardless
to what the _GL_ATTRIBUTE_* macros expand.
*/
/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
syntax, in static/inline function definitions.
There are similar constraints as for function declarations. However, here,
we cannot omit the storage-class specifier. Therefore, the following rule
applies:
* The macros
_GL_ATTRIBUTE_CONST
_GL_ATTRIBUTE_DEPRECATED
_GL_ATTRIBUTE_MAYBE_UNUSED
_GL_ATTRIBUTE_NODISCARD
_GL_ATTRIBUTE_PURE
_GL_ATTRIBUTE_REPRODUCIBLE
_GL_ATTRIBUTE_UNSEQUENCED
which may expand to bracket syntax [[...]], must come first, before the
storage-class specifier.
* Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax,
are better placed between the storage-class specifier and the return
type.
*/
/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
syntax, in variable declarations.
At which position can they be placed?
(Last tested with gcc/g++ 14 and clang/clang++ 18.)
=========================== foo.c = foo.cc ===========================
#ifdef __cplusplus
# define CC "C"
#else
# define CC
#endif
#define BD [[__deprecated__]]
#define AD __attribute__ ((__deprecated__))
// gcc clang g++ clang++
BD extern CC int var; // error error
extern CC BD int var; // error error
extern CC int BD var; // warn error warn error
extern CC int var BD;
AD extern CC int var; // warn
extern CC AD int var;
extern CC int AD var;
extern CC int var AD;
BD extern CC int z[]; // error error
extern CC BD int z[]; // error error
extern CC int BD z[]; // warn error warn error
extern CC int z1 BD [];
extern CC int z[] BD; // warn error error
AD extern CC int z[]; // warn
extern CC AD int z[];
extern CC int AD z[];
extern CC int z2 AD []; // error error error error
extern CC int z[] AD;
======================================================================
* For non-array variables, the only good position is after the variable name,
that is, at the end of the declaration.
* For array variables, you will need to distinguish C and C++:
- In C, before the 'extern' keyword.
- In C++, between the 'extern "C"' and the variable's type.
*/
/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
is the size of the returned memory block.
_GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
by the Nth argument of the function is the size of the returned memory block.
*/
/* Applies to: functions, pointer to functions, function types. */
#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
# if _GL_HAS_ATTRIBUTE (alloc_size)
# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
# else
# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
# endif
#endif
/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
function and report an error if it cannot do so. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
# if _GL_HAS_ATTRIBUTE (always_inline)
# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
# else
# define _GL_ATTRIBUTE_ALWAYS_INLINE
# endif
#endif
/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
in stack traces when debugging. The compiler should omit the function from
stack traces. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_ARTIFICIAL
# if _GL_HAS_ATTRIBUTE (artificial)
# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
# else
# define _GL_ATTRIBUTE_ARTIFICIAL
# endif
#endif
/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */
/* Applies to: functions. */
/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
<https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */
#ifndef _GL_ATTRIBUTE_COLD
# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
# ifndef __SUNPRO_C
# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
# else
# define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
# endif
# else
# define _GL_ATTRIBUTE_COLD
# endif
#endif
/* _GL_ATTRIBUTE_CONST declares:
It is OK for a compiler to move calls to the function and to omit
calls to the function if another call has the same arguments or the
result is not used.
This attribute is safe for a function that neither depends on
nor affects state, and always returns exactly once -
e.g., does not raise an exception, call longjmp, or loop forever.
(This attribute is stricter than _GL_ATTRIBUTE_PURE because the
function cannot observe state. It is stricter than
_GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly
once and cannot depend on state addressed by its arguments.) */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_CONST
# if _GL_HAS_ATTRIBUTE (const)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
# else
# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED
# endif
#endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F.
_GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#ifndef _GL_ATTRIBUTE_DEALLOC
# if _GL_GNUC_PREREQ (11, 0)
# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
# else
# define _GL_ATTRIBUTE_DEALLOC(f, i)
# endif
#endif
/* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue
to use this earlier definition, since <stdlib.h> may not have been included
yet. */
#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
# if defined __cplusplus && defined __GNUC__ && !defined __clang__
/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
# define _GL_ATTRIBUTE_DEALLOC_FREE \
_GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
# else
# define _GL_ATTRIBUTE_DEALLOC_FREE \
_GL_ATTRIBUTE_DEALLOC (free, 1)
# endif
#endif
/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated.
The compiler may warn if the entity is used. */
/* Applies to:
- function, variable,
- struct, union, struct/union member,
- enumeration, enumeration item,
- typedef,
in C++ also: namespace, class, template specialization. */
#ifndef _GL_ATTRIBUTE_DEPRECATED
# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
# if _GL_HAVE___HAS_C_ATTRIBUTE
# if __has_c_attribute (__deprecated__)
# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
# endif
# endif
# endif
# if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
# endif
# ifndef _GL_ATTRIBUTE_DEPRECATED
# define _GL_ATTRIBUTE_DEPRECATED
# endif
#endif
/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and
the function call is not optimized away.
_GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and
the function call is not optimized away. */
/* Applies to: functions. */
#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING)
# if _GL_HAS_ATTRIBUTE (error)
# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
# elif _GL_HAS_ATTRIBUTE (diagnose_if)
# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error")))
# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning")))
# else
# define _GL_ATTRIBUTE_ERROR(msg)
# define _GL_ATTRIBUTE_WARNING(msg)
# endif
#endif
/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain
visible to debuggers etc., even with '-fwhole-program'. */
/* Applies to: functions, variables. */
#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
# if _GL_HAS_ATTRIBUTE (externally_visible)
# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
# else
# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
# endif
#endif
/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if
the control flow falls through to the immediately following 'case' or
'default' label. The compiler should not warn in this case. */
/* Applies to: Empty statement (;), inside a 'switch' statement. */
/* Always expands to something. */
#ifndef _GL_ATTRIBUTE_FALLTHROUGH
# if _GL_HAVE___HAS_C_ATTRIBUTE
# if __has_c_attribute (__fallthrough__)
# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
# endif
# endif
# if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
# endif
# ifndef _GL_ATTRIBUTE_FALLTHROUGH
# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
# endif
#endif
/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
declares that the STRING-INDEXth function argument is a format string of
style ARCHETYPE, which is one of:
printf, gnu_printf
scanf, gnu_scanf,
strftime, gnu_strftime,
strfmon,
or the same thing prefixed and suffixed with '__'.
If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
are suitable for the format string. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_FORMAT
# if _GL_HAS_ATTRIBUTE (format)
# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
# else
# define _GL_ATTRIBUTE_FORMAT(spec)
# endif
#endif
/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other
compilation unit, it executes code from that unit only by return or by
exception handling. This declaration lets the compiler optimize that unit
more aggressively. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_LEAF
# if _GL_HAS_ATTRIBUTE (leaf)
# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
# else
# define _GL_ATTRIBUTE_LEAF
# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
allocated memory. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_MALLOC
# if _GL_HAS_ATTRIBUTE (malloc)
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define _GL_ATTRIBUTE_MALLOC
# endif
#endif
/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the
same storage as pointers to other types. Thus this declaration disables
strict aliasing optimization. */
/* Applies to: types. */
/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */
#ifndef _GL_ATTRIBUTE_MAY_ALIAS
# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
# else
# define _GL_ATTRIBUTE_MAY_ALIAS
# endif
#endif
/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
the entity is not used. The compiler should not warn if the entity is not
used. */
/* Applies to:
- function, variable,
- struct, union, struct/union member,
- enumeration, enumeration item,
- typedef,
in C++ also: class. */
/* In C++ and C23, this is spelled [[__maybe_unused__]].
GCC's syntax is __attribute__ ((__unused__)).
clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode,
__has_c_attribute (__maybe_unused__) yields true but the use of
[[__maybe_unused__]] nevertheless produces a warning. */
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
# if defined __clang__ && defined __cplusplus
# if !defined __apple_build_version__ && __clang_major__ >= 10
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
# endif
# elif _GL_HAVE___HAS_C_ATTRIBUTE
# if __has_c_attribute (__maybe_unused__)
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
# endif
# endif
# endif
# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
# endif
#endif
/* Alternative spelling of this macro, for convenience and for
compatibility with glibc/include/libc-symbols.h. */
#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
/* Earlier spellings of this macro. */
#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
/* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not
discard the return value. The compiler may warn if the caller does not use
the return value, unless the caller uses something like ignore_value. */
/* Applies to: function, enumeration, class. */
#ifndef _GL_ATTRIBUTE_NODISCARD
# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
# if defined __clang__ && defined __cplusplus
/* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces
a warning.
The 1000 below means a yet unknown threshold. When clang++ version X
starts supporting [[__nodiscard__]] without warning about it, you can
replace the 1000 with X. */
# if __clang_major__ >= 1000
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
# endif
# elif _GL_HAVE___HAS_C_ATTRIBUTE
# if __has_c_attribute (__nodiscard__)
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
# endif
# endif
# endif
# if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
# endif
# ifndef _GL_ATTRIBUTE_NODISCARD
# define _GL_ATTRIBUTE_NODISCARD
# endif
#endif
/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the
function. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_NOINLINE
# if _GL_HAS_ATTRIBUTE (noinline)
# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
# else
# define _GL_ATTRIBUTE_NOINLINE
# endif
#endif
/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,...
must not be NULL.
_GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be
null. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_NONNULL
# if _GL_HAS_ATTRIBUTE (nonnull)
# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
# else
# define _GL_ATTRIBUTE_NONNULL(args)
# endif
#endif
/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
not meant to be NUL-terminated. */
/* Applies to: struct/union members and variables that are arrays of element
type '[[un]signed] char'. */
#ifndef _GL_ATTRIBUTE_NONSTRING
# if _GL_HAS_ATTRIBUTE (nonstring)
# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
# else
# define _GL_ATTRIBUTE_NONSTRING
# endif
#endif
/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */
/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
*/
/* Applies to: functions. */
/* After a function's parameter list, this attribute must come first, before
other attributes. */
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
# define _GL_ATTRIBUTE_NOTHROW throw ()
# endif
# else
# define _GL_ATTRIBUTE_NOTHROW
# endif
# else
# if _GL_HAS_ATTRIBUTE (nothrow)
# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
# else
# define _GL_ATTRIBUTE_NOTHROW
# endif
# endif
#endif
/* _GL_ATTRIBUTE_PACKED declares:
For struct members: The member has the smallest possible alignment.
For struct, union, class: All members have the smallest possible alignment,
minimizing the memory required. */
/* Applies to: struct members, struct, union,
in C++ also: class. */
#ifndef _GL_ATTRIBUTE_PACKED
/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
__has_attribute OK. */
# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
# else
# define _GL_ATTRIBUTE_PACKED
# endif
#endif
/* _GL_ATTRIBUTE_PURE declares:
It is OK for a compiler to move calls to the function and to omit
calls to the function if another call has the same arguments or the
result is not used, and if observable state is the same.
This attribute is safe for a function that does not affect observable state
and always returns exactly once.
(This attribute is looser than _GL_ATTRIBUTE_CONST because the function
can depend on observable state. It is stricter than
_GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly
once and cannot affect state addressed by its arguments.) */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_PURE
# if _GL_HAS_ATTRIBUTE (pure)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE
# endif
#endif
/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
It is OK for a compiler to move calls to the function and to omit duplicate
calls to the function with the same arguments, so long as the state
addressed by its arguments is the same and is updated in time for
the rest of the program.
This attribute is safe for a function that is effectless and idempotent; see
ISO C 23 § 6.7.12.7 for a definition of these terms.
(This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
the function need not be stateless and idempotent. It is looser
than _GL_ATTRIBUTE_PURE because the function need not return
exactly once and can affect state addressed by its arguments.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
<https://stackoverflow.com/questions/76847905/>. */
/* Applies to: functions, pointer to functions, function types. */
#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
/* This may be revisited when gcc and clang support [[reproducible]] or possibly
__attribute__ ((__reproducible__)). */
# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
# if _GL_HAS_ATTRIBUTE (reproducible)
# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
# endif
# endif
# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
# define _GL_ATTRIBUTE_REPRODUCIBLE
# endif
#endif
/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
a non-NULL pointer. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL
# if _GL_HAS_ATTRIBUTE (returns_nonnull)
# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
# else
# define _GL_ATTRIBUTE_RETURNS_NONNULL
# endif
#endif
/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a
trailing NULL argument.
_GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
_GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_SENTINEL
# if _GL_HAS_ATTRIBUTE (sentinel)
# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
# else
# define _GL_ATTRIBUTE_SENTINEL(pos)
# endif
#endif
/* _GL_ATTRIBUTE_UNSEQUENCED declares:
It is OK for a compiler to move calls to the function and to omit duplicate
calls to the function with the same arguments, so long as the state
addressed by its arguments is the same.
This attribute is safe for a function that is effectless, idempotent,
stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
these terms.
(This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
the function must be stateless and independent. It is looser than
_GL_ATTRIBUTE_CONST because the function need not return exactly
once and can depend on state addressed by its arguments.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
<https://stackoverflow.com/questions/76847905/>. */
/* Applies to: functions, pointer to functions, function types. */
#ifndef _GL_ATTRIBUTE_UNSEQUENCED
/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
__attribute__ ((__unsequenced__)). */
# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
# if _GL_HAS_ATTRIBUTE (unsequenced)
# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
# endif
# endif
# ifndef _GL_ATTRIBUTE_UNSEQUENCED
# define _GL_ATTRIBUTE_UNSEQUENCED
# endif
#endif
/* A helper macro. Don't use it directly. */
#ifndef _GL_ATTRIBUTE_UNUSED
# if _GL_HAS_ATTRIBUTE (unused)
# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
# define _GL_ATTRIBUTE_UNUSED
# endif
#endif
/* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the
immediately preceding label is not used. The compiler should not warn
if the label is not used. */
/* Applies to: label (both in C and C++). */
/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;'
syntax. But clang does. */
#ifndef _GL_UNUSED_LABEL
# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
# else
# define _GL_UNUSED_LABEL
# endif
#endif
/* The following attributes enable detection of multithread-safety problems
and resource leaks at compile-time, by clang ≥ 15, when the warning option
-Wthread-safety is enabled. For usage, see
<https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
# if __clang_major__ >= 15
# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
__attribute__ ((__capability__ (concept)))
# else
# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
# endif
#endif
#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
# if __clang_major__ >= 15
# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
__attribute__ ((__acquire_capability__ (resource)))
# else
# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
# endif
#endif
#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
# if __clang_major__ >= 15
# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
__attribute__ ((__release_capability__ (resource)))
# else
# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
# endif
#endif
/* In C++, there is the concept of "language linkage", that encompasses
name mangling and function calling conventions.
The following macros start and end a block of "C" linkage. */
#ifdef __cplusplus
# define _GL_BEGIN_C_LINKAGE extern "C" {
# define _GL_END_C_LINKAGE }
#else
# define _GL_BEGIN_C_LINKAGE
# define _GL_END_C_LINKAGE
#endif
/* Define to a type to use for 'error_t' if it is not otherwise available. */
#undef error_t
/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
__APPLE__ && __MACH__ test for Mac OS X.
__APPLE_CC__ tests for the Apple compiler and its version.
__STDC_VERSION__ tests for the C99 mode. */
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif
/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where
n1 and n2 are expressions without side effects, that evaluate to real
numbers (excluding NaN).
It returns
1 if n1 > n2
0 if n1 == n2
-1 if n1 < n2
The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
jump with nearly all GCC versions up to GCC 10.
This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many
GCC versions up to GCC 9.
The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
avoids conditional jumps in all GCC versions >= 3.4. */
#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
|