diff options
Diffstat (limited to 'gl')
403 files changed, 9650 insertions, 2888 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index dcebd4aa..df988b37 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am | |||
@@ -1,6 +1,6 @@ | |||
1 | ## DO NOT EDIT! GENERATED AUTOMATICALLY! | 1 | ## DO NOT EDIT! GENERATED AUTOMATICALLY! |
2 | ## Process this file with automake to produce Makefile.in. | 2 | ## Process this file with automake to produce Makefile.in. |
3 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. | 3 | # Copyright (C) 2002-2024 Free Software Foundation, Inc. |
4 | # | 4 | # |
5 | # This file is free software; you can redistribute it and/or modify | 5 | # This file is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
@@ -62,6 +62,7 @@ SUBDIRS = | |||
62 | noinst_HEADERS = | 62 | noinst_HEADERS = |
63 | noinst_LIBRARIES = | 63 | noinst_LIBRARIES = |
64 | noinst_LTLIBRARIES = | 64 | noinst_LTLIBRARIES = |
65 | pkgdata_DATA = | ||
65 | EXTRA_DIST = | 66 | EXTRA_DIST = |
66 | BUILT_SOURCES = | 67 | BUILT_SOURCES = |
67 | SUFFIXES = | 68 | SUFFIXES = |
@@ -350,10 +351,32 @@ if GL_COND_OBJ_ERROR | |||
350 | libgnu_a_SOURCES += error.c | 351 | libgnu_a_SOURCES += error.c |
351 | endif | 352 | endif |
352 | 353 | ||
353 | EXTRA_DIST += error.h | ||
354 | |||
355 | ## end gnulib module error | 354 | ## end gnulib module error |
356 | 355 | ||
356 | ## begin gnulib module error-h | ||
357 | |||
358 | BUILT_SOURCES += error.h | ||
359 | |||
360 | # We need the following in order to override <error.h>. | ||
361 | error.h: error.in.h $(top_builddir)/config.status $(CXXDEFS_H) | ||
362 | $(gl_V_at)$(SED_HEADER_STDOUT) \ | ||
363 | -e 's|@''GUARD_PREFIX''@|GL|g' \ | ||
364 | -e 's|@''HAVE_ERROR_H''@|$(HAVE_ERROR_H)|g' \ | ||
365 | -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
366 | -e 's|@''NEXT_ERROR_H''@|$(NEXT_ERROR_H)|g' \ | ||
367 | -e 's|@''HAVE_ERROR''@|$(HAVE_ERROR)|g' \ | ||
368 | -e 's|@''HAVE_ERROR_AT_LINE''@|$(HAVE_ERROR_AT_LINE)|g' \ | ||
369 | -e 's|@''REPLACE_ERROR''@|$(REPLACE_ERROR)|g' \ | ||
370 | -e 's|@''REPLACE_ERROR_AT_LINE''@|$(REPLACE_ERROR_AT_LINE)|g' \ | ||
371 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
372 | $(srcdir)/error.in.h > $@-t | ||
373 | $(AM_V_at)mv $@-t $@ | ||
374 | MOSTLYCLEANFILES += error.h error.h-t | ||
375 | |||
376 | EXTRA_DIST += error.in.h | ||
377 | |||
378 | ## end gnulib module error-h | ||
379 | |||
357 | ## begin gnulib module exitfail | 380 | ## begin gnulib module exitfail |
358 | 381 | ||
359 | libgnu_a_SOURCES += exitfail.c | 382 | libgnu_a_SOURCES += exitfail.c |
@@ -595,6 +618,7 @@ SED_HEADER_STDOUT = sed -e 1h -e '1$(SED_HEADER_NOEDIT)' -e 1G | |||
595 | SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) -n -e 'w $@-t' | 618 | SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) -n -e 'w $@-t' |
596 | 619 | ||
597 | # Use $(gl_V_at) instead of $(AM_V_GEN) or $(AM_V_at) on a line that | 620 | # Use $(gl_V_at) instead of $(AM_V_GEN) or $(AM_V_at) on a line that |
621 | # is its recipe's first line if and only if @NMD@ lines are absent. | ||
598 | gl_V_at = $(AM_V_GEN) | 622 | gl_V_at = $(AM_V_GEN) |
599 | 623 | ||
600 | ## end gnulib module gen-header | 624 | ## end gnulib module gen-header |
@@ -698,7 +722,11 @@ EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h get | |||
698 | 722 | ||
699 | ## begin gnulib module getprogname | 723 | ## begin gnulib module getprogname |
700 | 724 | ||
701 | libgnu_a_SOURCES += getprogname.h getprogname.c | 725 | if GL_COND_OBJ_GETPROGNAME |
726 | libgnu_a_SOURCES += getprogname.c | ||
727 | endif | ||
728 | |||
729 | EXTRA_DIST += getprogname.h | ||
702 | 730 | ||
703 | ## end gnulib module getprogname | 731 | ## end gnulib module getprogname |
704 | 732 | ||
@@ -810,6 +838,8 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U | |||
810 | -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ | 838 | -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ |
811 | -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ | 839 | -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ |
812 | -e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \ | 840 | -e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \ |
841 | -e 's/@''REPLACE_IMAXABS''@/$(REPLACE_IMAXABS)/g' \ | ||
842 | -e 's/@''REPLACE_IMAXDIV''@/$(REPLACE_IMAXDIV)/g' \ | ||
813 | -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ | 843 | -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ |
814 | -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ | 844 | -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ |
815 | -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ | 845 | -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ |
@@ -827,6 +857,48 @@ EXTRA_DIST += inttypes.in.h | |||
827 | 857 | ||
828 | ## end gnulib module inttypes-incomplete | 858 | ## end gnulib module inttypes-incomplete |
829 | 859 | ||
860 | ## begin gnulib module iswblank | ||
861 | |||
862 | if GL_COND_OBJ_ISWBLANK | ||
863 | libgnu_a_SOURCES += iswblank.c | ||
864 | endif | ||
865 | |||
866 | ## end gnulib module iswblank | ||
867 | |||
868 | ## begin gnulib module iswctype | ||
869 | |||
870 | if GL_COND_OBJ_ISWCTYPE | ||
871 | libgnu_a_SOURCES += iswctype.c | ||
872 | endif | ||
873 | |||
874 | EXTRA_DIST += iswctype-impl.h | ||
875 | |||
876 | ## end gnulib module iswctype | ||
877 | |||
878 | ## begin gnulib module iswdigit | ||
879 | |||
880 | if GL_COND_OBJ_ISWDIGIT | ||
881 | libgnu_a_SOURCES += iswdigit.c | ||
882 | endif | ||
883 | |||
884 | ## end gnulib module iswdigit | ||
885 | |||
886 | ## begin gnulib module iswpunct | ||
887 | |||
888 | if GL_COND_OBJ_ISWPUNCT | ||
889 | libgnu_a_SOURCES += iswpunct.c | ||
890 | endif | ||
891 | |||
892 | ## end gnulib module iswpunct | ||
893 | |||
894 | ## begin gnulib module iswxdigit | ||
895 | |||
896 | if GL_COND_OBJ_ISWXDIGIT | ||
897 | libgnu_a_SOURCES += iswxdigit.c | ||
898 | endif | ||
899 | |||
900 | ## end gnulib module iswxdigit | ||
901 | |||
830 | ## begin gnulib module langinfo | 902 | ## begin gnulib module langinfo |
831 | 903 | ||
832 | BUILT_SOURCES += langinfo.h | 904 | BUILT_SOURCES += langinfo.h |
@@ -917,7 +989,7 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
917 | -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ | 989 | -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ |
918 | -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ | 990 | -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ |
919 | -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ | 991 | -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ |
920 | -e 's/@''GNULIB_LOCALENAME''@/$(GL_GNULIB_LOCALENAME)/g' \ | 992 | -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \ |
921 | -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ | 993 | -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ |
922 | -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ | 994 | -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ |
923 | -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ | 995 | -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ |
@@ -1043,11 +1115,15 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1043 | -e 's/@''GNULIB_FREXPF''@/$(GL_GNULIB_FREXPF)/g' \ | 1115 | -e 's/@''GNULIB_FREXPF''@/$(GL_GNULIB_FREXPF)/g' \ |
1044 | -e 's/@''GNULIB_FREXP''@/$(GL_GNULIB_FREXP)/g' \ | 1116 | -e 's/@''GNULIB_FREXP''@/$(GL_GNULIB_FREXP)/g' \ |
1045 | -e 's/@''GNULIB_FREXPL''@/$(GL_GNULIB_FREXPL)/g' \ | 1117 | -e 's/@''GNULIB_FREXPL''@/$(GL_GNULIB_FREXPL)/g' \ |
1118 | -e 's/@''GNULIB_GETPAYLOAD''@/$(GL_GNULIB_GETPAYLOAD)/g' \ | ||
1119 | -e 's/@''GNULIB_GETPAYLOADF''@/$(GL_GNULIB_GETPAYLOADF)/g' \ | ||
1120 | -e 's/@''GNULIB_GETPAYLOADL''@/$(GL_GNULIB_GETPAYLOADL)/g' \ | ||
1046 | -e 's/@''GNULIB_HYPOT''@/$(GL_GNULIB_HYPOT)/g' \ | 1121 | -e 's/@''GNULIB_HYPOT''@/$(GL_GNULIB_HYPOT)/g' \ |
1047 | -e 's/@''GNULIB_HYPOTF''@/$(GL_GNULIB_HYPOTF)/g' \ | 1122 | -e 's/@''GNULIB_HYPOTF''@/$(GL_GNULIB_HYPOTF)/g' \ |
1048 | -e 's/@''GNULIB_HYPOTL''@/$(GL_GNULIB_HYPOTL)/g' \ | 1123 | -e 's/@''GNULIB_HYPOTL''@/$(GL_GNULIB_HYPOTL)/g' \ |
1049 | < $(srcdir)/math.in.h | \ | 1124 | < $(srcdir)/math.in.h > $@-t1 |
1050 | sed -e 's/@''GNULIB_ILOGB''@/$(GL_GNULIB_ILOGB)/g' \ | 1125 | $(AM_V_at)sed \ |
1126 | -e 's/@''GNULIB_ILOGB''@/$(GL_GNULIB_ILOGB)/g' \ | ||
1051 | -e 's/@''GNULIB_ILOGBF''@/$(GL_GNULIB_ILOGBF)/g' \ | 1127 | -e 's/@''GNULIB_ILOGBF''@/$(GL_GNULIB_ILOGBF)/g' \ |
1052 | -e 's/@''GNULIB_ILOGBL''@/$(GL_GNULIB_ILOGBL)/g' \ | 1128 | -e 's/@''GNULIB_ILOGBL''@/$(GL_GNULIB_ILOGBL)/g' \ |
1053 | -e 's/@''GNULIB_ISFINITE''@/$(GL_GNULIB_ISFINITE)/g' \ | 1129 | -e 's/@''GNULIB_ISFINITE''@/$(GL_GNULIB_ISFINITE)/g' \ |
@@ -1056,6 +1132,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1056 | -e 's/@''GNULIB_ISNANF''@/$(GL_GNULIB_ISNANF)/g' \ | 1132 | -e 's/@''GNULIB_ISNANF''@/$(GL_GNULIB_ISNANF)/g' \ |
1057 | -e 's/@''GNULIB_ISNAND''@/$(GL_GNULIB_ISNAND)/g' \ | 1133 | -e 's/@''GNULIB_ISNAND''@/$(GL_GNULIB_ISNAND)/g' \ |
1058 | -e 's/@''GNULIB_ISNANL''@/$(GL_GNULIB_ISNANL)/g' \ | 1134 | -e 's/@''GNULIB_ISNANL''@/$(GL_GNULIB_ISNANL)/g' \ |
1135 | -e 's/@''GNULIB_LDEXP''@/$(GL_GNULIB_LDEXP)/g' \ | ||
1059 | -e 's/@''GNULIB_LDEXPF''@/$(GL_GNULIB_LDEXPF)/g' \ | 1136 | -e 's/@''GNULIB_LDEXPF''@/$(GL_GNULIB_LDEXPF)/g' \ |
1060 | -e 's/@''GNULIB_LDEXPL''@/$(GL_GNULIB_LDEXPL)/g' \ | 1137 | -e 's/@''GNULIB_LDEXPL''@/$(GL_GNULIB_LDEXPL)/g' \ |
1061 | -e 's/@''GNULIB_LOG''@/$(GL_GNULIB_LOG)/g' \ | 1138 | -e 's/@''GNULIB_LOG''@/$(GL_GNULIB_LOG)/g' \ |
@@ -1086,6 +1163,12 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1086 | -e 's/@''GNULIB_ROUND''@/$(GL_GNULIB_ROUND)/g' \ | 1163 | -e 's/@''GNULIB_ROUND''@/$(GL_GNULIB_ROUND)/g' \ |
1087 | -e 's/@''GNULIB_ROUNDF''@/$(GL_GNULIB_ROUNDF)/g' \ | 1164 | -e 's/@''GNULIB_ROUNDF''@/$(GL_GNULIB_ROUNDF)/g' \ |
1088 | -e 's/@''GNULIB_ROUNDL''@/$(GL_GNULIB_ROUNDL)/g' \ | 1165 | -e 's/@''GNULIB_ROUNDL''@/$(GL_GNULIB_ROUNDL)/g' \ |
1166 | -e 's/@''GNULIB_SETPAYLOAD''@/$(GL_GNULIB_SETPAYLOAD)/g' \ | ||
1167 | -e 's/@''GNULIB_SETPAYLOADF''@/$(GL_GNULIB_SETPAYLOADF)/g' \ | ||
1168 | -e 's/@''GNULIB_SETPAYLOADL''@/$(GL_GNULIB_SETPAYLOADL)/g' \ | ||
1169 | -e 's/@''GNULIB_SETPAYLOADSIG''@/$(GL_GNULIB_SETPAYLOADSIG)/g' \ | ||
1170 | -e 's/@''GNULIB_SETPAYLOADSIGF''@/$(GL_GNULIB_SETPAYLOADSIGF)/g' \ | ||
1171 | -e 's/@''GNULIB_SETPAYLOADSIGL''@/$(GL_GNULIB_SETPAYLOADSIGL)/g' \ | ||
1089 | -e 's/@''GNULIB_SIGNBIT''@/$(GL_GNULIB_SIGNBIT)/g' \ | 1172 | -e 's/@''GNULIB_SIGNBIT''@/$(GL_GNULIB_SIGNBIT)/g' \ |
1090 | -e 's/@''GNULIB_SINF''@/$(GL_GNULIB_SINF)/g' \ | 1173 | -e 's/@''GNULIB_SINF''@/$(GL_GNULIB_SINF)/g' \ |
1091 | -e 's/@''GNULIB_SINL''@/$(GL_GNULIB_SINL)/g' \ | 1174 | -e 's/@''GNULIB_SINL''@/$(GL_GNULIB_SINL)/g' \ |
@@ -1098,14 +1181,21 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1098 | -e 's/@''GNULIB_TRUNC''@/$(GL_GNULIB_TRUNC)/g' \ | 1181 | -e 's/@''GNULIB_TRUNC''@/$(GL_GNULIB_TRUNC)/g' \ |
1099 | -e 's/@''GNULIB_TRUNCF''@/$(GL_GNULIB_TRUNCF)/g' \ | 1182 | -e 's/@''GNULIB_TRUNCF''@/$(GL_GNULIB_TRUNCF)/g' \ |
1100 | -e 's/@''GNULIB_TRUNCL''@/$(GL_GNULIB_TRUNCL)/g' \ | 1183 | -e 's/@''GNULIB_TRUNCL''@/$(GL_GNULIB_TRUNCL)/g' \ |
1184 | -e 's/@''GNULIB_TOTALORDER''@/$(GL_GNULIB_TOTALORDER)/g' \ | ||
1185 | -e 's/@''GNULIB_TOTALORDERF''@/$(GL_GNULIB_TOTALORDERF)/g' \ | ||
1186 | -e 's/@''GNULIB_TOTALORDERL''@/$(GL_GNULIB_TOTALORDERL)/g' \ | ||
1187 | -e 's/@''GNULIB_TOTALORDERMAG''@/$(GL_GNULIB_TOTALORDERMAG)/g' \ | ||
1188 | -e 's/@''GNULIB_TOTALORDERMAGF''@/$(GL_GNULIB_TOTALORDERMAGF)/g' \ | ||
1189 | -e 's/@''GNULIB_TOTALORDERMAGL''@/$(GL_GNULIB_TOTALORDERMAGL)/g' \ | ||
1101 | -e 's/@''GNULIB_MDA_J0''@/$(GL_GNULIB_MDA_J0)/g' \ | 1190 | -e 's/@''GNULIB_MDA_J0''@/$(GL_GNULIB_MDA_J0)/g' \ |
1102 | -e 's/@''GNULIB_MDA_J1''@/$(GL_GNULIB_MDA_J1)/g' \ | 1191 | -e 's/@''GNULIB_MDA_J1''@/$(GL_GNULIB_MDA_J1)/g' \ |
1103 | -e 's/@''GNULIB_MDA_JN''@/$(GL_GNULIB_MDA_JN)/g' \ | 1192 | -e 's/@''GNULIB_MDA_JN''@/$(GL_GNULIB_MDA_JN)/g' \ |
1104 | -e 's/@''GNULIB_MDA_Y0''@/$(GL_GNULIB_MDA_Y0)/g' \ | 1193 | -e 's/@''GNULIB_MDA_Y0''@/$(GL_GNULIB_MDA_Y0)/g' \ |
1105 | -e 's/@''GNULIB_MDA_Y1''@/$(GL_GNULIB_MDA_Y1)/g' \ | 1194 | -e 's/@''GNULIB_MDA_Y1''@/$(GL_GNULIB_MDA_Y1)/g' \ |
1106 | -e 's/@''GNULIB_MDA_YN''@/$(GL_GNULIB_MDA_YN)/g' \ | 1195 | -e 's/@''GNULIB_MDA_YN''@/$(GL_GNULIB_MDA_YN)/g' \ |
1107 | | \ | 1196 | < $@-t1 > $@-t2 |
1108 | sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \ | 1197 | $(AM_V_at)sed \ |
1198 | -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \ | ||
1109 | -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ | 1199 | -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ |
1110 | -e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \ | 1200 | -e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \ |
1111 | -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ | 1201 | -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ |
@@ -1132,6 +1222,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1132 | -e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \ | 1222 | -e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \ |
1133 | -e 's|@''HAVE_FMODL''@|$(HAVE_FMODL)|g' \ | 1223 | -e 's|@''HAVE_FMODL''@|$(HAVE_FMODL)|g' \ |
1134 | -e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \ | 1224 | -e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \ |
1225 | -e 's|@''HAVE_GETPAYLOAD''@|$(HAVE_GETPAYLOAD)|g' \ | ||
1226 | -e 's|@''HAVE_GETPAYLOADF''@|$(HAVE_GETPAYLOADF)|g' \ | ||
1227 | -e 's|@''HAVE_GETPAYLOADL''@|$(HAVE_GETPAYLOADL)|g' \ | ||
1135 | -e 's|@''HAVE_HYPOTF''@|$(HAVE_HYPOTF)|g' \ | 1228 | -e 's|@''HAVE_HYPOTF''@|$(HAVE_HYPOTF)|g' \ |
1136 | -e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \ | 1229 | -e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \ |
1137 | -e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \ | 1230 | -e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \ |
@@ -1157,6 +1250,12 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1157 | -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \ | 1250 | -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \ |
1158 | -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \ | 1251 | -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \ |
1159 | -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \ | 1252 | -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \ |
1253 | -e 's|@''HAVE_SETPAYLOAD''@|$(HAVE_SETPAYLOAD)|g' \ | ||
1254 | -e 's|@''HAVE_SETPAYLOADF''@|$(HAVE_SETPAYLOADF)|g' \ | ||
1255 | -e 's|@''HAVE_SETPAYLOADL''@|$(HAVE_SETPAYLOADL)|g' \ | ||
1256 | -e 's|@''HAVE_SETPAYLOADSIG''@|$(HAVE_SETPAYLOADSIG)|g' \ | ||
1257 | -e 's|@''HAVE_SETPAYLOADSIGF''@|$(HAVE_SETPAYLOADSIGF)|g' \ | ||
1258 | -e 's|@''HAVE_SETPAYLOADSIGL''@|$(HAVE_SETPAYLOADSIGL)|g' \ | ||
1160 | -e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \ | 1259 | -e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \ |
1161 | -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \ | 1260 | -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \ |
1162 | -e 's|@''HAVE_SINHF''@|$(HAVE_SINHF)|g' \ | 1261 | -e 's|@''HAVE_SINHF''@|$(HAVE_SINHF)|g' \ |
@@ -1165,6 +1264,14 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1165 | -e 's|@''HAVE_TANF''@|$(HAVE_TANF)|g' \ | 1264 | -e 's|@''HAVE_TANF''@|$(HAVE_TANF)|g' \ |
1166 | -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \ | 1265 | -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \ |
1167 | -e 's|@''HAVE_TANHF''@|$(HAVE_TANHF)|g' \ | 1266 | -e 's|@''HAVE_TANHF''@|$(HAVE_TANHF)|g' \ |
1267 | -e 's|@''HAVE_TOTALORDER''@|$(HAVE_TOTALORDER)|g' \ | ||
1268 | -e 's|@''HAVE_TOTALORDERF''@|$(HAVE_TOTALORDERF)|g' \ | ||
1269 | -e 's|@''HAVE_TOTALORDERL''@|$(HAVE_TOTALORDERL)|g' \ | ||
1270 | -e 's|@''HAVE_TOTALORDERMAG''@|$(HAVE_TOTALORDERMAG)|g' \ | ||
1271 | -e 's|@''HAVE_TOTALORDERMAGF''@|$(HAVE_TOTALORDERMAGF)|g' \ | ||
1272 | -e 's|@''HAVE_TOTALORDERMAGL''@|$(HAVE_TOTALORDERMAGL)|g' \ | ||
1273 | < $@-t2 > $@-t3 | ||
1274 | $(AM_V_at)sed \ | ||
1168 | -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ | 1275 | -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ |
1169 | -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ | 1276 | -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ |
1170 | -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ | 1277 | -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ |
@@ -1201,8 +1308,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1201 | -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ | 1308 | -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ |
1202 | -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ | 1309 | -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ |
1203 | -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ | 1310 | -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ |
1204 | | \ | 1311 | < $@-t3 > $@-t4 |
1205 | sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ | 1312 | $(AM_V_at)sed \ |
1313 | -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ | ||
1206 | -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ | 1314 | -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ |
1207 | -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|g' \ | 1315 | -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|g' \ |
1208 | -e 's|@''REPLACE_ATAN2F''@|$(REPLACE_ATAN2F)|g' \ | 1316 | -e 's|@''REPLACE_ATAN2F''@|$(REPLACE_ATAN2F)|g' \ |
@@ -1233,6 +1341,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1233 | -e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \ | 1341 | -e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \ |
1234 | -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ | 1342 | -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ |
1235 | -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ | 1343 | -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ |
1344 | -e 's|@''REPLACE_GETPAYLOAD''@|$(REPLACE_GETPAYLOAD)|g' \ | ||
1345 | -e 's|@''REPLACE_GETPAYLOADF''@|$(REPLACE_GETPAYLOADF)|g' \ | ||
1346 | -e 's|@''REPLACE_GETPAYLOADL''@|$(REPLACE_GETPAYLOADL)|g' \ | ||
1236 | -e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \ | 1347 | -e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \ |
1237 | -e 's|@''REPLACE_HYPOT''@|$(REPLACE_HYPOT)|g' \ | 1348 | -e 's|@''REPLACE_HYPOT''@|$(REPLACE_HYPOT)|g' \ |
1238 | -e 's|@''REPLACE_HYPOTF''@|$(REPLACE_HYPOTF)|g' \ | 1349 | -e 's|@''REPLACE_HYPOTF''@|$(REPLACE_HYPOTF)|g' \ |
@@ -1244,6 +1355,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1244 | -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \ | 1355 | -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \ |
1245 | -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \ | 1356 | -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \ |
1246 | -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ | 1357 | -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ |
1358 | < $@-t4 > $@-t5 | ||
1359 | $(AM_V_at)sed \ | ||
1360 | -e 's|@''REPLACE_LDEXP''@|$(REPLACE_LDEXP)|g' \ | ||
1247 | -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ | 1361 | -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ |
1248 | -e 's|@''REPLACE_LOG''@|$(REPLACE_LOG)|g' \ | 1362 | -e 's|@''REPLACE_LOG''@|$(REPLACE_LOG)|g' \ |
1249 | -e 's|@''REPLACE_LOGF''@|$(REPLACE_LOGF)|g' \ | 1363 | -e 's|@''REPLACE_LOGF''@|$(REPLACE_LOGF)|g' \ |
@@ -1279,15 +1393,22 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
1279 | -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ | 1393 | -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ |
1280 | -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ | 1394 | -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ |
1281 | -e 's|@''REPLACE_TANHF''@|$(REPLACE_TANHF)|g' \ | 1395 | -e 's|@''REPLACE_TANHF''@|$(REPLACE_TANHF)|g' \ |
1396 | -e 's|@''REPLACE_TOTALORDER''@|$(REPLACE_TOTALORDER)|g' \ | ||
1397 | -e 's|@''REPLACE_TOTALORDERF''@|$(REPLACE_TOTALORDERF)|g' \ | ||
1398 | -e 's|@''REPLACE_TOTALORDERL''@|$(REPLACE_TOTALORDERL)|g' \ | ||
1399 | -e 's|@''REPLACE_TOTALORDERMAG''@|$(REPLACE_TOTALORDERMAG)|g' \ | ||
1400 | -e 's|@''REPLACE_TOTALORDERMAGF''@|$(REPLACE_TOTALORDERMAGF)|g' \ | ||
1401 | -e 's|@''REPLACE_TOTALORDERMAGL''@|$(REPLACE_TOTALORDERMAGL)|g' \ | ||
1282 | -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ | 1402 | -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ |
1283 | -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ | 1403 | -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ |
1284 | -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ | 1404 | -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ |
1285 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 1405 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
1286 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 1406 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
1287 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 1407 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
1288 | > $@-t | 1408 | < $@-t5 > $@-t6 |
1289 | $(AM_V_at)mv $@-t $@ | 1409 | $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3 $@-t4 $@-t5 |
1290 | MOSTLYCLEANFILES += math.h math.h-t | 1410 | $(AM_V_at)mv $@-t6 $@ |
1411 | MOSTLYCLEANFILES += math.h math.h-t1 math.h-t2 math.h-t3 math.h-t4 math.h-t5 math.h-t6 | ||
1291 | 1412 | ||
1292 | EXTRA_DIST += math.in.h | 1413 | EXTRA_DIST += math.in.h |
1293 | 1414 | ||
@@ -1313,6 +1434,12 @@ endif | |||
1313 | 1434 | ||
1314 | ## end gnulib module mbsinit | 1435 | ## end gnulib module mbsinit |
1315 | 1436 | ||
1437 | ## begin gnulib module mbszero | ||
1438 | |||
1439 | libgnu_a_SOURCES += mbszero.c | ||
1440 | |||
1441 | ## end gnulib module mbszero | ||
1442 | |||
1316 | ## begin gnulib module mbtowc | 1443 | ## begin gnulib module mbtowc |
1317 | 1444 | ||
1318 | if GL_COND_OBJ_MBTOWC | 1445 | if GL_COND_OBJ_MBTOWC |
@@ -1534,6 +1661,14 @@ EXTRA_DIST += setlocale_null.h windows-initguard.h | |||
1534 | 1661 | ||
1535 | ## end gnulib module setlocale-null | 1662 | ## end gnulib module setlocale-null |
1536 | 1663 | ||
1664 | ## begin gnulib module setlocale-null-unlocked | ||
1665 | |||
1666 | libgnu_a_SOURCES += setlocale_null-unlocked.c | ||
1667 | |||
1668 | EXTRA_DIST += setlocale_null.h | ||
1669 | |||
1670 | ## end gnulib module setlocale-null-unlocked | ||
1671 | |||
1537 | ## begin gnulib module size_max | 1672 | ## begin gnulib module size_max |
1538 | 1673 | ||
1539 | libgnu_a_SOURCES += size_max.h | 1674 | libgnu_a_SOURCES += size_max.h |
@@ -1625,26 +1760,6 @@ EXTRA_DIST += stat-time.h | |||
1625 | 1760 | ||
1626 | ## end gnulib module stat-time | 1761 | ## end gnulib module stat-time |
1627 | 1762 | ||
1628 | ## begin gnulib module stdalign | ||
1629 | |||
1630 | BUILT_SOURCES += $(STDALIGN_H) | ||
1631 | |||
1632 | # We need the following in order to create <stdalign.h> when the system | ||
1633 | # doesn't have one that works. | ||
1634 | if GL_GENERATE_STDALIGN_H | ||
1635 | stdalign.h: stdalign.in.h $(top_builddir)/config.status | ||
1636 | $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/stdalign.in.h | ||
1637 | $(AM_V_at)mv $@-t $@ | ||
1638 | else | ||
1639 | stdalign.h: $(top_builddir)/config.status | ||
1640 | rm -f $@ | ||
1641 | endif | ||
1642 | MOSTLYCLEANFILES += stdalign.h stdalign.h-t | ||
1643 | |||
1644 | EXTRA_DIST += stdalign.in.h | ||
1645 | |||
1646 | ## end gnulib module stdalign | ||
1647 | |||
1648 | ## begin gnulib module stdckdint | 1763 | ## begin gnulib module stdckdint |
1649 | 1764 | ||
1650 | BUILT_SOURCES += $(STDCKDINT_H) | 1765 | BUILT_SOURCES += $(STDCKDINT_H) |
@@ -1816,14 +1931,17 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
1816 | -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ | 1931 | -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ |
1817 | -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ | 1932 | -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ |
1818 | -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ | 1933 | -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ |
1819 | < $(srcdir)/stdio.in.h | \ | 1934 | < $(srcdir)/stdio.in.h > $@-t1 |
1820 | sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ | 1935 | $(AM_V_at)sed \ |
1936 | -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ | ||
1821 | -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ | 1937 | -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ |
1822 | -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ | 1938 | -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ |
1823 | -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ | 1939 | -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ |
1824 | -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ | 1940 | -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ |
1825 | -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ | 1941 | -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ |
1942 | -e 's|@''HAVE_DECL_GETW''@|$(HAVE_DECL_GETW)|g' \ | ||
1826 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ | 1943 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ |
1944 | -e 's|@''HAVE_DECL_PUTW''@|$(HAVE_DECL_PUTW)|g' \ | ||
1827 | -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ | 1945 | -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ |
1828 | -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ | 1946 | -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ |
1829 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ | 1947 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ |
@@ -1834,6 +1952,8 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
1834 | -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ | 1952 | -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ |
1835 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ | 1953 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ |
1836 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ | 1954 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ |
1955 | < $@-t1 > $@-t2 | ||
1956 | $(AM_V_at)sed \ | ||
1837 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ | 1957 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ |
1838 | -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ | 1958 | -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ |
1839 | -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ | 1959 | -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ |
@@ -1871,9 +1991,10 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
1871 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 1991 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
1872 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 1992 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
1873 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 1993 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
1874 | > $@-t | 1994 | < $@-t2 > $@-t3 |
1875 | $(AM_V_at)mv $@-t $@ | 1995 | $(AM_V_at)rm -f $@-t1 $@-t2 |
1876 | MOSTLYCLEANFILES += stdio.h stdio.h-t | 1996 | $(AM_V_at)mv $@-t3 $@ |
1997 | MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 | ||
1877 | 1998 | ||
1878 | if GL_COND_OBJ_STDIO_READ | 1999 | if GL_COND_OBJ_STDIO_READ |
1879 | libgnu_a_SOURCES += stdio-read.c | 2000 | libgnu_a_SOURCES += stdio-read.c |
@@ -1908,10 +2029,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1908 | -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ | 2029 | -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ |
1909 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ | 2030 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ |
1910 | -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ | 2031 | -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ |
2032 | -e 's/@''GNULIB_GETPROGNAME''@/$(GL_GNULIB_GETPROGNAME)/g' \ | ||
1911 | -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ | 2033 | -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ |
1912 | -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ | 2034 | -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ |
1913 | -e 's/@''GNULIB_MALLOC_GNU''@/$(GL_GNULIB_MALLOC_GNU)/g' \ | 2035 | -e 's/@''GNULIB_MALLOC_GNU''@/$(GL_GNULIB_MALLOC_GNU)/g' \ |
1914 | -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ | 2036 | -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ |
2037 | -e 's/@''GNULIB_MBSTOWCS''@/$(GL_GNULIB_MBSTOWCS)/g' \ | ||
1915 | -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ | 2038 | -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ |
1916 | -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ | 2039 | -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ |
1917 | -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ | 2040 | -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ |
@@ -1924,6 +2047,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1924 | -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ | 2047 | -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ |
1925 | -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ | 2048 | -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ |
1926 | -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ | 2049 | -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ |
2050 | -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \ | ||
1927 | -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ | 2051 | -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ |
1928 | -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ | 2052 | -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ |
1929 | -e 's/@''GNULIB_REALLOC_GNU''@/$(GL_GNULIB_REALLOC_GNU)/g' \ | 2053 | -e 's/@''GNULIB_REALLOC_GNU''@/$(GL_GNULIB_REALLOC_GNU)/g' \ |
@@ -1934,6 +2058,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1934 | -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ | 2058 | -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ |
1935 | -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ | 2059 | -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ |
1936 | -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ | 2060 | -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ |
2061 | -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ | ||
1937 | -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ | 2062 | -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ |
1938 | -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ | 2063 | -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ |
1939 | -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ | 2064 | -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ |
@@ -1948,8 +2073,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1948 | -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ | 2073 | -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ |
1949 | -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ | 2074 | -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ |
1950 | -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ | 2075 | -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ |
1951 | < $(srcdir)/stdlib.in.h | \ | 2076 | < $(srcdir)/stdlib.in.h > $@-t1 |
1952 | sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ | 2077 | $(AM_V_at)sed \ |
2078 | -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ | ||
1953 | -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ | 2079 | -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ |
1954 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ | 2080 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ |
1955 | -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ | 2081 | -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ |
@@ -1957,6 +2083,8 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1957 | -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \ | 2083 | -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \ |
1958 | -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \ | 2084 | -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \ |
1959 | -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ | 2085 | -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ |
2086 | -e 's|@''HAVE_DECL_PROGRAM_INVOCATION_NAME''@|$(HAVE_DECL_PROGRAM_INVOCATION_NAME)|g' \ | ||
2087 | -e 's|@''HAVE_GETPROGNAME''@|$(HAVE_GETPROGNAME)|g' \ | ||
1960 | -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ | 2088 | -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ |
1961 | -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ | 2089 | -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ |
1962 | -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ | 2090 | -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ |
@@ -1983,6 +2111,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1983 | -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ | 2111 | -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ |
1984 | -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ | 2112 | -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ |
1985 | -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ | 2113 | -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ |
2114 | -e 's|@''HAVE_STRTOF''@|$(HAVE_STRTOF)|g' \ | ||
1986 | -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ | 2115 | -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ |
1987 | -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ | 2116 | -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ |
1988 | -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ | 2117 | -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ |
@@ -1992,21 +2121,33 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
1992 | -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ | 2121 | -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ |
1993 | -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ | 2122 | -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ |
1994 | -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ | 2123 | -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ |
2124 | < $@-t1 > $@-t2 | ||
2125 | $(AM_V_at)sed \ | ||
2126 | -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \ | ||
1995 | -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ | 2127 | -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ |
1996 | -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \ | 2128 | -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \ |
1997 | -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \ | 2129 | -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \ |
1998 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ | 2130 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ |
1999 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ | 2131 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ |
2132 | -e 's|@''REPLACE_GETLOADAVG''@|$(REPLACE_GETLOADAVG)|g' \ | ||
2133 | -e 's|@''REPLACE_GETPROGNAME''@|$(REPLACE_GETPROGNAME)|g' \ | ||
2134 | -e 's|@''REPLACE_GETSUBOPT''@|$(REPLACE_GETSUBOPT)|g' \ | ||
2000 | -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ | 2135 | -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ |
2001 | -e 's|@''REPLACE_MALLOC_FOR_MALLOC_GNU''@|$(REPLACE_MALLOC_FOR_MALLOC_GNU)|g' \ | 2136 | -e 's|@''REPLACE_MALLOC_FOR_MALLOC_GNU''@|$(REPLACE_MALLOC_FOR_MALLOC_GNU)|g' \ |
2002 | -e 's|@''REPLACE_MALLOC_FOR_MALLOC_POSIX''@|$(REPLACE_MALLOC_FOR_MALLOC_POSIX)|g' \ | 2137 | -e 's|@''REPLACE_MALLOC_FOR_MALLOC_POSIX''@|$(REPLACE_MALLOC_FOR_MALLOC_POSIX)|g' \ |
2138 | -e 's|@''REPLACE_MB_CUR_MAX''@|$(REPLACE_MB_CUR_MAX)|g' \ | ||
2139 | -e 's|@''REPLACE_MBSTOWCS''@|$(REPLACE_MBSTOWCS)|g' \ | ||
2003 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ | 2140 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ |
2141 | -e 's|@''REPLACE_MKOSTEMP''@|$(REPLACE_MKOSTEMP)|g' \ | ||
2142 | -e 's|@''REPLACE_MKOSTEMPS''@|$(REPLACE_MKOSTEMPS)|g' \ | ||
2004 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ | 2143 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ |
2005 | -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \ | 2144 | -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \ |
2145 | -e 's|@''REPLACE_POSIX_OPENPT''@|$(REPLACE_POSIX_OPENPT)|g' \ | ||
2006 | -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ | 2146 | -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ |
2007 | -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ | 2147 | -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ |
2008 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ | 2148 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ |
2009 | -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ | 2149 | -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ |
2150 | -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \ | ||
2010 | -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ | 2151 | -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ |
2011 | -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ | 2152 | -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ |
2012 | -e 's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \ | 2153 | -e 's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \ |
@@ -2016,6 +2157,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
2016 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ | 2157 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ |
2017 | -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ | 2158 | -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ |
2018 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ | 2159 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ |
2160 | -e 's|@''REPLACE_STRTOF''@|$(REPLACE_STRTOF)|g' \ | ||
2019 | -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ | 2161 | -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ |
2020 | -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ | 2162 | -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ |
2021 | -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ | 2163 | -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ |
@@ -2027,9 +2169,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
2027 | -e '/definition of _Noreturn/r $(_NORETURN_H)' \ | 2169 | -e '/definition of _Noreturn/r $(_NORETURN_H)' \ |
2028 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 2170 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
2029 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 2171 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
2030 | > $@-t | 2172 | < $@-t2 > $@-t3 |
2031 | $(AM_V_at)mv $@-t $@ | 2173 | $(AM_V_at)rm -f $@-t1 $@-t2 |
2032 | MOSTLYCLEANFILES += stdlib.h stdlib.h-t | 2174 | $(AM_V_at)mv $@-t3 $@ |
2175 | MOSTLYCLEANFILES += stdlib.h stdlib.h-t1 stdlib.h-t2 stdlib.h-t3 | ||
2033 | 2176 | ||
2034 | EXTRA_DIST += stdlib.in.h | 2177 | EXTRA_DIST += stdlib.in.h |
2035 | 2178 | ||
@@ -2147,8 +2290,9 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2147 | -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ | 2290 | -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ |
2148 | -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ | 2291 | -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ |
2149 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ | 2292 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ |
2150 | < $(srcdir)/string.in.h | \ | 2293 | < $(srcdir)/string.in.h > $@-t1 |
2151 | sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ | 2294 | $(AM_V_at)sed \ |
2295 | -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ | ||
2152 | -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ | 2296 | -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ |
2153 | -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ | 2297 | -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ |
2154 | -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ | 2298 | -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ |
@@ -2176,7 +2320,10 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2176 | -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ | 2320 | -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ |
2177 | -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ | 2321 | -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ |
2178 | -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ | 2322 | -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ |
2323 | -e 's|@''REPLACE_MEMPCPY''@|$(REPLACE_MEMPCPY)|g' \ | ||
2324 | -e 's|@''REPLACE_MEMSET_EXPLICIT''@|$(REPLACE_MEMSET_EXPLICIT)|g' \ | ||
2179 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ | 2325 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ |
2326 | -e 's|@''REPLACE_STPCPY''@|$(REPLACE_STPCPY)|g' \ | ||
2180 | -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ | 2327 | -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ |
2181 | -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ | 2328 | -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ |
2182 | -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ | 2329 | -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ |
@@ -2190,13 +2337,15 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2190 | -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ | 2337 | -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ |
2191 | -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ | 2338 | -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ |
2192 | -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ | 2339 | -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ |
2340 | -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ | ||
2193 | -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ | 2341 | -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ |
2194 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 2342 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
2195 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 2343 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
2196 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 2344 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
2197 | > $@-t | 2345 | < $@-t1 > $@-t2 |
2198 | $(AM_V_at)mv $@-t $@ | 2346 | $(AM_V_at)rm -f $@-t1 |
2199 | MOSTLYCLEANFILES += string.h string.h-t | 2347 | $(AM_V_at)mv $@-t2 $@ |
2348 | MOSTLYCLEANFILES += string.h string.h-t1 string.h-t2 | ||
2200 | 2349 | ||
2201 | EXTRA_DIST += string.in.h | 2350 | EXTRA_DIST += string.in.h |
2202 | 2351 | ||
@@ -2425,7 +2574,7 @@ libgnu_a_SOURCES += glthread/threadlib.c | |||
2425 | 2574 | ||
2426 | ## end gnulib module threadlib | 2575 | ## end gnulib module threadlib |
2427 | 2576 | ||
2428 | ## begin gnulib module time | 2577 | ## begin gnulib module time-h |
2429 | 2578 | ||
2430 | BUILT_SOURCES += time.h | 2579 | BUILT_SOURCES += time.h |
2431 | 2580 | ||
@@ -2444,6 +2593,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
2444 | -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ | 2593 | -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ |
2445 | -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ | 2594 | -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ |
2446 | -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ | 2595 | -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ |
2596 | -e 's/@''GNULIB_TIME''@/$(GL_GNULIB_TIME)/g' \ | ||
2447 | -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ | 2597 | -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ |
2448 | -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ | 2598 | -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ |
2449 | -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \ | 2599 | -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \ |
@@ -2465,7 +2615,10 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | |||
2465 | -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ | 2615 | -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ |
2466 | -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ | 2616 | -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ |
2467 | -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ | 2617 | -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ |
2618 | -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ | ||
2468 | -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ | 2619 | -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ |
2620 | -e 's|@''REPLACE_TIMESPEC_GET''@|$(REPLACE_TIMESPEC_GET)|g' \ | ||
2621 | -e 's|@''REPLACE_TIMESPEC_GETRES''@|$(REPLACE_TIMESPEC_GETRES)|g' \ | ||
2469 | -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ | 2622 | -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ |
2470 | -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ | 2623 | -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ |
2471 | -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ | 2624 | -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ |
@@ -2481,7 +2634,7 @@ MOSTLYCLEANFILES += time.h time.h-t | |||
2481 | 2634 | ||
2482 | EXTRA_DIST += time.in.h | 2635 | EXTRA_DIST += time.in.h |
2483 | 2636 | ||
2484 | ## end gnulib module time | 2637 | ## end gnulib module time-h |
2485 | 2638 | ||
2486 | ## begin gnulib module time_r | 2639 | ## begin gnulib module time_r |
2487 | 2640 | ||
@@ -2540,6 +2693,8 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2540 | -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ | 2693 | -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ |
2541 | -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ | 2694 | -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ |
2542 | -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ | 2695 | -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ |
2696 | < $(srcdir)/unistd.in.h > $@-t1 | ||
2697 | $(AM_V_at)sed \ | ||
2543 | -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ | 2698 | -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ |
2544 | -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ | 2699 | -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ |
2545 | -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ | 2700 | -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ |
@@ -2601,8 +2756,9 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2601 | -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ | 2756 | -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ |
2602 | -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ | 2757 | -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ |
2603 | -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ | 2758 | -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ |
2604 | < $(srcdir)/unistd.in.h | \ | 2759 | < $@-t1 > $@-t2 |
2605 | sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ | 2760 | $(AM_V_at)sed \ |
2761 | -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ | ||
2606 | -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ | 2762 | -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ |
2607 | -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ | 2763 | -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ |
2608 | -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ | 2764 | -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ |
@@ -2649,13 +2805,15 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2649 | -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ | 2805 | -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ |
2650 | -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ | 2806 | -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ |
2651 | -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ | 2807 | -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ |
2652 | | \ | 2808 | < $@-t2 > $@-t3 |
2653 | sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ | 2809 | $(AM_V_at)sed \ |
2810 | -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ | ||
2654 | -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ | 2811 | -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ |
2655 | -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ | 2812 | -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ |
2656 | -e 's|@''REPLACE_COPY_FILE_RANGE''@|$(REPLACE_COPY_FILE_RANGE)|g' \ | 2813 | -e 's|@''REPLACE_COPY_FILE_RANGE''@|$(REPLACE_COPY_FILE_RANGE)|g' \ |
2657 | -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ | 2814 | -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ |
2658 | -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ | 2815 | -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ |
2816 | -e 's|@''REPLACE_DUP3''@|$(REPLACE_DUP3)|g' \ | ||
2659 | -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ | 2817 | -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ |
2660 | -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ | 2818 | -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ |
2661 | -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ | 2819 | -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ |
@@ -2664,11 +2822,14 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2664 | -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ | 2822 | -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ |
2665 | -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ | 2823 | -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ |
2666 | -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ | 2824 | -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ |
2825 | -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ | ||
2667 | -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ | 2826 | -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ |
2827 | -e 's|@''REPLACE_FDATASYNC''@|$(REPLACE_FDATASYNC)|g' \ | ||
2668 | -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ | 2828 | -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ |
2669 | -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ | 2829 | -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ |
2670 | -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ | 2830 | -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ |
2671 | -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ | 2831 | -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ |
2832 | -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ | ||
2672 | -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ | 2833 | -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ |
2673 | -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ | 2834 | -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ |
2674 | -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ | 2835 | -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ |
@@ -2679,12 +2840,14 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2679 | -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ | 2840 | -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ |
2680 | -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ | 2841 | -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ |
2681 | -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ | 2842 | -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ |
2843 | -e 's|@''REPLACE_PIPE2''@|$(REPLACE_PIPE2)|g' \ | ||
2682 | -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ | 2844 | -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ |
2683 | -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ | 2845 | -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ |
2684 | -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ | 2846 | -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ |
2685 | -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ | 2847 | -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ |
2686 | -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ | 2848 | -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ |
2687 | -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ | 2849 | -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ |
2850 | -e 's|@''REPLACE_SETHOSTNAME''@|$(REPLACE_SETHOSTNAME)|g' \ | ||
2688 | -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ | 2851 | -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ |
2689 | -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ | 2852 | -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ |
2690 | -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ | 2853 | -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ |
@@ -2700,9 +2863,10 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
2700 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 2863 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
2701 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 2864 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
2702 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 2865 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
2703 | > $@-t | 2866 | < $@-t3 > $@-t4 |
2704 | $(AM_V_at)mv $@-t $@ | 2867 | $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3 |
2705 | MOSTLYCLEANFILES += unistd.h unistd.h-t | 2868 | $(AM_V_at)mv $@-t4 $@ |
2869 | MOSTLYCLEANFILES += unistd.h unistd.h-t1 unistd.h-t2 unistd.h-t3 unistd.h-t4 | ||
2706 | 2870 | ||
2707 | EXTRA_DIST += unistd.in.h | 2871 | EXTRA_DIST += unistd.in.h |
2708 | 2872 | ||
@@ -2777,6 +2941,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
2777 | -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ | 2941 | -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ |
2778 | -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ | 2942 | -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ |
2779 | -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \ | 2943 | -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \ |
2944 | -e 's/@''GNULIB_MBSZERO''@/$(GL_GNULIB_MBSZERO)/g' \ | ||
2780 | -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \ | 2945 | -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \ |
2781 | -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \ | 2946 | -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \ |
2782 | -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ | 2947 | -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ |
@@ -2815,10 +2980,12 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
2815 | -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \ | 2980 | -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \ |
2816 | -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ | 2981 | -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ |
2817 | -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \ | 2982 | -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \ |
2983 | -e 's/@''GNULIB_WGETCWD''@/$(GL_GNULIB_WGETCWD)/g' \ | ||
2818 | -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \ | 2984 | -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \ |
2819 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ | 2985 | -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ |
2820 | < $(srcdir)/wchar.in.h | \ | 2986 | < $(srcdir)/wchar.in.h > $@-t1 |
2821 | sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ | 2987 | $(AM_V_at)sed \ |
2988 | -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ | ||
2822 | -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ | 2989 | -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ |
2823 | -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ | 2990 | -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ |
2824 | -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ | 2991 | -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ |
@@ -2861,8 +3028,9 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
2861 | -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ | 3028 | -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ |
2862 | -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \ | 3029 | -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \ |
2863 | -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | 3030 | -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ |
2864 | | \ | 3031 | < $@-t1 > $@-t2 |
2865 | sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ | 3032 | $(AM_V_at)sed \ |
3033 | -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ | ||
2866 | -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ | 3034 | -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ |
2867 | -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ | 3035 | -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ |
2868 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ | 3036 | -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ |
@@ -2877,13 +3045,19 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
2877 | -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ | 3045 | -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ |
2878 | -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ | 3046 | -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ |
2879 | -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ | 3047 | -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ |
3048 | -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \ | ||
3049 | -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \ | ||
3050 | -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \ | ||
2880 | -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ | 3051 | -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ |
3052 | -e 's|@''REPLACE_WMEMCMP''@|$(REPLACE_WMEMCMP)|g' \ | ||
3053 | -e 's|@''REPLACE_WMEMPCPY''@|$(REPLACE_WMEMPCPY)|g' \ | ||
2881 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 3054 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
2882 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 3055 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
2883 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 3056 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
2884 | > $@-t | 3057 | < $@-t2 > $@-t3 |
2885 | $(AM_V_at)mv $@-t $@ | 3058 | $(AM_V_at)rm -f $@-t1 $@-t2 |
2886 | MOSTLYCLEANFILES += wchar.h wchar.h-t | 3059 | $(AM_V_at)mv $@-t3 $@ |
3060 | MOSTLYCLEANFILES += wchar.h wchar.h-t1 wchar.h-t2 wchar.h-t3 | ||
2887 | 3061 | ||
2888 | EXTRA_DIST += wchar.in.h | 3062 | EXTRA_DIST += wchar.in.h |
2889 | 3063 | ||
@@ -2897,6 +3071,16 @@ endif | |||
2897 | 3071 | ||
2898 | ## end gnulib module wcrtomb | 3072 | ## end gnulib module wcrtomb |
2899 | 3073 | ||
3074 | ## begin gnulib module wctype | ||
3075 | |||
3076 | if GL_COND_OBJ_WCTYPE | ||
3077 | libgnu_a_SOURCES += wctype.c | ||
3078 | endif | ||
3079 | |||
3080 | EXTRA_DIST += wctype-impl.h | ||
3081 | |||
3082 | ## end gnulib module wctype | ||
3083 | |||
2900 | ## begin gnulib module wctype-h | 3084 | ## begin gnulib module wctype-h |
2901 | 3085 | ||
2902 | BUILT_SOURCES += wctype.h | 3086 | BUILT_SOURCES += wctype.h |
@@ -2904,7 +3088,7 @@ libgnu_a_SOURCES += wctype-h.c | |||
2904 | 3088 | ||
2905 | # We need the following in order to create <wctype.h> when the system | 3089 | # We need the following in order to create <wctype.h> when the system |
2906 | # doesn't have one that works with the given compiler. | 3090 | # doesn't have one that works with the given compiler. |
2907 | wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) | 3091 | wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) |
2908 | $(gl_V_at)$(SED_HEADER_STDOUT) \ | 3092 | $(gl_V_at)$(SED_HEADER_STDOUT) \ |
2909 | -e 's|@''GUARD_PREFIX''@|GL|g' \ | 3093 | -e 's|@''GUARD_PREFIX''@|GL|g' \ |
2910 | -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ | 3094 | -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ |
@@ -2916,6 +3100,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H | |||
2916 | -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ | 3100 | -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ |
2917 | -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \ | 3101 | -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \ |
2918 | -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ | 3102 | -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ |
3103 | -e 's/@''GNULIB_ISWPUNCT''@/$(GL_GNULIB_ISWPUNCT)/g' \ | ||
2919 | -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ | 3104 | -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ |
2920 | -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ | 3105 | -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ |
2921 | -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ | 3106 | -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ |
@@ -2928,10 +3113,14 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H | |||
2928 | -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ | 3113 | -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ |
2929 | -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ | 3114 | -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ |
2930 | -e 's/@''REPLACE_ISWDIGIT''@/$(REPLACE_ISWDIGIT)/g' \ | 3115 | -e 's/@''REPLACE_ISWDIGIT''@/$(REPLACE_ISWDIGIT)/g' \ |
3116 | -e 's/@''REPLACE_ISWPUNCT''@/$(REPLACE_ISWPUNCT)/g' \ | ||
2931 | -e 's/@''REPLACE_ISWXDIGIT''@/$(REPLACE_ISWXDIGIT)/g' \ | 3117 | -e 's/@''REPLACE_ISWXDIGIT''@/$(REPLACE_ISWXDIGIT)/g' \ |
2932 | -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ | 3118 | -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ |
2933 | -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ | 3119 | -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ |
3120 | -e 's/@''REPLACE_WCTRANS''@/$(REPLACE_WCTRANS)/g' \ | ||
3121 | -e 's/@''REPLACE_WCTYPE''@/$(REPLACE_WCTYPE)/g' \ | ||
2934 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 3122 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
3123 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
2935 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 3124 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
2936 | $(srcdir)/wctype.in.h > $@-t | 3125 | $(srcdir)/wctype.in.h > $@-t |
2937 | $(AM_V_at)mv $@-t $@ | 3126 | $(AM_V_at)mv $@-t $@ |
diff --git a/gl/_Noreturn.h b/gl/_Noreturn.h index 6ecea98b..7326bd47 100644 --- a/gl/_Noreturn.h +++ b/gl/_Noreturn.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* A C macro for declaring that a function does not return. | 1 | /* A C macro for declaring that a function does not return. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify it | 4 | This program is free software: you can redistribute it and/or modify it |
5 | under the terms of the GNU Lesser General Public License as published | 5 | under the terms of the GNU Lesser General Public License as published |
diff --git a/gl/af_alg.c b/gl/af_alg.c index 9f022ce5..6fd08c28 100644 --- a/gl/af_alg.c +++ b/gl/af_alg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* af_alg.c - Compute message digests from file streams and buffers. | 1 | /* af_alg.c - Compute message digests from file streams and buffers. |
2 | Copyright (C) 2018-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/af_alg.h b/gl/af_alg.h index e8ffb3f7..ed933e12 100644 --- a/gl/af_alg.h +++ b/gl/af_alg.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* af_alg.h - Compute message digests from file streams and buffers. | 1 | /* af_alg.h - Compute message digests from file streams and buffers. |
2 | Copyright (C) 2018-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/alloca.in.h b/gl/alloca.in.h index a1bb3d75..6aa47df8 100644 --- a/gl/alloca.in.h +++ b/gl/alloca.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Memory allocation on the stack. | 1 | /* Memory allocation on the stack. |
2 | 2 | ||
3 | Copyright (C) 1995, 1999, 2001-2004, 2006-2023 Free Software Foundation, | 3 | Copyright (C) 1995, 1999, 2001-2004, 2006-2024 Free Software Foundation, |
4 | Inc. | 4 | Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/arg-nonnull.h b/gl/arg-nonnull.h index 9498ae1f..46c711ca 100644 --- a/gl/arg-nonnull.h +++ b/gl/arg-nonnull.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* A C macro for declaring that specific arguments must not be NULL. | 1 | /* A C macro for declaring that specific arguments must not be NULL. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify it | 4 | This program is free software: you can redistribute it and/or modify it |
5 | under the terms of the GNU Lesser General Public License as published | 5 | under the terms of the GNU Lesser General Public License as published |
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h index 80e6713f..523a448c 100644 --- a/gl/arpa_inet.in.h +++ b/gl/arpa_inet.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <arpa/inet.h>. | 1 | /* A GNU-like <arpa/inet.h>. |
2 | 2 | ||
3 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -49,6 +49,11 @@ | |||
49 | #ifndef _@GUARD_PREFIX@_ARPA_INET_H | 49 | #ifndef _@GUARD_PREFIX@_ARPA_INET_H |
50 | #define _@GUARD_PREFIX@_ARPA_INET_H | 50 | #define _@GUARD_PREFIX@_ARPA_INET_H |
51 | 51 | ||
52 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
53 | #if !_GL_CONFIG_H_INCLUDED | ||
54 | #error "Please include config.h first." | ||
55 | #endif | ||
56 | |||
52 | /* Get all possible declarations of inet_ntop() and inet_pton(). */ | 57 | /* Get all possible declarations of inet_ntop() and inet_pton(). */ |
53 | #if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \ | 58 | #if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \ |
54 | && @HAVE_WS2TCPIP_H@ | 59 | && @HAVE_WS2TCPIP_H@ |
diff --git a/gl/asnprintf.c b/gl/asnprintf.c index f4861bf8..a6c09bc2 100644 --- a/gl/asnprintf.c +++ b/gl/asnprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999, 2002, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/asprintf.c b/gl/asprintf.c index ba58e064..b0c33478 100644 --- a/gl/asprintf.c +++ b/gl/asprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999, 2002, 2006-2007, 2009-2023 Free Software Foundation, | 2 | Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation, |
3 | Inc. | 3 | Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/assert.in.h b/gl/assert.in.h index b0ab99c7..6e4995e1 100644 --- a/gl/assert.in.h +++ b/gl/assert.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for and wrapper around <assert.h> | 1 | /* Substitute for and wrapper around <assert.h> |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/attribute.h b/gl/attribute.h index 130644d8..710341ba 100644 --- a/gl/attribute.h +++ b/gl/attribute.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ATTRIBUTE_* macros for using attributes in GCC and similar compilers | 1 | /* ATTRIBUTE_* macros for using attributes in GCC and similar compilers |
2 | 2 | ||
3 | Copyright 2020-2023 Free Software Foundation, Inc. | 3 | Copyright 2020-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -41,6 +41,21 @@ | |||
41 | These names begin with 'ATTRIBUTE_' to avoid name clashes. */ | 41 | These names begin with 'ATTRIBUTE_' to avoid name clashes. */ |
42 | 42 | ||
43 | 43 | ||
44 | /* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE, | ||
45 | _GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST, | ||
46 | _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR, | ||
47 | _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE, | ||
48 | _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, | ||
49 | _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, | ||
50 | _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, | ||
51 | _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, | ||
52 | _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL, | ||
53 | _GL_ATTRIBUTE_SENTINEL. */ | ||
54 | #if !_GL_CONFIG_H_INCLUDED | ||
55 | #error "Please include config.h first." | ||
56 | #endif | ||
57 | |||
58 | |||
44 | /* =============== Attributes for specific kinds of functions =============== */ | 59 | /* =============== Attributes for specific kinds of functions =============== */ |
45 | 60 | ||
46 | /* Attributes for functions that should not be used. */ | 61 | /* Attributes for functions that should not be used. */ |
@@ -167,6 +182,8 @@ | |||
167 | 182 | ||
168 | /* The function does not throw exceptions. */ | 183 | /* The function does not throw exceptions. */ |
169 | /* Applies to: functions. */ | 184 | /* Applies to: functions. */ |
185 | /* After a function's parameter list, this attribute must come first, before | ||
186 | other attributes. */ | ||
170 | #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW | 187 | #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW |
171 | 188 | ||
172 | /* Do not inline the function. */ | 189 | /* Do not inline the function. */ |
diff --git a/gl/base64.c b/gl/base64.c index 95b669aa..c8b3b76b 100644 --- a/gl/base64.c +++ b/gl/base64.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* base64.c -- Encode binary data using printable characters. | 1 | /* base64.c -- Encode binary data using printable characters. |
2 | Copyright (C) 1999-2001, 2004-2006, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -42,6 +42,7 @@ | |||
42 | #include <config.h> | 42 | #include <config.h> |
43 | 43 | ||
44 | /* Get prototype. */ | 44 | /* Get prototype. */ |
45 | #define BASE64_INLINE _GL_EXTERN_INLINE | ||
45 | #include "base64.h" | 46 | #include "base64.h" |
46 | 47 | ||
47 | /* Get imalloc. */ | 48 | /* Get imalloc. */ |
@@ -49,9 +50,6 @@ | |||
49 | 50 | ||
50 | #include <intprops.h> | 51 | #include <intprops.h> |
51 | 52 | ||
52 | /* Get UCHAR_MAX. */ | ||
53 | #include <limits.h> | ||
54 | |||
55 | #include <string.h> | 53 | #include <string.h> |
56 | 54 | ||
57 | /* Convert 'char' to 'unsigned char' without casting. */ | 55 | /* Convert 'char' to 'unsigned char' without casting. */ |
@@ -242,7 +240,7 @@ base64_encode_alloc (const char *in, idx_t inlen, char **out) | |||
242 | : (_) == '/' ? 63 \ | 240 | : (_) == '/' ? 63 \ |
243 | : -1) | 241 | : -1) |
244 | 242 | ||
245 | static const signed char b64[0x100] = { | 243 | signed char const base64_to_int[256] = { |
246 | B64 (0), B64 (1), B64 (2), B64 (3), | 244 | B64 (0), B64 (1), B64 (2), B64 (3), |
247 | B64 (4), B64 (5), B64 (6), B64 (7), | 245 | B64 (4), B64 (5), B64 (6), B64 (7), |
248 | B64 (8), B64 (9), B64 (10), B64 (11), | 246 | B64 (8), B64 (9), B64 (10), B64 (11), |
@@ -309,28 +307,6 @@ static const signed char b64[0x100] = { | |||
309 | B64 (252), B64 (253), B64 (254), B64 (255) | 307 | B64 (252), B64 (253), B64 (254), B64 (255) |
310 | }; | 308 | }; |
311 | 309 | ||
312 | #if UCHAR_MAX == 255 | ||
313 | # define uchar_in_range(c) true | ||
314 | #else | ||
315 | # define uchar_in_range(c) ((c) <= 255) | ||
316 | #endif | ||
317 | |||
318 | /* Return true if CH is a character from the Base64 alphabet, and | ||
319 | false otherwise. Note that '=' is padding and not considered to be | ||
320 | part of the alphabet. */ | ||
321 | bool | ||
322 | isbase64 (char ch) | ||
323 | { | ||
324 | return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)]; | ||
325 | } | ||
326 | |||
327 | /* Initialize decode-context buffer, CTX. */ | ||
328 | void | ||
329 | base64_decode_ctx_init (struct base64_decode_context *ctx) | ||
330 | { | ||
331 | ctx->i = 0; | ||
332 | } | ||
333 | |||
334 | /* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and | 310 | /* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and |
335 | none of those four is a newline, then return *IN. Otherwise, copy up to | 311 | none of those four is a newline, then return *IN. Otherwise, copy up to |
336 | 4 - CTX->i non-newline bytes from that range into CTX->buf, starting at | 312 | 4 - CTX->i non-newline bytes from that range into CTX->buf, starting at |
@@ -405,8 +381,8 @@ decode_4 (char const *restrict in, idx_t inlen, | |||
405 | 381 | ||
406 | if (*outleft) | 382 | if (*outleft) |
407 | { | 383 | { |
408 | *out++ = ((b64[to_uchar (in[0])] << 2) | 384 | *out++ = ((base64_to_int[to_uchar (in[0])] << 2) |
409 | | (b64[to_uchar (in[1])] >> 4)); | 385 | | (base64_to_int[to_uchar (in[1])] >> 4)); |
410 | --*outleft; | 386 | --*outleft; |
411 | } | 387 | } |
412 | 388 | ||
@@ -420,6 +396,10 @@ decode_4 (char const *restrict in, idx_t inlen, | |||
420 | 396 | ||
421 | if (in[3] != '=') | 397 | if (in[3] != '=') |
422 | return_false; | 398 | return_false; |
399 | |||
400 | /* Reject non-canonical encodings. */ | ||
401 | if (base64_to_int[to_uchar (in[1])] & 0x0f) | ||
402 | return_false; | ||
423 | } | 403 | } |
424 | else | 404 | else |
425 | { | 405 | { |
@@ -428,8 +408,8 @@ decode_4 (char const *restrict in, idx_t inlen, | |||
428 | 408 | ||
429 | if (*outleft) | 409 | if (*outleft) |
430 | { | 410 | { |
431 | *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0) | 411 | *out++ = (((base64_to_int[to_uchar (in[1])] << 4) & 0xf0) |
432 | | (b64[to_uchar (in[2])] >> 2)); | 412 | | (base64_to_int[to_uchar (in[2])] >> 2)); |
433 | --*outleft; | 413 | --*outleft; |
434 | } | 414 | } |
435 | 415 | ||
@@ -440,6 +420,10 @@ decode_4 (char const *restrict in, idx_t inlen, | |||
440 | { | 420 | { |
441 | if (inlen != 4) | 421 | if (inlen != 4) |
442 | return_false; | 422 | return_false; |
423 | |||
424 | /* Reject non-canonical encodings. */ | ||
425 | if (base64_to_int[to_uchar (in[2])] & 0x03) | ||
426 | return_false; | ||
443 | } | 427 | } |
444 | else | 428 | else |
445 | { | 429 | { |
@@ -448,8 +432,8 @@ decode_4 (char const *restrict in, idx_t inlen, | |||
448 | 432 | ||
449 | if (*outleft) | 433 | if (*outleft) |
450 | { | 434 | { |
451 | *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0) | 435 | *out++ = (((base64_to_int[to_uchar (in[2])] << 6) & 0xc0) |
452 | | b64[to_uchar (in[3])]); | 436 | | base64_to_int[to_uchar (in[3])]); |
453 | --*outleft; | 437 | --*outleft; |
454 | } | 438 | } |
455 | } | 439 | } |
diff --git a/gl/base64.h b/gl/base64.h index 99137652..7691f6c4 100644 --- a/gl/base64.h +++ b/gl/base64.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* base64.h -- Encode binary data using printable characters. | 1 | /* base64.h -- Encode binary data using printable characters. |
2 | Copyright (C) 2004-2006, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2004-2006, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson. | 3 | Written by Simon Josefsson. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -16,18 +16,33 @@ | |||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #ifndef BASE64_H | 18 | #ifndef BASE64_H |
19 | # define BASE64_H | 19 | #define BASE64_H |
20 | |||
21 | /* This file uses _GL_INLINE_HEADER_BEGIN. */ | ||
22 | #if !_GL_CONFIG_H_INCLUDED | ||
23 | #error "Please include config.h first." | ||
24 | #endif | ||
20 | 25 | ||
21 | /* Get idx_t. */ | 26 | /* Get idx_t. */ |
22 | # include <idx.h> | 27 | #include <idx.h> |
28 | |||
29 | /* Pacify GCC in isubase64. */ | ||
30 | #if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) | ||
31 | # pragma GCC diagnostic ignored "-Wtype-limits" | ||
32 | #endif | ||
33 | |||
34 | _GL_INLINE_HEADER_BEGIN | ||
35 | #ifndef BASE64_INLINE | ||
36 | # define BASE64_INLINE _GL_INLINE | ||
37 | #endif | ||
23 | 38 | ||
24 | # ifdef __cplusplus | 39 | #ifdef __cplusplus |
25 | extern "C" { | 40 | extern "C" { |
26 | # endif | 41 | #endif |
27 | 42 | ||
28 | /* This uses that the expression (n+(k-1))/k means the smallest | 43 | /* This uses that the expression (n+(k-1))/k means the smallest |
29 | integer >= n/k, i.e., the ceiling of n/k. */ | 44 | integer >= n/k, i.e., the ceiling of n/k. */ |
30 | # define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4) | 45 | #define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4) |
31 | 46 | ||
32 | struct base64_decode_context | 47 | struct base64_decode_context |
33 | { | 48 | { |
@@ -35,14 +50,31 @@ struct base64_decode_context | |||
35 | char buf[4]; | 50 | char buf[4]; |
36 | }; | 51 | }; |
37 | 52 | ||
38 | extern bool isbase64 (char ch) _GL_ATTRIBUTE_CONST; | 53 | extern signed char const base64_to_int[256]; |
54 | |||
55 | BASE64_INLINE bool | ||
56 | isubase64 (unsigned char ch) | ||
57 | { | ||
58 | return ch < sizeof base64_to_int && 0 <= base64_to_int[ch]; | ||
59 | } | ||
60 | |||
61 | BASE64_INLINE bool | ||
62 | isbase64 (char ch) | ||
63 | { | ||
64 | return isubase64 (ch); | ||
65 | } | ||
39 | 66 | ||
40 | extern void base64_encode (const char *restrict in, idx_t inlen, | 67 | extern void base64_encode (const char *restrict in, idx_t inlen, |
41 | char *restrict out, idx_t outlen); | 68 | char *restrict out, idx_t outlen); |
42 | 69 | ||
43 | extern idx_t base64_encode_alloc (const char *in, idx_t inlen, char **out); | 70 | extern idx_t base64_encode_alloc (const char *in, idx_t inlen, char **out); |
44 | 71 | ||
45 | extern void base64_decode_ctx_init (struct base64_decode_context *ctx); | 72 | /* Initialize decode-context buffer, CTX. */ |
73 | BASE64_INLINE void | ||
74 | base64_decode_ctx_init (struct base64_decode_context *ctx) | ||
75 | { | ||
76 | ctx->i = 0; | ||
77 | } | ||
46 | 78 | ||
47 | extern bool base64_decode_ctx (struct base64_decode_context *ctx, | 79 | extern bool base64_decode_ctx (struct base64_decode_context *ctx, |
48 | const char *restrict in, idx_t inlen, | 80 | const char *restrict in, idx_t inlen, |
@@ -58,8 +90,10 @@ extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx, | |||
58 | #define base64_decode_alloc(in, inlen, out, outlen) \ | 90 | #define base64_decode_alloc(in, inlen, out, outlen) \ |
59 | base64_decode_alloc_ctx (NULL, in, inlen, out, outlen) | 91 | base64_decode_alloc_ctx (NULL, in, inlen, out, outlen) |
60 | 92 | ||
61 | # ifdef __cplusplus | 93 | #ifdef __cplusplus |
62 | } | 94 | } |
63 | # endif | 95 | #endif |
96 | |||
97 | _GL_INLINE_HEADER_END | ||
64 | 98 | ||
65 | #endif /* BASE64_H */ | 99 | #endif /* BASE64_H */ |
diff --git a/gl/basename-lgpl.c b/gl/basename-lgpl.c index 6de60aa6..256f8460 100644 --- a/gl/basename-lgpl.c +++ b/gl/basename-lgpl.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* basename.c -- return the last element in a file name | 1 | /* basename.c -- return the last element in a file name |
2 | 2 | ||
3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2023 Free Software | 3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/basename-lgpl.h b/gl/basename-lgpl.h index 5d996c1d..2a56be98 100644 --- a/gl/basename-lgpl.h +++ b/gl/basename-lgpl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Extract the last component (base name) of a file name. | 1 | /* Extract the last component (base name) of a file name. |
2 | 2 | ||
3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2023 Free Software Foundation, | 3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, |
4 | Inc. | 4 | Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
@@ -19,6 +19,11 @@ | |||
19 | #ifndef _BASENAME_LGPL_H | 19 | #ifndef _BASENAME_LGPL_H |
20 | #define _BASENAME_LGPL_H | 20 | #define _BASENAME_LGPL_H |
21 | 21 | ||
22 | /* This file uses _GL_ATTRIBUTE_PURE. */ | ||
23 | #if !_GL_CONFIG_H_INCLUDED | ||
24 | #error "Please include config.h first." | ||
25 | #endif | ||
26 | |||
22 | #include <stddef.h> | 27 | #include <stddef.h> |
23 | 28 | ||
24 | #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT | 29 | #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT |
diff --git a/gl/basename.c b/gl/basename.c index 21fab1ef..c5a6bdc9 100644 --- a/gl/basename.c +++ b/gl/basename.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* basename.c -- return the last element in a file name | 1 | /* basename.c -- return the last element in a file name |
2 | 2 | ||
3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2023 Free Software | 3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
@@ -1,5 +1,5 @@ | |||
1 | /* Convert unibyte character to wide character. | 1 | /* Convert unibyte character to wide character. |
2 | Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <string.h> | ||
25 | 26 | ||
26 | wint_t | 27 | wint_t |
27 | btowc (int c) | 28 | btowc (int c) |
@@ -32,7 +33,14 @@ btowc (int c) | |||
32 | wchar_t wc; | 33 | wchar_t wc; |
33 | 34 | ||
34 | buf[0] = c; | 35 | buf[0] = c; |
36 | #if HAVE_MBRTOWC | ||
37 | mbstate_t state; | ||
38 | mbszero (&state); | ||
39 | size_t ret = mbrtowc (&wc, buf, 1, &state); | ||
40 | if (!(ret == (size_t)(-1) || ret == (size_t)(-2))) | ||
41 | #else | ||
35 | if (mbtowc (&wc, buf, 1) >= 0) | 42 | if (mbtowc (&wc, buf, 1) >= 0) |
43 | #endif | ||
36 | return wc; | 44 | return wc; |
37 | } | 45 | } |
38 | return WEOF; | 46 | return WEOF; |
diff --git a/gl/byteswap.in.h b/gl/byteswap.in.h index e61be27e..8e49efad 100644 --- a/gl/byteswap.in.h +++ b/gl/byteswap.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* byteswap.h - Byte swapping | 1 | /* byteswap.h - Byte swapping |
2 | Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. | 3 | Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/c++defs.h b/gl/c++defs.h index 8ad46951..eb66967b 100644 --- a/gl/c++defs.h +++ b/gl/c++defs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* C++ compatible function declaration macros. | 1 | /* C++ compatible function declaration macros. |
2 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2010-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify it | 4 | This program is free software: you can redistribute it and/or modify it |
5 | under the terms of the GNU Lesser General Public License as published | 5 | under the terms of the GNU Lesser General Public License as published |
@@ -99,6 +99,12 @@ | |||
99 | Example: | 99 | Example: |
100 | _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) | 100 | _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) |
101 | _GL_ARG_NONNULL ((1))); | 101 | _GL_ARG_NONNULL ((1))); |
102 | |||
103 | Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front | ||
104 | of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's | ||
105 | because | ||
106 | [[...]] extern "C" <declaration>; | ||
107 | is invalid syntax in C++.) | ||
102 | */ | 108 | */ |
103 | #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ | 109 | #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ |
104 | _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) | 110 | _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) |
diff --git a/gl/calloc.c b/gl/calloc.c index 08843acd..81dfd3ef 100644 --- a/gl/calloc.c +++ b/gl/calloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* calloc() function that is glibc compatible. | 1 | /* calloc() function that is glibc compatible. |
2 | This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. | 2 | This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. |
3 | Copyright (C) 2004-2007, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1992-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992-2024 Free Software Foundation, Inc. |
2 | Copyright The GNU Toolchain Authors. | 2 | Copyright The GNU Toolchain Authors. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
@@ -42,8 +42,8 @@ | |||
42 | #if (defined __has_attribute \ | 42 | #if (defined __has_attribute \ |
43 | && (!defined __clang_minor__ \ | 43 | && (!defined __clang_minor__ \ |
44 | || (defined __apple_build_version__ \ | 44 | || (defined __apple_build_version__ \ |
45 | ? 6000000 <= __apple_build_version__ \ | 45 | ? 7000000 <= __apple_build_version__ \ |
46 | : 3 < __clang_major__ + (5 <= __clang_minor__)))) | 46 | : 5 <= __clang_major__))) |
47 | # define __glibc_has_attribute(attr) __has_attribute (attr) | 47 | # define __glibc_has_attribute(attr) __has_attribute (attr) |
48 | #else | 48 | #else |
49 | # define __glibc_has_attribute(attr) 0 | 49 | # define __glibc_has_attribute(attr) 0 |
@@ -140,32 +140,37 @@ | |||
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | 142 | ||
143 | /* Gnulib avoids these definitions, as they don't work on non-glibc platforms. | ||
144 | In particular, __bos and __bos0 are defined differently in the Android libc. | ||
145 | */ | ||
146 | #ifndef __GNULIB_CDEFS | ||
147 | |||
143 | /* Fortify support. */ | 148 | /* Fortify support. */ |
144 | #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) | 149 | # define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) |
145 | #define __bos0(ptr) __builtin_object_size (ptr, 0) | 150 | # define __bos0(ptr) __builtin_object_size (ptr, 0) |
146 | 151 | ||
147 | /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ | 152 | /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ |
148 | #if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ | 153 | # if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ |
149 | || __GNUC_PREREQ (12, 0)) | 154 | || __GNUC_PREREQ (12, 0)) |
150 | # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) | 155 | # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) |
151 | # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) | 156 | # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) |
152 | #else | 157 | # else |
153 | # define __glibc_objsize0(__o) __bos0 (__o) | 158 | # define __glibc_objsize0(__o) __bos0 (__o) |
154 | # define __glibc_objsize(__o) __bos (__o) | 159 | # define __glibc_objsize(__o) __bos (__o) |
155 | #endif | 160 | # endif |
156 | 161 | ||
157 | /* Compile time conditions to choose between the regular, _chk and _chk_warn | 162 | /* Compile time conditions to choose between the regular, _chk and _chk_warn |
158 | variants. These conditions should get evaluated to constant and optimized | 163 | variants. These conditions should get evaluated to constant and optimized |
159 | away. */ | 164 | away. */ |
160 | 165 | ||
161 | #define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) | 166 | # define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) |
162 | #define __glibc_unsigned_or_positive(__l) \ | 167 | # define __glibc_unsigned_or_positive(__l) \ |
163 | ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ | 168 | ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ |
164 | || (__builtin_constant_p (__l) && (__l) > 0)) | 169 | || (__builtin_constant_p (__l) && (__l) > 0)) |
165 | 170 | ||
166 | /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ | 171 | /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ |
167 | condition can be folded to a constant and if it is true, or unknown (-1) */ | 172 | condition can be folded to a constant and if it is true, or unknown (-1) */ |
168 | #define __glibc_safe_or_unknown_len(__l, __s, __osz) \ | 173 | # define __glibc_safe_or_unknown_len(__l, __s, __osz) \ |
169 | ((__osz) == (__SIZE_TYPE__) -1 \ | 174 | ((__osz) == (__SIZE_TYPE__) -1 \ |
170 | || (__glibc_unsigned_or_positive (__l) \ | 175 | || (__glibc_unsigned_or_positive (__l) \ |
171 | && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ | 176 | && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ |
@@ -175,7 +180,7 @@ | |||
175 | /* Conversely, we know at compile time that the length is unsafe if the | 180 | /* Conversely, we know at compile time that the length is unsafe if the |
176 | __L * __S <= __OBJSZ condition can be folded to a constant and if it is | 181 | __L * __S <= __OBJSZ condition can be folded to a constant and if it is |
177 | false. */ | 182 | false. */ |
178 | #define __glibc_unsafe_len(__l, __s, __osz) \ | 183 | # define __glibc_unsafe_len(__l, __s, __osz) \ |
179 | (__glibc_unsigned_or_positive (__l) \ | 184 | (__glibc_unsigned_or_positive (__l) \ |
180 | && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ | 185 | && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ |
181 | __s, __osz)) \ | 186 | __s, __osz)) \ |
@@ -184,7 +189,7 @@ | |||
184 | /* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be | 189 | /* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be |
185 | declared. */ | 190 | declared. */ |
186 | 191 | ||
187 | #define __glibc_fortify(f, __l, __s, __osz, ...) \ | 192 | # define __glibc_fortify(f, __l, __s, __osz, ...) \ |
188 | (__glibc_safe_or_unknown_len (__l, __s, __osz) \ | 193 | (__glibc_safe_or_unknown_len (__l, __s, __osz) \ |
189 | ? __ ## f ## _alias (__VA_ARGS__) \ | 194 | ? __ ## f ## _alias (__VA_ARGS__) \ |
190 | : (__glibc_unsafe_len (__l, __s, __osz) \ | 195 | : (__glibc_unsafe_len (__l, __s, __osz) \ |
@@ -194,13 +199,16 @@ | |||
194 | /* Fortify function f, where object size argument passed to f is the number of | 199 | /* Fortify function f, where object size argument passed to f is the number of |
195 | elements and not total size. */ | 200 | elements and not total size. */ |
196 | 201 | ||
197 | #define __glibc_fortify_n(f, __l, __s, __osz, ...) \ | 202 | # define __glibc_fortify_n(f, __l, __s, __osz, ...) \ |
198 | (__glibc_safe_or_unknown_len (__l, __s, __osz) \ | 203 | (__glibc_safe_or_unknown_len (__l, __s, __osz) \ |
199 | ? __ ## f ## _alias (__VA_ARGS__) \ | 204 | ? __ ## f ## _alias (__VA_ARGS__) \ |
200 | : (__glibc_unsafe_len (__l, __s, __osz) \ | 205 | : (__glibc_unsafe_len (__l, __s, __osz) \ |
201 | ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ | 206 | ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ |
202 | : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ | 207 | : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ |
203 | 208 | ||
209 | #endif | ||
210 | |||
211 | |||
204 | #if __GNUC_PREREQ (4,3) | 212 | #if __GNUC_PREREQ (4,3) |
205 | # define __warnattr(msg) __attribute__((__warning__ (msg))) | 213 | # define __warnattr(msg) __attribute__((__warning__ (msg))) |
206 | # define __errordecl(name, msg) \ | 214 | # define __errordecl(name, msg) \ |
diff --git a/gl/cloexec.c b/gl/cloexec.c index e4cecbd2..cdb0d740 100644 --- a/gl/cloexec.c +++ b/gl/cloexec.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cloexec.c - set or clear the close-on-exec descriptor flag | 1 | /* cloexec.c - set or clear the close-on-exec descriptor flag |
2 | 2 | ||
3 | Copyright (C) 1991, 2004-2006, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1991, 2004-2006, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/cloexec.h b/gl/cloexec.h index 057fd668..a7944d6d 100644 --- a/gl/cloexec.h +++ b/gl/cloexec.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cloexec.c - set or clear the close-on-exec descriptor flag | 1 | /* cloexec.c - set or clear the close-on-exec descriptor flag |
2 | 2 | ||
3 | Copyright (C) 2004, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -15,6 +15,11 @@ | |||
15 | You should have received a copy of the GNU Lesser General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #ifdef __cplusplus | ||
19 | extern "C" { | ||
20 | #endif | ||
21 | |||
22 | |||
18 | /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, | 23 | /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, |
19 | or clear the flag if VALUE is false. | 24 | or clear the flag if VALUE is false. |
20 | Return 0 on success, or -1 on error with 'errno' set. | 25 | Return 0 on success, or -1 on error with 'errno' set. |
@@ -32,3 +37,8 @@ int set_cloexec_flag (int desc, bool value); | |||
32 | be duplicated. */ | 37 | be duplicated. */ |
33 | 38 | ||
34 | int dup_cloexec (int fd); | 39 | int dup_cloexec (int fd); |
40 | |||
41 | |||
42 | #ifdef __cplusplus | ||
43 | } | ||
44 | #endif | ||
@@ -1,5 +1,5 @@ | |||
1 | /* close replacement. | 1 | /* close replacement. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/dirname-lgpl.c b/gl/dirname-lgpl.c index e9454af3..8333c0eb 100644 --- a/gl/dirname-lgpl.c +++ b/gl/dirname-lgpl.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* dirname.c -- return all but the last element in a file name | 1 | /* dirname.c -- return all but the last element in a file name |
2 | 2 | ||
3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2023 Free Software | 3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/dirname.c b/gl/dirname.c index e72f7130..393ec1b4 100644 --- a/gl/dirname.c +++ b/gl/dirname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* dirname.c -- return all but the last element in a file name | 1 | /* dirname.c -- return all but the last element in a file name |
2 | 2 | ||
3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2023 Free Software | 3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
diff --git a/gl/dirname.h b/gl/dirname.h index f98e83bd..33935ba9 100644 --- a/gl/dirname.h +++ b/gl/dirname.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Take file names apart into directory and base names. | 1 | /* Take file names apart into directory and base names. |
2 | 2 | ||
3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2023 Free Software Foundation, | 3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, |
4 | Inc. | 4 | Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
@@ -19,6 +19,12 @@ | |||
19 | #ifndef DIRNAME_H_ | 19 | #ifndef DIRNAME_H_ |
20 | # define DIRNAME_H_ 1 | 20 | # define DIRNAME_H_ 1 |
21 | 21 | ||
22 | /* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_PURE, | ||
23 | _GL_ATTRIBUTE_RETURNS_NONNULL. */ | ||
24 | #if !_GL_CONFIG_H_INCLUDED | ||
25 | #error "Please include config.h first." | ||
26 | #endif | ||
27 | |||
22 | # include <stdlib.h> | 28 | # include <stdlib.h> |
23 | # include "filename.h" | 29 | # include "filename.h" |
24 | # include "basename-lgpl.h" | 30 | # include "basename-lgpl.h" |
@@ -1,6 +1,6 @@ | |||
1 | /* Duplicate an open file descriptor to a specified file descriptor. | 1 | /* Duplicate an open file descriptor to a specified file descriptor. |
2 | 2 | ||
3 | Copyright (C) 1999, 2004-2007, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1999, 2004-2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/dynarray.h b/gl/dynarray.h index 91559109..8940e81b 100644 --- a/gl/dynarray.h +++ b/gl/dynarray.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Type-safe arrays which grow dynamically. | 1 | /* Type-safe arrays which grow dynamically. |
2 | Copyright 2021-2023 Free Software Foundation, Inc. | 2 | Copyright 2021-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/errno.in.h b/gl/errno.in.h index 3dda9c26..aa658e62 100644 --- a/gl/errno.in.h +++ b/gl/errno.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A POSIX-like <errno.h>. | 1 | /* A POSIX-like <errno.h>. |
2 | 2 | ||
3 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* Error handler for noninteractive utilities | 1 | /* Error handler for noninteractive utilities |
2 | Copyright (C) 1990-1998, 2000-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1990-1998, 2000-2007, 2009-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -19,9 +19,10 @@ | |||
19 | 19 | ||
20 | #if !_LIBC | 20 | #if !_LIBC |
21 | # include <config.h> | 21 | # include <config.h> |
22 | # define _GL_NO_INLINE_ERROR | ||
22 | #endif | 23 | #endif |
23 | 24 | ||
24 | #include "error.h" | 25 | #include <error.h> |
25 | 26 | ||
26 | #include <stdarg.h> | 27 | #include <stdarg.h> |
27 | #include <stdio.h> | 28 | #include <stdio.h> |
@@ -42,8 +43,6 @@ | |||
42 | # define USE_UNLOCKED_IO 0 | 43 | # define USE_UNLOCKED_IO 0 |
43 | # define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b) | 44 | # define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b) |
44 | # define _GL_ARG_NONNULL(a) | 45 | # define _GL_ARG_NONNULL(a) |
45 | #else | ||
46 | # include "getprogname.h" | ||
47 | #endif | 46 | #endif |
48 | 47 | ||
49 | #if USE_UNLOCKED_IO | 48 | #if USE_UNLOCKED_IO |
diff --git a/gl/error.h b/gl/error.h deleted file mode 100644 index a240526a..00000000 --- a/gl/error.h +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | /* Declaration for error-reporting function | ||
2 | Copyright (C) 1995-1997, 2003, 2006, 2008-2023 Free Software Foundation, | ||
3 | Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | |||
6 | This file is free software: you can redistribute it and/or modify | ||
7 | it under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of the | ||
9 | License, or (at your option) any later version. | ||
10 | |||
11 | This file is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public License | ||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
18 | |||
19 | #ifndef _ERROR_H | ||
20 | #define _ERROR_H 1 | ||
21 | |||
22 | /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ | ||
23 | #include <stdio.h> | ||
24 | |||
25 | #ifdef __cplusplus | ||
26 | extern "C" { | ||
27 | #endif | ||
28 | |||
29 | /* Print a message with 'fprintf (stderr, FORMAT, ...)'; | ||
30 | if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). | ||
31 | If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ | ||
32 | |||
33 | extern void error (int __status, int __errnum, const char *__format, ...) | ||
34 | #if GNULIB_VFPRINTF_POSIX | ||
35 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4)) | ||
36 | #else | ||
37 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 3, 4)) | ||
38 | #endif | ||
39 | ; | ||
40 | |||
41 | extern void error_at_line (int __status, int __errnum, const char *__fname, | ||
42 | unsigned int __lineno, const char *__format, ...) | ||
43 | #if GNULIB_VFPRINTF_POSIX | ||
44 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 6)) | ||
45 | #else | ||
46 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 5, 6)) | ||
47 | #endif | ||
48 | ; | ||
49 | |||
50 | /* If NULL, error will flush stdout, then print on stderr the program | ||
51 | name, a colon and a space. Otherwise, error will call this | ||
52 | function without parameters instead. */ | ||
53 | extern void (*error_print_progname) (void); | ||
54 | |||
55 | /* This variable is incremented each time 'error' is called. */ | ||
56 | extern unsigned int error_message_count; | ||
57 | |||
58 | /* Sometimes we want to have at most one error per line. This | ||
59 | variable controls whether this mode is selected or not. */ | ||
60 | extern int error_one_per_line; | ||
61 | |||
62 | #ifdef __cplusplus | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | #endif /* error.h */ | ||
diff --git a/gl/error.in.h b/gl/error.in.h new file mode 100644 index 00000000..51f8cafd --- /dev/null +++ b/gl/error.in.h | |||
@@ -0,0 +1,216 @@ | |||
1 | /* Declarations for error-reporting functions. | ||
2 | Copyright (C) 1995-1997, 2003, 2006, 2008-2024 Free Software Foundation, | ||
3 | Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | |||
6 | This file is free software: you can redistribute it and/or modify | ||
7 | it under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of the | ||
9 | License, or (at your option) any later version. | ||
10 | |||
11 | This file is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public License | ||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
18 | |||
19 | #ifndef _@GUARD_PREFIX@_ERROR_H | ||
20 | |||
21 | /* No @PRAGMA_SYSTEM_HEADER@ here, because it would prevent | ||
22 | -Wimplicit-fallthrough warnings for missing FALLTHROUGH after error(...) | ||
23 | or error_at_line(...) invocations. */ | ||
24 | |||
25 | /* The include_next requires a split double-inclusion guard. */ | ||
26 | #if @HAVE_ERROR_H@ | ||
27 | # @INCLUDE_NEXT@ @NEXT_ERROR_H@ | ||
28 | #endif | ||
29 | |||
30 | #ifndef _@GUARD_PREFIX@_ERROR_H | ||
31 | #define _@GUARD_PREFIX@_ERROR_H | ||
32 | |||
33 | /* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_FORMAT, | ||
34 | _GL_ATTRIBUTE_MAYBE_UNUSED. */ | ||
35 | #if !_GL_CONFIG_H_INCLUDED | ||
36 | #error "Please include config.h first." | ||
37 | #endif | ||
38 | |||
39 | /* Get 'unreachable'. */ | ||
40 | #include <stddef.h> | ||
41 | |||
42 | /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ | ||
43 | #include <stdio.h> | ||
44 | |||
45 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
46 | |||
47 | #if GNULIB_VFPRINTF_POSIX | ||
48 | # define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD | ||
49 | #else | ||
50 | # define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM | ||
51 | #endif | ||
52 | |||
53 | /* Helper macro for supporting the compiler's control flow analysis better. | ||
54 | It evaluates its arguments only once. | ||
55 | Test case: Compile copy-file.c with "gcc -Wimplicit-fallthrough". */ | ||
56 | #if defined __GNUC__ || defined __clang__ | ||
57 | /* Use 'unreachable' to tell the compiler when the function call does not | ||
58 | return. */ | ||
59 | # define __gl_error_call1(function, status, ...) \ | ||
60 | ((function) (status, __VA_ARGS__), \ | ||
61 | (status) != 0 ? unreachable () : (void) 0) | ||
62 | /* If STATUS is a not a constant, the function call may or may not return; | ||
63 | therefore -Wimplicit-fallthrough will produce a warning. Use a compound | ||
64 | statement in order to evaluate STATUS only once. | ||
65 | If STATUS is a constant, we don't use a compound statement, because that | ||
66 | would trigger a -Wimplicit-fallthrough warning even when STATUS is != 0, | ||
67 | when not optimizing. This causes STATUS to be evaluated twice, but | ||
68 | that's OK since it does not have side effects. */ | ||
69 | # define __gl_error_call(function, status, ...) \ | ||
70 | (__builtin_constant_p (status) \ | ||
71 | ? __gl_error_call1 (function, status, __VA_ARGS__) \ | ||
72 | : __extension__ \ | ||
73 | ({ \ | ||
74 | int const __errstatus = status; \ | ||
75 | __gl_error_call1 (function, __errstatus, __VA_ARGS__); \ | ||
76 | })) | ||
77 | #else | ||
78 | # define __gl_error_call(function, status, ...) \ | ||
79 | (function) (status, __VA_ARGS__) | ||
80 | #endif | ||
81 | |||
82 | #ifdef __cplusplus | ||
83 | extern "C" { | ||
84 | #endif | ||
85 | |||
86 | /* Print a message with 'fprintf (stderr, FORMAT, ...)'; | ||
87 | if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). | ||
88 | If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ | ||
89 | #if @REPLACE_ERROR@ | ||
90 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
91 | # undef error | ||
92 | # define error rpl_error | ||
93 | # endif | ||
94 | _GL_FUNCDECL_RPL (error, void, | ||
95 | (int __status, int __errnum, const char *__format, ...) | ||
96 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); | ||
97 | _GL_CXXALIAS_RPL (error, void, | ||
98 | (int __status, int __errnum, const char *__format, ...)); | ||
99 | # ifndef _GL_NO_INLINE_ERROR | ||
100 | # undef error | ||
101 | # define error(status, ...) \ | ||
102 | __gl_error_call (rpl_error, status, __VA_ARGS__) | ||
103 | # endif | ||
104 | #else | ||
105 | # if ! @HAVE_ERROR@ | ||
106 | _GL_FUNCDECL_SYS (error, void, | ||
107 | (int __status, int __errnum, const char *__format, ...) | ||
108 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); | ||
109 | # endif | ||
110 | _GL_CXXALIAS_SYS (error, void, | ||
111 | (int __status, int __errnum, const char *__format, ...)); | ||
112 | # ifndef _GL_NO_INLINE_ERROR | ||
113 | # ifdef error | ||
114 | /* Only gcc ≥ 4.7 has __builtin_va_arg_pack. */ | ||
115 | # if _GL_GNUC_PREREQ (4, 7) | ||
116 | # pragma GCC diagnostic push | ||
117 | # pragma GCC diagnostic ignored "-Wattributes" | ||
118 | _GL_ATTRIBUTE_MAYBE_UNUSED | ||
119 | static void | ||
120 | _GL_ATTRIBUTE_ALWAYS_INLINE | ||
121 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)) | ||
122 | _gl_inline_error (int __status, int __errnum, const char *__format, ...) | ||
123 | { | ||
124 | return error (__status, __errnum, __format, __builtin_va_arg_pack ()); | ||
125 | } | ||
126 | # pragma GCC diagnostic pop | ||
127 | # undef error | ||
128 | # define error(status, ...) \ | ||
129 | __gl_error_call (_gl_inline_error, status, __VA_ARGS__) | ||
130 | # endif | ||
131 | # else | ||
132 | # define error(status, ...) \ | ||
133 | __gl_error_call (error, status, __VA_ARGS__) | ||
134 | # endif | ||
135 | # endif | ||
136 | #endif | ||
137 | #if __GLIBC__ >= 2 | ||
138 | _GL_CXXALIASWARN (error); | ||
139 | #endif | ||
140 | |||
141 | /* Likewise. If FILENAME is non-NULL, include FILENAME:LINENO: in the | ||
142 | message. */ | ||
143 | #if @REPLACE_ERROR_AT_LINE@ | ||
144 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
145 | # undef error_at_line | ||
146 | # define error_at_line rpl_error_at_line | ||
147 | # endif | ||
148 | _GL_FUNCDECL_RPL (error_at_line, void, | ||
149 | (int __status, int __errnum, const char *__filename, | ||
150 | unsigned int __lineno, const char *__format, ...) | ||
151 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); | ||
152 | _GL_CXXALIAS_RPL (error_at_line, void, | ||
153 | (int __status, int __errnum, const char *__filename, | ||
154 | unsigned int __lineno, const char *__format, ...)); | ||
155 | # ifndef _GL_NO_INLINE_ERROR | ||
156 | # undef error_at_line | ||
157 | # define error_at_line(status, ...) \ | ||
158 | __gl_error_call (rpl_error_at_line, status, __VA_ARGS__) | ||
159 | # endif | ||
160 | #else | ||
161 | # if ! @HAVE_ERROR_AT_LINE@ | ||
162 | _GL_FUNCDECL_SYS (error_at_line, void, | ||
163 | (int __status, int __errnum, const char *__filename, | ||
164 | unsigned int __lineno, const char *__format, ...) | ||
165 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); | ||
166 | # endif | ||
167 | _GL_CXXALIAS_SYS (error_at_line, void, | ||
168 | (int __status, int __errnum, const char *__filename, | ||
169 | unsigned int __lineno, const char *__format, ...)); | ||
170 | # ifndef _GL_NO_INLINE_ERROR | ||
171 | # ifdef error_at_line | ||
172 | /* Only gcc ≥ 4.7 has __builtin_va_arg_pack. */ | ||
173 | # if _GL_GNUC_PREREQ (4, 7) | ||
174 | # pragma GCC diagnostic push | ||
175 | # pragma GCC diagnostic ignored "-Wattributes" | ||
176 | _GL_ATTRIBUTE_MAYBE_UNUSED | ||
177 | static void | ||
178 | _GL_ATTRIBUTE_ALWAYS_INLINE | ||
179 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)) | ||
180 | _gl_inline_error_at_line (int __status, int __errnum, const char *__filename, | ||
181 | unsigned int __lineno, const char *__format, ...) | ||
182 | { | ||
183 | return error_at_line (__status, __errnum, __filename, __lineno, __format, | ||
184 | __builtin_va_arg_pack ()); | ||
185 | } | ||
186 | # pragma GCC diagnostic pop | ||
187 | # undef error_at_line | ||
188 | # define error_at_line(status, ...) \ | ||
189 | __gl_error_call (_gl_inline_error_at_line, status, __VA_ARGS__) | ||
190 | # endif | ||
191 | # else | ||
192 | # define error_at_line(status, ...) \ | ||
193 | __gl_error_call (error_at_line, status, __VA_ARGS__) | ||
194 | # endif | ||
195 | # endif | ||
196 | #endif | ||
197 | _GL_CXXALIASWARN (error_at_line); | ||
198 | |||
199 | /* If NULL, error will flush stdout, then print on stderr the program | ||
200 | name, a colon and a space. Otherwise, error will call this | ||
201 | function without parameters instead. */ | ||
202 | extern void (*error_print_progname) (void); | ||
203 | |||
204 | /* This variable is incremented each time 'error' is called. */ | ||
205 | extern unsigned int error_message_count; | ||
206 | |||
207 | /* Sometimes we want to have at most one error per line. This | ||
208 | variable controls whether this mode is selected or not. */ | ||
209 | extern int error_one_per_line; | ||
210 | |||
211 | #ifdef __cplusplus | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | #endif /* _@GUARD_PREFIX@_ERROR_H */ | ||
216 | #endif /* _@GUARD_PREFIX@_ERROR_H */ | ||
diff --git a/gl/exitfail.c b/gl/exitfail.c index d67a130c..8a5962e8 100644 --- a/gl/exitfail.c +++ b/gl/exitfail.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Failure exit status | 1 | /* Failure exit status |
2 | 2 | ||
3 | Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/exitfail.h b/gl/exitfail.h index 85a6af64..fa264b5c 100644 --- a/gl/exitfail.h +++ b/gl/exitfail.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Failure exit status | 1 | /* Failure exit status |
2 | 2 | ||
3 | Copyright (C) 2002, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -15,4 +15,14 @@ | |||
15 | You should have received a copy of the GNU Lesser General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #ifdef __cplusplus | ||
19 | extern "C" { | ||
20 | #endif | ||
21 | |||
22 | |||
18 | extern int volatile exit_failure; | 23 | extern int volatile exit_failure; |
24 | |||
25 | |||
26 | #ifdef __cplusplus | ||
27 | } | ||
28 | #endif | ||
@@ -1,6 +1,6 @@ | |||
1 | /* Provide file descriptor control. | 1 | /* Provide file descriptor control. |
2 | 2 | ||
3 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h index e034eaf9..eea3b954 100644 --- a/gl/fcntl.in.h +++ b/gl/fcntl.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Like <fcntl.h>, but with non-working flags defined to 0. | 1 | /* Like <fcntl.h>, but with non-working flags defined to 0. |
2 | 2 | ||
3 | Copyright (C) 2006-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2006-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -74,6 +74,11 @@ | |||
74 | #ifndef _@GUARD_PREFIX@_FCNTL_H | 74 | #ifndef _@GUARD_PREFIX@_FCNTL_H |
75 | #define _@GUARD_PREFIX@_FCNTL_H | 75 | #define _@GUARD_PREFIX@_FCNTL_H |
76 | 76 | ||
77 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
78 | #if !_GL_CONFIG_H_INCLUDED | ||
79 | #error "Please include config.h first." | ||
80 | #endif | ||
81 | |||
77 | #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ | 82 | #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ |
78 | # include <unistd.h> | 83 | # include <unistd.h> |
79 | #endif | 84 | #endif |
diff --git a/gl/fd-hook.c b/gl/fd-hook.c index 36261150..75bbe49c 100644 --- a/gl/fd-hook.c +++ b/gl/fd-hook.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Hook for making file descriptor functions close(), ioctl() extensible. | 1 | /* Hook for making file descriptor functions close(), ioctl() extensible. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2009. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2009. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/fd-hook.h b/gl/fd-hook.h index 6bf3c24d..2150460b 100644 --- a/gl/fd-hook.h +++ b/gl/fd-hook.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Hook for making file descriptor functions close(), ioctl() extensible. | 1 | /* Hook for making file descriptor functions close(), ioctl() extensible. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/fflush.c b/gl/fflush.c index f3689b3e..36cc14d1 100644 --- a/gl/fflush.c +++ b/gl/fflush.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* fflush.c -- allow flushing input streams | 1 | /* fflush.c -- allow flushing input streams |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/filename.h b/gl/filename.h index a2400a9d..4f0f0fbc 100644 --- a/gl/filename.h +++ b/gl/filename.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Basic filename support macros. | 1 | /* Basic filename support macros. |
2 | Copyright (C) 2001-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2001-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/float+.h b/gl/float+.h index e7531e46..104f477f 100644 --- a/gl/float+.h +++ b/gl/float+.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Supplemental information about the floating-point formats. | 1 | /* Supplemental information about the floating-point formats. |
2 | Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2007. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2007. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -1,5 +1,5 @@ | |||
1 | /* Auxiliary definitions for <float.h>. | 1 | /* Auxiliary definitions for <float.h>. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2011. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/float.in.h b/gl/float.in.h index bf2c502c..73e8d406 100644 --- a/gl/float.in.h +++ b/gl/float.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A correct <float.h>. | 1 | /* A correct <float.h>. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* Round towards negative infinity. | 1 | /* Round towards negative infinity. |
2 | Copyright (C) 2007, 2010-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2010-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/floorf.c b/gl/floorf.c index e465c180..f9785d0c 100644 --- a/gl/floorf.c +++ b/gl/floorf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Round towards negative infinity. | 1 | /* Round towards negative infinity. |
2 | Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* Open a stream to a file. | 1 | /* Open a stream to a file. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -33,9 +33,13 @@ orig_fopen (const char *filename, const char *mode) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /* Specification. */ | 35 | /* Specification. */ |
36 | #ifdef __osf__ | ||
36 | /* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates | 37 | /* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates |
37 | this include because of the preliminary #include <stdio.h> above. */ | 38 | this include because of the preliminary #include <stdio.h> above. */ |
38 | #include "stdio.h" | 39 | # include "stdio.h" |
40 | #else | ||
41 | # include <stdio.h> | ||
42 | #endif | ||
39 | 43 | ||
40 | #include <errno.h> | 44 | #include <errno.h> |
41 | #include <fcntl.h> | 45 | #include <fcntl.h> |
@@ -225,5 +229,9 @@ rpl_fopen (const char *filename, const char *mode) | |||
225 | } | 229 | } |
226 | #endif | 230 | #endif |
227 | 231 | ||
232 | /* open_direction is sometimes used, sometimes unused. | ||
233 | Silence gcc's warning about this situation. */ | ||
234 | (void) open_direction; | ||
235 | |||
228 | return orig_fopen (filename, mode); | 236 | return orig_fopen (filename, mode); |
229 | } | 237 | } |
diff --git a/gl/fpurge.c b/gl/fpurge.c index 0dcb2b79..52a3dcef 100644 --- a/gl/fpurge.c +++ b/gl/fpurge.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Flushing buffers of a FILE stream. | 1 | /* Flushing buffers of a FILE stream. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/freading.c b/gl/freading.c index b9377cb0..c80d9aa8 100644 --- a/gl/freading.c +++ b/gl/freading.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Retrieve information about a FILE stream. | 1 | /* Retrieve information about a FILE stream. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/freading.h b/gl/freading.h index 27b3abbc..943354f5 100644 --- a/gl/freading.h +++ b/gl/freading.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Retrieve information about a FILE stream. | 1 | /* Retrieve information about a FILE stream. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -14,6 +14,11 @@ | |||
14 | You should have received a copy of the GNU Lesser General Public License | 14 | You should have received a copy of the GNU Lesser General Public License |
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | /* This file uses _GL_ATTRIBUTE_PURE, HAVE___FREADING, HAVE_STDIO_EXT_H. */ | ||
18 | #if !_GL_CONFIG_H_INCLUDED | ||
19 | #error "Please include config.h first." | ||
20 | #endif | ||
21 | |||
17 | #include <stdio.h> | 22 | #include <stdio.h> |
18 | 23 | ||
19 | /* Return true if the stream STREAM is opened read-only, or if the | 24 | /* Return true if the stream STREAM is opened read-only, or if the |
@@ -1,6 +1,6 @@ | |||
1 | /* Make free() preserve errno. | 1 | /* Make free() preserve errno. |
2 | 2 | ||
3 | Copyright (C) 2003, 2006, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2006, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* An fseek() function that, together with fflush(), is POSIX compliant. | 1 | /* An fseek() function that, together with fflush(), is POSIX compliant. |
2 | Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/fseeko.c b/gl/fseeko.c index 89a70874..2c3b053a 100644 --- a/gl/fseeko.c +++ b/gl/fseeko.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* An fseeko() function that, together with fflush(), is POSIX compliant. | 1 | /* An fseeko() function that, together with fflush(), is POSIX compliant. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* fstat() replacement. | 1 | /* fstat() replacement. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/fsusage.c b/gl/fsusage.c index f6f4b1c3..97d0eef7 100644 --- a/gl/fsusage.c +++ b/gl/fsusage.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* fsusage.c -- return space usage of mounted file systems | 1 | /* fsusage.c -- return space usage of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2023 Free Software | 3 | Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/fsusage.h b/gl/fsusage.h index 9630b04e..da878590 100644 --- a/gl/fsusage.h +++ b/gl/fsusage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* fsusage.h -- declarations for file system space usage info | 1 | /* fsusage.h -- declarations for file system space usage info |
2 | 2 | ||
3 | Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2023 Free Software | 3 | Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
@@ -19,9 +19,14 @@ | |||
19 | /* Space usage statistics for a file system. Blocks are 512-byte. */ | 19 | /* Space usage statistics for a file system. Blocks are 512-byte. */ |
20 | 20 | ||
21 | #if !defined FSUSAGE_H_ | 21 | #if !defined FSUSAGE_H_ |
22 | # define FSUSAGE_H_ | 22 | #define FSUSAGE_H_ |
23 | |||
24 | #include <stdint.h> | ||
25 | |||
26 | #ifdef __cplusplus | ||
27 | extern "C" { | ||
28 | #endif | ||
23 | 29 | ||
24 | # include <stdint.h> | ||
25 | 30 | ||
26 | struct fs_usage | 31 | struct fs_usage |
27 | { | 32 | { |
@@ -36,4 +41,9 @@ struct fs_usage | |||
36 | 41 | ||
37 | int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); | 42 | int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); |
38 | 43 | ||
44 | |||
45 | #ifdef __cplusplus | ||
46 | } | ||
47 | #endif | ||
48 | |||
39 | #endif | 49 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* An ftell() function that works around platform bugs. | 1 | /* An ftell() function that works around platform bugs. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/ftello.c b/gl/ftello.c index 14184e5e..64119aab 100644 --- a/gl/ftello.c +++ b/gl/ftello.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* An ftello() function that works around platform bugs. | 1 | /* An ftello() function that works around platform bugs. |
2 | Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c index 3436c07a..37092e29 100644 --- a/gl/gai_strerror.c +++ b/gl/gai_strerror.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2023 Free Software | 1 | /* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2024 Free Software |
2 | Foundation, Inc. | 2 | Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. | 4 | Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. |
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c index 6586ee58..bf5d61f3 100644 --- a/gl/getaddrinfo.c +++ b/gl/getaddrinfo.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Get address information (partial implementation). | 1 | /* Get address information (partial implementation). |
2 | Copyright (C) 1997, 2001-2002, 2004-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1997, 2001-2002, 2004-2024 Free Software Foundation, Inc. |
3 | Contributed by Simon Josefsson <simon@josefsson.org>. | 3 | Contributed by Simon Josefsson <simon@josefsson.org>. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/getdelim.c b/gl/getdelim.c index 79ec3dd1..58063b15 100644 --- a/gl/getdelim.c +++ b/gl/getdelim.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getdelim.c --- Implementation of replacement getdelim function. | 1 | /* getdelim.c --- Implementation of replacement getdelim function. |
2 | Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2023 Free Software | 2 | Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -30,10 +30,6 @@ | |||
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <errno.h> | 31 | #include <errno.h> |
32 | 32 | ||
33 | #ifndef SSIZE_MAX | ||
34 | # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) | ||
35 | #endif | ||
36 | |||
37 | #if USE_UNLOCKED_IO | 33 | #if USE_UNLOCKED_IO |
38 | # include "unlocked-io.h" | 34 | # include "unlocked-io.h" |
39 | # define getc_maybe_unlocked(fp) getc(fp) | 35 | # define getc_maybe_unlocked(fp) getc(fp) |
diff --git a/gl/getdtablesize.c b/gl/getdtablesize.c index ac2d1753..762c100b 100644 --- a/gl/getdtablesize.c +++ b/gl/getdtablesize.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getdtablesize() function: Return maximum possible file descriptor value + 1. | 1 | /* getdtablesize() function: Return maximum possible file descriptor value + 1. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/gethostname.c b/gl/gethostname.c index 0c616c34..c075b6df 100644 --- a/gl/gethostname.c +++ b/gl/gethostname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* gethostname emulation for SysV and POSIX.1. | 1 | /* gethostname emulation for SysV and POSIX.1. |
2 | 2 | ||
3 | Copyright (C) 1992, 2003, 2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1992, 2003, 2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/getline.c b/gl/getline.c index 85f16ab8..2d03b646 100644 --- a/gl/getline.c +++ b/gl/getline.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getline.c --- Implementation of replacement getline function. | 1 | /* getline.c --- Implementation of replacement getline function. |
2 | Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/getloadavg.c b/gl/getloadavg.c index 59b53e79..c940e4c7 100644 --- a/gl/getloadavg.c +++ b/gl/getloadavg.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Get the system load averages. | 1 | /* Get the system load averages. |
2 | 2 | ||
3 | Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2023 Free Software | 3 | Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | NOTE: The canonical source of this file is maintained with gnulib. | 6 | NOTE: The canonical source of this file is maintained with gnulib. |
diff --git a/gl/getopt-cdefs.in.h b/gl/getopt-cdefs.in.h index e76c78cb..a1d304d4 100644 --- a/gl/getopt-cdefs.in.h +++ b/gl/getopt-cdefs.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getopt-on-non-glibc compatibility macros. | 1 | /* getopt-on-non-glibc compatibility macros. |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | Unlike most of the getopt implementation, it is NOT shared | 4 | Unlike most of the getopt implementation, it is NOT shared |
5 | with the GNU C Library. | 5 | with the GNU C Library. |
@@ -57,7 +57,11 @@ | |||
57 | 57 | ||
58 | #ifndef __THROW | 58 | #ifndef __THROW |
59 | # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) | 59 | # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) |
60 | # define __THROW throw () | 60 | # if __cplusplus >= 201103L |
61 | # define __THROW noexcept (true) | ||
62 | # else | ||
63 | # define __THROW throw () | ||
64 | # endif | ||
61 | # else | 65 | # else |
62 | # define __THROW | 66 | # define __THROW |
63 | # endif | 67 | # endif |
diff --git a/gl/getopt-core.h b/gl/getopt-core.h index c5dd4936..12d09a25 100644 --- a/gl/getopt-core.h +++ b/gl/getopt-core.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Declarations for getopt (basic, portable features only). | 1 | /* Declarations for getopt (basic, portable features only). |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library and is also part of gnulib. | 3 | This file is part of the GNU C Library and is also part of gnulib. |
4 | Patches to this file should be submitted to both projects. | 4 | Patches to this file should be submitted to both projects. |
5 | 5 | ||
diff --git a/gl/getopt-ext.h b/gl/getopt-ext.h index d37c2932..e4b499d4 100644 --- a/gl/getopt-ext.h +++ b/gl/getopt-ext.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Declarations for getopt (GNU extensions). | 1 | /* Declarations for getopt (GNU extensions). |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library and is also part of gnulib. | 3 | This file is part of the GNU C Library and is also part of gnulib. |
4 | Patches to this file should be submitted to both projects. | 4 | Patches to this file should be submitted to both projects. |
5 | 5 | ||
diff --git a/gl/getopt-pfx-core.h b/gl/getopt-pfx-core.h index 3a2fde5a..78b7816a 100644 --- a/gl/getopt-pfx-core.h +++ b/gl/getopt-pfx-core.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getopt (basic, portable features) gnulib wrapper header. | 1 | /* getopt (basic, portable features) gnulib wrapper header. |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | Unlike most of the getopt implementation, it is NOT shared | 4 | Unlike most of the getopt implementation, it is NOT shared |
5 | with the GNU C Library. | 5 | with the GNU C Library. |
@@ -47,7 +47,7 @@ | |||
47 | # define optind __GETOPT_ID (optind) | 47 | # define optind __GETOPT_ID (optind) |
48 | # define optopt __GETOPT_ID (optopt) | 48 | # define optopt __GETOPT_ID (optopt) |
49 | 49 | ||
50 | /* Work around a a problem on macOS, which declares getopt with a | 50 | /* Work around a problem on macOS, which declares getopt with a |
51 | trailing __DARWIN_ALIAS(getopt) that would expand to something like | 51 | trailing __DARWIN_ALIAS(getopt) that would expand to something like |
52 | __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following | 52 | __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following |
53 | hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ | 53 | hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ |
diff --git a/gl/getopt-pfx-ext.h b/gl/getopt-pfx-ext.h index 8578d725..f001c11e 100644 --- a/gl/getopt-pfx-ext.h +++ b/gl/getopt-pfx-ext.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getopt (GNU extensions) gnulib wrapper header. | 1 | /* getopt (GNU extensions) gnulib wrapper header. |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | Unlike most of the getopt implementation, it is NOT shared | 4 | Unlike most of the getopt implementation, it is NOT shared |
5 | with the GNU C Library. | 5 | with the GNU C Library. |
diff --git a/gl/getopt.c b/gl/getopt.c index 1e2441c4..f66f119e 100644 --- a/gl/getopt.c +++ b/gl/getopt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Getopt for GNU. | 1 | /* Getopt for GNU. |
2 | Copyright (C) 1987-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1987-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library and is also part of gnulib. | 3 | This file is part of the GNU C Library and is also part of gnulib. |
4 | Patches to this file should be submitted to both projects. | 4 | Patches to this file should be submitted to both projects. |
5 | 5 | ||
@@ -21,7 +21,7 @@ | |||
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #include "getopt.h" | 24 | #include <getopt.h> |
25 | 25 | ||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
@@ -223,8 +223,9 @@ process_long_option (int argc, char **argv, const char *optstring, | |||
223 | { | 223 | { |
224 | /* Didn't find an exact match, so look for abbreviations. */ | 224 | /* Didn't find an exact match, so look for abbreviations. */ |
225 | unsigned char *ambig_set = NULL; | 225 | unsigned char *ambig_set = NULL; |
226 | int ambig_malloced = 0; | 226 | /* Use simpler fallback diagnostic if ambig_set == &ambig_fallback. */ |
227 | int ambig_fallback = 0; | 227 | unsigned char ambig_fallback; |
228 | void *ambig_malloced = NULL; | ||
228 | int indfound = -1; | 229 | int indfound = -1; |
229 | 230 | ||
230 | for (p = longopts, option_index = 0; p->name; p++, option_index++) | 231 | for (p = longopts, option_index = 0; p->name; p++, option_index++) |
@@ -242,39 +243,42 @@ process_long_option (int argc, char **argv, const char *optstring, | |||
242 | || pfound->val != p->val) | 243 | || pfound->val != p->val) |
243 | { | 244 | { |
244 | /* Second or later nonexact match found. */ | 245 | /* Second or later nonexact match found. */ |
245 | if (!ambig_fallback) | 246 | if (ambig_set != &ambig_fallback) |
246 | { | 247 | { |
247 | if (!print_errors) | 248 | if (!print_errors) |
248 | /* Don't waste effort tracking the ambig set if | 249 | /* Don't waste effort tracking the ambig set if |
249 | we're not going to print it anyway. */ | 250 | we're not going to print it anyway. */ |
250 | ambig_fallback = 1; | 251 | ambig_set = &ambig_fallback; |
251 | else if (!ambig_set) | 252 | else if (!ambig_set) |
252 | { | 253 | { |
253 | if (__libc_use_alloca (n_options)) | 254 | if (__libc_use_alloca (n_options)) |
254 | ambig_set = alloca (n_options); | 255 | ambig_set = alloca (n_options); |
255 | else if ((ambig_set = malloc (n_options)) == NULL) | ||
256 | /* Fall back to simpler error message. */ | ||
257 | ambig_fallback = 1; | ||
258 | else | 256 | else |
259 | ambig_malloced = 1; | 257 | { |
258 | ambig_malloced = malloc (n_options); | ||
259 | /* Fall back to simpler diagnostic if | ||
260 | memory allocation fails. */ | ||
261 | ambig_set = (ambig_malloced ? ambig_malloced | ||
262 | : &ambig_fallback); | ||
263 | } | ||
260 | 264 | ||
261 | if (ambig_set) | 265 | if (ambig_set != &ambig_fallback) |
262 | { | 266 | { |
263 | memset (ambig_set, 0, n_options); | 267 | memset (ambig_set, 0, n_options); |
264 | ambig_set[indfound] = 1; | 268 | ambig_set[indfound] = 1; |
265 | } | 269 | } |
266 | } | 270 | } |
267 | if (ambig_set) | 271 | if (ambig_set && ambig_set != &ambig_fallback) |
268 | ambig_set[option_index] = 1; | 272 | ambig_set[option_index] = 1; |
269 | } | 273 | } |
270 | } | 274 | } |
271 | } | 275 | } |
272 | 276 | ||
273 | if (ambig_set || ambig_fallback) | 277 | if (ambig_set) |
274 | { | 278 | { |
275 | if (print_errors) | 279 | if (print_errors) |
276 | { | 280 | { |
277 | if (ambig_fallback) | 281 | if (ambig_set == &ambig_fallback) |
278 | fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"), | 282 | fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"), |
279 | argv[0], prefix, d->__nextchar); | 283 | argv[0], prefix, d->__nextchar); |
280 | else | 284 | else |
@@ -296,8 +300,7 @@ process_long_option (int argc, char **argv, const char *optstring, | |||
296 | funlockfile (stderr); | 300 | funlockfile (stderr); |
297 | } | 301 | } |
298 | } | 302 | } |
299 | if (ambig_malloced) | 303 | free (ambig_malloced); |
300 | free (ambig_set); | ||
301 | d->__nextchar += strlen (d->__nextchar); | 304 | d->__nextchar += strlen (d->__nextchar); |
302 | d->optind++; | 305 | d->optind++; |
303 | d->optopt = 0; | 306 | d->optopt = 0; |
diff --git a/gl/getopt.in.h b/gl/getopt.in.h index 0867d365..c2411a75 100644 --- a/gl/getopt.in.h +++ b/gl/getopt.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | Unlike most of the getopt implementation, it is NOT shared | 4 | Unlike most of the getopt implementation, it is NOT shared |
5 | with the GNU C Library, which supplies a different version of | 5 | with the GNU C Library, which supplies a different version of |
diff --git a/gl/getopt1.c b/gl/getopt1.c index 49323aa8..c42d29f8 100644 --- a/gl/getopt1.c +++ b/gl/getopt1.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
2 | Copyright (C) 1987-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1987-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library and is also part of gnulib. | 3 | This file is part of the GNU C Library and is also part of gnulib. |
4 | Patches to this file should be submitted to both projects. | 4 | Patches to this file should be submitted to both projects. |
5 | 5 | ||
@@ -21,7 +21,7 @@ | |||
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #include "getopt.h" | 24 | #include <getopt.h> |
25 | #include "getopt_int.h" | 25 | #include "getopt_int.h" |
26 | 26 | ||
27 | int | 27 | int |
diff --git a/gl/getopt_int.h b/gl/getopt_int.h index 4d9e24be..c00c0b69 100644 --- a/gl/getopt_int.h +++ b/gl/getopt_int.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Internal declarations for getopt. | 1 | /* Internal declarations for getopt. |
2 | Copyright (C) 1989-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1989-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library and is also part of gnulib. | 3 | This file is part of the GNU C Library and is also part of gnulib. |
4 | Patches to this file should be submitted to both projects. | 4 | Patches to this file should be submitted to both projects. |
5 | 5 | ||
diff --git a/gl/getprogname.c b/gl/getprogname.c index 32c96043..392a9a2f 100644 --- a/gl/getprogname.c +++ b/gl/getprogname.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Program name management. | 1 | /* Program name management. |
2 | Copyright (C) 2016-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2016-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as published by | 5 | it under the terms of the GNU Lesser General Public License as published by |
@@ -16,11 +16,10 @@ | |||
16 | 16 | ||
17 | #include <config.h> | 17 | #include <config.h> |
18 | 18 | ||
19 | /* Specification. */ | 19 | /* Specification. Also get __argv declaration. */ |
20 | #include "getprogname.h" | 20 | #include <stdlib.h> |
21 | 21 | ||
22 | #include <errno.h> /* get program_invocation_name declaration */ | 22 | #include <errno.h> /* get program_invocation_name declaration */ |
23 | #include <stdlib.h> /* get __argv declaration */ | ||
24 | 23 | ||
25 | #ifdef _AIX | 24 | #ifdef _AIX |
26 | # include <unistd.h> | 25 | # include <unistd.h> |
@@ -53,13 +52,12 @@ | |||
53 | 52 | ||
54 | #if defined __SCO_VERSION__ || defined __sysv5__ | 53 | #if defined __SCO_VERSION__ || defined __sysv5__ |
55 | # include <fcntl.h> | 54 | # include <fcntl.h> |
56 | # include <stdlib.h> | ||
57 | # include <string.h> | 55 | # include <string.h> |
58 | #endif | 56 | #endif |
59 | 57 | ||
60 | #include "basename-lgpl.h" | 58 | #include "basename-lgpl.h" |
61 | 59 | ||
62 | #ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ | 60 | #ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Solaris >= 11, Cygwin, Android API level >= 21 */ |
63 | char const * | 61 | char const * |
64 | getprogname (void) | 62 | getprogname (void) |
65 | { | 63 | { |
@@ -214,7 +212,19 @@ getprogname (void) | |||
214 | { | 212 | { |
215 | char *s = strdup (last_component (buf.ps_pathptr)); | 213 | char *s = strdup (last_component (buf.ps_pathptr)); |
216 | if (s) | 214 | if (s) |
217 | p = s; | 215 | { |
216 | # if defined __XPLINK__ && __CHARSET_LIB == 1 | ||
217 | /* The compiler option -qascii is in use. | ||
218 | https://makingdeveloperslivesbetter.wordpress.com/2022/01/07/is-z-os-ascii-or-ebcdic-yes/ | ||
219 | https://www.ibm.com/docs/en/zos/2.5.0?topic=features-macros-related-compiler-option-settings | ||
220 | So, convert the result from EBCDIC to ASCII. | ||
221 | https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-e2a-s-convert-string-from-ebcdic-ascii */ | ||
222 | if (__e2a_s (s) == (size_t)-1) | ||
223 | free (s); | ||
224 | else | ||
225 | # endif | ||
226 | p = s; | ||
227 | } | ||
218 | break; | 228 | break; |
219 | } | 229 | } |
220 | } | 230 | } |
diff --git a/gl/getprogname.h b/gl/getprogname.h index 4b9126f9..bee1c1a2 100644 --- a/gl/getprogname.h +++ b/gl/getprogname.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Program name management. | 1 | /* Program name management. |
2 | Copyright (C) 2016-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2016-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as published by | 5 | it under the terms of the GNU Lesser General Public License as published by |
@@ -19,22 +19,8 @@ | |||
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | 21 | ||
22 | #ifdef __cplusplus | 22 | #if __GNUC__ || (__clang_major__ >= 4) |
23 | extern "C" { | 23 | # warning "The include file getprogname.h is deprecated. Use <stdlib.h> instead." |
24 | #endif | ||
25 | |||
26 | /* Return the base name of the executing program. | ||
27 | On native Windows this will usually end in ".exe" or ".EXE". */ | ||
28 | #ifndef HAVE_GETPROGNAME | ||
29 | extern char const *getprogname (void) | ||
30 | # ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME | ||
31 | _GL_ATTRIBUTE_PURE | ||
32 | # endif | ||
33 | ; | ||
34 | #endif | ||
35 | |||
36 | #ifdef __cplusplus | ||
37 | } | ||
38 | #endif | 24 | #endif |
39 | 25 | ||
40 | #endif | 26 | #endif |
diff --git a/gl/gettext.h b/gl/gettext.h index d0462c47..39d5ae4d 100644 --- a/gl/gettext.h +++ b/gl/gettext.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convenience header for conditional use of GNU <libintl.h>. | 1 | /* Convenience header for conditional use of GNU <libintl.h>. |
2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2023 Free Software | 2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/gl_openssl.h b/gl/gl_openssl.h index f63c386e..06864732 100644 --- a/gl/gl_openssl.h +++ b/gl/gl_openssl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*- | 1 | /* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*- |
2 | 2 | ||
3 | Copyright (C) 2013-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2013-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -17,13 +17,15 @@ | |||
17 | 17 | ||
18 | /* Written by Pádraig Brady */ | 18 | /* Written by Pádraig Brady */ |
19 | 19 | ||
20 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ | ||
21 | #if !_GL_CONFIG_H_INCLUDED | ||
22 | #error "Please include config.h first." | ||
23 | #endif | ||
24 | |||
20 | #ifndef GL_OPENSSL_NAME | 25 | #ifndef GL_OPENSSL_NAME |
21 | # error "Please define GL_OPENSSL_NAME to 1,5,256 etc." | 26 | # error "Please define GL_OPENSSL_NAME to 1,5,256 etc." |
22 | #endif | 27 | #endif |
23 | 28 | ||
24 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
25 | # error "Please include config.h first." | ||
26 | #endif | ||
27 | _GL_INLINE_HEADER_BEGIN | 29 | _GL_INLINE_HEADER_BEGIN |
28 | #ifndef GL_OPENSSL_INLINE | 30 | #ifndef GL_OPENSSL_INLINE |
29 | # define GL_OPENSSL_INLINE _GL_INLINE | 31 | # define GL_OPENSSL_INLINE _GL_INLINE |
diff --git a/gl/glthread/lock.c b/gl/glthread/lock.c index 82fb7553..6661ad6a 100644 --- a/gl/glthread/lock.c +++ b/gl/glthread/lock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Locking in multithreaded situations. | 1 | /* Locking in multithreaded situations. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/glthread/lock.h b/gl/glthread/lock.h index ae3ee2d6..2d5cb320 100644 --- a/gl/glthread/lock.h +++ b/gl/glthread/lock.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Locking in multithreaded situations. | 1 | /* Locking in multithreaded situations. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -77,6 +77,14 @@ | |||
77 | #ifndef _LOCK_H | 77 | #ifndef _LOCK_H |
78 | #define _LOCK_H | 78 | #define _LOCK_H |
79 | 79 | ||
80 | /* This file uses HAVE_THREADS_H, HAVE_PTHREAD_RWLOCK, | ||
81 | HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER, | ||
82 | PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, | ||
83 | HAVE_PTHREAD_MUTEX_RECURSIVE. */ | ||
84 | #if !_GL_CONFIG_H_INCLUDED | ||
85 | #error "Please include config.h first." | ||
86 | #endif | ||
87 | |||
80 | #include <errno.h> | 88 | #include <errno.h> |
81 | #include <stdlib.h> | 89 | #include <stdlib.h> |
82 | 90 | ||
diff --git a/gl/glthread/threadlib.c b/gl/glthread/threadlib.c index 5ecf827f..7a776768 100644 --- a/gl/glthread/threadlib.c +++ b/gl/glthread/threadlib.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Multithreading primitives. | 1 | /* Multithreading primitives. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/hard-locale.c b/gl/hard-locale.c index 0a28552e..653c5809 100644 --- a/gl/hard-locale.c +++ b/gl/hard-locale.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* hard-locale.c -- Determine whether a locale is hard. | 1 | /* hard-locale.c -- Determine whether a locale is hard. |
2 | 2 | ||
3 | Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2023 Free Software | 3 | Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
@@ -21,6 +21,7 @@ | |||
21 | #include "hard-locale.h" | 21 | #include "hard-locale.h" |
22 | 22 | ||
23 | #include <locale.h> | 23 | #include <locale.h> |
24 | #include <stdlib.h> | ||
24 | #include <string.h> | 25 | #include <string.h> |
25 | 26 | ||
26 | bool | 27 | bool |
@@ -31,5 +32,16 @@ hard_locale (int category) | |||
31 | if (setlocale_null_r (category, locale, sizeof (locale))) | 32 | if (setlocale_null_r (category, locale, sizeof (locale))) |
32 | return false; | 33 | return false; |
33 | 34 | ||
34 | return !(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0); | 35 | if (!(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)) |
36 | return true; | ||
37 | |||
38 | #if defined __ANDROID__ | ||
39 | /* On Android 5.0 or newer, it is possible to set a locale that has the same | ||
40 | name as the "C" locale but in fact uses UTF-8 encoding. Cf. test case 2 in | ||
41 | <https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00141.html>. */ | ||
42 | if (MB_CUR_MAX > 1) | ||
43 | return true; | ||
44 | #endif | ||
45 | |||
46 | return false; | ||
35 | } | 47 | } |
diff --git a/gl/hard-locale.h b/gl/hard-locale.h index 880c9e85..5d40e522 100644 --- a/gl/hard-locale.h +++ b/gl/hard-locale.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Determine whether a locale is hard. | 1 | /* Determine whether a locale is hard. |
2 | 2 | ||
3 | Copyright (C) 1999, 2003-2004, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1999, 2003-2004, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -16,11 +16,23 @@ | |||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #ifndef HARD_LOCALE_H_ | 18 | #ifndef HARD_LOCALE_H_ |
19 | # define HARD_LOCALE_H_ 1 | 19 | #define HARD_LOCALE_H_ 1 |
20 | |||
21 | #ifdef __cplusplus | ||
22 | extern "C" { | ||
23 | #endif | ||
24 | |||
20 | 25 | ||
21 | /* Return true if the specified CATEGORY of the current locale is hard, i.e. | 26 | /* Return true if the specified CATEGORY of the current locale is hard, i.e. |
22 | different from the C or POSIX locale that has a fixed behavior. | 27 | different from the C or POSIX locale that has a fixed behavior. |
23 | CATEGORY must be one of the LC_* values, but not LC_ALL. */ | 28 | CATEGORY must be one of the LC_* values, but not LC_ALL. |
29 | Note: This function uses the current global locale; it ignores the | ||
30 | per-thread locale. */ | ||
24 | extern bool hard_locale (int category); | 31 | extern bool hard_locale (int category); |
25 | 32 | ||
33 | |||
34 | #ifdef __cplusplus | ||
35 | } | ||
36 | #endif | ||
37 | |||
26 | #endif /* HARD_LOCALE_H_ */ | 38 | #endif /* HARD_LOCALE_H_ */ |
diff --git a/gl/ialloc.c b/gl/ialloc.c index cd44d8ca..8564a15b 100644 --- a/gl/ialloc.c +++ b/gl/ialloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* malloc with idx_t rather than size_t | 1 | /* malloc with idx_t rather than size_t |
2 | 2 | ||
3 | Copyright 2021-2023 Free Software Foundation, Inc. | 3 | Copyright 2021-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/ialloc.h b/gl/ialloc.h index 1d43faf3..2aa94ae7 100644 --- a/gl/ialloc.h +++ b/gl/ialloc.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ialloc.h -- malloc with idx_t rather than size_t | 1 | /* ialloc.h -- malloc with idx_t rather than size_t |
2 | 2 | ||
3 | Copyright 2021-2023 Free Software Foundation, Inc. | 3 | Copyright 2021-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,15 +18,21 @@ | |||
18 | #ifndef IALLOC_H_ | 18 | #ifndef IALLOC_H_ |
19 | #define IALLOC_H_ | 19 | #define IALLOC_H_ |
20 | 20 | ||
21 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_COLD, | ||
22 | _GL_ATTRIBUTE_MALLOC. */ | ||
23 | #if !_GL_CONFIG_H_INCLUDED | ||
24 | #error "Please include config.h first." | ||
25 | #endif | ||
26 | |||
21 | #include "idx.h" | 27 | #include "idx.h" |
22 | 28 | ||
23 | #include <errno.h> | 29 | #include <errno.h> |
24 | #include <stdint.h> | 30 | #include <stdint.h> |
25 | #include <stdlib.h> | 31 | #include <stdlib.h> |
26 | 32 | #if defined __CHERI_PURE_CAPABILITY__ | |
27 | #ifndef _GL_INLINE_HEADER_BEGIN | 33 | # include <cheri.h> |
28 | #error "Please include config.h first." | ||
29 | #endif | 34 | #endif |
35 | |||
30 | _GL_INLINE_HEADER_BEGIN | 36 | _GL_INLINE_HEADER_BEGIN |
31 | #ifndef IALLOC_INLINE | 37 | #ifndef IALLOC_INLINE |
32 | # define IALLOC_INLINE _GL_INLINE | 38 | # define IALLOC_INLINE _GL_INLINE |
@@ -43,6 +49,9 @@ _gl_alloc_nomem (void) | |||
43 | return NULL; | 49 | return NULL; |
44 | } | 50 | } |
45 | 51 | ||
52 | /* imalloc (size) is like malloc (size). | ||
53 | It returns a non-NULL pointer to size bytes of memory. | ||
54 | Upon failure, it returns NULL with errno set. */ | ||
46 | IALLOC_INLINE | 55 | IALLOC_INLINE |
47 | _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ | 56 | _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ |
48 | void * | 57 | void * |
@@ -51,16 +60,32 @@ imalloc (idx_t s) | |||
51 | return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); | 60 | return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); |
52 | } | 61 | } |
53 | 62 | ||
63 | /* irealloc (ptr, size) is like realloc (ptr, size). | ||
64 | It returns a non-NULL pointer to size bytes of memory. | ||
65 | Upon failure, it returns NULL with errno set. */ | ||
54 | IALLOC_INLINE | 66 | IALLOC_INLINE |
55 | /*_GL_ATTRIBUTE_DEALLOC_FREE*/ | 67 | /*_GL_ATTRIBUTE_DEALLOC_FREE*/ |
56 | void * | 68 | void * |
57 | irealloc (void *p, idx_t s) | 69 | irealloc (void *p, idx_t s) |
58 | { | 70 | { |
59 | /* Work around GNU realloc glitch by treating a zero size as if it | 71 | if (s <= SIZE_MAX) |
60 | were 1, so that returning NULL is equivalent to failing. */ | 72 | { |
61 | return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem (); | 73 | /* Work around GNU realloc glitch by treating a zero size as if it |
74 | were 1, so that returning NULL is equivalent to failing. */ | ||
75 | p = realloc (p, s | !s); | ||
76 | #if defined __CHERI_PURE_CAPABILITY__ | ||
77 | if (p != NULL) | ||
78 | p = cheri_bounds_set (p, s); | ||
79 | #endif | ||
80 | return p; | ||
81 | } | ||
82 | else | ||
83 | return _gl_alloc_nomem (); | ||
62 | } | 84 | } |
63 | 85 | ||
86 | /* icalloc (num, size) is like calloc (num, size). | ||
87 | It returns a non-NULL pointer to num * size bytes of memory. | ||
88 | Upon failure, it returns NULL with errno set. */ | ||
64 | IALLOC_INLINE | 89 | IALLOC_INLINE |
65 | _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ | 90 | _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ |
66 | void * | 91 | void * |
@@ -81,20 +106,35 @@ icalloc (idx_t n, idx_t s) | |||
81 | return calloc (n, s); | 106 | return calloc (n, s); |
82 | } | 107 | } |
83 | 108 | ||
109 | /* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size). | ||
110 | It returns a non-NULL pointer to num * size bytes of memory. | ||
111 | Upon failure, it returns NULL with errno set. */ | ||
84 | IALLOC_INLINE void * | 112 | IALLOC_INLINE void * |
85 | ireallocarray (void *p, idx_t n, idx_t s) | 113 | ireallocarray (void *p, idx_t n, idx_t s) |
86 | { | 114 | { |
87 | /* Work around GNU reallocarray glitch by treating a zero size as if | 115 | if (n <= SIZE_MAX && s <= SIZE_MAX) |
88 | it were 1, so that returning NULL is equivalent to failing. */ | 116 | { |
89 | if (n == 0 || s == 0) | 117 | /* Work around GNU reallocarray glitch by treating a zero size as if |
90 | n = s = 1; | 118 | it were 1, so that returning NULL is equivalent to failing. */ |
91 | return (n <= SIZE_MAX && s <= SIZE_MAX | 119 | size_t nx = n; |
92 | ? reallocarray (p, n, s) | 120 | size_t sx = s; |
93 | : _gl_alloc_nomem ()); | 121 | if (n == 0 || s == 0) |
122 | nx = sx = 1; | ||
123 | p = reallocarray (p, nx, sx); | ||
124 | #if defined __CHERI_PURE_CAPABILITY__ | ||
125 | if (p != NULL && (n == 0 || s == 0)) | ||
126 | p = cheri_bounds_set (p, 0); | ||
127 | #endif | ||
128 | return p; | ||
129 | } | ||
130 | else | ||
131 | return _gl_alloc_nomem (); | ||
94 | } | 132 | } |
95 | 133 | ||
96 | #ifdef __cplusplus | 134 | #ifdef __cplusplus |
97 | } | 135 | } |
98 | #endif | 136 | #endif |
99 | 137 | ||
138 | _GL_INLINE_HEADER_END | ||
139 | |||
100 | #endif | 140 | #endif |
diff --git a/gl/idpriv-droptemp.c b/gl/idpriv-droptemp.c index 2a85431a..eb882dea 100644 --- a/gl/idpriv-droptemp.c +++ b/gl/idpriv-droptemp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Dropping uid/gid privileges of the current process temporarily. | 1 | /* Dropping uid/gid privileges of the current process temporarily. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
diff --git a/gl/idpriv.h b/gl/idpriv.h index 99f87c08..a3ae5926 100644 --- a/gl/idpriv.h +++ b/gl/idpriv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Dropping uid/gid privileges of the current process. | 1 | /* Dropping uid/gid privileges of the current process. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -1,5 +1,5 @@ | |||
1 | /* A type for indices and sizes. | 1 | /* A type for indices and sizes. |
2 | Copyright (C) 2020-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2020-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
@@ -111,6 +111,11 @@ | |||
111 | help producing good code and good warnings. The type 'idx_t' could | 111 | help producing good code and good warnings. The type 'idx_t' could |
112 | then be typedef'ed to a range type that is signed after promotion. */ | 112 | then be typedef'ed to a range type that is signed after promotion. */ |
113 | 113 | ||
114 | #ifdef __cplusplus | ||
115 | extern "C" { | ||
116 | #endif | ||
117 | |||
118 | |||
114 | /* In the future, idx_t could be typedef'ed to a signed range type. | 119 | /* In the future, idx_t could be typedef'ed to a signed range type. |
115 | The clang "extended integer types", supported in Clang 11 or newer | 120 | The clang "extended integer types", supported in Clang 11 or newer |
116 | <https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>, | 121 | <https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>, |
@@ -131,4 +136,9 @@ typedef ptrdiff_t idx_t; | |||
131 | Perhaps there should be another macro IDX_VALUE_BITS that does not | 136 | Perhaps there should be another macro IDX_VALUE_BITS that does not |
132 | count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ | 137 | count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ |
133 | 138 | ||
139 | |||
140 | #ifdef __cplusplus | ||
141 | } | ||
142 | #endif | ||
143 | |||
134 | #endif /* _IDX_H */ | 144 | #endif /* _IDX_H */ |
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c index 9e2d412e..0a4ba20e 100644 --- a/gl/inet_ntop.c +++ b/gl/inet_ntop.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form | 1 | /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form |
2 | 2 | ||
3 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/intprops-internal.h b/gl/intprops-internal.h index 0467a9ca..b5ba8d7c 100644 --- a/gl/intprops-internal.h +++ b/gl/intprops-internal.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* intprops-internal.h -- properties of integer types not visible to users | 1 | /* intprops-internal.h -- properties of integer types not visible to users |
2 | 2 | ||
3 | Copyright (C) 2001-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2001-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify it | 5 | This program is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Lesser General Public License as published | 6 | under the terms of the GNU Lesser General Public License as published |
@@ -20,6 +20,11 @@ | |||
20 | 20 | ||
21 | #include <limits.h> | 21 | #include <limits.h> |
22 | 22 | ||
23 | /* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ | ||
24 | #if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) | ||
25 | # pragma GCC diagnostic ignored "-Wtype-limits" | ||
26 | #endif | ||
27 | |||
23 | /* Return a value with the common real type of E and V and the value of V. | 28 | /* Return a value with the common real type of E and V and the value of V. |
24 | Do not evaluate E. */ | 29 | Do not evaluate E. */ |
25 | #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) | 30 | #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) |
@@ -164,7 +169,9 @@ | |||
164 | /* Work around GCC bug 91450. */ | 169 | /* Work around GCC bug 91450. */ |
165 | # define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ | 170 | # define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ |
166 | ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \ | 171 | ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \ |
167 | && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ | 172 | && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, \ |
173 | (__typeof__ (*(r))) 0, \ | ||
174 | (__typeof__ (*(r))) -1)) \ | ||
168 | ? ((void) __builtin_mul_overflow (a, b, r), 1) \ | 175 | ? ((void) __builtin_mul_overflow (a, b, r), 1) \ |
169 | : __builtin_mul_overflow (a, b, r)) | 176 | : __builtin_mul_overflow (a, b, r)) |
170 | # endif | 177 | # endif |
diff --git a/gl/intprops.h b/gl/intprops.h index 44b5e60f..43734f34 100644 --- a/gl/intprops.h +++ b/gl/intprops.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* intprops.h -- properties of integer types | 1 | /* intprops.h -- properties of integer types |
2 | 2 | ||
3 | Copyright (C) 2001-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2001-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify it | 5 | This program is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Lesser General Public License as published | 6 | under the terms of the GNU Lesser General Public License as published |
diff --git a/gl/inttypes.in.h b/gl/inttypes.in.h index 50a2bbfc..b9ab8a4b 100644 --- a/gl/inttypes.in.h +++ b/gl/inttypes.in.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2006-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2006-2024 Free Software Foundation, Inc. |
2 | Written by Paul Eggert, Bruno Haible, Derek Price. | 2 | Written by Paul Eggert, Bruno Haible, Derek Price. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | 4 | ||
@@ -46,6 +46,11 @@ | |||
46 | #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H | 46 | #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H |
47 | #define INTTYPES_H | 47 | #define INTTYPES_H |
48 | 48 | ||
49 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
50 | #if !_GL_CONFIG_H_INCLUDED | ||
51 | #error "Please include config.h first." | ||
52 | #endif | ||
53 | |||
49 | /* Include <stdint.h> or the gnulib replacement. | 54 | /* Include <stdint.h> or the gnulib replacement. |
50 | But avoid namespace pollution on glibc systems. */ | 55 | But avoid namespace pollution on glibc systems. */ |
51 | #ifndef __GLIBC__ | 56 | #ifndef __GLIBC__ |
@@ -903,8 +908,21 @@ extern "C" { | |||
903 | #endif | 908 | #endif |
904 | 909 | ||
905 | #if @GNULIB_IMAXABS@ | 910 | #if @GNULIB_IMAXABS@ |
906 | # if !@HAVE_DECL_IMAXABS@ | 911 | # if @REPLACE_IMAXABS@ |
907 | extern intmax_t imaxabs (intmax_t); | 912 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
913 | # undef imaxabs | ||
914 | # define imaxabs rpl_imaxabs | ||
915 | # endif | ||
916 | _GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x)); | ||
917 | _GL_CXXALIAS_RPL (imaxabs, intmax_t, (intmax_t x)); | ||
918 | # else | ||
919 | # if !@HAVE_DECL_IMAXABS@ | ||
920 | _GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x)); | ||
921 | # endif | ||
922 | _GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x)); | ||
923 | # endif | ||
924 | # if __GLIBC__ >= 2 | ||
925 | _GL_CXXALIASWARN (imaxabs); | ||
908 | # endif | 926 | # endif |
909 | #elif defined GNULIB_POSIXCHECK | 927 | #elif defined GNULIB_POSIXCHECK |
910 | # undef imaxabs | 928 | # undef imaxabs |
@@ -921,8 +939,21 @@ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; | |||
921 | # define GNULIB_defined_imaxdiv_t 1 | 939 | # define GNULIB_defined_imaxdiv_t 1 |
922 | # endif | 940 | # endif |
923 | # endif | 941 | # endif |
924 | # if !@HAVE_DECL_IMAXDIV@ | 942 | # if @REPLACE_IMAXDIV@ |
925 | extern imaxdiv_t imaxdiv (intmax_t, intmax_t); | 943 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
944 | # undef imaxdiv | ||
945 | # define imaxdiv rpl_imaxdiv | ||
946 | # endif | ||
947 | _GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); | ||
948 | _GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); | ||
949 | # else | ||
950 | # if !@HAVE_DECL_IMAXDIV@ | ||
951 | _GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); | ||
952 | # endif | ||
953 | _GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); | ||
954 | # endif | ||
955 | # if __GLIBC__ >= 2 | ||
956 | _GL_CXXALIASWARN (imaxdiv); | ||
926 | # endif | 957 | # endif |
927 | #elif defined GNULIB_POSIXCHECK | 958 | #elif defined GNULIB_POSIXCHECK |
928 | # undef imaxdiv | 959 | # undef imaxdiv |
diff --git a/gl/iswblank.c b/gl/iswblank.c new file mode 100644 index 00000000..f699850a --- /dev/null +++ b/gl/iswblank.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* Test wide character for being blank. | ||
2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include <wctype.h> | ||
21 | |||
22 | int | ||
23 | iswblank (wint_t wc) | ||
24 | { | ||
25 | return wc == ' ' || wc == '\t'; | ||
26 | } | ||
diff --git a/gl/iswctype-impl.h b/gl/iswctype-impl.h new file mode 100644 index 00000000..999f220c --- /dev/null +++ b/gl/iswctype-impl.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* Test whether a wide character has a given property. | ||
2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | int | ||
19 | iswctype (wint_t wc, wctype_t desc) | ||
20 | { | ||
21 | return ((int (*) (wint_t)) desc) (wc); | ||
22 | } | ||
diff --git a/gl/iswctype.c b/gl/iswctype.c new file mode 100644 index 00000000..f4e6f015 --- /dev/null +++ b/gl/iswctype.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* Test whether a wide character has a given property. | ||
2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #include <config.h> | ||
19 | |||
20 | /* Specification. */ | ||
21 | #include <wctype.h> | ||
22 | |||
23 | #if GNULIB_defined_wint_t && !GNULIB_defined_wctype_t | ||
24 | |||
25 | int | ||
26 | iswctype (wint_t wc, wctype_t desc) | ||
27 | # undef iswctype | ||
28 | { | ||
29 | return ((wchar_t) wc == wc ? iswctype ((wchar_t) wc, desc) : 0); | ||
30 | } | ||
31 | |||
32 | #else | ||
33 | |||
34 | # include "iswctype-impl.h" | ||
35 | |||
36 | #endif | ||
diff --git a/gl/iswdigit.c b/gl/iswdigit.c new file mode 100644 index 00000000..57363ab8 --- /dev/null +++ b/gl/iswdigit.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* Test wide character for being a digit. | ||
2 | Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include <wctype.h> | ||
21 | |||
22 | int | ||
23 | iswdigit (wint_t wc) | ||
24 | { | ||
25 | return wc >= '0' && wc <= '9'; | ||
26 | } | ||
diff --git a/gl/iswpunct.c b/gl/iswpunct.c new file mode 100644 index 00000000..c7cb28b5 --- /dev/null +++ b/gl/iswpunct.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* Test wide character for being a punctuation or symbol character. | ||
2 | Copyright (C) 2023-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include <wctype.h> | ||
21 | |||
22 | #include <ctype.h> | ||
23 | |||
24 | int | ||
25 | iswpunct (wint_t wc) | ||
26 | #undef iswpunct | ||
27 | { | ||
28 | #if defined __ANDROID__ | ||
29 | if ((unsigned int) wc < 128) | ||
30 | return ispunct ((unsigned int) wc); | ||
31 | #endif | ||
32 | return iswpunct (wc); | ||
33 | } | ||
diff --git a/gl/iswxdigit.c b/gl/iswxdigit.c new file mode 100644 index 00000000..d32e3b0f --- /dev/null +++ b/gl/iswxdigit.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* Test wide character for being a hexadecimal digit. | ||
2 | Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include <wctype.h> | ||
21 | |||
22 | int | ||
23 | iswxdigit (wint_t wc) | ||
24 | { | ||
25 | return ((wc >= '0' && wc <= '9') | ||
26 | #if 'A' == 0x41 && 'a' == 0x61 | ||
27 | /* Optimization, assuming ASCII */ | ||
28 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F') | ||
29 | #else | ||
30 | || (wc >= 'A' && wc <= 'F') || (wc >= 'a' && wc <= 'f') | ||
31 | #endif | ||
32 | ); | ||
33 | } | ||
@@ -1,5 +1,5 @@ | |||
1 | /* Replacement for 'int' to 'long double' conversion routine. | 1 | /* Replacement for 'int' to 'long double' conversion routine. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2011. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/langinfo.in.h b/gl/langinfo.in.h index c7555a6a..febbd25f 100644 --- a/gl/langinfo.in.h +++ b/gl/langinfo.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for and wrapper around <langinfo.h>. | 1 | /* Substitute for and wrapper around <langinfo.h>. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -34,6 +34,11 @@ | |||
34 | #ifndef _@GUARD_PREFIX@_LANGINFO_H | 34 | #ifndef _@GUARD_PREFIX@_LANGINFO_H |
35 | #define _@GUARD_PREFIX@_LANGINFO_H | 35 | #define _@GUARD_PREFIX@_LANGINFO_H |
36 | 36 | ||
37 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
38 | #if !_GL_CONFIG_H_INCLUDED | ||
39 | #error "Please include config.h first." | ||
40 | #endif | ||
41 | |||
37 | 42 | ||
38 | #if !@HAVE_LANGINFO_H@ | 43 | #if !@HAVE_LANGINFO_H@ |
39 | 44 | ||
@@ -208,7 +213,9 @@ _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); | |||
208 | # endif | 213 | # endif |
209 | _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); | 214 | _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); |
210 | # endif | 215 | # endif |
216 | # if __GLIBC__ >= 2 | ||
211 | _GL_CXXALIASWARN (nl_langinfo); | 217 | _GL_CXXALIASWARN (nl_langinfo); |
218 | # endif | ||
212 | #elif defined GNULIB_POSIXCHECK | 219 | #elif defined GNULIB_POSIXCHECK |
213 | # undef nl_langinfo | 220 | # undef nl_langinfo |
214 | # if HAVE_RAW_DECL_NL_LANGINFO | 221 | # if HAVE_RAW_DECL_NL_LANGINFO |
diff --git a/gl/lc-charset-dispatch.c b/gl/lc-charset-dispatch.c index cd74466b..e2f8b2f5 100644 --- a/gl/lc-charset-dispatch.c +++ b/gl/lc-charset-dispatch.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Dispatching based on the current locale's character encoding. | 1 | /* Dispatching based on the current locale's character encoding. |
2 | Copyright (C) 2018-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/lc-charset-dispatch.h b/gl/lc-charset-dispatch.h index c82b6a60..4c1cf5f1 100644 --- a/gl/lc-charset-dispatch.h +++ b/gl/lc-charset-dispatch.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Dispatching based on the current locale's character encoding. | 1 | /* Dispatching based on the current locale's character encoding. |
2 | Copyright (C) 2018-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/libc-config.h b/gl/libc-config.h index 1d28e58c..70114608 100644 --- a/gl/libc-config.h +++ b/gl/libc-config.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* System definitions for code taken from the GNU C Library | 1 | /* System definitions for code taken from the GNU C Library |
2 | 2 | ||
3 | Copyright 2017-2023 Free Software Foundation, Inc. | 3 | Copyright 2017-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or | 5 | This program is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
@@ -137,8 +137,6 @@ | |||
137 | # undef __attribute_returns_twice__ | 137 | # undef __attribute_returns_twice__ |
138 | # undef __attribute_used__ | 138 | # undef __attribute_used__ |
139 | # undef __attribute_warn_unused_result__ | 139 | # undef __attribute_warn_unused_result__ |
140 | # undef __bos | ||
141 | # undef __bos0 | ||
142 | # undef __errordecl | 140 | # undef __errordecl |
143 | # undef __extension__ | 141 | # undef __extension__ |
144 | # undef __extern_always_inline | 142 | # undef __extern_always_inline |
@@ -147,21 +145,13 @@ | |||
147 | # undef __fortified_attr_access | 145 | # undef __fortified_attr_access |
148 | # undef __fortify_function | 146 | # undef __fortify_function |
149 | # undef __glibc_c99_flexarr_available | 147 | # undef __glibc_c99_flexarr_available |
150 | # undef __glibc_fortify | ||
151 | # undef __glibc_fortify_n | ||
152 | # undef __glibc_has_attribute | 148 | # undef __glibc_has_attribute |
153 | # undef __glibc_has_builtin | 149 | # undef __glibc_has_builtin |
154 | # undef __glibc_has_extension | 150 | # undef __glibc_has_extension |
155 | # undef __glibc_likely | 151 | # undef __glibc_likely |
156 | # undef __glibc_macro_warning | 152 | # undef __glibc_macro_warning |
157 | # undef __glibc_macro_warning1 | 153 | # undef __glibc_macro_warning1 |
158 | # undef __glibc_objsize | ||
159 | # undef __glibc_objsize0 | ||
160 | # undef __glibc_safe_len_cond | ||
161 | # undef __glibc_safe_or_unknown_len | ||
162 | # undef __glibc_unlikely | 154 | # undef __glibc_unlikely |
163 | # undef __glibc_unsafe_len | ||
164 | # undef __glibc_unsigned_or_positive | ||
165 | # undef __inline | 155 | # undef __inline |
166 | # undef __ptr_t | 156 | # undef __ptr_t |
167 | # undef __restrict | 157 | # undef __restrict |
@@ -170,6 +160,18 @@ | |||
170 | # undef __va_arg_pack_len | 160 | # undef __va_arg_pack_len |
171 | # undef __warnattr | 161 | # undef __warnattr |
172 | # undef __wur | 162 | # undef __wur |
163 | # ifndef __GNULIB_CDEFS | ||
164 | # undef __bos | ||
165 | # undef __bos0 | ||
166 | # undef __glibc_fortify | ||
167 | # undef __glibc_fortify_n | ||
168 | # undef __glibc_objsize | ||
169 | # undef __glibc_objsize0 | ||
170 | # undef __glibc_safe_len_cond | ||
171 | # undef __glibc_safe_or_unknown_len | ||
172 | # undef __glibc_unsafe_len | ||
173 | # undef __glibc_unsigned_or_positive | ||
174 | # endif | ||
173 | 175 | ||
174 | /* Include our copy of glibc <sys/cdefs.h>. */ | 176 | /* Include our copy of glibc <sys/cdefs.h>. */ |
175 | # include <cdefs.h> | 177 | # include <cdefs.h> |
diff --git a/gl/limits.in.h b/gl/limits.in.h index eaeac472..c65eb4c1 100644 --- a/gl/limits.in.h +++ b/gl/limits.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <limits.h>. | 1 | /* A GNU-like <limits.h>. |
2 | 2 | ||
3 | Copyright 2016-2023 Free Software Foundation, Inc. | 3 | Copyright 2016-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -99,6 +99,11 @@ | |||
99 | # endif | 99 | # endif |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | /* Assume no multibyte character is longer than 16 bytes. */ | ||
103 | #ifndef MB_LEN_MAX | ||
104 | # define MB_LEN_MAX 16 | ||
105 | #endif | ||
106 | |||
102 | /* Macros specified by C23 and by ISO/IEC TS 18661-1:2014. */ | 107 | /* Macros specified by C23 and by ISO/IEC TS 18661-1:2014. */ |
103 | 108 | ||
104 | #if (! defined ULLONG_WIDTH \ | 109 | #if (! defined ULLONG_WIDTH \ |
@@ -119,11 +124,26 @@ | |||
119 | 124 | ||
120 | /* Macros specified by C23. */ | 125 | /* Macros specified by C23. */ |
121 | 126 | ||
122 | #if (! defined BOOL_WIDTH \ | 127 | #if (defined _GNU_SOURCE \ |
123 | && (defined _GNU_SOURCE \ | 128 | || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)) |
124 | || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) | 129 | # if ! defined BOOL_WIDTH |
125 | # define BOOL_MAX 1 | 130 | # define BOOL_WIDTH 1 |
126 | # define BOOL_WIDTH 1 | 131 | # define BOOL_MAX 1 |
132 | # elif ! defined BOOL_MAX | ||
133 | # define BOOL_MAX 1 | ||
134 | # endif | ||
135 | #endif | ||
136 | |||
137 | /* Macro specified by POSIX. */ | ||
138 | |||
139 | /* The maximum ssize_t value. Although it might not be of ssize_t type | ||
140 | as it should be, it's too much trouble to fix this minor detail. */ | ||
141 | #ifndef SSIZE_MAX | ||
142 | # ifdef _WIN64 | ||
143 | # define SSIZE_MAX LLONG_MAX | ||
144 | # else | ||
145 | # define SSIZE_MAX LONG_MAX | ||
146 | # endif | ||
127 | #endif | 147 | #endif |
128 | 148 | ||
129 | #endif /* _@GUARD_PREFIX@_LIMITS_H */ | 149 | #endif /* _@GUARD_PREFIX@_LIMITS_H */ |
diff --git a/gl/localcharset.c b/gl/localcharset.c index 7ed9c957..93c4baa4 100644 --- a/gl/localcharset.c +++ b/gl/localcharset.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Determine a canonical name for the current locale's character encoding. | 1 | /* Determine a canonical name for the current locale's character encoding. |
2 | 2 | ||
3 | Copyright (C) 2000-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2000-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1054,7 +1054,7 @@ locale_charset (void) | |||
1054 | } | 1054 | } |
1055 | } | 1055 | } |
1056 | if (0) | 1056 | if (0) |
1057 | done_table_lookup: ; | 1057 | done_table_lookup: {} |
1058 | else | 1058 | else |
1059 | # endif | 1059 | # endif |
1060 | { | 1060 | { |
diff --git a/gl/localcharset.h b/gl/localcharset.h index 29ee8dc0..47214024 100644 --- a/gl/localcharset.h +++ b/gl/localcharset.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Determine a canonical name for the current locale's character encoding. | 1 | /* Determine a canonical name for the current locale's character encoding. |
2 | Copyright (C) 2000-2003, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2000-2003, 2009-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU CHARSET Library. | 3 | This file is part of the GNU CHARSET Library. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -104,10 +104,8 @@ extern const char * locale_charset (void); | |||
104 | GBK glibc aix osf solaris freebsd darwin cygwin windows dos | 104 | GBK glibc aix osf solaris freebsd darwin cygwin windows dos |
105 | GB18030 glibc hpux solaris freebsd netbsd darwin | 105 | GB18030 glibc hpux solaris freebsd netbsd darwin |
106 | SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin | 106 | SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin |
107 | JOHAB glibc solaris windows | 107 | JOHAB solaris windows |
108 | TIS-620 glibc aix hpux osf solaris cygwin zos | 108 | TIS-620 glibc aix hpux osf solaris cygwin zos |
109 | VISCII Y glibc | ||
110 | TCVN5712-1 glibc | ||
111 | ARMSCII-8 glibc freebsd netbsd darwin | 109 | ARMSCII-8 glibc freebsd netbsd darwin |
112 | GEORGIAN-PS glibc cygwin | 110 | GEORGIAN-PS glibc cygwin |
113 | PT154 glibc netbsd cygwin | 111 | PT154 glibc netbsd cygwin |
diff --git a/gl/locale.in.h b/gl/locale.in.h index 538b8341..1b11a41c 100644 --- a/gl/locale.in.h +++ b/gl/locale.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* A POSIX <locale.h>. | 1 | /* A POSIX <locale.h>. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -44,6 +44,11 @@ | |||
44 | #ifndef _@GUARD_PREFIX@_LOCALE_H | 44 | #ifndef _@GUARD_PREFIX@_LOCALE_H |
45 | #define _@GUARD_PREFIX@_LOCALE_H | 45 | #define _@GUARD_PREFIX@_LOCALE_H |
46 | 46 | ||
47 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
48 | #if !_GL_CONFIG_H_INCLUDED | ||
49 | #error "Please include config.h first." | ||
50 | #endif | ||
51 | |||
47 | /* NetBSD 5.0 mis-defines NULL. */ | 52 | /* NetBSD 5.0 mis-defines NULL. */ |
48 | #include <stddef.h> | 53 | #include <stddef.h> |
49 | 54 | ||
@@ -211,7 +216,7 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " | |||
211 | # include "setlocale_null.h" | 216 | # include "setlocale_null.h" |
212 | #endif | 217 | #endif |
213 | 218 | ||
214 | #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) | 219 | #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) |
215 | # if @REPLACE_NEWLOCALE@ | 220 | # if @REPLACE_NEWLOCALE@ |
216 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 221 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
217 | # undef newlocale | 222 | # undef newlocale |
@@ -229,7 +234,7 @@ _GL_CXXALIAS_SYS (newlocale, locale_t, | |||
229 | (int category_mask, const char *name, locale_t base)); | 234 | (int category_mask, const char *name, locale_t base)); |
230 | # endif | 235 | # endif |
231 | # endif | 236 | # endif |
232 | # if @HAVE_NEWLOCALE@ | 237 | # if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ |
233 | _GL_CXXALIASWARN (newlocale); | 238 | _GL_CXXALIASWARN (newlocale); |
234 | # endif | 239 | # endif |
235 | # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ | 240 | # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ |
@@ -244,24 +249,24 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable"); | |||
244 | # endif | 249 | # endif |
245 | #endif | 250 | #endif |
246 | 251 | ||
247 | #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) | 252 | #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) |
248 | # if @REPLACE_DUPLOCALE@ | 253 | # if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@. */ |
249 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 254 | # if @REPLACE_DUPLOCALE@ |
250 | # undef duplocale | 255 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
251 | # define duplocale rpl_duplocale | 256 | # undef duplocale |
252 | # define GNULIB_defined_duplocale 1 | 257 | # define duplocale rpl_duplocale |
253 | # endif | 258 | # define GNULIB_defined_duplocale 1 |
259 | # endif | ||
254 | _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); | 260 | _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); |
255 | _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); | 261 | _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); |
256 | # else | 262 | # else |
257 | # if @HAVE_DUPLOCALE@ | ||
258 | _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); | 263 | _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); |
259 | # endif | 264 | # endif |
260 | # endif | 265 | # endif |
261 | # if @HAVE_DUPLOCALE@ | 266 | # if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ |
262 | _GL_CXXALIASWARN (duplocale); | 267 | _GL_CXXALIASWARN (duplocale); |
263 | # endif | 268 | # endif |
264 | # if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@ | 269 | # if @HAVE_DUPLOCALE@ |
265 | # ifndef HAVE_WORKING_DUPLOCALE | 270 | # ifndef HAVE_WORKING_DUPLOCALE |
266 | # define HAVE_WORKING_DUPLOCALE 1 | 271 | # define HAVE_WORKING_DUPLOCALE 1 |
267 | # endif | 272 | # endif |
@@ -274,7 +279,7 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " | |||
274 | # endif | 279 | # endif |
275 | #endif | 280 | #endif |
276 | 281 | ||
277 | #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) | 282 | #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) |
278 | # if @REPLACE_FREELOCALE@ | 283 | # if @REPLACE_FREELOCALE@ |
279 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 284 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
280 | # undef freelocale | 285 | # undef freelocale |
@@ -290,7 +295,7 @@ _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); | |||
290 | _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); | 295 | _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); |
291 | # endif | 296 | # endif |
292 | # endif | 297 | # endif |
293 | # if @HAVE_FREELOCALE@ | 298 | # if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ |
294 | _GL_CXXALIASWARN (freelocale); | 299 | _GL_CXXALIASWARN (freelocale); |
295 | # endif | 300 | # endif |
296 | #elif defined GNULIB_POSIXCHECK | 301 | #elif defined GNULIB_POSIXCHECK |
diff --git a/gl/localeconv.c b/gl/localeconv.c index 60c050f4..10fc7b74 100644 --- a/gl/localeconv.c +++ b/gl/localeconv.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Query locale dependent information for formatting numbers. | 1 | /* Query locale dependent information for formatting numbers. |
2 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -19,10 +19,14 @@ | |||
19 | /* Specification. */ | 19 | /* Specification. */ |
20 | #include <locale.h> | 20 | #include <locale.h> |
21 | 21 | ||
22 | #include <limits.h> | ||
23 | |||
22 | #if HAVE_STRUCT_LCONV_DECIMAL_POINT | 24 | #if HAVE_STRUCT_LCONV_DECIMAL_POINT |
23 | 25 | ||
26 | # define FIX_CHAR_VALUE(x) ((x) >= 0 ? (x) : CHAR_MAX) | ||
27 | |||
24 | /* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_* | 28 | /* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_* |
25 | members. */ | 29 | members or where fields of type 'char' are set to -1 instead of CHAR_MAX. */ |
26 | 30 | ||
27 | struct lconv * | 31 | struct lconv * |
28 | localeconv (void) | 32 | localeconv (void) |
@@ -41,21 +45,30 @@ localeconv (void) | |||
41 | result.positive_sign = sys_result->positive_sign; | 45 | result.positive_sign = sys_result->positive_sign; |
42 | result.negative_sign = sys_result->negative_sign; | 46 | result.negative_sign = sys_result->negative_sign; |
43 | result.currency_symbol = sys_result->currency_symbol; | 47 | result.currency_symbol = sys_result->currency_symbol; |
44 | result.frac_digits = sys_result->frac_digits; | 48 | result.frac_digits = FIX_CHAR_VALUE (sys_result->frac_digits); |
45 | result.p_cs_precedes = sys_result->p_cs_precedes; | 49 | result.p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes); |
46 | result.p_sign_posn = sys_result->p_sign_posn; | 50 | result.p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn); |
47 | result.p_sep_by_space = sys_result->p_sep_by_space; | 51 | result.p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space); |
48 | result.n_cs_precedes = sys_result->n_cs_precedes; | 52 | result.n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes); |
49 | result.n_sign_posn = sys_result->n_sign_posn; | 53 | result.n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn); |
50 | result.n_sep_by_space = sys_result->n_sep_by_space; | 54 | result.n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space); |
51 | result.int_curr_symbol = sys_result->int_curr_symbol; | 55 | result.int_curr_symbol = sys_result->int_curr_symbol; |
52 | result.int_frac_digits = sys_result->int_frac_digits; | 56 | result.int_frac_digits = FIX_CHAR_VALUE (sys_result->int_frac_digits); |
53 | result.int_p_cs_precedes = sys_result->p_cs_precedes; | 57 | # if HAVE_STRUCT_LCONV_INT_P_CS_PRECEDES |
54 | result.int_p_sign_posn = sys_result->p_sign_posn; | 58 | result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->int_p_cs_precedes); |
55 | result.int_p_sep_by_space = sys_result->p_sep_by_space; | 59 | result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->int_p_sign_posn); |
56 | result.int_n_cs_precedes = sys_result->n_cs_precedes; | 60 | result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->int_p_sep_by_space); |
57 | result.int_n_sign_posn = sys_result->n_sign_posn; | 61 | result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->int_n_cs_precedes); |
58 | result.int_n_sep_by_space = sys_result->n_sep_by_space; | 62 | result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->int_n_sign_posn); |
63 | result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->int_n_sep_by_space); | ||
64 | # else | ||
65 | result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes); | ||
66 | result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn); | ||
67 | result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space); | ||
68 | result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes); | ||
69 | result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn); | ||
70 | result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space); | ||
71 | # endif | ||
59 | 72 | ||
60 | return &result; | 73 | return &result; |
61 | } | 74 | } |
@@ -64,8 +77,6 @@ localeconv (void) | |||
64 | 77 | ||
65 | /* Override for platforms where 'struct lconv' is a dummy. */ | 78 | /* Override for platforms where 'struct lconv' is a dummy. */ |
66 | 79 | ||
67 | # include <limits.h> | ||
68 | |||
69 | struct lconv * | 80 | struct lconv * |
70 | localeconv (void) | 81 | localeconv (void) |
71 | { | 82 | { |
@@ -1,5 +1,5 @@ | |||
1 | /* An lseek() function that detects pipes. | 1 | /* An lseek() function that detects pipes. |
2 | Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index 7fe03e0b..cd167718 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # 00gnulib.m4 serial 8 | 1 | # 00gnulib.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -49,14 +50,14 @@ dnl AC_REQUIRE([gl_COMPILER_CLANG]) | |||
49 | [if test $gl_cv_compiler_clang = yes; then | 50 | [if test $gl_cv_compiler_clang = yes; then |
50 | dnl Test whether the compiler supports the option | 51 | dnl Test whether the compiler supports the option |
51 | dnl '-Werror=implicit-function-declaration'. | 52 | dnl '-Werror=implicit-function-declaration'. |
52 | save_ac_compile="$ac_compile" | 53 | saved_ac_compile="$ac_compile" |
53 | ac_compile="$ac_compile -Werror=implicit-function-declaration" | 54 | ac_compile="$ac_compile -Werror=implicit-function-declaration" |
54 | dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a | 55 | dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a |
55 | dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". | 56 | dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". |
56 | _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], | 57 | _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], |
57 | [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], | 58 | [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], |
58 | [gl_cv_compiler_check_decl_option=none]) | 59 | [gl_cv_compiler_check_decl_option=none]) |
59 | ac_compile="$save_ac_compile" | 60 | ac_compile="$saved_ac_compile" |
60 | else | 61 | else |
61 | gl_cv_compiler_check_decl_option=none | 62 | gl_cv_compiler_check_decl_option=none |
62 | fi | 63 | fi |
@@ -71,11 +72,11 @@ dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl | |||
71 | dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC | 72 | dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC |
72 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. | 73 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. |
73 | m4_define([_AC_CHECK_DECL_BODY], | 74 | m4_define([_AC_CHECK_DECL_BODY], |
74 | [ ac_save_ac_compile="$ac_compile" | 75 | [ ac_saved_ac_compile="$ac_compile" |
75 | if test -n "$ac_compile_for_check_decl"; then | 76 | if test -n "$ac_compile_for_check_decl"; then |
76 | ac_compile="$ac_compile_for_check_decl" | 77 | ac_compile="$ac_compile_for_check_decl" |
77 | fi] | 78 | fi] |
78 | m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" | 79 | m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_saved_ac_compile" |
79 | ]) | 80 | ]) |
80 | 81 | ||
81 | # gl_00GNULIB | 82 | # gl_00GNULIB |
diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4 index acf8668b..20baf164 100644 --- a/gl/m4/__inline.m4 +++ b/gl/m4/__inline.m4 | |||
@@ -1,9 +1,12 @@ | |||
1 | # Test for __inline keyword | 1 | # __inline.m4 |
2 | dnl Copyright 2017-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright 2017-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
8 | # Test for __inline keyword | ||
9 | |||
7 | AC_DEFUN([gl___INLINE], | 10 | AC_DEFUN([gl___INLINE], |
8 | [ | 11 | [ |
9 | AC_CACHE_CHECK([whether the compiler supports the __inline keyword], | 12 | AC_CACHE_CHECK([whether the compiler supports the __inline keyword], |
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 index e7947648..0abd6d90 100644 --- a/gl/m4/absolute-header.m4 +++ b/gl/m4/absolute-header.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # absolute-header.m4 serial 17 | 1 | # absolute-header.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -66,7 +67,7 @@ AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], | |||
66 | esac | 67 | esac |
67 | changequote(,) | 68 | changequote(,) |
68 | case "$host_os" in | 69 | case "$host_os" in |
69 | mingw*) | 70 | mingw* | windows*) |
70 | dnl For the sake of native Windows compilers (excluding gcc), | 71 | dnl For the sake of native Windows compilers (excluding gcc), |
71 | dnl treat backslash as a directory separator, like /. | 72 | dnl treat backslash as a directory separator, like /. |
72 | dnl Actually, these compilers use a double-backslash as | 73 | dnl Actually, these compilers use a double-backslash as |
diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4 index f4c0d624..33b74945 100644 --- a/gl/m4/af_alg.m4 +++ b/gl/m4/af_alg.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # af_alg.m4 serial 6 | 1 | # af_alg.m4 |
2 | dnl Copyright 2018-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
3 | dnl Copyright 2018-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index c685fac9..dc78dc19 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # alloca.m4 serial 21 | 1 | # alloca.m4 |
2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 21 |
3 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index fa5fe831..9eac86d7 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # arpa_inet_h.m4 serial 17 | 1 | # arpa_inet_h.m4 |
2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 17 |
3 | dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 index abba4fa3..b90d0f19 100644 --- a/gl/m4/assert_h.m4 +++ b/gl/m4/assert_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # assert-h.m4 | 1 | # assert_h.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,16 +10,16 @@ dnl From Paul Eggert. | |||
9 | AC_DEFUN([gl_ASSERT_H], | 10 | AC_DEFUN([gl_ASSERT_H], |
10 | [ | 11 | [ |
11 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], | 12 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], |
12 | [gl_save_CFLAGS=$CFLAGS | 13 | [gl_saved_CFLAGS=$CFLAGS |
13 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do | 14 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do |
14 | AS_CASE([$gl_working], | 15 | AS_CASE([$gl_working], |
15 | [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) | 16 | [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) |
16 | 17 | ||
17 | AC_COMPILE_IFELSE( | 18 | AC_COMPILE_IFELSE( |
18 | [AC_LANG_PROGRAM( | 19 | [AC_LANG_PROGRAM( |
19 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 | 20 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 |
20 | #pragma clang diagnostic error "-Wc2x-extensions" | 21 | #pragma clang diagnostic error "-Wc2x-extensions" |
21 | #pragma clang diagnostic error "-Wc++17-extensions" | 22 | #pragma clang diagnostic error "-Wc++1z-extensions" |
22 | #endif | 23 | #endif |
23 | #ifdef INCLUDE_ASSERT_H | 24 | #ifdef INCLUDE_ASSERT_H |
24 | #include <assert.h> | 25 | #include <assert.h> |
@@ -32,7 +33,7 @@ AC_DEFUN([gl_ASSERT_H], | |||
32 | ]])], | 33 | ]])], |
33 | [gl_cv_static_assert=$gl_working], | 34 | [gl_cv_static_assert=$gl_working], |
34 | [gl_cv_static_assert=no]) | 35 | [gl_cv_static_assert=no]) |
35 | CFLAGS=$gl_save_CFLAGS | 36 | CFLAGS=$gl_saved_CFLAGS |
36 | test "$gl_cv_static_assert" != no && break | 37 | test "$gl_cv_static_assert" != no && break |
37 | done]) | 38 | done]) |
38 | 39 | ||
@@ -46,10 +47,13 @@ AC_DEFUN([gl_ASSERT_H], | |||
46 | gl_NEXT_HEADERS([assert.h])]) | 47 | gl_NEXT_HEADERS([assert.h])]) |
47 | 48 | ||
48 | dnl The "zz" puts this toward config.h's end, to avoid potential | 49 | dnl The "zz" puts this toward config.h's end, to avoid potential |
49 | dnl collisions with other definitions. #undef assert so that | 50 | dnl collisions with other definitions. |
50 | dnl programs are not tempted to use it without specifically | 51 | dnl #undef assert so that programs are not tempted to use it without |
51 | dnl including assert.h. Break the #undef apart with a comment | 52 | dnl specifically including assert.h. |
52 | dnl so that 'configure' does not comment it out. | 53 | dnl #undef __ASSERT_H__ so that on IRIX, when programs later include |
54 | dnl <assert.h>, this include actually defines assert. | ||
55 | dnl Break the #undef_s apart with a comment so that 'configure' does | ||
56 | dnl not comment them out. | ||
53 | AH_VERBATIM([zzstatic_assert], | 57 | AH_VERBATIM([zzstatic_assert], |
54 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ | 58 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ |
55 | && (!defined __cplusplus \ | 59 | && (!defined __cplusplus \ |
@@ -57,6 +61,9 @@ AC_DEFUN([gl_ASSERT_H], | |||
57 | && __GNUG__ < 6 && __clang_major__ < 6))) | 61 | && __GNUG__ < 6 && __clang_major__ < 6))) |
58 | #include <assert.h> | 62 | #include <assert.h> |
59 | #undef/**/assert | 63 | #undef/**/assert |
64 | #ifdef __sgi | ||
65 | #undef/**/__ASSERT_H__ | ||
66 | #endif | ||
60 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. | 67 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. |
61 | We need it also to be invocable with a single argument. */ | 68 | We need it also to be invocable with a single argument. */ |
62 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus | 69 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus |
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index 987930ab..26f2af41 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # base64.m4 serial 4 | 1 | # base64.m4 |
2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index 77218a7d..d9dd7036 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # btowc.m4 serial 12 | 1 | # btowc.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -40,12 +41,12 @@ int main () | |||
40 | [ | 41 | [ |
41 | changequote(,)dnl | 42 | changequote(,)dnl |
42 | case "$host_os" in | 43 | case "$host_os" in |
43 | # Guess no on Cygwin. | 44 | # Guess no on Cygwin. |
44 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; | 45 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; |
45 | # Guess yes on native Windows. | 46 | # Guess yes on native Windows. |
46 | mingw*) gl_cv_func_btowc_nul="guessing yes" ;; | 47 | mingw* | windows*) gl_cv_func_btowc_nul="guessing yes" ;; |
47 | # Guess yes otherwise. | 48 | # Guess yes otherwise. |
48 | *) gl_cv_func_btowc_nul="guessing yes" ;; | 49 | *) gl_cv_func_btowc_nul="guessing yes" ;; |
49 | esac | 50 | esac |
50 | changequote([,])dnl | 51 | changequote([,])dnl |
51 | ]) | 52 | ]) |
@@ -59,12 +60,12 @@ changequote([,])dnl | |||
59 | dnl is present. | 60 | dnl is present. |
60 | changequote(,)dnl | 61 | changequote(,)dnl |
61 | case "$host_os" in | 62 | case "$host_os" in |
62 | # Guess no on IRIX. | 63 | # Guess no on IRIX. |
63 | irix*) gl_cv_func_btowc_eof="guessing no" ;; | 64 | irix*) gl_cv_func_btowc_eof="guessing no" ;; |
64 | # Guess yes on native Windows. | 65 | # Guess yes on native Windows. |
65 | mingw*) gl_cv_func_btowc_eof="guessing yes" ;; | 66 | mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;; |
66 | # Guess yes otherwise. | 67 | # Guess yes otherwise. |
67 | *) gl_cv_func_btowc_eof="guessing yes" ;; | 68 | *) gl_cv_func_btowc_eof="guessing yes" ;; |
68 | esac | 69 | esac |
69 | changequote([,])dnl | 70 | changequote([,])dnl |
70 | if test $LOCALE_FR != none; then | 71 | if test $LOCALE_FR != none; then |
@@ -88,6 +89,50 @@ int main () | |||
88 | fi | 89 | fi |
89 | ]) | 90 | ]) |
90 | 91 | ||
92 | dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: | ||
93 | dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and | ||
94 | dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. | ||
95 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | ||
96 | AC_CACHE_CHECK([whether btowc is consistent with mbrtowc in the C locale], | ||
97 | [gl_cv_func_btowc_consistent], | ||
98 | [ | ||
99 | AC_RUN_IFELSE( | ||
100 | [AC_LANG_SOURCE([[ | ||
101 | #include <stdlib.h> | ||
102 | #include <string.h> | ||
103 | #include <wchar.h> | ||
104 | int main () | ||
105 | { | ||
106 | #if HAVE_MBRTOWC | ||
107 | wint_t wc1 = btowc (0x80); | ||
108 | wchar_t wc2 = (wchar_t) 0xbadface; | ||
109 | char buf[1] = { 0x80 }; | ||
110 | mbstate_t state; | ||
111 | memset (&state, 0, sizeof (mbstate_t)); | ||
112 | if (mbrtowc (&wc2, buf, 1, &state) != 1 || wc1 != wc2) | ||
113 | return 1; | ||
114 | #endif | ||
115 | return 0; | ||
116 | }]])], | ||
117 | [gl_cv_func_btowc_consistent=yes], | ||
118 | [gl_cv_func_btowc_consistent=no], | ||
119 | [case "$host_os" in | ||
120 | # Guess no on mingw. | ||
121 | mingw* | windows*) | ||
122 | AC_EGREP_CPP([Problem], [ | ||
123 | #ifdef __MINGW32__ | ||
124 | Problem | ||
125 | #endif | ||
126 | ], | ||
127 | [gl_cv_func_btowc_consistent="guessing no"], | ||
128 | [gl_cv_func_btowc_consistent="guessing yes"]) | ||
129 | ;; | ||
130 | # Guess yes otherwise. | ||
131 | *) gl_cv_func_btowc_consistent="guessing yes" ;; | ||
132 | esac | ||
133 | ]) | ||
134 | ]) | ||
135 | |||
91 | case "$gl_cv_func_btowc_nul" in | 136 | case "$gl_cv_func_btowc_nul" in |
92 | *yes) ;; | 137 | *yes) ;; |
93 | *) REPLACE_BTOWC=1 ;; | 138 | *) REPLACE_BTOWC=1 ;; |
@@ -96,10 +141,22 @@ int main () | |||
96 | *yes) ;; | 141 | *yes) ;; |
97 | *) REPLACE_BTOWC=1 ;; | 142 | *) REPLACE_BTOWC=1 ;; |
98 | esac | 143 | esac |
144 | case "$gl_cv_func_btowc_consistent" in | ||
145 | *yes) ;; | ||
146 | *) REPLACE_BTOWC=1 ;; | ||
147 | esac | ||
148 | if test $REPLACE_BTOWC = 0; then | ||
149 | gl_MBRTOWC_C_LOCALE | ||
150 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
151 | *yes) ;; | ||
152 | *) REPLACE_BTOWC=1 ;; | ||
153 | esac | ||
154 | fi | ||
99 | fi | 155 | fi |
100 | ]) | 156 | ]) |
101 | 157 | ||
102 | # Prerequisites of lib/btowc.c. | 158 | # Prerequisites of lib/btowc.c. |
103 | AC_DEFUN([gl_PREREQ_BTOWC], [ | 159 | AC_DEFUN([gl_PREREQ_BTOWC], [ |
104 | : | 160 | : |
161 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | ||
105 | ]) | 162 | ]) |
diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 index 531ed48a..c7af926b 100644 --- a/gl/m4/builtin-expect.m4 +++ b/gl/m4/builtin-expect.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | dnl Check for __builtin_expect. | 1 | # builtin-expect.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2016-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2016-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl Check for __builtin_expect. | ||
9 | |||
8 | dnl Written by Paul Eggert. | 10 | dnl Written by Paul Eggert. |
9 | 11 | ||
10 | AC_DEFUN([gl___BUILTIN_EXPECT], | 12 | AC_DEFUN([gl___BUILTIN_EXPECT], |
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 index 8058d178..0c76fe93 100644 --- a/gl/m4/byteswap.m4 +++ b/gl/m4/byteswap.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # byteswap.m4 serial 5 | 1 | # byteswap.m4 |
2 | dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4 index f614371b..0fb0de3b 100644 --- a/gl/m4/c-bool.m4 +++ b/gl/m4/c-bool.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | # Check for bool that conforms to C2023. | 1 | # c-bool.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2022-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2022-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # Check for bool that conforms to C2023. | ||
9 | |||
8 | AC_DEFUN([gl_C_BOOL], | 10 | AC_DEFUN([gl_C_BOOL], |
9 | [ | 11 | [ |
10 | AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool], | 12 | AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool], |
diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4 index 23c0dd9f..550cf5cc 100644 --- a/gl/m4/calloc.m4 +++ b/gl/m4/calloc.m4 | |||
@@ -1,9 +1,9 @@ | |||
1 | # calloc.m4 serial 29 | 1 | # calloc.m4 |
2 | 2 | # serial 31 | |
3 | # Copyright (C) 2004-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # Written by Jim Meyering. | 8 | # Written by Jim Meyering. |
9 | 9 | ||
@@ -36,14 +36,14 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF], | |||
36 | [ac_cv_func_calloc_0_nonnull=no]) | 36 | [ac_cv_func_calloc_0_nonnull=no]) |
37 | else | 37 | else |
38 | case "$host_os" in | 38 | case "$host_os" in |
39 | # Guess yes on glibc systems. | 39 | # Guess yes on glibc systems. |
40 | *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | 40 | *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; |
41 | # Guess yes on musl systems. | 41 | # Guess yes on musl systems. |
42 | *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | 42 | *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; |
43 | # Guess yes on native Windows. | 43 | # Guess yes on native Windows. |
44 | mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | 44 | mingw* | windows*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; |
45 | # If we don't know, obey --enable-cross-guesses. | 45 | # If we don't know, obey --enable-cross-guesses. |
46 | *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; | 46 | *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; |
47 | esac | 47 | esac |
48 | fi | 48 | fi |
49 | ]) | 49 | ]) |
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 index 9f95c670..88c37fab 100644 --- a/gl/m4/close.m4 +++ b/gl/m4/close.m4 | |||
@@ -1,10 +1,11 @@ | |||
1 | # close.m4 serial 9 | 1 | # close.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
7 | AC_DEFUN([gl_FUNC_CLOSE], | 8 | AC_DEFUN_ONCE([gl_FUNC_CLOSE], |
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
10 | m4_ifdef([gl_MSVC_INVAL], [ | 11 | m4_ifdef([gl_MSVC_INVAL], [ |
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index 5804f472..e69b7402 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # codeset.m4 serial 5 (gettext-0.18.2) | 1 | # codeset.m4 |
2 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2023 Free Software | 2 | # serial 5 (gettext-0.18.2) |
3 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software | ||
3 | dnl Foundation, Inc. | 4 | dnl Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index 1776e5eb..3437c699 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # double-slash-root.m4 serial 4 -*- Autoconf -*- | 1 | # double-slash-root.m4 |
2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 4 -*- Autoconf -*- |
3 | dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 index e1cc73e1..786121fd 100644 --- a/gl/m4/dup2.m4 +++ b/gl/m4/dup2.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | #serial 27 | 1 | # dup2.m4 |
2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 28 |
3 | dnl Copyright (C) 2002, 2005, 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -67,7 +68,7 @@ AC_DEFUN([gl_FUNC_DUP2], | |||
67 | ], | 68 | ], |
68 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], | 69 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], |
69 | [case "$host_os" in | 70 | [case "$host_os" in |
70 | mingw*) # on this platform, dup2 always returns 0 for success | 71 | mingw* | windows*) # on this platform, dup2 always returns 0 for success |
71 | gl_cv_func_dup2_works="guessing no" ;; | 72 | gl_cv_func_dup2_works="guessing no" ;; |
72 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 | 73 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 |
73 | gl_cv_func_dup2_works="guessing no" ;; | 74 | gl_cv_func_dup2_works="guessing no" ;; |
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4 index cb3e08fe..8a15e705 100644 --- a/gl/m4/eealloc.m4 +++ b/gl/m4/eealloc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # eealloc.m4 serial 3 | 1 | # eealloc.m4 |
2 | dnl Copyright (C) 2003, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
3 | dnl Copyright (C) 2003, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 741dfc56..107960b2 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # environ.m4 serial 8 | 1 | # environ.m4 |
2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 4c70d225..b6050e5d 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # errno_h.m4 serial 14 | 1 | # errno_h.m4 |
2 | dnl Copyright (C) 2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 8cc75dff..273b636b 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 | |||
@@ -1,22 +1,12 @@ | |||
1 | #serial 15 | 1 | # error.m4 |
2 | 2 | # serial 16 | |
3 | # Copyright (C) 1996-1998, 2001-2004, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1996-1998, 2001-2004, 2009-2024 Free Software Foundation, Inc. |
4 | # | 4 | dnl This file is free software; the Free Software Foundation |
5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 7 | ||
9 | AC_DEFUN([gl_ERROR], | 8 | AC_DEFUN([gl_ERROR], |
10 | [ | 9 | [ |
11 | dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer | ||
12 | dnl maintained in Autoconf and because it invokes AC_LIBOBJ. | ||
13 | AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], | ||
14 | [AC_LINK_IFELSE( | ||
15 | [AC_LANG_PROGRAM( | ||
16 | [[#include <error.h>]], | ||
17 | [[error_at_line (0, 0, "", 0, "an error occurred");]])], | ||
18 | [ac_cv_lib_error_at_line=yes], | ||
19 | [ac_cv_lib_error_at_line=no])]) | ||
20 | ]) | 10 | ]) |
21 | 11 | ||
22 | # Prerequisites of lib/error.c. | 12 | # Prerequisites of lib/error.c. |
diff --git a/gl/m4/error_h.m4 b/gl/m4/error_h.m4 new file mode 100644 index 00000000..050a410c --- /dev/null +++ b/gl/m4/error_h.m4 | |||
@@ -0,0 +1,125 @@ | |||
1 | # error_h.m4 | ||
2 | # serial 4 | ||
3 | dnl Copyright (C) 1996-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | dnl From Bruno Haible. | ||
9 | dnl Provide a working <error.h>. | ||
10 | |||
11 | AC_DEFUN_ONCE([gl_ERROR_H], | ||
12 | [ | ||
13 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
14 | |||
15 | gl_CHECK_NEXT_HEADERS([error.h]) | ||
16 | if test $ac_cv_header_error_h = yes; then | ||
17 | HAVE_ERROR_H=1 | ||
18 | else | ||
19 | HAVE_ERROR_H=0 | ||
20 | fi | ||
21 | AC_SUBST([HAVE_ERROR_H]) | ||
22 | |||
23 | REPLACE_ERROR=0 | ||
24 | |||
25 | gl_CHECK_FUNCS_ANDROID([error], [[#include <error.h>]]) | ||
26 | if test $ac_cv_func_error = yes; then | ||
27 | HAVE_ERROR=1 | ||
28 | else | ||
29 | HAVE_ERROR=0 | ||
30 | case "$gl_cv_onwards_func_error" in | ||
31 | future*) REPLACE_ERROR=1 ;; | ||
32 | esac | ||
33 | fi | ||
34 | |||
35 | dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer | ||
36 | dnl maintained in Autoconf and because it invokes AC_LIBOBJ. | ||
37 | dnl We need to notice a missing declaration, like gl_CHECK_FUNCS_ANDROID does. | ||
38 | AC_CHECK_DECL([error_at_line], , , [[#include <error.h>]]) | ||
39 | if test $ac_cv_have_decl_error_at_line = yes; then | ||
40 | AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], | ||
41 | [AC_LINK_IFELSE( | ||
42 | [AC_LANG_PROGRAM( | ||
43 | [[#include <error.h>]], | ||
44 | [[error_at_line (0, 0, "", 0, "an error occurred");]])], | ||
45 | [ac_cv_lib_error_at_line=yes], | ||
46 | [ac_cv_lib_error_at_line=no])]) | ||
47 | else | ||
48 | ac_cv_lib_error_at_line=no | ||
49 | fi | ||
50 | if test $ac_cv_lib_error_at_line = yes; then | ||
51 | HAVE_ERROR_AT_LINE=1 | ||
52 | else | ||
53 | HAVE_ERROR_AT_LINE=0 | ||
54 | fi | ||
55 | REPLACE_ERROR_AT_LINE=0 | ||
56 | |||
57 | if test $ac_cv_func_error = yes && test $ac_cv_lib_error_at_line = yes; then | ||
58 | dnl On Android 11, when error_print_progname is set, the output of the | ||
59 | dnl error() function contains an extra space. | ||
60 | AC_CACHE_CHECK([for working error function], | ||
61 | [gl_cv_func_working_error], | ||
62 | [if test $cross_compiling != yes; then | ||
63 | AC_LINK_IFELSE( | ||
64 | [AC_LANG_PROGRAM([[ | ||
65 | #include <error.h> | ||
66 | static void print_no_progname (void) {} | ||
67 | ]], [[ | ||
68 | error_print_progname = print_no_progname; | ||
69 | error (0, 0, "foo"); | ||
70 | ]]) | ||
71 | ], | ||
72 | [rm -f conftest.out | ||
73 | if test -s conftest$ac_exeext \ | ||
74 | && ./conftest$ac_exeext 2> conftest.out; then | ||
75 | if grep ' ' conftest.out >/dev/null; then | ||
76 | gl_cv_func_working_error=no | ||
77 | else | ||
78 | gl_cv_func_working_error=yes | ||
79 | fi | ||
80 | else | ||
81 | gl_cv_func_working_error=no | ||
82 | fi | ||
83 | rm -f conftest.out | ||
84 | ], | ||
85 | [gl_cv_func_working_error=no]) | ||
86 | else | ||
87 | AC_COMPILE_IFELSE( | ||
88 | [AC_LANG_PROGRAM([[ | ||
89 | #include <error.h> | ||
90 | ]], [[ | ||
91 | error (0, 0, "foo"); | ||
92 | ]]) | ||
93 | ], | ||
94 | [case "$host_os" in | ||
95 | # Guess yes on glibc systems. | ||
96 | *-gnu* | gnu*) gl_cv_func_working_error="guessing yes" ;; | ||
97 | # Guess no on Android. | ||
98 | linux*-android*) gl_cv_func_working_error="guessing no" ;; | ||
99 | # If we don't know, obey --enable-cross-guesses. | ||
100 | *) gl_cv_func_working_error="$gl_cross_guess_normal" ;; | ||
101 | esac | ||
102 | ], | ||
103 | [gl_cv_func_working_error=no]) | ||
104 | fi | ||
105 | ]) | ||
106 | case "$gl_cv_func_working_error" in | ||
107 | *no) | ||
108 | REPLACE_ERROR=1 | ||
109 | REPLACE_ERROR_AT_LINE=1 | ||
110 | ;; | ||
111 | esac | ||
112 | fi | ||
113 | |||
114 | if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ | ||
115 | || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then | ||
116 | COMPILE_ERROR_C=1 | ||
117 | else | ||
118 | COMPILE_ERROR_C=0 | ||
119 | fi | ||
120 | |||
121 | AC_SUBST([HAVE_ERROR]) | ||
122 | AC_SUBST([HAVE_ERROR_AT_LINE]) | ||
123 | AC_SUBST([REPLACE_ERROR]) | ||
124 | AC_SUBST([REPLACE_ERROR_AT_LINE]) | ||
125 | ]) | ||
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4 index 2ef46437..db597afc 100644 --- a/gl/m4/exponentd.m4 +++ b/gl/m4/exponentd.m4 | |||
@@ -1,9 +1,10 @@ | |||
1 | # exponentd.m4 serial 3 | 1 | # exponentd.m4 |
2 | dnl Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], | 7 | AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], |
7 | [ | 8 | [ |
8 | AC_CACHE_CHECK([where to find the exponent in a 'double'], | 9 | AC_CACHE_CHECK([where to find the exponent in a 'double'], |
9 | [gl_cv_cc_double_expbit0], | 10 | [gl_cv_cc_double_expbit0], |
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 5336b8da..1fb68956 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 | |||
@@ -1,10 +1,11 @@ | |||
1 | # serial 23 -*- Autoconf -*- | 1 | # extensions.m4 |
2 | # Enable extensions on systems that normally disable them. | 2 | # serial 25 -*- Autoconf -*- |
3 | dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
3 | 7 | ||
4 | # Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. | 8 | # Enable extensions on systems that normally disable them. |
5 | # This file is free software; the Free Software Foundation | ||
6 | # gives unlimited permission to copy and/or distribute it, | ||
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 9 | ||
9 | dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that | 10 | dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that |
10 | dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. | 11 | dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. |
@@ -229,4 +230,15 @@ AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], | |||
229 | [Define to enable the declarations of ISO C 11 types and functions.]) | 230 | [Define to enable the declarations of ISO C 11 types and functions.]) |
230 | ;; | 231 | ;; |
231 | esac | 232 | esac |
233 | |||
234 | dnl On OpenSolaris derivatives, the include files contains a couple of | ||
235 | dnl declarations that are only activated with an explicit | ||
236 | dnl -D__STDC_WANT_LIB_EXT1__. | ||
237 | AH_VERBATIM([USE_ISO_C_23_ANNEX_K_EXTENSIONS], | ||
238 | [/* Define to enable the declarations of ISO C 23 Annex K types and functions. */ | ||
239 | #if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__) | ||
240 | #undef/**/__STDC_WANT_LIB_EXT1__ | ||
241 | #define __STDC_WANT_LIB_EXT1__ 1 | ||
242 | #endif | ||
243 | ]) | ||
232 | ]) | 244 | ]) |
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index c001b1cf..547da82a 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | dnl 'extern inline' a la ISO C99. | 1 | # extern-inline.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2012-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2012-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl 'extern inline' a la ISO C99. | ||
9 | |||
8 | AC_DEFUN([gl_EXTERN_INLINE], | 10 | AC_DEFUN([gl_EXTERN_INLINE], |
9 | [ | 11 | [ |
10 | AC_CACHE_CHECK([whether ctype.h defines __header_inline], | 12 | AC_CACHE_CHECK([whether ctype.h defines __header_inline], |
@@ -79,7 +81,8 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
79 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | 81 | # define _GL_EXTERN_INLINE_STDHEADER_BUG |
80 | #endif | 82 | #endif |
81 | #if ((__GNUC__ \ | 83 | #if ((__GNUC__ \ |
82 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | 84 | ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ |
85 | && !defined __PCC__) \ | ||
83 | : (199901L <= __STDC_VERSION__ \ | 86 | : (199901L <= __STDC_VERSION__ \ |
84 | && !defined __HP_cc \ | 87 | && !defined __HP_cc \ |
85 | && !defined __PGI \ | 88 | && !defined __PGI \ |
@@ -89,6 +92,7 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
89 | # define _GL_EXTERN_INLINE extern inline | 92 | # define _GL_EXTERN_INLINE extern inline |
90 | # define _GL_EXTERN_INLINE_IN_USE | 93 | # define _GL_EXTERN_INLINE_IN_USE |
91 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | 94 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ |
95 | && !defined __PCC__ \ | ||
92 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) | 96 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
93 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ | 97 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ |
94 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | 98 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ |
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4 new file mode 100644 index 00000000..0c1358ed --- /dev/null +++ b/gl/m4/fclose.m4 | |||
@@ -0,0 +1,99 @@ | |||
1 | # fclose.m4 | ||
2 | # serial 12 | ||
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN_ONCE([gl_FUNC_FCLOSE], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
11 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
12 | |||
13 | gl_FUNC_FFLUSH_STDIN | ||
14 | case "$gl_cv_func_fflush_stdin" in | ||
15 | *yes) ;; | ||
16 | *) REPLACE_FCLOSE=1 ;; | ||
17 | esac | ||
18 | |||
19 | AC_REQUIRE([gl_FUNC_CLOSE]) | ||
20 | if test $REPLACE_CLOSE = 1; then | ||
21 | REPLACE_FCLOSE=1 | ||
22 | fi | ||
23 | |||
24 | case "$host_os" in | ||
25 | openedition) REPLACE_FCLOSE=1 ;; | ||
26 | esac | ||
27 | |||
28 | if test $REPLACE_FCLOSE = 0; then | ||
29 | gl_FUNC_FCLOSE_STDIN | ||
30 | case "$gl_cv_func_fclose_stdin" in | ||
31 | *yes) ;; | ||
32 | *) REPLACE_FCLOSE=1 ;; | ||
33 | esac | ||
34 | fi | ||
35 | ]) | ||
36 | |||
37 | dnl Determine whether fclose works on input streams. | ||
38 | dnl Sets gl_cv_func_fclose_stdin. | ||
39 | |||
40 | AC_DEFUN([gl_FUNC_FCLOSE_STDIN], | ||
41 | [ | ||
42 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
43 | AC_CHECK_HEADERS_ONCE([unistd.h]) | ||
44 | AC_CACHE_CHECK([whether fclose works on input streams], | ||
45 | [gl_cv_func_fclose_stdin], | ||
46 | [echo hello world > conftest.txt | ||
47 | AC_RUN_IFELSE( | ||
48 | [AC_LANG_PROGRAM( | ||
49 | [[#include <fcntl.h> | ||
50 | #include <stdio.h> | ||
51 | #if HAVE_UNISTD_H | ||
52 | # include <unistd.h> | ||
53 | #else /* on Windows with MSVC */ | ||
54 | # include <io.h> | ||
55 | #endif | ||
56 | ]GL_MDA_DEFINES], | ||
57 | [[int fd; | ||
58 | int fd2; | ||
59 | FILE *fp; | ||
60 | fd = open ("conftest.txt", O_RDONLY); | ||
61 | if (fd < 0) | ||
62 | return 1; | ||
63 | if (lseek (fd, 1, SEEK_SET) != 1) | ||
64 | return 2; | ||
65 | fd2 = dup (fd); | ||
66 | if (fd2 < 0) | ||
67 | return 3; | ||
68 | fp = fdopen (fd2, "r"); | ||
69 | if (fp == NULL) | ||
70 | return 4; | ||
71 | if (fgetc (fp) != 'e') | ||
72 | { fclose (fp); return 5; } | ||
73 | /* This fclose() call should reposition the underlying file | ||
74 | descriptor. */ | ||
75 | if (fclose (fp) != 0) | ||
76 | return 6; | ||
77 | if (lseek (fd2, 0, SEEK_CUR) != -1) /* should fail with EBADF */ | ||
78 | return 7; | ||
79 | /* Verify the file position. */ | ||
80 | if (lseek (fd, 0, SEEK_CUR) != 2) | ||
81 | return 8; | ||
82 | return 0; | ||
83 | ]])], | ||
84 | [gl_cv_func_fclose_stdin=yes], | ||
85 | [gl_cv_func_fclose_stdin=no], | ||
86 | [case "$host_os" in | ||
87 | # Guess no on glibc systems. | ||
88 | *-gnu* | gnu*) gl_cv_func_fclose_stdin="guessing no" ;; | ||
89 | # Guess yes on musl systems. | ||
90 | *-musl* | midipix*) gl_cv_func_fclose_stdin="guessing yes" ;; | ||
91 | # Guess no on native Windows. | ||
92 | mingw* | windows*) gl_cv_func_fclose_stdin="guessing no" ;; | ||
93 | # If we don't know, obey --enable-cross-guesses. | ||
94 | *) gl_cv_func_fclose_stdin="$gl_cross_guess_normal" ;; | ||
95 | esac | ||
96 | ]) | ||
97 | rm conftest.txt | ||
98 | ]) | ||
99 | ]) | ||
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 59d558bd..43aa1325 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fcntl-o.m4 serial 7 | 1 | # fcntl-o.m4 |
2 | dnl Copyright (C) 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -117,9 +118,9 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
117 | *) gl_cv_header_working_fcntl_h='no';; | 118 | *) gl_cv_header_working_fcntl_h='no';; |
118 | esac], | 119 | esac], |
119 | [case "$host_os" in | 120 | [case "$host_os" in |
120 | # Guess 'no' on native Windows. | 121 | # Guess 'no' on native Windows. |
121 | mingw*) gl_cv_header_working_fcntl_h='no' ;; | 122 | mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; |
122 | *) gl_cv_header_working_fcntl_h=cross-compiling ;; | 123 | *) gl_cv_header_working_fcntl_h=cross-compiling ;; |
123 | esac | 124 | esac |
124 | ]) | 125 | ]) |
125 | ]) | 126 | ]) |
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 index 524a99af..f6d0f377 100644 --- a/gl/m4/fcntl.m4 +++ b/gl/m4/fcntl.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fcntl.m4 serial 11 | 1 | # fcntl.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -82,7 +83,7 @@ AC_DEFUN([gl_FUNC_FCNTL], | |||
82 | esac | 83 | esac |
83 | 84 | ||
84 | dnl Many systems lack F_DUPFD_CLOEXEC. | 85 | dnl Many systems lack F_DUPFD_CLOEXEC. |
85 | dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. | 86 | dnl NetBSD 10.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. |
86 | AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], | 87 | AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], |
87 | [gl_cv_func_fcntl_f_dupfd_cloexec], | 88 | [gl_cv_func_fcntl_f_dupfd_cloexec], |
88 | [AC_RUN_IFELSE( | 89 | [AC_RUN_IFELSE( |
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 68f4e648..b69f7a0c 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | # fcntl_h.m4 | ||
1 | # serial 20 | 2 | # serial 20 |
2 | # Configure fcntl.h. | 3 | dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. |
3 | dnl Copyright (C) 2006-2007, 2009-2023 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # Configure fcntl.h. | ||
9 | |||
8 | dnl Written by Paul Eggert. | 10 | dnl Written by Paul Eggert. |
9 | 11 | ||
10 | AC_DEFUN_ONCE([gl_FCNTL_H], | 12 | AC_DEFUN_ONCE([gl_FCNTL_H], |
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4 index 3e3c8903..43fc3bf3 100644 --- a/gl/m4/fflush.m4 +++ b/gl/m4/fflush.m4 | |||
@@ -1,9 +1,9 @@ | |||
1 | # fflush.m4 serial 18 | 1 | # fflush.m4 |
2 | 2 | # serial 19 | |
3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl From Eric Blake | 8 | dnl From Eric Blake |
9 | 9 | ||
@@ -79,9 +79,9 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], | |||
79 | [gl_cv_func_fflush_stdin=yes], | 79 | [gl_cv_func_fflush_stdin=yes], |
80 | [gl_cv_func_fflush_stdin=no], | 80 | [gl_cv_func_fflush_stdin=no], |
81 | [case "$host_os" in | 81 | [case "$host_os" in |
82 | # Guess no on native Windows. | 82 | # Guess no on native Windows. |
83 | mingw*) gl_cv_func_fflush_stdin="guessing no" ;; | 83 | mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; |
84 | *) gl_cv_func_fflush_stdin=cross ;; | 84 | *) gl_cv_func_fflush_stdin=cross ;; |
85 | esac | 85 | esac |
86 | ]) | 86 | ]) |
87 | rm conftest.txt | 87 | rm conftest.txt |
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index 2f0c9c4e..c95d4171 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # float_h.m4 serial 13 | 1 | # float_h.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -84,9 +85,11 @@ int main () | |||
84 | [gl_cv_func_itold_works="guessing no"], | 85 | [gl_cv_func_itold_works="guessing no"], |
85 | [gl_cv_func_itold_works="guessing yes"]) | 86 | [gl_cv_func_itold_works="guessing yes"]) |
86 | ;; | 87 | ;; |
87 | # Guess yes on native Windows. | 88 | # Guess yes on native Windows. |
88 | mingw*) gl_cv_func_itold_works="guessing yes" ;; | 89 | mingw* | windows*) |
89 | *) gl_cv_func_itold_works="guessing yes" ;; | 90 | gl_cv_func_itold_works="guessing yes" ;; |
91 | *) | ||
92 | gl_cv_func_itold_works="guessing yes" ;; | ||
90 | esac | 93 | esac |
91 | ]) | 94 | ]) |
92 | ]) | 95 | ]) |
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index c49ffa6b..2572c848 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # floorf.m4 serial 18 | 1 | # floorf.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 21 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -26,7 +27,7 @@ AC_DEFUN([gl_FUNC_FLOORF], | |||
26 | AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559], | 27 | AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559], |
27 | [gl_cv_func_floorf_ieee], | 28 | [gl_cv_func_floorf_ieee], |
28 | [ | 29 | [ |
29 | save_LIBS="$LIBS" | 30 | saved_LIBS="$LIBS" |
30 | LIBS="$LIBS $FLOORF_LIBM" | 31 | LIBS="$LIBS $FLOORF_LIBM" |
31 | AC_RUN_IFELSE( | 32 | AC_RUN_IFELSE( |
32 | [AC_LANG_SOURCE([[ | 33 | [AC_LANG_SOURCE([[ |
@@ -49,17 +50,17 @@ int main (int argc, char *argv[]) | |||
49 | [gl_cv_func_floorf_ieee=yes], | 50 | [gl_cv_func_floorf_ieee=yes], |
50 | [gl_cv_func_floorf_ieee=no], | 51 | [gl_cv_func_floorf_ieee=no], |
51 | [case "$host_os" in | 52 | [case "$host_os" in |
52 | # Guess yes on glibc systems. | 53 | # Guess yes on glibc systems. |
53 | *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; | 54 | *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; |
54 | # Guess yes on musl systems. | 55 | # Guess yes on musl systems. |
55 | *-musl*) gl_cv_func_floorf_ieee="guessing yes" ;; | 56 | *-musl* | midipix*) gl_cv_func_floorf_ieee="guessing yes" ;; |
56 | # Guess yes on native Windows. | 57 | # Guess yes on native Windows. |
57 | mingw*) gl_cv_func_floorf_ieee="guessing yes" ;; | 58 | mingw* | windows*) gl_cv_func_floorf_ieee="guessing yes" ;; |
58 | # If we don't know, obey --enable-cross-guesses. | 59 | # If we don't know, obey --enable-cross-guesses. |
59 | *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; | 60 | *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; |
60 | esac | 61 | esac |
61 | ]) | 62 | ]) |
62 | LIBS="$save_LIBS" | 63 | LIBS="$saved_LIBS" |
63 | ]) | 64 | ]) |
64 | case "$gl_cv_func_floorf_ieee" in | 65 | case "$gl_cv_func_floorf_ieee" in |
65 | *yes) ;; | 66 | *yes) ;; |
@@ -94,7 +95,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], | |||
94 | [[x = funcptr(x) + floorf(x);]])], | 95 | [[x = funcptr(x) + floorf(x);]])], |
95 | [gl_cv_func_floorf_libm=]) | 96 | [gl_cv_func_floorf_libm=]) |
96 | if test "$gl_cv_func_floorf_libm" = "?"; then | 97 | if test "$gl_cv_func_floorf_libm" = "?"; then |
97 | save_LIBS="$LIBS" | 98 | saved_LIBS="$LIBS" |
98 | LIBS="$LIBS -lm" | 99 | LIBS="$LIBS -lm" |
99 | AC_LINK_IFELSE( | 100 | AC_LINK_IFELSE( |
100 | [AC_LANG_PROGRAM( | 101 | [AC_LANG_PROGRAM( |
@@ -106,7 +107,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], | |||
106 | float x;]], | 107 | float x;]], |
107 | [[x = funcptr(x) + floorf(x);]])], | 108 | [[x = funcptr(x) + floorf(x);]])], |
108 | [gl_cv_func_floorf_libm="-lm"]) | 109 | [gl_cv_func_floorf_libm="-lm"]) |
109 | LIBS="$save_LIBS" | 110 | LIBS="$saved_LIBS" |
110 | fi | 111 | fi |
111 | ]) | 112 | ]) |
112 | FLOORF_LIBM="$gl_cv_func_floorf_libm" | 113 | FLOORF_LIBM="$gl_cv_func_floorf_libm" |
diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4 index 9c39ff72..f3b7aadd 100644 --- a/gl/m4/fopen.m4 +++ b/gl/m4/fopen.m4 | |||
@@ -1,15 +1,16 @@ | |||
1 | # fopen.m4 serial 13 | 1 | # fopen.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
7 | AC_DEFUN([gl_FUNC_FOPEN], | 8 | AC_DEFUN([gl_FUNC_FOPEN_ITSELF], |
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
10 | AC_REQUIRE([AC_CANONICAL_HOST]) | 11 | AC_REQUIRE([AC_CANONICAL_HOST]) |
11 | case "$host_os" in | 12 | case "$host_os" in |
12 | mingw* | pw*) | 13 | mingw* | windows* | pw*) |
13 | dnl Replace fopen, for handling of "/dev/null". | 14 | dnl Replace fopen, for handling of "/dev/null". |
14 | REPLACE_FOPEN=1 | 15 | REPLACE_FOPEN=1 |
15 | dnl fopen on mingw also has the trailing slash bug. | 16 | dnl fopen on mingw also has the trailing slash bug. |
@@ -58,6 +59,15 @@ changequote([,])dnl | |||
58 | esac | 59 | esac |
59 | ]) | 60 | ]) |
60 | 61 | ||
62 | AC_DEFUN([gl_FUNC_FOPEN], | ||
63 | [ | ||
64 | AC_REQUIRE([gl_FUNC_FOPEN_ITSELF]) | ||
65 | AC_REQUIRE([gl_FUNC_FCLOSE]) | ||
66 | if test $REPLACE_FCLOSE = 1; then | ||
67 | REPLACE_FOPEN=1 | ||
68 | fi | ||
69 | ]) | ||
70 | |||
61 | AC_DEFUN([gl_FUNC_FOPEN_GNU], | 71 | AC_DEFUN([gl_FUNC_FOPEN_GNU], |
62 | [ | 72 | [ |
63 | AC_REQUIRE([gl_FUNC_FOPEN]) | 73 | AC_REQUIRE([gl_FUNC_FOPEN]) |
@@ -87,7 +97,7 @@ int main () | |||
87 | [gl_cv_func_fopen_mode_x=no], | 97 | [gl_cv_func_fopen_mode_x=no], |
88 | [case "$host_os" in | 98 | [case "$host_os" in |
89 | # Guess yes on glibc and musl systems. | 99 | # Guess yes on glibc and musl systems. |
90 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | 100 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) |
91 | gl_cv_func_fopen_mode_x="guessing yes" ;; | 101 | gl_cv_func_fopen_mode_x="guessing yes" ;; |
92 | # If we don't know, obey --enable-cross-guesses. | 102 | # If we don't know, obey --enable-cross-guesses. |
93 | *) | 103 | *) |
@@ -124,10 +134,10 @@ int main () | |||
124 | [gl_cv_func_fopen_mode_e=no], | 134 | [gl_cv_func_fopen_mode_e=no], |
125 | [case "$host_os" in | 135 | [case "$host_os" in |
126 | # Guess yes on glibc and musl systems. | 136 | # Guess yes on glibc and musl systems. |
127 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | 137 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) |
128 | gl_cv_func_fopen_mode_e="guessing yes" ;; | 138 | gl_cv_func_fopen_mode_e="guessing yes" ;; |
129 | # Guess no on native Windows. | 139 | # Guess no on native Windows. |
130 | mingw*) | 140 | mingw* | windows*) |
131 | gl_cv_func_fopen_mode_e="guessing no" ;; | 141 | gl_cv_func_fopen_mode_e="guessing no" ;; |
132 | # If we don't know, obey --enable-cross-guesses. | 142 | # If we don't know, obey --enable-cross-guesses. |
133 | *) | 143 | *) |
diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4 index b365409d..a77f5b96 100644 --- a/gl/m4/fpurge.m4 +++ b/gl/m4/fpurge.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fpurge.m4 serial 12 | 1 | # fpurge.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -10,7 +11,7 @@ AC_DEFUN([gl_FUNC_FPURGE], | |||
10 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 11 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
11 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) | 12 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) |
12 | AC_CHECK_FUNCS_ONCE([fpurge]) | 13 | AC_CHECK_FUNCS_ONCE([fpurge]) |
13 | AC_CHECK_FUNCS_ONCE([__fpurge]) | 14 | gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]]) |
14 | AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) | 15 | AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) |
15 | if test "x$ac_cv_func_fpurge" = xyes; then | 16 | if test "x$ac_cv_func_fpurge" = xyes; then |
16 | HAVE_FPURGE=1 | 17 | HAVE_FPURGE=1 |
@@ -53,10 +54,10 @@ AC_DEFUN([gl_FUNC_FPURGE], | |||
53 | [gl_cv_func_fpurge_works=yes], | 54 | [gl_cv_func_fpurge_works=yes], |
54 | [gl_cv_func_fpurge_works=no], | 55 | [gl_cv_func_fpurge_works=no], |
55 | [case "$host_os" in | 56 | [case "$host_os" in |
56 | # Guess yes on musl systems. | 57 | # Guess yes on musl systems. |
57 | *-musl*) gl_cv_func_fpurge_works="guessing yes" ;; | 58 | *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;; |
58 | # Otherwise obey --enable-cross-guesses. | 59 | # Otherwise obey --enable-cross-guesses. |
59 | *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; | 60 | *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; |
60 | esac | 61 | esac |
61 | ]) | 62 | ]) |
62 | ]) | 63 | ]) |
diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4 index 35333369..be899456 100644 --- a/gl/m4/freading.m4 +++ b/gl/m4/freading.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # freading.m4 serial 2 | 1 | # freading.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,5 +8,8 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | AC_DEFUN([gl_FUNC_FREADING], | 8 | AC_DEFUN([gl_FUNC_FREADING], |
8 | [ | 9 | [ |
9 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) | 10 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) |
10 | AC_CHECK_FUNCS_ONCE([__freading]) | 11 | gl_CHECK_FUNCS_ANDROID([__freading], |
12 | [[#include <stdio.h> | ||
13 | #include <stdio_ext.h> | ||
14 | ]]) | ||
11 | ]) | 15 | ]) |
diff --git a/gl/m4/free.m4 b/gl/m4/free.m4 index 0389dea3..a2b596d6 100644 --- a/gl/m4/free.m4 +++ b/gl/m4/free.m4 | |||
@@ -1,8 +1,9 @@ | |||
1 | # free.m4 serial 6 | 1 | # free.m4 |
2 | # Copyright (C) 2003-2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
3 | # This file is free software; the Free Software Foundation | 3 | dnl Copyright (C) 2003-2005, 2009-2024 Free Software Foundation, Inc. |
4 | # gives unlimited permission to copy and/or distribute it, | 4 | dnl This file is free software; the Free Software Foundation |
5 | # with or without modifications, as long as this notice is preserved. | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | 7 | ||
7 | # Written by Paul Eggert and Bruno Haible. | 8 | # Written by Paul Eggert and Bruno Haible. |
8 | 9 | ||
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4 index c5fe688c..fb220a1f 100644 --- a/gl/m4/fseek.m4 +++ b/gl/m4/fseek.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fseek.m4 serial 4 | 1 | # fseek.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 index 05ee06bc..5682a1f2 100644 --- a/gl/m4/fseeko.m4 +++ b/gl/m4/fseeko.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fseeko.m4 serial 20 | 1 | # fseeko.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 20 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4 index 7cb2edb0..47777b0c 100644 --- a/gl/m4/fstat.m4 +++ b/gl/m4/fstat.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # fstat.m4 serial 8 | 1 | # fstat.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -10,10 +11,10 @@ AC_DEFUN([gl_FUNC_FSTAT], | |||
10 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) |
11 | 12 | ||
12 | case "$host_os" in | 13 | case "$host_os" in |
13 | mingw* | solaris*) | 14 | darwin* | mingw* | windows* | solaris*) |
15 | dnl macOS and Solaris stat can return a negative tv_nsec. | ||
14 | dnl On MinGW, the original stat() returns st_atime, st_mtime, | 16 | dnl On MinGW, the original stat() returns st_atime, st_mtime, |
15 | dnl st_ctime values that are affected by the time zone. | 17 | dnl st_ctime values that are affected by the time zone. |
16 | dnl Solaris stat can return a negative tv_nsec. | ||
17 | REPLACE_FSTAT=1 | 18 | REPLACE_FSTAT=1 |
18 | ;; | 19 | ;; |
19 | esac | 20 | esac |
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index f65c459f..05a68805 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 | |||
@@ -1,4 +1,10 @@ | |||
1 | #serial 6 | 1 | # fstypename.m4 |
2 | # serial 6 | ||
3 | dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software | ||
4 | dnl Foundation, Inc. | ||
5 | dnl This file is free software; the Free Software Foundation | ||
6 | dnl gives unlimited permission to copy and/or distribute it, | ||
7 | dnl with or without modifications, as long as this notice is preserved. | ||
2 | 8 | ||
3 | dnl From Jim Meyering. | 9 | dnl From Jim Meyering. |
4 | dnl | 10 | dnl |
@@ -6,12 +12,6 @@ dnl See if struct statfs has the f_fstypename member. | |||
6 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. | 12 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. |
7 | dnl | 13 | dnl |
8 | 14 | ||
9 | # Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2023 Free Software | ||
10 | # Foundation, Inc. | ||
11 | # This file is free software; the Free Software Foundation | ||
12 | # gives unlimited permission to copy and/or distribute it, | ||
13 | # with or without modifications, as long as this notice is preserved. | ||
14 | |||
15 | AC_DEFUN([gl_FSTYPENAME], | 15 | AC_DEFUN([gl_FSTYPENAME], |
16 | [ | 16 | [ |
17 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, | 17 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, |
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 88f3ca81..1ce90660 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 | |||
@@ -1,11 +1,11 @@ | |||
1 | # fsusage.m4 | ||
1 | # serial 35 | 2 | # serial 35 |
2 | # Obtaining file system usage information. | 3 | dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
3 | 7 | ||
4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2023 Free Software Foundation, Inc. | 8 | # Obtaining file system usage information. |
5 | # | ||
6 | # This file is free software; the Free Software Foundation | ||
7 | # gives unlimited permission to copy and/or distribute it, | ||
8 | # with or without modifications, as long as this notice is preserved. | ||
9 | 9 | ||
10 | # Written by Jim Meyering. | 10 | # Written by Jim Meyering. |
11 | 11 | ||
@@ -269,7 +269,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; | |||
269 | 269 | ||
270 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. | 270 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. |
271 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, | 271 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, |
272 | # enable the work-around code in fsusage.c. | 272 | # enable the workaround code in fsusage.c. |
273 | AC_DEFUN([gl_STATFS_TRUNCATES], | 273 | AC_DEFUN([gl_STATFS_TRUNCATES], |
274 | [ | 274 | [ |
275 | AC_CACHE_CHECK([for statfs that truncates block counts], | 275 | AC_CACHE_CHECK([for statfs that truncates block counts], |
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4 index 79f1aaf2..ab10736b 100644 --- a/gl/m4/ftell.m4 +++ b/gl/m4/ftell.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # ftell.m4 serial 3 | 1 | # ftell.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 index 4901b168..0eb8fa0d 100644 --- a/gl/m4/ftello.m4 +++ b/gl/m4/ftello.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # ftello.m4 serial 14 | 1 | # ftello.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -37,13 +38,24 @@ AC_DEFUN([gl_FUNC_FTELLO], | |||
37 | if test $gl_cv_var_stdin_large_offset = no; then | 38 | if test $gl_cv_var_stdin_large_offset = no; then |
38 | REPLACE_FTELLO=1 | 39 | REPLACE_FTELLO=1 |
39 | fi | 40 | fi |
41 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
42 | if test $REPLACE_FTELLO = 0; then | ||
43 | dnl On native Windows, in some circumstances, ftell(), ftello(), | ||
44 | dnl fgetpos(), lseek(), _lseeki64() all succeed on devices of type | ||
45 | dnl FILE_TYPE_PIPE. However, to match POSIX behaviour, we want | ||
46 | dnl ftell(), ftello(), fgetpos(), lseek() to fail when the argument fd | ||
47 | dnl designates a pipe. See also | ||
48 | dnl https://github.com/python/cpython/issues/78961#issuecomment-1093800325 | ||
49 | case "$host_os" in | ||
50 | mingw* | windows*) REPLACE_FTELLO=1 ;; | ||
51 | esac | ||
52 | fi | ||
40 | if test $REPLACE_FTELLO = 0; then | 53 | if test $REPLACE_FTELLO = 0; then |
41 | dnl Detect bug on Solaris. | 54 | dnl Detect bug on Solaris. |
42 | dnl ftell and ftello produce incorrect results after putc that followed a | 55 | dnl ftell and ftello produce incorrect results after putc that followed a |
43 | dnl getc call that reached EOF on Solaris. This is because the _IOREAD | 56 | dnl getc call that reached EOF on Solaris. This is because the _IOREAD |
44 | dnl flag does not get cleared in this case, even though _IOWRT gets set, | 57 | dnl flag does not get cleared in this case, even though _IOWRT gets set, |
45 | dnl and ftell and ftello look whether the _IOREAD flag is set. | 58 | dnl and ftell and ftello look whether the _IOREAD flag is set. |
46 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
47 | AC_CACHE_CHECK([whether ftello works], | 59 | AC_CACHE_CHECK([whether ftello works], |
48 | [gl_cv_func_ftello_works], | 60 | [gl_cv_func_ftello_works], |
49 | [ | 61 | [ |
@@ -51,12 +63,12 @@ AC_DEFUN([gl_FUNC_FTELLO], | |||
51 | dnl be opened. | 63 | dnl be opened. |
52 | changequote(,)dnl | 64 | changequote(,)dnl |
53 | case "$host_os" in | 65 | case "$host_os" in |
54 | # Guess no on Solaris. | 66 | # Guess no on Solaris. |
55 | solaris*) gl_cv_func_ftello_works="guessing no" ;; | 67 | solaris*) gl_cv_func_ftello_works="guessing no" ;; |
56 | # Guess yes on native Windows. | 68 | # Guess yes on native Windows. |
57 | mingw*) gl_cv_func_ftello_works="guessing yes" ;; | 69 | mingw* | windows*) gl_cv_func_ftello_works="guessing yes" ;; |
58 | # Guess yes otherwise. | 70 | # Guess yes otherwise. |
59 | *) gl_cv_func_ftello_works="guessing yes" ;; | 71 | *) gl_cv_func_ftello_works="guessing yes" ;; |
60 | esac | 72 | esac |
61 | changequote([,])dnl | 73 | changequote([,])dnl |
62 | AC_RUN_IFELSE( | 74 | AC_RUN_IFELSE( |
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 15f09ffb..8e209177 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # getaddrinfo.m4 serial 34 | 1 | # getaddrinfo.m4 |
2 | dnl Copyright (C) 2004-2023 Free Software Foundation, Inc. | 2 | # serial 35 |
3 | dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -41,7 +42,7 @@ AC_DEFUN([gl_GETADDRINFO], | |||
41 | AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], | 42 | AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], |
42 | gl_cv_w32_getaddrinfo, [ | 43 | gl_cv_w32_getaddrinfo, [ |
43 | gl_cv_w32_getaddrinfo=no | 44 | gl_cv_w32_getaddrinfo=no |
44 | am_save_LIBS="$LIBS" | 45 | gl_saved_LIBS="$LIBS" |
45 | LIBS="$LIBS -lws2_32" | 46 | LIBS="$LIBS -lws2_32" |
46 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 47 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
47 | #ifdef HAVE_WS2TCPIP_H | 48 | #ifdef HAVE_WS2TCPIP_H |
@@ -49,7 +50,7 @@ AC_DEFUN([gl_GETADDRINFO], | |||
49 | #endif | 50 | #endif |
50 | #include <stddef.h> | 51 | #include <stddef.h> |
51 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) | 52 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) |
52 | LIBS="$am_save_LIBS" | 53 | LIBS="$gl_saved_LIBS" |
53 | ]) | 54 | ]) |
54 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then | 55 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then |
55 | GETADDRINFO_LIB="-lws2_32" | 56 | GETADDRINFO_LIB="-lws2_32" |
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 9aaed202..61139039 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 | |||
@@ -1,6 +1,7 @@ | |||
1 | # getdelim.m4 serial 16 | 1 | # getdelim.m4 |
2 | # serial 19 | ||
2 | 3 | ||
3 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | 4 | dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. |
4 | dnl | 5 | dnl |
5 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
6 | dnl gives unlimited permission to copy and/or distribute it, | 7 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -18,7 +19,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
18 | 19 | ||
19 | AC_CHECK_DECLS_ONCE([getdelim]) | 20 | AC_CHECK_DECLS_ONCE([getdelim]) |
20 | 21 | ||
21 | AC_CHECK_FUNCS_ONCE([getdelim]) | 22 | gl_CHECK_FUNCS_ANDROID([getdelim], [[#include <stdio.h>]]) |
22 | if test $ac_cv_func_getdelim = yes; then | 23 | if test $ac_cv_func_getdelim = yes; then |
23 | HAVE_GETDELIM=1 | 24 | HAVE_GETDELIM=1 |
24 | dnl Found it in some library. Verify that it works. | 25 | dnl Found it in some library. Verify that it works. |
@@ -82,8 +83,8 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
82 | ], | 83 | ], |
83 | [gl_cv_func_working_getdelim="guessing yes"], | 84 | [gl_cv_func_working_getdelim="guessing yes"], |
84 | [case "$host_os" in | 85 | [case "$host_os" in |
85 | *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; | 86 | *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; |
86 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; | 87 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; |
87 | esac | 88 | esac |
88 | ]) | 89 | ]) |
89 | ]) | 90 | ]) |
@@ -96,6 +97,9 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
96 | esac | 97 | esac |
97 | else | 98 | else |
98 | HAVE_GETDELIM=0 | 99 | HAVE_GETDELIM=0 |
100 | case "$gl_cv_onwards_func_getdelim" in | ||
101 | future*) REPLACE_GETDELIM=1 ;; | ||
102 | esac | ||
99 | fi | 103 | fi |
100 | 104 | ||
101 | if test $ac_cv_have_decl_getdelim = no; then | 105 | if test $ac_cv_have_decl_getdelim = no; then |
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 index 8bcda905..aaefe9b2 100644 --- a/gl/m4/getdtablesize.m4 +++ b/gl/m4/getdtablesize.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # getdtablesize.m4 serial 8 | 1 | # getdtablesize.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 63f5f636..2f743b7d 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # gethostname.m4 serial 15 | 1 | # gethostname.m4 |
2 | dnl Copyright (C) 2002, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
3 | dnl Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -20,7 +21,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
20 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], | 21 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], |
21 | [gl_cv_w32_gethostname], | 22 | [gl_cv_w32_gethostname], |
22 | [gl_cv_w32_gethostname=no | 23 | [gl_cv_w32_gethostname=no |
23 | gl_save_LIBS="$LIBS" | 24 | gl_saved_LIBS="$LIBS" |
24 | LIBS="$LIBS -lws2_32" | 25 | LIBS="$LIBS -lws2_32" |
25 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 26 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
26 | #ifdef HAVE_WINSOCK2_H | 27 | #ifdef HAVE_WINSOCK2_H |
@@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
28 | #endif | 29 | #endif |
29 | #include <stddef.h> | 30 | #include <stddef.h> |
30 | ]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) | 31 | ]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) |
31 | LIBS="$gl_save_LIBS" | 32 | LIBS="$gl_saved_LIBS" |
32 | ]) | 33 | ]) |
33 | if test "$gl_cv_w32_gethostname" = "yes"; then | 34 | if test "$gl_cv_w32_gethostname" = "yes"; then |
34 | GETHOSTNAME_LIB="-lws2_32" | 35 | GETHOSTNAME_LIB="-lws2_32" |
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 03569f06..36513cd4 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 | |||
@@ -1,6 +1,7 @@ | |||
1 | # getline.m4 serial 30 | 1 | # getline.m4 |
2 | # serial 33 | ||
2 | 3 | ||
3 | dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, | 4 | dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, |
4 | dnl Inc. | 5 | dnl Inc. |
5 | dnl | 6 | dnl |
6 | dnl This file is free software; the Free Software Foundation | 7 | dnl This file is free software; the Free Software Foundation |
@@ -23,12 +24,9 @@ AC_DEFUN([gl_FUNC_GETLINE], | |||
23 | 24 | ||
24 | AC_CHECK_DECLS_ONCE([getline]) | 25 | AC_CHECK_DECLS_ONCE([getline]) |
25 | 26 | ||
26 | gl_getline_needs_run_time_check=no | 27 | gl_CHECK_FUNCS_ANDROID([getline], [[#include <stdio.h>]]) |
27 | AC_CHECK_FUNC([getline], | 28 | if test $ac_cv_func_getline = yes; then |
28 | [dnl Found it in some library. Verify that it works. | 29 | dnl Found it in some library. Verify that it works. |
29 | gl_getline_needs_run_time_check=yes], | ||
30 | [am_cv_func_working_getline=no]) | ||
31 | if test $gl_getline_needs_run_time_check = yes; then | ||
32 | AC_CACHE_CHECK([for working getline function], | 30 | AC_CACHE_CHECK([for working getline function], |
33 | [am_cv_func_working_getline], | 31 | [am_cv_func_working_getline], |
34 | [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data | 32 | [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data |
@@ -79,12 +77,17 @@ AC_DEFUN([gl_FUNC_GETLINE], | |||
79 | ], | 77 | ], |
80 | [am_cv_func_working_getline="guessing yes"], | 78 | [am_cv_func_working_getline="guessing yes"], |
81 | [case "$host_os" in | 79 | [case "$host_os" in |
82 | *-musl*) am_cv_func_working_getline="guessing yes" ;; | 80 | *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;; |
83 | *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; | 81 | *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; |
84 | esac | 82 | esac |
85 | ]) | 83 | ]) |
86 | ]) | 84 | ]) |
87 | ]) | 85 | ]) |
86 | else | ||
87 | am_cv_func_working_getline=no | ||
88 | case "$gl_cv_onwards_func_getline" in | ||
89 | future*) REPLACE_GETLINE=1 ;; | ||
90 | esac | ||
88 | fi | 91 | fi |
89 | 92 | ||
90 | if test $ac_cv_have_decl_getline = no; then | 93 | if test $ac_cv_have_decl_getline = no; then |
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 79e420ba..0918bcd2 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 | |||
@@ -1,13 +1,12 @@ | |||
1 | # Check for getloadavg. | 1 | # getloadavg.m4 |
2 | 2 | # serial 13 | |
3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free Software | 3 | dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software |
4 | # Foundation, Inc. | 4 | dnl Foundation, Inc. |
5 | dnl This file is free software; the Free Software Foundation | ||
6 | dnl gives unlimited permission to copy and/or distribute it, | ||
7 | dnl with or without modifications, as long as this notice is preserved. | ||
5 | 8 | ||
6 | # This file is free software; the Free Software Foundation | 9 | # Check for getloadavg. |
7 | # gives unlimited permission to copy and/or distribute it, | ||
8 | # with or without modifications, as long as this notice is preserved. | ||
9 | |||
10 | #serial 10 | ||
11 | 10 | ||
12 | # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. | 11 | # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. |
13 | # New applications should use gl_GETLOADAVG instead. | 12 | # New applications should use gl_GETLOADAVG instead. |
@@ -20,13 +19,18 @@ AC_DEFUN([gl_GETLOADAVG], | |||
20 | # Persuade glibc <stdlib.h> to declare getloadavg(). | 19 | # Persuade glibc <stdlib.h> to declare getloadavg(). |
21 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 20 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
22 | 21 | ||
23 | gl_save_LIBS=$LIBS | 22 | gl_saved_LIBS=$LIBS |
24 | 23 | ||
25 | # getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, | 24 | # getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, |
26 | # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. | 25 | # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. |
27 | HAVE_GETLOADAVG=1 | 26 | HAVE_GETLOADAVG=1 |
28 | AC_CHECK_FUNC([getloadavg], [], | 27 | gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]]) |
29 | [gl_func_getloadavg_done=no | 28 | if test $ac_cv_func_getloadavg != yes; then |
29 | case "$gl_cv_onwards_func_getloadavg" in | ||
30 | future*) REPLACE_GETLOADAVG=1 ;; | ||
31 | esac | ||
32 | |||
33 | gl_func_getloadavg_done=no | ||
30 | 34 | ||
31 | # Some systems with -lutil have (and need) -lkvm as well, some do not. | 35 | # Some systems with -lutil have (and need) -lkvm as well, some do not. |
32 | # On Solaris, -lkvm requires nlist from -lelf, so check that first | 36 | # On Solaris, -lkvm requires nlist from -lelf, so check that first |
@@ -73,14 +77,15 @@ AC_CHECK_FUNC([getloadavg], [], | |||
73 | AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) | 77 | AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) |
74 | AC_CHECK_LIB([dgc], [dg_sys_info])]) | 78 | AC_CHECK_LIB([dgc], [dg_sys_info])]) |
75 | fi | 79 | fi |
76 | fi]) | 80 | fi |
81 | fi | ||
77 | 82 | ||
78 | if test "x$gl_save_LIBS" = x; then | 83 | if test "x$gl_saved_LIBS" = x; then |
79 | GETLOADAVG_LIBS=$LIBS | 84 | GETLOADAVG_LIBS=$LIBS |
80 | else | 85 | else |
81 | GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"` | 86 | GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_saved_LIBS!!"` |
82 | fi | 87 | fi |
83 | LIBS=$gl_save_LIBS | 88 | LIBS=$gl_saved_LIBS |
84 | 89 | ||
85 | AC_SUBST([GETLOADAVG_LIBS])dnl | 90 | AC_SUBST([GETLOADAVG_LIBS])dnl |
86 | 91 | ||
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 7981a095..297722ea 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # getopt.m4 serial 48 | 1 | # getopt.m4 |
2 | dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 49 |
3 | dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -197,8 +198,8 @@ main () | |||
197 | fi | 198 | fi |
198 | else | 199 | else |
199 | case "$host_os" in | 200 | case "$host_os" in |
200 | darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; | 201 | darwin* | aix* | mingw* | windows*) gl_cv_func_getopt_posix="guessing no";; |
201 | *) gl_cv_func_getopt_posix="guessing yes";; | 202 | *) gl_cv_func_getopt_posix="guessing yes";; |
202 | esac | 203 | esac |
203 | fi | 204 | fi |
204 | ]) | 205 | ]) |
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 index b67c527c..b24f4480 100644 --- a/gl/m4/getprogname.m4 +++ b/gl/m4/getprogname.m4 | |||
@@ -1,16 +1,33 @@ | |||
1 | # getprogname.m4 - check for getprogname or replacements for it | 1 | # getprogname.m4 |
2 | # serial 8 | ||
3 | dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
2 | 7 | ||
3 | # Copyright (C) 2016-2023 Free Software Foundation, Inc. | 8 | # Check for getprogname or replacements for it |
4 | # This file is free software; the Free Software Foundation | ||
5 | # gives unlimited permission to copy and/or distribute it, | ||
6 | # with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | # serial 4 | ||
9 | 9 | ||
10 | AC_DEFUN([gl_FUNC_GETPROGNAME], | 10 | AC_DEFUN([gl_FUNC_GETPROGNAME], |
11 | [ | 11 | [ |
12 | AC_CHECK_FUNCS_ONCE([getprogname getexecname]) | 12 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
14 | gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]]) | ||
15 | if test $ac_cv_func_getprogname = no; then | ||
16 | HAVE_GETPROGNAME=0 | ||
17 | case "$gl_cv_onwards_func_getprogname" in | ||
18 | future*) REPLACE_GETPROGNAME=1 ;; | ||
19 | esac | ||
20 | fi | ||
21 | AC_CHECK_DECLS([program_invocation_name], | ||
22 | [], | ||
23 | [HAVE_DECL_PROGRAM_INVOCATION_NAME=0], | ||
24 | [[#include <errno.h>]]) | ||
25 | ]) | ||
26 | |||
27 | AC_DEFUN([gl_PREREQ_GETPROGNAME], | ||
28 | [ | ||
13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 29 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
30 | AC_CHECK_FUNCS_ONCE([getexecname]) | ||
14 | ac_found=0 | 31 | ac_found=0 |
15 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], | 32 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], |
16 | [#include <errno.h>]) | 33 | [#include <errno.h>]) |
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 index 7eab4e10..c5e1f7ba 100644 --- a/gl/m4/gl-openssl.m4 +++ b/gl/m4/gl-openssl.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # gl-openssl.m4 serial 6 | 1 | # gl-openssl.m4 |
2 | dnl Copyright (C) 2013-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
3 | dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -39,6 +40,9 @@ AC_DEFUN([gl_CRYPTO_CHECK], | |||
39 | AC_SUBST([LIB_CRYPTO]) | 40 | AC_SUBST([LIB_CRYPTO]) |
40 | if test "x$with_openssl" != xno; then | 41 | if test "x$with_openssl" != xno; then |
41 | if test "x$with_openssl" = xauto-gpl-compat; then | 42 | if test "x$with_openssl" = xauto-gpl-compat; then |
43 | dnl OpenSSL versions < 3 are under the OpenSSL license, which is not | ||
44 | dnl GPL compatible. | ||
45 | dnl See <https://www.gnu.org/licenses/license-list.en.html#OpenSSL>. | ||
42 | AC_CACHE_CHECK([whether openssl is GPL compatible], | 46 | AC_CACHE_CHECK([whether openssl is GPL compatible], |
43 | [gl_cv_openssl_gpl_compat], | 47 | [gl_cv_openssl_gpl_compat], |
44 | [AC_COMPILE_IFELSE( | 48 | [AC_COMPILE_IFELSE( |
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 267f0692..fcf84226 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. | 1 | # Copyright (C) 2002-2024 Free Software Foundation, Inc. |
2 | # | 2 | # |
3 | # This file is free software; you can redistribute it and/or modify | 3 | # This file is free software; you can redistribute it and/or modify |
4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index facc3404..cb730449 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # gnulib-common.m4 serial 75a | 1 | # gnulib-common.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 93 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -15,6 +16,10 @@ AC_DEFUN([gl_COMMON], [ | |||
15 | AC_REQUIRE([gl_ZZGNULIB]) | 16 | AC_REQUIRE([gl_ZZGNULIB]) |
16 | ]) | 17 | ]) |
17 | AC_DEFUN([gl_COMMON_BODY], [ | 18 | AC_DEFUN([gl_COMMON_BODY], [ |
19 | AH_VERBATIM([0witness], | ||
20 | [/* Witness that <config.h> has been included. */ | ||
21 | #define _GL_CONFIG_H_INCLUDED 1 | ||
22 | ]) | ||
18 | AH_VERBATIM([_GL_GNUC_PREREQ], | 23 | AH_VERBATIM([_GL_GNUC_PREREQ], |
19 | [/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ | 24 | [/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ |
20 | #if defined __GNUC__ && defined __GNUC_MINOR__ | 25 | #if defined __GNUC__ && defined __GNUC_MINOR__ |
@@ -72,50 +77,74 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
72 | #endif]) | 77 | #endif]) |
73 | AH_VERBATIM([attribute], | 78 | AH_VERBATIM([attribute], |
74 | [/* Attributes. */ | 79 | [/* Attributes. */ |
75 | #if (defined __has_attribute \ | 80 | /* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if |
76 | && (!defined __clang_minor__ \ | 81 | <config.h> gets included once again after <sys/cdefs.h>, __has_attribute(x) |
77 | || (defined __apple_build_version__ \ | 82 | expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all |
78 | ? 6000000 <= __apple_build_version__ \ | 83 | attributes. */ |
79 | : 3 < __clang_major__ + (5 <= __clang_minor__)))) | 84 | #ifndef _GL_HAS_ATTRIBUTE |
80 | # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) | 85 | # if (defined __has_attribute \ |
81 | #else | 86 | && (!defined __clang_minor__ \ |
82 | # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr | 87 | || (defined __apple_build_version__ \ |
83 | # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) | 88 | ? 7000000 <= __apple_build_version__ \ |
84 | # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) | 89 | : 5 <= __clang_major__))) |
85 | # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) | 90 | # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) |
86 | # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) | ||
87 | # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) | ||
88 | # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) | ||
89 | # define _GL_ATTR_diagnose_if 0 | ||
90 | # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) | ||
91 | # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) | ||
92 | # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) | ||
93 | # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) | ||
94 | # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) | ||
95 | # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) | ||
96 | # ifdef _ICC | ||
97 | # define _GL_ATTR_may_alias 0 | ||
98 | # else | 91 | # else |
99 | # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) | 92 | # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr |
93 | # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) | ||
94 | # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) | ||
95 | # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) | ||
96 | # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) | ||
97 | # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) | ||
98 | # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) | ||
99 | # define _GL_ATTR_diagnose_if 0 | ||
100 | # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) | ||
101 | # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) | ||
102 | # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) | ||
103 | # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) | ||
104 | # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) | ||
105 | # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) | ||
106 | # ifdef _ICC | ||
107 | # define _GL_ATTR_may_alias 0 | ||
108 | # else | ||
109 | # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) | ||
110 | # endif | ||
111 | # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) | ||
112 | # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) | ||
113 | # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) | ||
114 | # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) | ||
115 | # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) | ||
116 | # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) | ||
117 | # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) | ||
118 | # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) | ||
119 | # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) | ||
120 | # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) | ||
100 | # endif | 121 | # endif |
101 | # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) | ||
102 | # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) | ||
103 | # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) | ||
104 | # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) | ||
105 | # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) | ||
106 | # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) | ||
107 | # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) | ||
108 | # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) | ||
109 | # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) | ||
110 | # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) | ||
111 | #endif | 122 | #endif |
112 | 123 | ||
113 | /* Disable GCC -Wpedantic if using __has_c_attribute and this is not C23+. */ | 124 | /* Use __has_c_attribute if available. However, do not use with |
114 | #if (defined __has_c_attribute && _GL_GNUC_PREREQ (4, 6) \ | 125 | pre-C23 GCC, which can issue false positives if -Wpedantic. */ |
115 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710) | 126 | #if (defined __has_c_attribute \ |
116 | # pragma GCC diagnostic ignored "-Wpedantic" | 127 | && ! (_GL_GNUC_PREREQ (4, 6) \ |
128 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)) | ||
129 | # define _GL_HAVE___HAS_C_ATTRIBUTE 1 | ||
130 | #else | ||
131 | # define _GL_HAVE___HAS_C_ATTRIBUTE 0 | ||
117 | #endif | 132 | #endif |
118 | 133 | ||
134 | /* Define if, in a function declaration, the attributes in bracket syntax | ||
135 | [[...]] must come before the attributes in __attribute__((...)) syntax. | ||
136 | If this is defined, it is best to avoid the bracket syntax, so that the | ||
137 | various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any | ||
138 | order. */ | ||
139 | #ifdef __cplusplus | ||
140 | # if defined __clang__ | ||
141 | # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 | ||
142 | # endif | ||
143 | #else | ||
144 | # if defined __GNUC__ && !defined __clang__ | ||
145 | # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 | ||
146 | # endif | ||
147 | #endif | ||
119 | ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. | 148 | ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. |
120 | [ | 149 | [ |
121 | /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function | 150 | /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function |
@@ -223,9 +252,11 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
223 | - typedef, | 252 | - typedef, |
224 | in C++ also: namespace, class, template specialization. */ | 253 | in C++ also: namespace, class, template specialization. */ |
225 | #ifndef _GL_ATTRIBUTE_DEPRECATED | 254 | #ifndef _GL_ATTRIBUTE_DEPRECATED |
226 | # ifdef __has_c_attribute | 255 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
227 | # if __has_c_attribute (__deprecated__) | 256 | # if _GL_HAVE___HAS_C_ATTRIBUTE |
228 | # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] | 257 | # if __has_c_attribute (__deprecated__) |
258 | # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] | ||
259 | # endif | ||
229 | # endif | 260 | # endif |
230 | # endif | 261 | # endif |
231 | # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) | 262 | # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) |
@@ -271,7 +302,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
271 | /* Applies to: Empty statement (;), inside a 'switch' statement. */ | 302 | /* Applies to: Empty statement (;), inside a 'switch' statement. */ |
272 | /* Always expands to something. */ | 303 | /* Always expands to something. */ |
273 | #ifndef _GL_ATTRIBUTE_FALLTHROUGH | 304 | #ifndef _GL_ATTRIBUTE_FALLTHROUGH |
274 | # ifdef __has_c_attribute | 305 | # if _GL_HAVE___HAS_C_ATTRIBUTE |
275 | # if __has_c_attribute (__fallthrough__) | 306 | # if __has_c_attribute (__fallthrough__) |
276 | # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] | 307 | # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] |
277 | # endif | 308 | # endif |
@@ -351,11 +382,19 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
351 | in C++ also: class. */ | 382 | in C++ also: class. */ |
352 | /* In C++ and C23, this is spelled [[__maybe_unused__]]. | 383 | /* In C++ and C23, this is spelled [[__maybe_unused__]]. |
353 | GCC's syntax is __attribute__ ((__unused__)). | 384 | GCC's syntax is __attribute__ ((__unused__)). |
354 | clang supports both syntaxes. */ | 385 | clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode, |
386 | __has_c_attribute (__maybe_unused__) yields true but the use of | ||
387 | [[__maybe_unused__]] nevertheless produces a warning. */ | ||
355 | #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | 388 | #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED |
356 | # ifdef __has_c_attribute | 389 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
357 | # if __has_c_attribute (__maybe_unused__) | 390 | # if defined __clang__ && defined __cplusplus |
358 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | 391 | # if !defined __apple_build_version__ && __clang_major__ >= 10 |
392 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | ||
393 | # endif | ||
394 | # elif _GL_HAVE___HAS_C_ATTRIBUTE | ||
395 | # if __has_c_attribute (__maybe_unused__) | ||
396 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | ||
397 | # endif | ||
359 | # endif | 398 | # endif |
360 | # endif | 399 | # endif |
361 | # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | 400 | # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED |
@@ -373,9 +412,20 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
373 | the return value, unless the caller uses something like ignore_value. */ | 412 | the return value, unless the caller uses something like ignore_value. */ |
374 | /* Applies to: function, enumeration, class. */ | 413 | /* Applies to: function, enumeration, class. */ |
375 | #ifndef _GL_ATTRIBUTE_NODISCARD | 414 | #ifndef _GL_ATTRIBUTE_NODISCARD |
376 | # ifdef __has_c_attribute | 415 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
377 | # if __has_c_attribute (__nodiscard__) | 416 | # if defined __clang__ && defined __cplusplus |
378 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | 417 | /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces |
418 | a warning. | ||
419 | The 1000 below means a yet unknown threshold. When clang++ version X | ||
420 | starts supporting [[__nodiscard__]] without warning about it, you can | ||
421 | replace the 1000 with X. */ | ||
422 | # if __clang_major__ >= 1000 | ||
423 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | ||
424 | # endif | ||
425 | # elif _GL_HAVE___HAS_C_ATTRIBUTE | ||
426 | # if __has_c_attribute (__nodiscard__) | ||
427 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | ||
428 | # endif | ||
379 | # endif | 429 | # endif |
380 | # endif | 430 | # endif |
381 | # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) | 431 | # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) |
@@ -427,11 +477,25 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
427 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | 477 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. |
428 | */ | 478 | */ |
429 | /* Applies to: functions. */ | 479 | /* Applies to: functions. */ |
480 | /* After a function's parameter list, this attribute must come first, before | ||
481 | other attributes. */ | ||
430 | #ifndef _GL_ATTRIBUTE_NOTHROW | 482 | #ifndef _GL_ATTRIBUTE_NOTHROW |
431 | # if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus | 483 | # if defined __cplusplus |
432 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | 484 | # if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 |
485 | # if __cplusplus >= 201103L | ||
486 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
487 | # else | ||
488 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
489 | # endif | ||
490 | # else | ||
491 | # define _GL_ATTRIBUTE_NOTHROW | ||
492 | # endif | ||
433 | # else | 493 | # else |
434 | # define _GL_ATTRIBUTE_NOTHROW | 494 | # if _GL_HAS_ATTRIBUTE (nothrow) |
495 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
496 | # else | ||
497 | # define _GL_ATTRIBUTE_NOTHROW | ||
498 | # endif | ||
435 | # endif | 499 | # endif |
436 | #endif | 500 | #endif |
437 | 501 | ||
@@ -441,8 +505,10 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
441 | minimizing the memory required. */ | 505 | minimizing the memory required. */ |
442 | /* Applies to: struct members, struct, union, | 506 | /* Applies to: struct members, struct, union, |
443 | in C++ also: class. */ | 507 | in C++ also: class. */ |
508 | /* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite | ||
509 | __has_attribute OK. */ | ||
444 | #ifndef _GL_ATTRIBUTE_PACKED | 510 | #ifndef _GL_ATTRIBUTE_PACKED |
445 | # if _GL_HAS_ATTRIBUTE (packed) | 511 | # if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C |
446 | # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) | 512 | # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) |
447 | # else | 513 | # else |
448 | # define _GL_ATTRIBUTE_PACKED | 514 | # define _GL_ATTRIBUTE_PACKED |
@@ -513,6 +579,18 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
513 | # endif | 579 | # endif |
514 | #endif | 580 | #endif |
515 | ]) | 581 | ]) |
582 | AH_VERBATIM([c_linkage], | ||
583 | [/* In C++, there is the concept of "language linkage", that encompasses | ||
584 | name mangling and function calling conventions. | ||
585 | The following macros start and end a block of "C" linkage. */ | ||
586 | #ifdef __cplusplus | ||
587 | # define _GL_BEGIN_C_LINKAGE extern "C" { | ||
588 | # define _GL_END_C_LINKAGE } | ||
589 | #else | ||
590 | # define _GL_BEGIN_C_LINKAGE | ||
591 | # define _GL_END_C_LINKAGE | ||
592 | #endif | ||
593 | ]) | ||
516 | AH_VERBATIM([async_safe], | 594 | AH_VERBATIM([async_safe], |
517 | [/* The _GL_ASYNC_SAFE marker should be attached to functions that are | 595 | [/* The _GL_ASYNC_SAFE marker should be attached to functions that are |
518 | signal handlers (for signals other than SIGABRT, SIGPIPE) or can be | 596 | signal handlers (for signals other than SIGABRT, SIGPIPE) or can be |
@@ -568,7 +646,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
568 | dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), | 646 | dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), |
569 | dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). | 647 | dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). |
570 | AC_ARG_ENABLE([cross-guesses], | 648 | AC_ARG_ENABLE([cross-guesses], |
571 | [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], | 649 | [AS_HELP_STRING([[--enable-cross-guesses={conservative|risky}]], |
572 | [specify policy for cross-compilation guesses])], | 650 | [specify policy for cross-compilation guesses])], |
573 | [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then | 651 | [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then |
574 | AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) | 652 | AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) |
@@ -1005,6 +1083,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], | |||
1005 | dnl -Wno-pedantic >= 4.8 >= 3.9 | 1083 | dnl -Wno-pedantic >= 4.8 >= 3.9 |
1006 | dnl -Wno-sign-compare >= 3 >= 3.9 | 1084 | dnl -Wno-sign-compare >= 3 >= 3.9 |
1007 | dnl -Wno-sign-conversion >= 4.3 >= 3.9 | 1085 | dnl -Wno-sign-conversion >= 4.3 >= 3.9 |
1086 | dnl -Wno-tautological-out-of-range-compare - >= 3.9 | ||
1008 | dnl -Wno-type-limits >= 4.3 >= 3.9 | 1087 | dnl -Wno-type-limits >= 4.3 >= 3.9 |
1009 | dnl -Wno-undef >= 3 >= 3.9 | 1088 | dnl -Wno-undef >= 3 >= 3.9 |
1010 | dnl -Wno-unsuffixed-float-constants >= 4.5 | 1089 | dnl -Wno-unsuffixed-float-constants >= 4.5 |
@@ -1030,6 +1109,9 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], | |||
1030 | #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1109 | #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
1031 | -Wno-pedantic | 1110 | -Wno-pedantic |
1032 | #endif | 1111 | #endif |
1112 | #if 3 < __clang_major__ + (9 <= __clang_minor__) | ||
1113 | -Wno-tautological-constant-out-of-range-compare | ||
1114 | #endif | ||
1033 | #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1115 | #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
1034 | -Wno-sign-conversion | 1116 | -Wno-sign-conversion |
1035 | -Wno-type-limits | 1117 | -Wno-type-limits |
@@ -1080,6 +1162,238 @@ AC_DEFUN([gl_CONDITIONAL_HEADER], | |||
1080 | m4_popdef([gl_header_name]) | 1162 | m4_popdef([gl_header_name]) |
1081 | ]) | 1163 | ]) |
1082 | 1164 | ||
1165 | dnl Preparations for gl_CHECK_FUNCS_MACOS. | ||
1166 | AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS], | ||
1167 | [ | ||
1168 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
1169 | AC_REQUIRE([gl_COMPILER_CLANG]) | ||
1170 | AC_CACHE_CHECK([for compiler option needed when checking for future declarations], | ||
1171 | [gl_cv_compiler_check_future_option], | ||
1172 | [case "$host_os" in | ||
1173 | dnl This is only needed on macOS. | ||
1174 | darwin*) | ||
1175 | if test $gl_cv_compiler_clang = yes; then | ||
1176 | dnl Test whether the compiler supports the option | ||
1177 | dnl '-Werror=unguarded-availability-new'. | ||
1178 | saved_ac_compile="$ac_compile" | ||
1179 | ac_compile="$ac_compile -Werror=unguarded-availability-new" | ||
1180 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], | ||
1181 | [gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'], | ||
1182 | [gl_cv_compiler_check_future_option=none]) | ||
1183 | ac_compile="$saved_ac_compile" | ||
1184 | else | ||
1185 | gl_cv_compiler_check_future_option=none | ||
1186 | fi | ||
1187 | ;; | ||
1188 | *) gl_cv_compiler_check_future_option=none ;; | ||
1189 | esac | ||
1190 | ]) | ||
1191 | ]) | ||
1192 | |||
1193 | dnl Pieces of the expansion of | ||
1194 | dnl gl_CHECK_FUNCS_ANDROID | ||
1195 | dnl gl_CHECK_FUNCS_MACOS | ||
1196 | dnl gl_CHECK_FUNCS_ANDROID_MACOS | ||
1197 | |||
1198 | AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE], | ||
1199 | [ | ||
1200 | *) | ||
1201 | AC_CHECK_FUNC([$1]) | ||
1202 | [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] | ||
1203 | ;; | ||
1204 | ]) | ||
1205 | |||
1206 | AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID], | ||
1207 | [ | ||
1208 | linux*-android*) | ||
1209 | AC_CHECK_DECL([$1], , , [$2]) | ||
1210 | if test $[ac_cv_have_decl_][$1] = yes; then | ||
1211 | AC_CHECK_FUNC([[$1]]) | ||
1212 | if test $[ac_cv_func_][$1] = yes; then | ||
1213 | [gl_cv_onwards_func_][$1]=yes | ||
1214 | else | ||
1215 | dnl The function is declared but does not exist. This should not | ||
1216 | dnl happen normally. But anyway, we know that a future version | ||
1217 | dnl of Android will have the function. | ||
1218 | [gl_cv_onwards_func_][$1]='future OS version' | ||
1219 | fi | ||
1220 | else | ||
1221 | [gl_cv_onwards_func_][$1]='future OS version' | ||
1222 | fi | ||
1223 | ;; | ||
1224 | ]) | ||
1225 | |||
1226 | AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS], | ||
1227 | [ | ||
1228 | darwin*) | ||
1229 | if test "x$gl_cv_compiler_check_future_option" != "xnone"; then | ||
1230 | dnl Use a compile test, not a link test. | ||
1231 | saved_ac_compile="$ac_compile" | ||
1232 | ac_compile="$ac_compile $gl_cv_compiler_check_future_option" | ||
1233 | saved_ac_compile_for_check_decl="$ac_compile_for_check_decl" | ||
1234 | ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option" | ||
1235 | unset [ac_cv_have_decl_][$1] | ||
1236 | AC_CHECK_DECL([$1], , , [$2]) | ||
1237 | ac_compile="$saved_ac_compile" | ||
1238 | ac_compile_for_check_decl="$saved_ac_compile_for_check_decl" | ||
1239 | [ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]" | ||
1240 | if test $[ac_cv_func_][$1] = yes; then | ||
1241 | [gl_cv_onwards_func_][$1]=yes | ||
1242 | else | ||
1243 | unset [ac_cv_have_decl_][$1] | ||
1244 | AC_CHECK_DECL([$1], , , [$2]) | ||
1245 | if test $[ac_cv_have_decl_][$1] = yes; then | ||
1246 | [gl_cv_onwards_func_][$1]='future OS version' | ||
1247 | else | ||
1248 | [gl_cv_onwards_func_][$1]=no | ||
1249 | fi | ||
1250 | fi | ||
1251 | else | ||
1252 | AC_CHECK_FUNC([$1]) | ||
1253 | [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] | ||
1254 | fi | ||
1255 | ;; | ||
1256 | ]) | ||
1257 | |||
1258 | AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS], | ||
1259 | [ | ||
1260 | case "$[gl_cv_onwards_func_][$1]" in | ||
1261 | future*) [ac_cv_func_][$1]=no ;; | ||
1262 | *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;; | ||
1263 | esac | ||
1264 | if test $[ac_cv_func_][$1] = yes; then | ||
1265 | AC_DEFINE([HAVE_]m4_translit([[$1]], | ||
1266 | [abcdefghijklmnopqrstuvwxyz], | ||
1267 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), | ||
1268 | [1], [Define to 1 if you have the `$1' function.]) | ||
1269 | fi | ||
1270 | ]) | ||
1271 | |||
1272 | dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) | ||
1273 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
1274 | dnl on Android. | ||
1275 | dnl | ||
1276 | dnl When code is compiled on Android, it is in the context of a certain | ||
1277 | dnl "Android API level", which indicates the minimum version of Android on | ||
1278 | dnl which the app can be installed. In other words, you don't compile for a | ||
1279 | dnl specific version of Android. You compile for all versions of Android, | ||
1280 | dnl onwards from the given API level. | ||
1281 | dnl Thus, the question "does the OS have the function func" has three possible | ||
1282 | dnl answers: | ||
1283 | dnl - yes, in all versions starting from the given API level, | ||
1284 | dnl - no, in no version, | ||
1285 | dnl - not in the given API level, but in a later version of Android. | ||
1286 | dnl | ||
1287 | dnl In detail, this works as follows: | ||
1288 | dnl If func was added to Android API level, say, 28, then the libc.so has the | ||
1289 | dnl symbol func always, whereas the header file <foo.h> declares func | ||
1290 | dnl conditionally: | ||
1291 | dnl #if __ANDROID_API__ >= 28 | ||
1292 | dnl ... func (...) __INTRODUCED_IN(28); | ||
1293 | dnl #endif | ||
1294 | dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28", | ||
1295 | dnl the function func is declared and exists in libc. | ||
1296 | dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27", | ||
1297 | dnl the function func is not declared but exists in libc. | ||
1298 | dnl | ||
1299 | dnl This macro sets two variables: | ||
1300 | dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" | ||
1301 | dnl - ac_cv_func_<func> to yes / no / no | ||
1302 | dnl The first variable allows to distinguish all three cases. | ||
1303 | dnl The second variable is set, so that an invocation | ||
1304 | dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) | ||
1305 | dnl can be used as a drop-in replacement for | ||
1306 | dnl AC_CHECK_FUNCS([func]). | ||
1307 | AC_DEFUN([gl_CHECK_FUNCS_ANDROID], | ||
1308 | [ | ||
1309 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
1310 | AC_CACHE_CHECK([for [$1]], | ||
1311 | [[gl_cv_onwards_func_][$1]], | ||
1312 | [gl_SILENT([ | ||
1313 | case "$host_os" in | ||
1314 | gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) | ||
1315 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
1316 | esac | ||
1317 | ]) | ||
1318 | ]) | ||
1319 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
1320 | ]) | ||
1321 | |||
1322 | dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) | ||
1323 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
1324 | dnl on macOS. | ||
1325 | dnl | ||
1326 | dnl When code is compiled on macOS, it is in the context of a certain minimum | ||
1327 | dnl macOS version, that can be set through the option '-mmacosx-version-min='. | ||
1328 | dnl In other words, you don't compile for a specific version of macOS. You | ||
1329 | dnl compile for all versions of macOS, onwards from the given version. | ||
1330 | dnl Thus, the question "does the OS have the function func" has three possible | ||
1331 | dnl answers: | ||
1332 | dnl - yes, in all versions starting from the given version, | ||
1333 | dnl - no, in no version, | ||
1334 | dnl - not in the given version, but in a later version of macOS. | ||
1335 | dnl | ||
1336 | dnl In detail, this works as follows: | ||
1337 | dnl If func was added to, say, macOS version 13, then the libc has the | ||
1338 | dnl symbol func always, whereas the header file <foo.h> declares func | ||
1339 | dnl conditionally with a special availability attribute: | ||
1340 | dnl ... func (...) __attribute__((availability(macos,introduced=13.0))); | ||
1341 | dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no | ||
1342 | dnl warning about the use of func, and the resulting binary | ||
1343 | dnl - runs fine on macOS 13, | ||
1344 | dnl - aborts with a dyld "Symbol not found" message on macOS 12. | ||
1345 | dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a | ||
1346 | dnl warning: 'func' is only available on macOS 13.0 or newer | ||
1347 | dnl [-Wunguarded-availability-new], | ||
1348 | dnl and the resulting binary | ||
1349 | dnl - runs fine on macOS 13, | ||
1350 | dnl - crashes with a SIGSEGV (signal 11) on macOS 12. | ||
1351 | dnl | ||
1352 | dnl This macro sets two variables: | ||
1353 | dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" | ||
1354 | dnl - ac_cv_func_<func> to yes / no / no | ||
1355 | dnl The first variable allows to distinguish all three cases. | ||
1356 | dnl The second variable is set, so that an invocation | ||
1357 | dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) | ||
1358 | dnl can be used as a drop-in replacement for | ||
1359 | dnl AC_CHECK_FUNCS([func]). | ||
1360 | AC_DEFUN([gl_CHECK_FUNCS_MACOS], | ||
1361 | [ | ||
1362 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
1363 | AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) | ||
1364 | AC_CACHE_CHECK([for [$1]], | ||
1365 | [[gl_cv_onwards_func_][$1]], | ||
1366 | [gl_SILENT([ | ||
1367 | case "$host_os" in | ||
1368 | gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) | ||
1369 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
1370 | esac | ||
1371 | ]) | ||
1372 | ]) | ||
1373 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
1374 | ]) | ||
1375 | |||
1376 | dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include <foo.h>]]) | ||
1377 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
1378 | dnl on Android and on macOS. | ||
1379 | dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS. | ||
1380 | AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS], | ||
1381 | [ | ||
1382 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
1383 | AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) | ||
1384 | AC_CACHE_CHECK([for [$1]], | ||
1385 | [[gl_cv_onwards_func_][$1]], | ||
1386 | [gl_SILENT([ | ||
1387 | case "$host_os" in | ||
1388 | gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) | ||
1389 | gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) | ||
1390 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
1391 | esac | ||
1392 | ]) | ||
1393 | ]) | ||
1394 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
1395 | ]) | ||
1396 | |||
1083 | dnl Expands to some code for use in .c programs that, on native Windows, defines | 1397 | dnl Expands to some code for use in .c programs that, on native Windows, defines |
1084 | dnl the Microsoft deprecated alias function names to the underscore-prefixed | 1398 | dnl the Microsoft deprecated alias function names to the underscore-prefixed |
1085 | dnl actual function names. With this macro, these function names are available | 1399 | dnl actual function names. With this macro, these function names are available |
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 4764622e..83a0f727 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! | 1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! |
2 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | # Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | # | 3 | # |
4 | # This file is free software; you can redistribute it and/or modify | 4 | # This file is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -43,6 +43,7 @@ AC_DEFUN([gl_EARLY], | |||
43 | AC_REQUIRE([gl_PROG_AR_RANLIB]) | 43 | AC_REQUIRE([gl_PROG_AR_RANLIB]) |
44 | 44 | ||
45 | # Code from module absolute-header: | 45 | # Code from module absolute-header: |
46 | # Code from module alignasof: | ||
46 | # Code from module alloca-opt: | 47 | # Code from module alloca-opt: |
47 | # Code from module arpa_inet: | 48 | # Code from module arpa_inet: |
48 | # Code from module assert-h: | 49 | # Code from module assert-h: |
@@ -67,6 +68,7 @@ AC_DEFUN([gl_EARLY], | |||
67 | # Code from module environ: | 68 | # Code from module environ: |
68 | # Code from module errno: | 69 | # Code from module errno: |
69 | # Code from module error: | 70 | # Code from module error: |
71 | # Code from module error-h: | ||
70 | # Code from module exitfail: | 72 | # Code from module exitfail: |
71 | # Code from module extensions: | 73 | # Code from module extensions: |
72 | # Code from module extern-inline: | 74 | # Code from module extern-inline: |
@@ -112,6 +114,11 @@ AC_DEFUN([gl_EARLY], | |||
112 | # Code from module inet_ntop: | 114 | # Code from module inet_ntop: |
113 | # Code from module intprops: | 115 | # Code from module intprops: |
114 | # Code from module inttypes-incomplete: | 116 | # Code from module inttypes-incomplete: |
117 | # Code from module iswblank: | ||
118 | # Code from module iswctype: | ||
119 | # Code from module iswdigit: | ||
120 | # Code from module iswpunct: | ||
121 | # Code from module iswxdigit: | ||
115 | # Code from module langinfo: | 122 | # Code from module langinfo: |
116 | # Code from module largefile: | 123 | # Code from module largefile: |
117 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 124 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
@@ -128,6 +135,7 @@ AC_DEFUN([gl_EARLY], | |||
128 | # Code from module math: | 135 | # Code from module math: |
129 | # Code from module mbrtowc: | 136 | # Code from module mbrtowc: |
130 | # Code from module mbsinit: | 137 | # Code from module mbsinit: |
138 | # Code from module mbszero: | ||
131 | # Code from module mbtowc: | 139 | # Code from module mbtowc: |
132 | # Code from module memchr: | 140 | # Code from module memchr: |
133 | # Code from module minmax: | 141 | # Code from module minmax: |
@@ -150,6 +158,7 @@ AC_DEFUN([gl_EARLY], | |||
150 | # Code from module servent: | 158 | # Code from module servent: |
151 | # Code from module setenv: | 159 | # Code from module setenv: |
152 | # Code from module setlocale-null: | 160 | # Code from module setlocale-null: |
161 | # Code from module setlocale-null-unlocked: | ||
153 | # Code from module size_max: | 162 | # Code from module size_max: |
154 | # Code from module snippet/_Noreturn: | 163 | # Code from module snippet/_Noreturn: |
155 | # Code from module snippet/arg-nonnull: | 164 | # Code from module snippet/arg-nonnull: |
@@ -163,12 +172,12 @@ AC_DEFUN([gl_EARLY], | |||
163 | # Code from module stat: | 172 | # Code from module stat: |
164 | # Code from module stat-time: | 173 | # Code from module stat-time: |
165 | # Code from module std-gnu11: | 174 | # Code from module std-gnu11: |
166 | # Code from module stdalign: | ||
167 | # Code from module stdbool: | 175 | # Code from module stdbool: |
168 | # Code from module stdckdint: | 176 | # Code from module stdckdint: |
169 | # Code from module stddef: | 177 | # Code from module stddef: |
170 | # Code from module stdint: | 178 | # Code from module stdint: |
171 | # Code from module stdio: | 179 | # Code from module stdio: |
180 | gl_STDIO_H_EARLY | ||
172 | # Code from module stdlib: | 181 | # Code from module stdlib: |
173 | # Code from module strcase: | 182 | # Code from module strcase: |
174 | # Code from module strcasestr: | 183 | # Code from module strcasestr: |
@@ -186,7 +195,7 @@ AC_DEFUN([gl_EARLY], | |||
186 | # Code from module sys_uio: | 195 | # Code from module sys_uio: |
187 | # Code from module threadlib: | 196 | # Code from module threadlib: |
188 | gl_THREADLIB_EARLY | 197 | gl_THREADLIB_EARLY |
189 | # Code from module time: | 198 | # Code from module time-h: |
190 | # Code from module time_r: | 199 | # Code from module time_r: |
191 | # Code from module timegm: | 200 | # Code from module timegm: |
192 | # Code from module unistd: | 201 | # Code from module unistd: |
@@ -199,6 +208,7 @@ AC_DEFUN([gl_EARLY], | |||
199 | # Code from module vsnprintf: | 208 | # Code from module vsnprintf: |
200 | # Code from module wchar: | 209 | # Code from module wchar: |
201 | # Code from module wcrtomb: | 210 | # Code from module wcrtomb: |
211 | # Code from module wctype: | ||
202 | # Code from module wctype-h: | 212 | # Code from module wctype-h: |
203 | # Code from module windows-mutex: | 213 | # Code from module windows-mutex: |
204 | # Code from module windows-once: | 214 | # Code from module windows-once: |
@@ -229,6 +239,7 @@ AC_DEFUN([gl_INIT], | |||
229 | gl_COMMON | 239 | gl_COMMON |
230 | gl_source_base='gl' | 240 | gl_source_base='gl' |
231 | gl_source_base_prefix= | 241 | gl_source_base_prefix= |
242 | gl_ALIGNASOF | ||
232 | gl_FUNC_ALLOCA | 243 | gl_FUNC_ALLOCA |
233 | gl_CONDITIONAL_HEADER([alloca.h]) | 244 | gl_CONDITIONAL_HEADER([alloca.h]) |
234 | AC_PROG_MKDIR_P | 245 | AC_PROG_MKDIR_P |
@@ -280,14 +291,17 @@ AC_DEFUN([gl_INIT], | |||
280 | gl_HEADER_ERRNO_H | 291 | gl_HEADER_ERRNO_H |
281 | gl_CONDITIONAL_HEADER([errno.h]) | 292 | gl_CONDITIONAL_HEADER([errno.h]) |
282 | AC_PROG_MKDIR_P | 293 | AC_PROG_MKDIR_P |
294 | AC_REQUIRE([gl_ERROR_H]) | ||
283 | gl_ERROR | 295 | gl_ERROR |
284 | gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test "$ac_cv_lib_error_at_line" = no]) | 296 | gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test $COMPILE_ERROR_C = 1]) |
285 | AM_COND_IF([GL_COND_OBJ_ERROR], [ | 297 | AM_COND_IF([GL_COND_OBJ_ERROR], [ |
286 | gl_PREREQ_ERROR | 298 | gl_PREREQ_ERROR |
287 | ]) | 299 | ]) |
288 | m4_ifdef([AM_XGETTEXT_OPTION], | 300 | m4_ifdef([AM_XGETTEXT_OPTION], |
289 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) | 301 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) |
290 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) | 302 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) |
303 | gl_ERROR_H | ||
304 | AC_PROG_MKDIR_P | ||
291 | AC_REQUIRE([gl_EXTERN_INLINE]) | 305 | AC_REQUIRE([gl_EXTERN_INLINE]) |
292 | gl_FUNC_FCNTL | 306 | gl_FUNC_FCNTL |
293 | gl_CONDITIONAL([GL_COND_OBJ_FCNTL], | 307 | gl_CONDITIONAL([GL_COND_OBJ_FCNTL], |
@@ -350,7 +364,7 @@ AC_DEFUN([gl_INIT], | |||
350 | gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) | 364 | gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) |
351 | AM_COND_IF([GL_COND_OBJ_FSTAT], [ | 365 | AM_COND_IF([GL_COND_OBJ_FSTAT], [ |
352 | case "$host_os" in | 366 | case "$host_os" in |
353 | mingw*) | 367 | mingw* | windows*) |
354 | AC_LIBOBJ([stat-w32]) | 368 | AC_LIBOBJ([stat-w32]) |
355 | ;; | 369 | ;; |
356 | esac | 370 | esac |
@@ -406,7 +420,8 @@ AC_DEFUN([gl_INIT], | |||
406 | gl_STDIO_MODULE_INDICATOR([getline]) | 420 | gl_STDIO_MODULE_INDICATOR([getline]) |
407 | AC_REQUIRE([AC_CANONICAL_HOST]) | 421 | AC_REQUIRE([AC_CANONICAL_HOST]) |
408 | gl_GETLOADAVG | 422 | gl_GETLOADAVG |
409 | gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0]) | 423 | gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], |
424 | [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]) | ||
410 | AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ | 425 | AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ |
411 | gl_PREREQ_GETLOADAVG | 426 | gl_PREREQ_GETLOADAVG |
412 | ]) | 427 | ]) |
@@ -427,11 +442,20 @@ AC_DEFUN([gl_INIT], | |||
427 | ]) | 442 | ]) |
428 | gl_UNISTD_MODULE_INDICATOR([getopt-posix]) | 443 | gl_UNISTD_MODULE_INDICATOR([getopt-posix]) |
429 | gl_FUNC_GETPROGNAME | 444 | gl_FUNC_GETPROGNAME |
445 | gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], | ||
446 | [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) | ||
447 | AM_COND_IF([GL_COND_OBJ_GETPROGNAME], [ | ||
448 | gl_PREREQ_GETPROGNAME | ||
449 | ]) | ||
450 | gl_STDLIB_MODULE_INDICATOR([getprogname]) | ||
430 | AC_SUBST([LIBINTL]) | 451 | AC_SUBST([LIBINTL]) |
431 | AC_SUBST([LTLIBINTL]) | 452 | AC_SUBST([LTLIBINTL]) |
432 | AC_PROG_MKDIR_P | 453 | AC_PROG_MKDIR_P |
433 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | 454 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) |
434 | LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" | 455 | HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" |
456 | AC_SUBST([HARD_LOCALE_LIB]) | ||
457 | dnl For backward compatibility. | ||
458 | LIB_HARD_LOCALE="$HARD_LOCALE_LIB" | ||
435 | AC_SUBST([LIB_HARD_LOCALE]) | 459 | AC_SUBST([LIB_HARD_LOCALE]) |
436 | gl_HOSTENT | 460 | gl_HOSTENT |
437 | gl_IDPRIV | 461 | gl_IDPRIV |
@@ -445,6 +469,26 @@ AC_DEFUN([gl_INIT], | |||
445 | gl_INTTYPES_INCOMPLETE | 469 | gl_INTTYPES_INCOMPLETE |
446 | gl_INTTYPES_H_REQUIRE_DEFAULTS | 470 | gl_INTTYPES_H_REQUIRE_DEFAULTS |
447 | AC_PROG_MKDIR_P | 471 | AC_PROG_MKDIR_P |
472 | gl_FUNC_ISWBLANK | ||
473 | gl_CONDITIONAL([GL_COND_OBJ_ISWBLANK], | ||
474 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && { test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; }]) | ||
475 | gl_WCTYPE_MODULE_INDICATOR([iswblank]) | ||
476 | gl_FUNC_ISWCTYPE | ||
477 | gl_CONDITIONAL([GL_COND_OBJ_ISWCTYPE], | ||
478 | [test $HAVE_WCTYPE_T = 0 || test $GNULIBHEADERS_OVERRIDE_WINT_T = 1 || test $REPLACE_WCTYPE = 1]) | ||
479 | gl_WCTYPE_MODULE_INDICATOR([iswctype]) | ||
480 | gl_FUNC_ISWDIGIT | ||
481 | gl_CONDITIONAL([GL_COND_OBJ_ISWDIGIT], | ||
482 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWDIGIT = 1]) | ||
483 | gl_WCTYPE_MODULE_INDICATOR([iswdigit]) | ||
484 | gl_FUNC_ISWPUNCT | ||
485 | gl_CONDITIONAL([GL_COND_OBJ_ISWPUNCT], | ||
486 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWPUNCT = 1]) | ||
487 | gl_WCTYPE_MODULE_INDICATOR([iswpunct]) | ||
488 | gl_FUNC_ISWXDIGIT | ||
489 | gl_CONDITIONAL([GL_COND_OBJ_ISWXDIGIT], | ||
490 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWXDIGIT = 1]) | ||
491 | gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) | ||
448 | gl_LANGINFO_H | 492 | gl_LANGINFO_H |
449 | gl_LANGINFO_H_REQUIRE_DEFAULTS | 493 | gl_LANGINFO_H_REQUIRE_DEFAULTS |
450 | AC_PROG_MKDIR_P | 494 | AC_PROG_MKDIR_P |
@@ -504,6 +548,10 @@ AC_DEFUN([gl_INIT], | |||
504 | gl_PREREQ_MBSINIT | 548 | gl_PREREQ_MBSINIT |
505 | ]) | 549 | ]) |
506 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) | 550 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) |
551 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | ||
552 | gl_MBSTATE_T_BROKEN | ||
553 | gl_MUSL_LIBC | ||
554 | gl_WCHAR_MODULE_INDICATOR([mbszero]) | ||
507 | gl_FUNC_MBTOWC | 555 | gl_FUNC_MBTOWC |
508 | gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], | 556 | gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], |
509 | [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) | 557 | [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) |
@@ -611,7 +659,7 @@ AC_DEFUN([gl_INIT], | |||
611 | gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) | 659 | gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) |
612 | AM_COND_IF([GL_COND_OBJ_STAT], [ | 660 | AM_COND_IF([GL_COND_OBJ_STAT], [ |
613 | case "$host_os" in | 661 | case "$host_os" in |
614 | mingw*) | 662 | mingw* | windows*) |
615 | AC_LIBOBJ([stat-w32]) | 663 | AC_LIBOBJ([stat-w32]) |
616 | ;; | 664 | ;; |
617 | esac | 665 | esac |
@@ -620,9 +668,6 @@ AC_DEFUN([gl_INIT], | |||
620 | gl_SYS_STAT_MODULE_INDICATOR([stat]) | 668 | gl_SYS_STAT_MODULE_INDICATOR([stat]) |
621 | gl_STAT_TIME | 669 | gl_STAT_TIME |
622 | gl_STAT_BIRTHTIME | 670 | gl_STAT_BIRTHTIME |
623 | gl_STDALIGN_H | ||
624 | gl_CONDITIONAL_HEADER([stdalign.h]) | ||
625 | AC_PROG_MKDIR_P | ||
626 | gl_C_BOOL | 671 | gl_C_BOOL |
627 | AC_CHECK_HEADERS_ONCE([stdckdint.h]) | 672 | AC_CHECK_HEADERS_ONCE([stdckdint.h]) |
628 | if test $ac_cv_header_stdckdint_h = yes; then | 673 | if test $ac_cv_header_stdckdint_h = yes; then |
@@ -781,21 +826,24 @@ AC_DEFUN([gl_INIT], | |||
781 | gl_PREREQ_WCRTOMB | 826 | gl_PREREQ_WCRTOMB |
782 | ]) | 827 | ]) |
783 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) | 828 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) |
829 | gl_FUNC_WCTYPE | ||
830 | gl_CONDITIONAL([GL_COND_OBJ_WCTYPE], [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]) | ||
831 | gl_WCTYPE_MODULE_INDICATOR([wctype]) | ||
784 | gl_WCTYPE_H | 832 | gl_WCTYPE_H |
785 | gl_WCTYPE_H_REQUIRE_DEFAULTS | 833 | gl_WCTYPE_H_REQUIRE_DEFAULTS |
786 | AC_PROG_MKDIR_P | 834 | AC_PROG_MKDIR_P |
787 | AC_REQUIRE([AC_CANONICAL_HOST]) | 835 | AC_REQUIRE([AC_CANONICAL_HOST]) |
788 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], | 836 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], |
789 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 837 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
790 | AC_REQUIRE([AC_CANONICAL_HOST]) | 838 | AC_REQUIRE([AC_CANONICAL_HOST]) |
791 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], | 839 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], |
792 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 840 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
793 | AC_REQUIRE([AC_CANONICAL_HOST]) | 841 | AC_REQUIRE([AC_CANONICAL_HOST]) |
794 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], | 842 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], |
795 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 843 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
796 | AC_REQUIRE([AC_CANONICAL_HOST]) | 844 | AC_REQUIRE([AC_CANONICAL_HOST]) |
797 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], | 845 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], |
798 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 846 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
799 | gl_XALLOC | 847 | gl_XALLOC |
800 | gl_MODULE_INDICATOR([xalloc]) | 848 | gl_MODULE_INDICATOR([xalloc]) |
801 | gl_MODULE_INDICATOR([xalloc-die]) | 849 | gl_MODULE_INDICATOR([xalloc-die]) |
@@ -1002,7 +1050,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1002 | lib/dynarray.h | 1050 | lib/dynarray.h |
1003 | lib/errno.in.h | 1051 | lib/errno.in.h |
1004 | lib/error.c | 1052 | lib/error.c |
1005 | lib/error.h | 1053 | lib/error.in.h |
1006 | lib/exitfail.c | 1054 | lib/exitfail.c |
1007 | lib/exitfail.h | 1055 | lib/exitfail.h |
1008 | lib/fcntl.c | 1056 | lib/fcntl.c |
@@ -1062,6 +1110,12 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1062 | lib/intprops-internal.h | 1110 | lib/intprops-internal.h |
1063 | lib/intprops.h | 1111 | lib/intprops.h |
1064 | lib/inttypes.in.h | 1112 | lib/inttypes.in.h |
1113 | lib/iswblank.c | ||
1114 | lib/iswctype-impl.h | ||
1115 | lib/iswctype.c | ||
1116 | lib/iswdigit.c | ||
1117 | lib/iswpunct.c | ||
1118 | lib/iswxdigit.c | ||
1065 | lib/itold.c | 1119 | lib/itold.c |
1066 | lib/langinfo.in.h | 1120 | lib/langinfo.in.h |
1067 | lib/lc-charset-dispatch.c | 1121 | lib/lc-charset-dispatch.c |
@@ -1089,6 +1143,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1089 | lib/mbrtowc-impl.h | 1143 | lib/mbrtowc-impl.h |
1090 | lib/mbrtowc.c | 1144 | lib/mbrtowc.c |
1091 | lib/mbsinit.c | 1145 | lib/mbsinit.c |
1146 | lib/mbszero.c | ||
1092 | lib/mbtowc-impl.h | 1147 | lib/mbtowc-impl.h |
1093 | lib/mbtowc-lock.c | 1148 | lib/mbtowc-lock.c |
1094 | lib/mbtowc-lock.h | 1149 | lib/mbtowc-lock.h |
@@ -1124,6 +1179,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1124 | lib/regexec.c | 1179 | lib/regexec.c |
1125 | lib/setenv.c | 1180 | lib/setenv.c |
1126 | lib/setlocale-lock.c | 1181 | lib/setlocale-lock.c |
1182 | lib/setlocale_null-unlocked.c | ||
1127 | lib/setlocale_null.c | 1183 | lib/setlocale_null.c |
1128 | lib/setlocale_null.h | 1184 | lib/setlocale_null.h |
1129 | lib/sha256-stream.c | 1185 | lib/sha256-stream.c |
@@ -1138,7 +1194,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1138 | lib/stat-w32.c | 1194 | lib/stat-w32.c |
1139 | lib/stat-w32.h | 1195 | lib/stat-w32.h |
1140 | lib/stat.c | 1196 | lib/stat.c |
1141 | lib/stdalign.in.h | ||
1142 | lib/stdckdint.in.h | 1197 | lib/stdckdint.in.h |
1143 | lib/stddef.in.h | 1198 | lib/stddef.in.h |
1144 | lib/stdint.in.h | 1199 | lib/stdint.in.h |
@@ -1183,6 +1238,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1183 | lib/wchar.in.h | 1238 | lib/wchar.in.h |
1184 | lib/wcrtomb.c | 1239 | lib/wcrtomb.c |
1185 | lib/wctype-h.c | 1240 | lib/wctype-h.c |
1241 | lib/wctype-impl.h | ||
1242 | lib/wctype.c | ||
1186 | lib/wctype.in.h | 1243 | lib/wctype.in.h |
1187 | lib/windows-initguard.h | 1244 | lib/windows-initguard.h |
1188 | lib/windows-mutex.c | 1245 | lib/windows-mutex.c |
@@ -1220,9 +1277,11 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1220 | m4/environ.m4 | 1277 | m4/environ.m4 |
1221 | m4/errno_h.m4 | 1278 | m4/errno_h.m4 |
1222 | m4/error.m4 | 1279 | m4/error.m4 |
1280 | m4/error_h.m4 | ||
1223 | m4/exponentd.m4 | 1281 | m4/exponentd.m4 |
1224 | m4/extensions.m4 | 1282 | m4/extensions.m4 |
1225 | m4/extern-inline.m4 | 1283 | m4/extern-inline.m4 |
1284 | m4/fclose.m4 | ||
1226 | m4/fcntl-o.m4 | 1285 | m4/fcntl-o.m4 |
1227 | m4/fcntl.m4 | 1286 | m4/fcntl.m4 |
1228 | m4/fcntl_h.m4 | 1287 | m4/fcntl_h.m4 |
@@ -1257,6 +1316,11 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1257 | m4/intmax_t.m4 | 1316 | m4/intmax_t.m4 |
1258 | m4/inttypes.m4 | 1317 | m4/inttypes.m4 |
1259 | m4/inttypes_h.m4 | 1318 | m4/inttypes_h.m4 |
1319 | m4/iswblank.m4 | ||
1320 | m4/iswctype.m4 | ||
1321 | m4/iswdigit.m4 | ||
1322 | m4/iswpunct.m4 | ||
1323 | m4/iswxdigit.m4 | ||
1260 | m4/langinfo_h.m4 | 1324 | m4/langinfo_h.m4 |
1261 | m4/largefile.m4 | 1325 | m4/largefile.m4 |
1262 | m4/limits-h.m4 | 1326 | m4/limits-h.m4 |
@@ -1284,6 +1348,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1284 | m4/msvc-inval.m4 | 1348 | m4/msvc-inval.m4 |
1285 | m4/msvc-nothrow.m4 | 1349 | m4/msvc-nothrow.m4 |
1286 | m4/multiarch.m4 | 1350 | m4/multiarch.m4 |
1351 | m4/musl.m4 | ||
1287 | m4/netdb_h.m4 | 1352 | m4/netdb_h.m4 |
1288 | m4/netinet_in_h.m4 | 1353 | m4/netinet_in_h.m4 |
1289 | m4/nl_langinfo.m4 | 1354 | m4/nl_langinfo.m4 |
@@ -1346,6 +1411,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
1346 | m4/wchar_h.m4 | 1411 | m4/wchar_h.m4 |
1347 | m4/wchar_t.m4 | 1412 | m4/wchar_t.m4 |
1348 | m4/wcrtomb.m4 | 1413 | m4/wcrtomb.m4 |
1414 | m4/wctype.m4 | ||
1349 | m4/wctype_h.m4 | 1415 | m4/wctype_h.m4 |
1350 | m4/wint_t.m4 | 1416 | m4/wint_t.m4 |
1351 | m4/xalloc.m4 | 1417 | m4/xalloc.m4 |
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index a9dd569b..ef45f51f 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # gnulib-tool.m4 serial 4 | 1 | # gnulib-tool.m4 |
2 | dnl Copyright (C) 2004-2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 3b2cc2b2..36dc636e 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # hostent.m4 serial 4 | 1 | # hostent.m4 |
2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -26,7 +27,7 @@ AC_DEFUN([gl_HOSTENT], | |||
26 | AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], | 27 | AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], |
27 | [gl_cv_w32_gethostbyname], | 28 | [gl_cv_w32_gethostbyname], |
28 | [gl_cv_w32_gethostbyname=no | 29 | [gl_cv_w32_gethostbyname=no |
29 | gl_save_LIBS="$LIBS" | 30 | gl_saved_LIBS="$LIBS" |
30 | LIBS="$LIBS -lws2_32" | 31 | LIBS="$LIBS -lws2_32" |
31 | AC_LINK_IFELSE( | 32 | AC_LINK_IFELSE( |
32 | [AC_LANG_PROGRAM( | 33 | [AC_LANG_PROGRAM( |
@@ -38,7 +39,7 @@ AC_DEFUN([gl_HOSTENT], | |||
38 | ]], | 39 | ]], |
39 | [[gethostbyname(NULL);]])], | 40 | [[gethostbyname(NULL);]])], |
40 | [gl_cv_w32_gethostbyname=yes]) | 41 | [gl_cv_w32_gethostbyname=yes]) |
41 | LIBS="$gl_save_LIBS" | 42 | LIBS="$gl_saved_LIBS" |
42 | ]) | 43 | ]) |
43 | if test "$gl_cv_w32_gethostbyname" = "yes"; then | 44 | if test "$gl_cv_w32_gethostbyname" = "yes"; then |
44 | HOSTENT_LIB="-lws2_32" | 45 | HOSTENT_LIB="-lws2_32" |
diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4 index fc3dd17d..53693527 100644 --- a/gl/m4/idpriv.m4 +++ b/gl/m4/idpriv.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # idpriv.m4 serial 1 | 1 | # idpriv.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 9f19215e..03e85251 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # include_next.m4 serial 26 | 1 | # include_next.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 27 |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -74,17 +75,17 @@ EOF | |||
74 | #endif | 75 | #endif |
75 | #define DEFINED_IN_CONFTESTD2 | 76 | #define DEFINED_IN_CONFTESTD2 |
76 | EOF | 77 | EOF |
77 | gl_save_CPPFLAGS="$CPPFLAGS" | 78 | gl_saved_CPPFLAGS="$CPPFLAGS" |
78 | CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" | 79 | CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1b -Iconftestd2" |
79 | dnl We intentionally avoid using AC_LANG_SOURCE here. | 80 | dnl We intentionally avoid using AC_LANG_SOURCE here. |
80 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], | 81 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], |
81 | [gl_cv_have_include_next=yes], | 82 | [gl_cv_have_include_next=yes], |
82 | [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" | 83 | [CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1a -Iconftestd2" |
83 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], | 84 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], |
84 | [gl_cv_have_include_next=buggy], | 85 | [gl_cv_have_include_next=buggy], |
85 | [gl_cv_have_include_next=no]) | 86 | [gl_cv_have_include_next=no]) |
86 | ]) | 87 | ]) |
87 | CPPFLAGS="$gl_save_CPPFLAGS" | 88 | CPPFLAGS="$gl_saved_CPPFLAGS" |
88 | rm -rf conftestd1a conftestd1b conftestd2 | 89 | rm -rf conftestd1a conftestd1b conftestd2 |
89 | ]) | 90 | ]) |
90 | PRAGMA_SYSTEM_HEADER= | 91 | PRAGMA_SYSTEM_HEADER= |
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 48822d69..168e17e0 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # inet_ntop.m4 serial 21 | 1 | # inet_ntop.m4 |
2 | dnl Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 22 |
3 | dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -36,14 +37,14 @@ AC_DEFUN([gl_FUNC_INET_NTOP], | |||
36 | HAVE_DECL_INET_NTOP=0 | 37 | HAVE_DECL_INET_NTOP=0 |
37 | fi | 38 | fi |
38 | else | 39 | else |
39 | gl_save_LIBS=$LIBS | 40 | gl_saved_LIBS=$LIBS |
40 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], | 41 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], |
41 | [AC_CHECK_FUNCS([inet_ntop]) | 42 | [AC_CHECK_FUNCS([inet_ntop]) |
42 | if test $ac_cv_func_inet_ntop = no; then | 43 | if test $ac_cv_func_inet_ntop = no; then |
43 | HAVE_INET_NTOP=0 | 44 | HAVE_INET_NTOP=0 |
44 | fi | 45 | fi |
45 | ]) | 46 | ]) |
46 | LIBS=$gl_save_LIBS | 47 | LIBS=$gl_saved_LIBS |
47 | 48 | ||
48 | if test "$ac_cv_search_inet_ntop" != "no" \ | 49 | if test "$ac_cv_search_inet_ntop" != "no" \ |
49 | && test "$ac_cv_search_inet_ntop" != "none required"; then | 50 | && test "$ac_cv_search_inet_ntop" != "none required"; then |
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index ef32e1b9..72858ea8 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # intmax_t.m4 serial 9 | 1 | # intmax_t.m4 |
2 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 9 |
3 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4 index bf2eab2b..c43cd162 100644 --- a/gl/m4/inttypes.m4 +++ b/gl/m4/inttypes.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # inttypes.m4 serial 36 | 1 | # inttypes.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 37 |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -170,6 +171,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], | |||
170 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) | 171 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) |
171 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) | 172 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) |
172 | HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) | 173 | HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) |
174 | HAVE_IMAXABS=1; AC_SUBST([HAVE_IMAXABS]) | ||
175 | HAVE_IMAXDIV=1; AC_SUBST([HAVE_IMAXDIV]) | ||
176 | REPLACE_IMAXABS=0; AC_SUBST([REPLACE_IMAXABS]) | ||
177 | REPLACE_IMAXDIV=0; AC_SUBST([REPLACE_IMAXDIV]) | ||
173 | REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) | 178 | REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) |
174 | REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) | 179 | REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) |
175 | INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) | 180 | INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) |
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 68c60e9d..3b9da5b0 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # inttypes_h.m4 serial 10 | 1 | # inttypes_h.m4 |
2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
3 | dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/iswblank.m4 b/gl/m4/iswblank.m4 new file mode 100644 index 00000000..4dc12d9a --- /dev/null +++ b/gl/m4/iswblank.m4 | |||
@@ -0,0 +1,39 @@ | |||
1 | # iswblank.m4 | ||
2 | # serial 7 | ||
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN([gl_FUNC_ISWBLANK], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | dnl Persuade glibc <wctype.h> to declare iswblank(). | ||
13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
14 | gl_CHECK_FUNCS_ANDROID([iswblank], [[#include <wctype.h>]]) | ||
15 | AC_CHECK_DECLS([iswblank], , , [[ | ||
16 | #include <wchar.h> | ||
17 | #include <wctype.h> | ||
18 | ]]) | ||
19 | if test $ac_cv_func_iswblank = no; then | ||
20 | HAVE_ISWBLANK=0 | ||
21 | if test $ac_cv_have_decl_iswblank = yes \ | ||
22 | || case "$gl_cv_onwards_func_iswblank" in \ | ||
23 | future*) true ;; \ | ||
24 | *) false ;; \ | ||
25 | esac; then | ||
26 | REPLACE_ISWBLANK=1 | ||
27 | fi | ||
28 | fi | ||
29 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
30 | dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>. | ||
31 | : | ||
32 | else | ||
33 | if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then | ||
34 | dnl Redefine only iswblank. | ||
35 | : | ||
36 | fi | ||
37 | fi | ||
38 | |||
39 | ]) | ||
diff --git a/gl/m4/iswctype.m4 b/gl/m4/iswctype.m4 new file mode 100644 index 00000000..16031be4 --- /dev/null +++ b/gl/m4/iswctype.m4 | |||
@@ -0,0 +1,14 @@ | |||
1 | # iswctype.m4 | ||
2 | # serial 3 | ||
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN([gl_FUNC_ISWCTYPE], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | dnl Determine REPLACE_WCTYPE. | ||
13 | AC_REQUIRE([gl_FUNC_WCTYPE]) | ||
14 | ]) | ||
diff --git a/gl/m4/iswdigit.m4 b/gl/m4/iswdigit.m4 new file mode 100644 index 00000000..999acd28 --- /dev/null +++ b/gl/m4/iswdigit.m4 | |||
@@ -0,0 +1,121 @@ | |||
1 | # iswdigit.m4 | ||
2 | # serial 7 | ||
3 | dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN([gl_FUNC_ISWDIGIT], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | AC_REQUIRE([gt_LOCALE_FR]) | ||
13 | AC_REQUIRE([gt_LOCALE_JA]) | ||
14 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
15 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
16 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
17 | |||
18 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
19 | dnl <wctype.h> redefines iswdigit already. | ||
20 | REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" | ||
21 | else | ||
22 | AC_CACHE_CHECK([whether iswdigit is ISO C compliant], | ||
23 | [gl_cv_func_iswdigit_works], | ||
24 | [ | ||
25 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
26 | dnl is present. | ||
27 | changequote(,)dnl | ||
28 | case "$host_os" in | ||
29 | # Guess no on FreeBSD, NetBSD, Solaris, native Windows. | ||
30 | freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) | ||
31 | gl_cv_func_iswdigit_works="guessing no" ;; | ||
32 | # Guess yes otherwise. | ||
33 | *) gl_cv_func_iswdigit_works="guessing yes" ;; | ||
34 | esac | ||
35 | changequote([,])dnl | ||
36 | if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then | ||
37 | AC_RUN_IFELSE( | ||
38 | [AC_LANG_SOURCE([[ | ||
39 | #include <locale.h> | ||
40 | #include <stdlib.h> | ||
41 | #include <string.h> | ||
42 | #include <wchar.h> | ||
43 | #include <wctype.h> | ||
44 | |||
45 | /* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ | ||
46 | static int | ||
47 | for_character (const char *s, size_t n) | ||
48 | { | ||
49 | mbstate_t state; | ||
50 | wchar_t wc; | ||
51 | size_t ret; | ||
52 | |||
53 | memset (&state, '\0', sizeof (mbstate_t)); | ||
54 | wc = (wchar_t) 0xBADFACE; | ||
55 | ret = mbrtowc (&wc, s, n, &state); | ||
56 | if (ret != n) | ||
57 | abort (); | ||
58 | |||
59 | return iswdigit (wc); | ||
60 | } | ||
61 | |||
62 | int | ||
63 | main (int argc, char *argv[]) | ||
64 | { | ||
65 | int is; | ||
66 | int result = 0; | ||
67 | |||
68 | if (strcmp ("$LOCALE_FR", "none") != 0 | ||
69 | && setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
70 | { | ||
71 | /* This fails on mingw, MSVC 14. */ | ||
72 | /* U+00B2 SUPERSCRIPT TWO */ | ||
73 | is = for_character ("\262", 1); | ||
74 | if (!(is == 0)) | ||
75 | result |= 1; | ||
76 | } | ||
77 | if (strcmp ("$LOCALE_JA", "none") != 0 | ||
78 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
79 | { | ||
80 | /* This fails on NetBSD 10.0. */ | ||
81 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
82 | is = for_character ("\243\261", 2); | ||
83 | if (!(is == 0)) | ||
84 | result |= 2; | ||
85 | } | ||
86 | if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 | ||
87 | && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
88 | { | ||
89 | /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ | ||
90 | /* U+0663 ARABIC-INDIC DIGIT THREE */ | ||
91 | is = for_character ("\331\243", 2); | ||
92 | if (!(is == 0)) | ||
93 | result |= 4; | ||
94 | /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ | ||
95 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
96 | is = for_character ("\357\274\221", 3); | ||
97 | if (!(is == 0)) | ||
98 | result |= 8; | ||
99 | } | ||
100 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
101 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
102 | { | ||
103 | /* This fails on NetBSD 10.0, Solaris 10, Solaris 11.4. */ | ||
104 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
105 | is = for_character ("\243\261", 2); | ||
106 | if (!(is == 0)) | ||
107 | result |= 16; | ||
108 | } | ||
109 | return result; | ||
110 | }]])], | ||
111 | [gl_cv_func_iswdigit_works=yes], | ||
112 | [gl_cv_func_iswdigit_works=no], | ||
113 | [:]) | ||
114 | fi | ||
115 | ]) | ||
116 | case "$gl_cv_func_iswdigit_works" in | ||
117 | *yes) ;; | ||
118 | *) REPLACE_ISWDIGIT=1 ;; | ||
119 | esac | ||
120 | fi | ||
121 | ]) | ||
diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4 new file mode 100644 index 00000000..1edf58aa --- /dev/null +++ b/gl/m4/iswpunct.m4 | |||
@@ -0,0 +1,49 @@ | |||
1 | # iswpunct.m4 | ||
2 | # serial 2 | ||
3 | dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN([gl_FUNC_ISWPUNCT], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | |||
14 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
15 | dnl <wctype.h> redefines iswpunct already. | ||
16 | REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL" | ||
17 | else | ||
18 | AC_CACHE_CHECK([whether iswpunct is consistent with ispunct], | ||
19 | [gl_cv_func_iswpunct_works], | ||
20 | [AC_RUN_IFELSE( | ||
21 | [AC_LANG_SOURCE([[ | ||
22 | #include <ctype.h> | ||
23 | #include <wchar.h> | ||
24 | #include <wctype.h> | ||
25 | int | ||
26 | main (int argc, char *argv[]) | ||
27 | { | ||
28 | int result = 0; | ||
29 | /* This fails on Android 11. */ | ||
30 | if ((! iswpunct ('\`')) != (! ispunct ('\`'))) | ||
31 | result |= 1; | ||
32 | return result; | ||
33 | }]])], | ||
34 | [gl_cv_func_iswpunct_works=yes], | ||
35 | [gl_cv_func_iswpunct_works=no], | ||
36 | [case "$host_os" in | ||
37 | # Guess no on Android. | ||
38 | android*) gl_cv_func_iswpunct_works="guessing no" ;; | ||
39 | # Guess yes otherwise. | ||
40 | *) gl_cv_func_iswpunct_works="guessing yes" ;; | ||
41 | esac | ||
42 | ]) | ||
43 | ]) | ||
44 | case "$gl_cv_func_iswpunct_works" in | ||
45 | *yes) ;; | ||
46 | *) REPLACE_ISWPUNCT=1 ;; | ||
47 | esac | ||
48 | fi | ||
49 | ]) | ||
diff --git a/gl/m4/iswxdigit.m4 b/gl/m4/iswxdigit.m4 new file mode 100644 index 00000000..6085bf6b --- /dev/null +++ b/gl/m4/iswxdigit.m4 | |||
@@ -0,0 +1,111 @@ | |||
1 | # iswxdigit.m4 | ||
2 | # serial 7 | ||
3 | dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN([gl_FUNC_ISWXDIGIT], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | AC_REQUIRE([gt_LOCALE_JA]) | ||
13 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
14 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
16 | |||
17 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
18 | dnl <wctype.h> redefines iswxdigit already. | ||
19 | REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" | ||
20 | else | ||
21 | AC_CACHE_CHECK([whether iswxdigit is ISO C compliant], | ||
22 | [gl_cv_func_iswxdigit_works], | ||
23 | [ | ||
24 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
25 | dnl is present. | ||
26 | changequote(,)dnl | ||
27 | case "$host_os" in | ||
28 | # Guess no on FreeBSD, NetBSD, Solaris, native Windows. | ||
29 | freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) | ||
30 | gl_cv_func_iswxdigit_works="guessing no" ;; | ||
31 | # Guess yes otherwise. | ||
32 | *) gl_cv_func_iswxdigit_works="guessing yes" ;; | ||
33 | esac | ||
34 | changequote([,])dnl | ||
35 | if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then | ||
36 | AC_RUN_IFELSE( | ||
37 | [AC_LANG_SOURCE([[ | ||
38 | #include <locale.h> | ||
39 | #include <stdlib.h> | ||
40 | #include <string.h> | ||
41 | #include <wchar.h> | ||
42 | #include <wctype.h> | ||
43 | |||
44 | /* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ | ||
45 | static int | ||
46 | for_character (const char *s, size_t n) | ||
47 | { | ||
48 | mbstate_t state; | ||
49 | wchar_t wc; | ||
50 | size_t ret; | ||
51 | |||
52 | memset (&state, '\0', sizeof (mbstate_t)); | ||
53 | wc = (wchar_t) 0xBADFACE; | ||
54 | ret = mbrtowc (&wc, s, n, &state); | ||
55 | if (ret != n) | ||
56 | abort (); | ||
57 | |||
58 | return iswxdigit (wc); | ||
59 | } | ||
60 | |||
61 | int | ||
62 | main (int argc, char *argv[]) | ||
63 | { | ||
64 | int is; | ||
65 | int result = 0; | ||
66 | |||
67 | if (strcmp ("$LOCALE_JA", "none") != 0 | ||
68 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
69 | { | ||
70 | /* This fails on NetBSD 10.0. */ | ||
71 | /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ | ||
72 | is = for_character ("\243\301", 2); | ||
73 | if (!(is == 0)) | ||
74 | result |= 1; | ||
75 | } | ||
76 | if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 | ||
77 | && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
78 | { | ||
79 | /* This fails on FreeBSD 13.0. */ | ||
80 | /* U+0663 ARABIC-INDIC DIGIT THREE */ | ||
81 | is = for_character ("\331\243", 2); | ||
82 | if (!(is == 0)) | ||
83 | result |= 2; | ||
84 | /* This fails on NetBSD 10.0, MSVC 14. */ | ||
85 | /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ | ||
86 | is = for_character ("\357\274\241", 3); | ||
87 | if (!(is == 0)) | ||
88 | result |= 4; | ||
89 | } | ||
90 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
91 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
92 | { | ||
93 | /* This fails on Solaris 10, Solaris 11.4. */ | ||
94 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
95 | is = for_character ("\243\261", 2); | ||
96 | if (!(is == 0)) | ||
97 | result |= 8; | ||
98 | } | ||
99 | return result; | ||
100 | }]])], | ||
101 | [gl_cv_func_iswxdigit_works=yes], | ||
102 | [gl_cv_func_iswxdigit_works=no], | ||
103 | [:]) | ||
104 | fi | ||
105 | ]) | ||
106 | case "$gl_cv_func_iswxdigit_works" in | ||
107 | *yes) ;; | ||
108 | *) REPLACE_ISWXDIGIT=1 ;; | ||
109 | esac | ||
110 | fi | ||
111 | ]) | ||
diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 index b17a526a..5eee8a71 100644 --- a/gl/m4/langinfo_h.m4 +++ b/gl/m4/langinfo_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # langinfo_h.m4 serial 12 | 1 | # langinfo_h.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 7fb81b86..2f824089 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 | |||
@@ -1,16 +1,18 @@ | |||
1 | # largefile.m4 | ||
2 | # serial 1 | ||
3 | dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
1 | # Enable large files on systems where this is not the default. | 8 | # Enable large files on systems where this is not the default. |
2 | # Enable support for files on Linux file systems with 64-bit inode numbers. | 9 | # Enable support for files on Linux file systems with 64-bit inode numbers. |
3 | 10 | ||
4 | # Copyright 1992-1996, 1998-2023 Free Software Foundation, Inc. | ||
5 | # This file is free software; the Free Software Foundation | ||
6 | # gives unlimited permission to copy and/or distribute it, | ||
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | |||
9 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: | 11 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: |
10 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this | 12 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this |
11 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko | 13 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko |
12 | # and ftello in C++ mode as well. | 14 | # and ftello in C++ mode as well. |
13 | # Fixed in Autoconf 2.72, which has AC_SYS_YEAR2038. | 15 | # This problem occurs in Autoconf 2.71 and earlier, which lack AC_SYS_YEAR2038. |
14 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | 16 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], |
15 | m4_ifndef([AC_SYS_YEAR2038], [[ | 17 | m4_ifndef([AC_SYS_YEAR2038], [[ |
16 | AC_REQUIRE([AC_CANONICAL_HOST]) | 18 | AC_REQUIRE([AC_CANONICAL_HOST]) |
@@ -24,29 +26,20 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | |||
24 | ]]) | 26 | ]]) |
25 | ) | 27 | ) |
26 | 28 | ||
27 | # Work around a problem in autoconf <= 2.69: | 29 | dnl Remove AC_SYS_YEAR2038_RECOMMENDED if unpatched Autoconf 2.72 or earlier. |
28 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, | 30 | dnl Autoconf 2.72 still uses -n32, which is not a C preprocessor option, |
29 | # or configures them incorrectly in some cases. | 31 | dnl and which was useful only on IRIX which is no longer supported. |
30 | m4_version_prereq([2.70], [], [ | 32 | dnl This should be fixed in Autoconf 2.73. |
31 | 33 | m4_ifdef([AC_SYS_YEAR2038_RECOMMENDED], | |
32 | # _AC_SYS_LARGEFILE_TEST_INCLUDES | 34 | [m4_bmatch(m4_ifdef([_AC_SYS_LARGEFILE_OPTIONS], |
33 | # ------------------------------- | 35 | [m4_defn([_AC_SYS_LARGEFILE_OPTIONS])], |
34 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], | 36 | ["-n32"]), |
35 | [#include <sys/types.h> | 37 | ["-n32"], |
36 | /* Check that off_t can represent 2**63 - 1 correctly. | 38 | [m4_undefine([AC_SYS_YEAR2038_RECOMMENDED])])]) |
37 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||
38 | since some C++ compilers masquerading as C compilers | ||
39 | incorrectly reject 9223372036854775807. */ | ||
40 | #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | ||
41 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | ||
42 | && LARGE_OFF_T % 2147483647 == 1) | ||
43 | ? 1 : -1]];[]dnl | ||
44 | ]) | ||
45 | ])# m4_version_prereq 2.70 | ||
46 | 39 | ||
47 | # Support AC_SYS_YEAR2038, even if Autoconf 2.71 or earlier. | 40 | m4_ifndef([AC_SYS_YEAR2038_RECOMMENDED], [ |
48 | # This code is taken from Autoconf master. | 41 | # Fix up AC_SYS_YEAR2038_RECOMMENDED and related macros, even if |
49 | m4_ifndef([AC_SYS_YEAR2038], [ | 42 | # unpatched Autoconf 2.72 or earlier. This code is taken from Autoconf master. |
50 | 43 | ||
51 | # _AC_SYS_YEAR2038_TEST_CODE | 44 | # _AC_SYS_YEAR2038_TEST_CODE |
52 | # -------------------------- | 45 | # -------------------------- |
@@ -78,8 +71,8 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
78 | dnl 32-bit MinGW (misconfiguration) | 71 | dnl 32-bit MinGW (misconfiguration) |
79 | )) | 72 | )) |
80 | 73 | ||
81 | # _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED]) | 74 | # _AC_SYS_YEAR2038_PROBE |
82 | # ----------------------------------------- | 75 | # ---------------------- |
83 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent | 76 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent |
84 | # time points more than 2**31 - 1 seconds after the epoch (dates after | 77 | # time points more than 2**31 - 1 seconds after the epoch (dates after |
85 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts | 78 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts |
@@ -92,13 +85,10 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
92 | # AC_TRY_RUN. Note also that some systems only support large time_t | 85 | # AC_TRY_RUN. Note also that some systems only support large time_t |
93 | # together with large off_t. | 86 | # together with large off_t. |
94 | # | 87 | # |
95 | # If support is not detected, the behavior depends on which of the | ||
96 | # top-level AC_SYS_YEAR2038 macros was used (see below). | ||
97 | # | ||
98 | # If you change this macro you may also need to change | 88 | # If you change this macro you may also need to change |
99 | # _AC_SYS_YEAR2038_OPTIONS. | 89 | # _AC_SYS_YEAR2038_OPTIONS. |
100 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], | 90 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], |
101 | [AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038], | 91 | [AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038], |
102 | [ac_cv_sys_year2038_opts], | 92 | [ac_cv_sys_year2038_opts], |
103 | [ac_save_CPPFLAGS="$CPPFLAGS" | 93 | [ac_save_CPPFLAGS="$CPPFLAGS" |
104 | ac_opt_found=no | 94 | ac_opt_found=no |
@@ -117,40 +107,20 @@ ac_have_year2038=yes | |||
117 | AS_CASE([$ac_cv_sys_year2038_opts], | 107 | AS_CASE([$ac_cv_sys_year2038_opts], |
118 | ["none needed"], [], | 108 | ["none needed"], [], |
119 | ["support not detected"], | 109 | ["support not detected"], |
120 | [ac_have_year2038=no | 110 | [ac_have_year2038=no], |
121 | AS_CASE([$enable_year2038], | ||
122 | [yes], | ||
123 | [# If we're not cross compiling and 'touch' works with a large | ||
124 | # timestamp, then we can presume the system supports wider time_t | ||
125 | # *somehow* and we just weren't able to detect it. One common | ||
126 | # case that we deliberately *don't* probe for is a system that | ||
127 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
128 | # wide time_t. (It would be inappropriate for us to override an | ||
129 | # intentional use of -m32.) Error out, demanding use of | ||
130 | # --disable-year2038 if this is intentional. | ||
131 | AS_IF([test $cross_compiling = no], | ||
132 | [AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
133 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
134 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
135 | [AC_MSG_FAILURE(m4_text_wrap( | ||
136 | [this system appears to support timestamps after January 2038, | ||
137 | but no mechanism for enabling wide 'time_t' was detected. | ||
138 | Did you mean to build a 64-bit binary? (e.g. 'CC="${CC} -m64"'.) | ||
139 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
140 | [], [], [55]))])])])])], | ||
141 | 111 | ||
142 | ["-D_TIME_BITS=64"], | 112 | ["-D_TIME_BITS=64"], |
143 | [AC_DEFINE([_TIME_BITS], [64], | 113 | [AC_DEFINE([_TIME_BITS], [64], |
144 | [Number of bits in time_t, on hosts where this is settable.])], | 114 | [Number of bits in time_t, on hosts where this is settable.])], |
145 | 115 | ||
146 | ["-D__MINGW_USE_VC2005_COMPAT=1"], | 116 | ["-D__MINGW_USE_VC2005_COMPAT"], |
147 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], | 117 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], |
148 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], | 118 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], |
149 | 119 | ||
150 | ["-U_USE_32_BIT_TIME_T"*], | 120 | ["-U_USE_32_BIT_TIME_T"*], |
151 | [AC_MSG_FAILURE(m4_text_wrap( | 121 | [AC_MSG_FAILURE(m4_text_wrap( |
152 | [the 'time_t' type is currently forced to be 32-bit. | 122 | [the 'time_t' type is currently forced to be 32-bit. |
153 | It will stop working after January 2038. | 123 | It will stop working after mid-January 2038. |
154 | Remove _USE_32BIT_TIME_T from the compiler flags.], | 124 | Remove _USE_32BIT_TIME_T from the compiler flags.], |
155 | [], [], [55]))], | 125 | [], [], [55]))], |
156 | 126 | ||
@@ -160,12 +130,11 @@ AS_CASE([$ac_cv_sys_year2038_opts], | |||
160 | 130 | ||
161 | # _AC_SYS_YEAR2038_ENABLE | 131 | # _AC_SYS_YEAR2038_ENABLE |
162 | # ----------------------- | 132 | # ----------------------- |
163 | # Subroutine of AC_SYS_YEAR2038 and _AC_SYS_YEAR2038_OPT_IN. | ||
164 | # Depending on which of the YEAR2038 macros was used, add either an | 133 | # Depending on which of the YEAR2038 macros was used, add either an |
165 | # --enable-year2038, or a --disable-year2038, or no option at all to | 134 | # --enable-year2038 or a --disable-year2038 to |
166 | # the configure script. Note that this is expanded very late and | 135 | # the configure script. This is expanded very late and |
167 | # therefore there cannot be any code in the AC_ARG_ENABLE. The | 136 | # therefore there cannot be any code in the AC_ARG_ENABLE. The |
168 | # default value for enable_year2038 is emitted unconditionally | 137 | # default value for 'enable_year2038' is emitted unconditionally |
169 | # because the generated code always looks at this variable. | 138 | # because the generated code always looks at this variable. |
170 | m4_define([_AC_SYS_YEAR2038_ENABLE], | 139 | m4_define([_AC_SYS_YEAR2038_ENABLE], |
171 | [m4_divert_text([DEFAULTS], | 140 | [m4_divert_text([DEFAULTS], |
@@ -175,50 +144,70 @@ m4_define([_AC_SYS_YEAR2038_ENABLE], | |||
175 | [AC_ARG_ENABLE([year2038], | 144 | [AC_ARG_ENABLE([year2038], |
176 | m4_provide_if([AC_SYS_YEAR2038], | 145 | m4_provide_if([AC_SYS_YEAR2038], |
177 | [AS_HELP_STRING([--disable-year2038], | 146 | [AS_HELP_STRING([--disable-year2038], |
178 | [do not support timestamps after 2038])], | 147 | [don't support timestamps after 2038])], |
179 | [AS_HELP_STRING([--enable-year2038], | 148 | [AS_HELP_STRING([--enable-year2038], |
180 | [support timestamps after 2038])]))]) | 149 | [support timestamps after 2038])]))]) |
181 | 150 | ||
182 | # _AC_SYS_YEAR2038_OPT_IN | ||
183 | # ----------------------- | ||
184 | # If the --enable-year2038 option is given to configure, attempt to | ||
185 | # detect and activate support for large time_t on 32-bit systems. | ||
186 | # This macro is automatically invoked by AC_SYS_LARGEFILE when large | ||
187 | # *file* support is detected. It does not AC_REQUIRE AC_SYS_LARGEFILE | ||
188 | # to avoid a dependency loop, and is therefore unsafe to expose as a | ||
189 | # documented macro. | ||
190 | AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN], | ||
191 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | ||
192 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | ||
193 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | ||
194 | ])]) | ||
195 | |||
196 | # AC_SYS_YEAR2038 | 151 | # AC_SYS_YEAR2038 |
197 | # --------------- | 152 | # --------------- |
198 | # Attempt to detect and activate support for large time_t. | 153 | # Attempt to detect and activate support for large time_t. |
199 | # On systems where time_t is not always 64 bits, this probe can be | 154 | # On systems where time_t is not always 64 bits, this probe can be |
200 | # skipped by passing the --disable-year2038 option to configure. | 155 | # skipped by passing the --disable-year2038 option to configure. |
201 | AC_DEFUN([AC_SYS_YEAR2038], | 156 | AC_DEFUN([AC_SYS_YEAR2038], |
202 | [AC_REQUIRE([AC_SYS_LARGEFILE])]dnl | 157 | [AC_REQUIRE([AC_SYS_LARGEFILE])dnl |
203 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | 158 | AS_IF([test "$enable_year2038,$ac_have_year2038,$cross_compiling" = yes,no,no], |
204 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | 159 | [# If we're not cross compiling and 'touch' works with a large |
205 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | 160 | # timestamp, then we can presume the system supports wider time_t |
206 | ])]) | 161 | # *somehow* and we just weren't able to detect it. One common |
162 | # case that we deliberately *don't* probe for is a system that | ||
163 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
164 | # wide time_t. (It would be inappropriate for us to override an | ||
165 | # intentional use of -m32.) Error out, demanding use of | ||
166 | # --disable-year2038 if this is intentional. | ||
167 | AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
168 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
169 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
170 | [AC_MSG_FAILURE(m4_text_wrap( | ||
171 | [this system appears to support timestamps after mid-January 2038, | ||
172 | but no mechanism for enabling wide 'time_t' was detected. | ||
173 | Did you mean to build a 64-bit binary? (E.g., 'CC="${CC} -m64"'.) | ||
174 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
175 | [], [], [55]))])])])]) | ||
176 | |||
177 | # AC_SYS_YEAR2038_RECOMMENDED | ||
178 | # --------------------------- | ||
179 | # Same as AC_SYS_YEAR2038, but recommend support for large time_t. | ||
180 | # If we cannot find any way to make time_t capable of representing | ||
181 | # values larger than 2**31 - 1, error out unless --disable-year2038 is given. | ||
182 | AC_DEFUN([AC_SYS_YEAR2038_RECOMMENDED], | ||
183 | [AC_REQUIRE([AC_SYS_YEAR2038])dnl | ||
184 | AS_IF([test "$enable_year2038,$ac_have_year2038" = yes,no], | ||
185 | [AC_MSG_FAILURE(m4_text_wrap( | ||
186 | [could not enable timestamps after mid-January 2038. | ||
187 | This package recommends support for these later timestamps. | ||
188 | However, to proceed with signed 32-bit time_t even though it | ||
189 | will fail then, configure with '--disable-year2038'.], | ||
190 | [], [], [55]))])]) | ||
207 | 191 | ||
208 | # _AC_SYS_LARGEFILE_TEST_CODE | 192 | # _AC_SYS_LARGEFILE_TEST_CODE |
209 | # --------------------------- | 193 | # --------------------------- |
210 | # C code used to probe for large file support. | 194 | # C code used to probe for large file support. |
211 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | 195 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], |
212 | [@%:@include <sys/types.h> | 196 | [@%:@include <sys/types.h> |
213 | /* Check that off_t can represent 2**63 - 1 correctly. | 197 | @%:@ifndef FTYPE |
214 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | 198 | @%:@ define FTYPE off_t |
199 | @%:@endif | ||
200 | /* Check that FTYPE can represent 2**63 - 1 correctly. | ||
201 | We can't simply define LARGE_FTYPE to be 9223372036854775807, | ||
215 | since some C++ compilers masquerading as C compilers | 202 | since some C++ compilers masquerading as C compilers |
216 | incorrectly reject 9223372036854775807. */ | 203 | incorrectly reject 9223372036854775807. */ |
217 | @%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | 204 | @%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) |
218 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | 205 | int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721 |
219 | && LARGE_OFF_T % 2147483647 == 1) | 206 | && LARGE_FTYPE % 2147483647 == 1) |
220 | ? 1 : -1]];[]dnl | 207 | ? 1 : -1]];[]dnl |
221 | ]) | 208 | ]) |
209 | # Defined by Autoconf 2.71 and circa 2022 Gnulib unwisely depended on it. | ||
210 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [_AC_SYS_LARGEFILE_TEST_CODE]) | ||
222 | 211 | ||
223 | # _AC_SYS_LARGEFILE_OPTIONS | 212 | # _AC_SYS_LARGEFILE_OPTIONS |
224 | # ------------------------- | 213 | # ------------------------- |
@@ -228,8 +217,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | |||
228 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | 217 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( |
229 | ["none needed"] dnl Most current systems | 218 | ["none needed"] dnl Most current systems |
230 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec | 219 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec |
231 | ["-D_LARGE_FILES=1"] dnl AIX (which versions?) | 220 | ["-D_LARGE_FILES=1"] dnl 32-bit AIX 4.2.1+, 32-bit z/OS |
232 | ["-n32"] dnl Irix 6.2 w/ SGI compiler | ||
233 | )) | 221 | )) |
234 | 222 | ||
235 | # _AC_SYS_LARGEFILE_PROBE | 223 | # _AC_SYS_LARGEFILE_PROBE |
@@ -246,24 +234,43 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | |||
246 | # If you change this macro you may also need to change | 234 | # If you change this macro you may also need to change |
247 | # _AC_SYS_LARGEFILE_OPTIONS. | 235 | # _AC_SYS_LARGEFILE_OPTIONS. |
248 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], | 236 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], |
249 | [AC_CACHE_CHECK([for $CC option to enable large file support], | 237 | [AC_CACHE_CHECK([for $CPPFLAGS option for large files], |
250 | [ac_cv_sys_largefile_opts], | 238 | [ac_cv_sys_largefile_opts], |
251 | [ac_save_CC="$CC" | 239 | [ac_save_CPPFLAGS=$CPPFLAGS |
252 | ac_opt_found=no | 240 | ac_opt_found=no |
253 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do | 241 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do |
254 | AS_IF([test x"$ac_opt" != x"none needed"], | 242 | AS_IF([test x"$ac_opt" != x"none needed"], |
255 | [CC="$ac_save_CC $ac_opt"]) | 243 | [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"]) |
256 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], | 244 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], |
257 | [ac_cv_sys_largefile_opts="$ac_opt" | 245 | [AS_IF([test x"$ac_opt" = x"none needed"], |
246 | [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. | ||
247 | CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t" | ||
248 | AC_COMPILE_IFELSE([], [], | ||
249 | [CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" | ||
250 | AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])]) | ||
251 | ac_cv_sys_largefile_opts=$ac_opt | ||
258 | ac_opt_found=yes]) | 252 | ac_opt_found=yes]) |
259 | test $ac_opt_found = no || break | 253 | test $ac_opt_found = no || break |
260 | done | 254 | done |
261 | CC="$ac_save_CC" | 255 | CPPFLAGS=$ac_save_CPPFLAGS |
256 | dnl Gnulib implements large file support for native Windows, based on the | ||
257 | dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE. | ||
258 | m4_ifdef([gl_LARGEFILE], [ | ||
259 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
260 | if test $ac_opt_found != yes; then | ||
261 | AS_CASE([$host_os], | ||
262 | [mingw* | windows*], | ||
263 | [ac_cv_sys_largefile_opts="supported through gnulib" | ||
264 | ac_opt_found=yes] | ||
265 | ) | ||
266 | fi | ||
267 | ]) | ||
262 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) | 268 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) |
263 | 269 | ||
264 | ac_have_largefile=yes | 270 | ac_have_largefile=yes |
265 | AS_CASE([$ac_cv_sys_largefile_opts], | 271 | AS_CASE([$ac_cv_sys_largefile_opts], |
266 | ["none needed"], [], | 272 | ["none needed"], [], |
273 | ["supported through gnulib"], [], | ||
267 | ["support not detected"], | 274 | ["support not detected"], |
268 | [ac_have_largefile=no], | 275 | [ac_have_largefile=no], |
269 | 276 | ||
@@ -275,27 +282,12 @@ AS_CASE([$ac_cv_sys_largefile_opts], | |||
275 | [AC_DEFINE([_LARGE_FILES], [1], | 282 | [AC_DEFINE([_LARGE_FILES], [1], |
276 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], | 283 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], |
277 | 284 | ||
278 | ["-n32"], | ||
279 | [CC="$CC -n32"], | ||
280 | |||
281 | [AC_MSG_ERROR( | 285 | [AC_MSG_ERROR( |
282 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) | 286 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) |
283 | 287 | ||
284 | _AC_SYS_YEAR2038_OPT_IN | 288 | AS_IF([test "$enable_year2038" != no], |
285 | ]) | 289 | [_AC_SYS_YEAR2038_PROBE]) |
286 | 290 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) | |
287 | # _AC_SYS_LARGEFILE_ENABLE | ||
288 | # ------------------------ | ||
289 | # Subroutine of AC_SYS_LARGEFILE. Note that this | ||
290 | # is expanded very late and therefore there cannot be any code in the | ||
291 | # AC_ARG_ENABLE. The default value for enable_largefile is emitted | ||
292 | # unconditionally because the generated shell code always looks at | ||
293 | # this variable. | ||
294 | m4_define([_AC_SYS_LARGEFILE_ENABLE], | ||
295 | [m4_divert_text([DEFAULTS], | ||
296 | enable_largefile=yes)]dnl | ||
297 | [AC_ARG_ENABLE([largefile], | ||
298 | [AS_HELP_STRING([--disable-largefile], [omit support for large files])])]) | ||
299 | 291 | ||
300 | # AC_SYS_LARGEFILE | 292 | # AC_SYS_LARGEFILE |
301 | # ---------------- | 293 | # ---------------- |
@@ -306,14 +298,13 @@ m4_define([_AC_SYS_LARGEFILE_ENABLE], | |||
306 | # Additionally, on Linux file systems with 64-bit inodes a file that happens | 298 | # Additionally, on Linux file systems with 64-bit inodes a file that happens |
307 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on | 299 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on |
308 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. | 300 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. |
309 | # This macro allows configuration to continue if the system doesn't support | ||
310 | # large files. | ||
311 | AC_DEFUN([AC_SYS_LARGEFILE], | 301 | AC_DEFUN([AC_SYS_LARGEFILE], |
312 | [m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl | 302 | [AC_ARG_ENABLE([largefile], |
313 | AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE]) | 303 | [AS_HELP_STRING([--disable-largefile], |
314 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE]) | 304 | [omit support for large files])])dnl |
315 | ])]) | 305 | AS_IF([test "$enable_largefile,$enable_year2038" != no,no], |
316 | ])# m4_ifndef AC_SYS_YEAR2038 | 306 | [_AC_SYS_LARGEFILE_PROBE])]) |
307 | ])# m4_ifndef AC_SYS_YEAR2038_RECOMMENDED | ||
317 | 308 | ||
318 | # Enable large files on systems where this is implemented by Gnulib, not by the | 309 | # Enable large files on systems where this is implemented by Gnulib, not by the |
319 | # system headers. | 310 | # system headers. |
@@ -323,7 +314,7 @@ AC_DEFUN([gl_LARGEFILE], | |||
323 | [ | 314 | [ |
324 | AC_REQUIRE([AC_CANONICAL_HOST]) | 315 | AC_REQUIRE([AC_CANONICAL_HOST]) |
325 | case "$host_os" in | 316 | case "$host_os" in |
326 | mingw*) | 317 | mingw* | windows*) |
327 | dnl Native Windows. | 318 | dnl Native Windows. |
328 | dnl mingw64 defines off_t to a 64-bit type already, if | 319 | dnl mingw64 defines off_t to a 64-bit type already, if |
329 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. | 320 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. |
diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4 index 5088fa16..1b619e1e 100644 --- a/gl/m4/limits-h.m4 +++ b/gl/m4/limits-h.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | dnl Check whether limits.h has needed features. | 1 | # limits-h.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2016-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2016-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl Check whether limits.h has needed features. | ||
9 | |||
8 | dnl From Paul Eggert. | 10 | dnl From Paul Eggert. |
9 | 11 | ||
10 | AC_DEFUN_ONCE([gl_LIMITS_H], | 12 | AC_DEFUN_ONCE([gl_LIMITS_H], |
@@ -23,14 +25,27 @@ AC_DEFUN_ONCE([gl_LIMITS_H], | |||
23 | int wb = WORD_BIT; | 25 | int wb = WORD_BIT; |
24 | int ullw = ULLONG_WIDTH; | 26 | int ullw = ULLONG_WIDTH; |
25 | int bw = BOOL_WIDTH; | 27 | int bw = BOOL_WIDTH; |
28 | int bm = BOOL_MAX; | ||
29 | int mblm = MB_LEN_MAX; | ||
26 | ]])], | 30 | ]])], |
27 | [gl_cv_header_limits_width=yes], | 31 | [gl_cv_header_limits_width=yes], |
28 | [gl_cv_header_limits_width=no])]) | 32 | [gl_cv_header_limits_width=no])]) |
29 | if test "$gl_cv_header_limits_width" = yes; then | 33 | GL_GENERATE_LIMITS_H=true |
30 | GL_GENERATE_LIMITS_H=false | 34 | AS_IF([test "$gl_cv_header_limits_width" = yes], |
31 | else | 35 | [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX], |
32 | GL_GENERATE_LIMITS_H=true | 36 | [gl_cv_header_limits_ssize_max], |
33 | fi | 37 | [AC_COMPILE_IFELSE( |
38 | [AC_LANG_SOURCE( | ||
39 | [[#include <limits.h> | ||
40 | #ifndef SSIZE_MAX | ||
41 | #error "SSIZE_MAX is not defined" | ||
42 | #endif | ||
43 | ]])], | ||
44 | [gl_cv_header_limits_ssize_max=yes], | ||
45 | [gl_cv_header_limits_ssize_max=no])]) | ||
46 | if test "$gl_cv_header_limits_ssize_max" = yes; then | ||
47 | GL_GENERATE_LIMITS_H=false | ||
48 | fi]) | ||
34 | ]) | 49 | ]) |
35 | 50 | ||
36 | dnl Unconditionally enables the replacement of <limits.h>. | 51 | dnl Unconditionally enables the replacement of <limits.h>. |
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index 15b6b2a5..807a5eed 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # localcharset.m4 serial 8 | 1 | # localcharset.m4 |
2 | dnl Copyright (C) 2002, 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index 8c41fadf..f8d7c543 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # locale-fr.m4 serial 20 | 1 | # locale-fr.m4 |
2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 23 |
3 | dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | 9 | ||
9 | dnl Determine the name of a french locale with traditional encoding. | 10 | dnl Determine the name of a french locale with traditional encoding. |
10 | AC_DEFUN([gt_LOCALE_FR], | 11 | AC_DEFUN_ONCE([gt_LOCALE_FR], |
11 | [ | 12 | [ |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 13 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 14 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
@@ -86,7 +87,7 @@ int main () { | |||
86 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 87 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
87 | # "ja" as "Japanese" or "Japanese_Japan.932", | 88 | # "ja" as "Japanese" or "Japanese_Japan.932", |
88 | # and similar. | 89 | # and similar. |
89 | mingw*) | 90 | mingw* | windows*) |
90 | # Test for the native Windows locale name. | 91 | # Test for the native Windows locale name. |
91 | if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 92 | if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
92 | gt_cv_locale_fr=French_France.1252 | 93 | gt_cv_locale_fr=French_France.1252 |
@@ -116,7 +117,7 @@ int main () { | |||
116 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 117 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
117 | gt_cv_locale_fr=fr_FR.iso88591 | 118 | gt_cv_locale_fr=fr_FR.iso88591 |
118 | else | 119 | else |
119 | # Test for the Solaris 7 locale name. | 120 | # Test for the Solaris 10 locale name. |
120 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 121 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
121 | gt_cv_locale_fr=fr | 122 | gt_cv_locale_fr=fr |
122 | else | 123 | else |
@@ -133,15 +134,31 @@ int main () { | |||
133 | rm -fr conftest* | 134 | rm -fr conftest* |
134 | ]) | 135 | ]) |
135 | LOCALE_FR=$gt_cv_locale_fr | 136 | LOCALE_FR=$gt_cv_locale_fr |
137 | case $LOCALE_FR in #( | ||
138 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
139 | dnl This locale name might cause trouble with sh or make. | ||
140 | AC_MSG_WARN([invalid locale "$LOCALE_FR"; assuming "none"]) | ||
141 | LOCALE_FR=none;; | ||
142 | esac | ||
136 | AC_SUBST([LOCALE_FR]) | 143 | AC_SUBST([LOCALE_FR]) |
137 | ]) | 144 | ]) |
138 | 145 | ||
139 | dnl Determine the name of a french locale with UTF-8 encoding. | 146 | dnl Determine the name of a french locale with UTF-8 encoding. |
140 | AC_DEFUN([gt_LOCALE_FR_UTF8], | 147 | AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8], |
141 | [ | 148 | [ |
149 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
142 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 150 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
143 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ | 151 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ |
144 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | 152 | case "$host_os" in |
153 | *-musl* | midipix*) | ||
154 | dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without | ||
155 | dnl any locale file on disk. But they are effectively equivalent to the | ||
156 | dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) | ||
157 | dnl for which localizations (.mo files) have been installed. | ||
158 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
159 | ;; | ||
160 | *) | ||
161 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | ||
145 | #include <locale.h> | 162 | #include <locale.h> |
146 | #include <time.h> | 163 | #include <time.h> |
147 | #if HAVE_LANGINFO_CODESET | 164 | #if HAVE_LANGINFO_CODESET |
@@ -203,51 +220,82 @@ int main () { | |||
203 | #endif | 220 | #endif |
204 | return 0; | 221 | return 0; |
205 | } | 222 | } |
206 | ]])]) | 223 | ]])]) |
207 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 224 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
208 | case "$host_os" in | 225 | case "$host_os" in |
209 | # Handle native Windows specially, because there setlocale() interprets | 226 | # Handle native Windows specially, because there setlocale() interprets |
210 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", | 227 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", |
211 | # "fr" or "fra" as "French" or "French_France.1252", | 228 | # "fr" or "fra" as "French" or "French_France.1252", |
212 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 229 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
213 | # "ja" as "Japanese" or "Japanese_Japan.932", | 230 | # "ja" as "Japanese" or "Japanese_Japan.932", |
214 | # and similar. | 231 | # and similar. |
215 | mingw*) | 232 | mingw* | windows*) |
216 | # Test for the hypothetical native Windows locale name. | 233 | # Test for the hypothetical native Windows locale name. |
217 | if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 234 | if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
218 | gt_cv_locale_fr_utf8=French_France.65001 | 235 | gt_cv_locale_fr_utf8=French_France.65001 |
219 | else | ||
220 | # None found. | ||
221 | gt_cv_locale_fr_utf8=none | ||
222 | fi | ||
223 | ;; | ||
224 | *) | ||
225 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | ||
226 | # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the | ||
227 | # configure script would override the LC_ALL setting. Likewise for | ||
228 | # LC_CTYPE, which is also set at the beginning of the configure script. | ||
229 | # Test for the usual locale name. | ||
230 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
231 | gt_cv_locale_fr_utf8=fr_FR | ||
232 | else | ||
233 | # Test for the locale name with explicit encoding suffix. | ||
234 | if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
235 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
236 | else | ||
237 | # Test for the Solaris 7 locale name. | ||
238 | if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
239 | gt_cv_locale_fr_utf8=fr.UTF-8 | ||
240 | else | 236 | else |
241 | # None found. | 237 | # None found. |
242 | gt_cv_locale_fr_utf8=none | 238 | gt_cv_locale_fr_utf8=none |
243 | fi | 239 | fi |
244 | fi | 240 | ;; |
245 | fi | 241 | *) |
246 | ;; | 242 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because |
247 | esac | 243 | # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the |
248 | fi | 244 | # configure script would override the LC_ALL setting. Likewise for |
249 | rm -fr conftest* | 245 | # LC_CTYPE, which is also set at the beginning of the configure script. |
246 | # Test for the usual locale name. | ||
247 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
248 | gt_cv_locale_fr_utf8=fr_FR | ||
249 | else | ||
250 | # Test for the locale name with explicit encoding suffix. | ||
251 | if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
252 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
253 | else | ||
254 | # Test for the Solaris 10 locale name. | ||
255 | if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
256 | gt_cv_locale_fr_utf8=fr.UTF-8 | ||
257 | else | ||
258 | # None found. | ||
259 | gt_cv_locale_fr_utf8=none | ||
260 | fi | ||
261 | fi | ||
262 | fi | ||
263 | ;; | ||
264 | esac | ||
265 | fi | ||
266 | rm -fr conftest* | ||
267 | ;; | ||
268 | esac | ||
250 | ]) | 269 | ]) |
251 | LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 | 270 | LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 |
271 | case $LOCALE_FR_UTF8 in #( | ||
272 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
273 | dnl This locale name might cause trouble with sh or make. | ||
274 | AC_MSG_WARN([invalid locale "$LOCALE_FR_UTF8"; assuming "none"]) | ||
275 | LOCALE_FR_UTF8=none;; | ||
276 | esac | ||
252 | AC_SUBST([LOCALE_FR_UTF8]) | 277 | AC_SUBST([LOCALE_FR_UTF8]) |
278 | |||
279 | dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they | ||
280 | dnl can rely on. | ||
281 | case "$host_os" in | ||
282 | *-musl* | midipix*) | ||
283 | dnl On musl libc, locale categories other than LC_CTYPE and LC_MESSAGES | ||
284 | dnl are effectively unimplemented. | ||
285 | LC_COLLATE_IMPLEMENTED=false | ||
286 | LC_NUMERIC_IMPLEMENTED=false | ||
287 | LC_TIME_IMPLEMENTED=false | ||
288 | LC_MONETARY_IMPLEMENTED=false | ||
289 | ;; | ||
290 | *) | ||
291 | LC_COLLATE_IMPLEMENTED=true | ||
292 | LC_NUMERIC_IMPLEMENTED=true | ||
293 | LC_TIME_IMPLEMENTED=true | ||
294 | LC_MONETARY_IMPLEMENTED=true | ||
295 | ;; | ||
296 | esac | ||
297 | AC_SUBST([LC_COLLATE_IMPLEMENTED]) | ||
298 | AC_SUBST([LC_NUMERIC_IMPLEMENTED]) | ||
299 | AC_SUBST([LC_TIME_IMPLEMENTED]) | ||
300 | AC_SUBST([LC_MONETARY_IMPLEMENTED]) | ||
253 | ]) | 301 | ]) |
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 25901730..8423bcb9 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # locale-ja.m4 serial 15 | 1 | # locale-ja.m4 |
2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
3 | dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | 9 | ||
9 | dnl Determine the name of a japanese locale with EUC-JP encoding. | 10 | dnl Determine the name of a japanese locale with EUC-JP encoding. |
10 | AC_DEFUN([gt_LOCALE_JA], | 11 | AC_DEFUN_ONCE([gt_LOCALE_JA], |
11 | [ | 12 | [ |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 13 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 14 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
@@ -90,7 +91,7 @@ int main () | |||
90 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 91 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
91 | # "ja" as "Japanese" or "Japanese_Japan.932", | 92 | # "ja" as "Japanese" or "Japanese_Japan.932", |
92 | # and similar. | 93 | # and similar. |
93 | mingw*) | 94 | mingw* | windows*) |
94 | # Note that on native Windows, the Japanese locale is | 95 | # Note that on native Windows, the Japanese locale is |
95 | # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we | 96 | # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we |
96 | # cannot use it here. | 97 | # cannot use it here. |
@@ -117,7 +118,7 @@ int main () | |||
117 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 118 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
118 | gt_cv_locale_ja=ja_JP.EUC | 119 | gt_cv_locale_ja=ja_JP.EUC |
119 | else | 120 | else |
120 | # Test for the Solaris 7 locale name. | 121 | # Test for the Solaris 10 locale name. |
121 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 122 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
122 | gt_cv_locale_ja=ja | 123 | gt_cv_locale_ja=ja |
123 | else | 124 | else |
@@ -139,5 +140,11 @@ int main () | |||
139 | rm -fr conftest* | 140 | rm -fr conftest* |
140 | ]) | 141 | ]) |
141 | LOCALE_JA=$gt_cv_locale_ja | 142 | LOCALE_JA=$gt_cv_locale_ja |
143 | case $LOCALE_JA in #( | ||
144 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
145 | dnl This locale name might cause trouble with sh or make. | ||
146 | AC_MSG_WARN([invalid locale "$LOCALE_JA"; assuming "none"]) | ||
147 | LOCALE_JA=none;; | ||
148 | esac | ||
142 | AC_SUBST([LOCALE_JA]) | 149 | AC_SUBST([LOCALE_JA]) |
143 | ]) | 150 | ]) |
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index b9f9eef7..7f1a10be 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # locale-zh.m4 serial 15 | 1 | # locale-zh.m4 |
2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
3 | dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | 9 | ||
9 | dnl Determine the name of a chinese locale with GB18030 encoding. | 10 | dnl Determine the name of a chinese locale with GB18030 encoding. |
10 | AC_DEFUN([gt_LOCALE_ZH_CN], | 11 | AC_DEFUN_ONCE([gt_LOCALE_ZH_CN], |
11 | [ | 12 | [ |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 13 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 14 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
@@ -91,7 +92,7 @@ int main () | |||
91 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 92 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
92 | # "ja" as "Japanese" or "Japanese_Japan.932", | 93 | # "ja" as "Japanese" or "Japanese_Japan.932", |
93 | # and similar. | 94 | # and similar. |
94 | mingw*) | 95 | mingw* | windows*) |
95 | # Test for the hypothetical native Windows locale name. | 96 | # Test for the hypothetical native Windows locale name. |
96 | if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 97 | if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
97 | gt_cv_locale_zh_CN=Chinese_China.54936 | 98 | gt_cv_locale_zh_CN=Chinese_China.54936 |
@@ -133,5 +134,11 @@ int main () | |||
133 | rm -fr conftest* | 134 | rm -fr conftest* |
134 | ]) | 135 | ]) |
135 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN | 136 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN |
137 | case $LOCALE_ZH_CN in #( | ||
138 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
139 | dnl This locale name might cause trouble with sh or make. | ||
140 | AC_MSG_WARN([invalid locale "$LOCALE_ZH_CN"; assuming "none"]) | ||
141 | LOCALE_ZH_CN=none;; | ||
142 | esac | ||
136 | AC_SUBST([LOCALE_ZH_CN]) | 143 | AC_SUBST([LOCALE_ZH_CN]) |
137 | ]) | 144 | ]) |
diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 index a33a0a46..cd1c81ec 100644 --- a/gl/m4/locale_h.m4 +++ b/gl/m4/locale_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # locale_h.m4 serial 28 | 1 | # locale_h.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 31 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -59,7 +60,9 @@ AC_DEFUN_ONCE([gl_LOCALE_H], | |||
59 | dnl On native Windows with MSVC, merely define these member names as macros. | 60 | dnl On native Windows with MSVC, merely define these member names as macros. |
60 | dnl This avoids trouble in C++ mode. | 61 | dnl This avoids trouble in C++ mode. |
61 | case "$host_os" in | 62 | case "$host_os" in |
62 | mingw*) | 63 | windows*-msvc*) |
64 | ;; | ||
65 | mingw* | windows*) | ||
63 | AC_EGREP_CPP([Special], [ | 66 | AC_EGREP_CPP([Special], [ |
64 | #ifdef _MSC_VER | 67 | #ifdef _MSC_VER |
65 | Special | 68 | Special |
@@ -152,7 +155,7 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], | |||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) | 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) |
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) | 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) |
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) | 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) |
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) | 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) |
156 | ]) | 159 | ]) |
157 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) | 160 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) |
158 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 161 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) |
diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4 index ae225fed..77d5684f 100644 --- a/gl/m4/localeconv.m4 +++ b/gl/m4/localeconv.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # localeconv.m4 serial 1 | 1 | # localeconv.m4 |
2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
3 | dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,10 +9,45 @@ AC_DEFUN([gl_FUNC_LOCALECONV], | |||
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_LOCALE_H]) | 11 | AC_REQUIRE([gl_LOCALE_H]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
11 | 13 | ||
12 | if test $REPLACE_STRUCT_LCONV = 1; then | 14 | if test $REPLACE_STRUCT_LCONV = 1; then |
13 | REPLACE_LOCALECONV=1 | 15 | REPLACE_LOCALECONV=1 |
14 | fi | 16 | fi |
17 | if test $REPLACE_LOCALECONV = 0; then | ||
18 | dnl Test whether fields of type 'char' are filled correctly. | ||
19 | dnl This test fails on mingw 5.0.3. | ||
20 | AC_CACHE_CHECK([whether localeconv works], | ||
21 | [gl_cv_func_localeconv_works], | ||
22 | [AC_RUN_IFELSE( | ||
23 | [AC_LANG_SOURCE([[ | ||
24 | #include <locale.h> | ||
25 | #include <limits.h> | ||
26 | int main () | ||
27 | { | ||
28 | struct lconv *l = localeconv (); | ||
29 | return l->frac_digits != CHAR_MAX && l->frac_digits < 0; | ||
30 | } | ||
31 | ]])], | ||
32 | [gl_cv_func_localeconv_works=yes], | ||
33 | [gl_cv_func_localeconv_works=no], | ||
34 | [case "$host_os" in | ||
35 | # Guess yes on glibc systems. | ||
36 | *-gnu* | gnu*) gl_cv_func_localeconv_works="guessing yes" ;; | ||
37 | # Guess yes on musl systems. | ||
38 | *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;; | ||
39 | # Guess no on native Windows. | ||
40 | mingw* | windows*) gl_cv_func_localeconv_works="guessing no" ;; | ||
41 | # If we don't know, obey --enable-cross-guesses. | ||
42 | *) gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;; | ||
43 | esac | ||
44 | ]) | ||
45 | ]) | ||
46 | case "$gl_cv_func_localeconv_works" in | ||
47 | *yes) ;; | ||
48 | *) REPLACE_LOCALECONV=1 ;; | ||
49 | esac | ||
50 | fi | ||
15 | ]) | 51 | ]) |
16 | 52 | ||
17 | # Prerequisites of lib/localeconv.c. | 53 | # Prerequisites of lib/localeconv.c. |
@@ -19,4 +55,6 @@ AC_DEFUN([gl_PREREQ_LOCALECONV], | |||
19 | [ | 55 | [ |
20 | AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], | 56 | AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], |
21 | [[#include <locale.h>]]) | 57 | [[#include <locale.h>]]) |
58 | AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [], | ||
59 | [[#include <locale.h>]]) | ||
22 | ]) | 60 | ]) |
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index 88cf5575..eb0fc6a1 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # lock.m4 serial 14 | 1 | # lock.m4 |
2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index fd4f1f27..0bc3d65e 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # lseek.m4 serial 12 | 1 | # lseek.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -13,13 +14,15 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
13 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 14 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
14 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], | 15 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], |
15 | [case "$host_os" in | 16 | [case "$host_os" in |
16 | mingw*) | 17 | mingw* | windows*) |
17 | dnl Native Windows. | 18 | dnl Native Windows. |
18 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or | 19 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or |
19 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) | 20 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) |
20 | dnl for a pipe depends on the environment: In a Cygwin 1.5 | 21 | dnl for a pipe depends on the environment: |
21 | dnl environment it succeeds (wrong); in a Cygwin 1.7 environment | 22 | dnl In a Cygwin 1.5 environment it succeeds (wrong); |
22 | dnl it fails with a wrong errno value. | 23 | dnl in a Cygwin 1.7 environment it fails with a wrong errno value; |
24 | dnl in a Cygwin 2.9.0 environment it fails correctly; | ||
25 | dnl in a Cygwin 3.4.6 environment it succeeds again (wrong). | ||
23 | gl_cv_func_lseek_pipe=no | 26 | gl_cv_func_lseek_pipe=no |
24 | ;; | 27 | ;; |
25 | *) | 28 | *) |
@@ -70,9 +73,29 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
70 | REPLACE_LSEEK=1 | 73 | REPLACE_LSEEK=1 |
71 | fi | 74 | fi |
72 | 75 | ||
73 | dnl macOS SEEK_DATA is incompatible with other platforms. | 76 | AS_IF([test $REPLACE_LSEEK = 0], |
74 | case $host_os in | 77 | [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU], |
75 | darwin*) | 78 | [gl_cv_func_lseek_works_but_incompatible], |
76 | REPLACE_LSEEK=1;; | 79 | [AC_PREPROC_IFELSE( |
77 | esac | 80 | [AC_LANG_SOURCE( |
81 | dnl Use macOS "9999" to stand for a future fixed macOS version. | ||
82 | dnl See ../lib/unistd.in.h and <https://bugs.gnu.org/61386>. | ||
83 | [[#include <unistd.h> | ||
84 | #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA | ||
85 | # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ | ||
86 | # include <AvailabilityMacros.h> | ||
87 | # endif | ||
88 | # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED | ||
89 | # define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
90 | # endif | ||
91 | #endif | ||
92 | #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
93 | #error "No need to work around the bug" | ||
94 | #endif | ||
95 | ]])], | ||
96 | [gl_cv_func_lseek_works_but_incompatible=yes], | ||
97 | [gl_cv_func_lseek_works_but_incompatible=no])]) | ||
98 | if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then | ||
99 | REPLACE_LSEEK=1 | ||
100 | fi]) | ||
78 | ]) | 101 | ]) |
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 55402924..41a46937 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # malloc.m4 serial 28 | 1 | # malloc.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 31 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -16,7 +17,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], | |||
16 | [[#include <stdlib.h> | 17 | [[#include <stdlib.h> |
17 | ]], | 18 | ]], |
18 | [[void *p = malloc (0); | 19 | [[void *p = malloc (0); |
19 | int result = !p; | 20 | void * volatile vp = p; |
21 | int result = !vp; | ||
20 | free (p); | 22 | free (p); |
21 | return result;]]) | 23 | return result;]]) |
22 | ], | 24 | ], |
@@ -25,8 +27,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], | |||
25 | [case "$host_os" in | 27 | [case "$host_os" in |
26 | # Guess yes on platforms where we know the result. | 28 | # Guess yes on platforms where we know the result. |
27 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | 29 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ |
28 | | gnu* | *-musl* | midnightbsd* \ | 30 | | gnu* | *-musl* | midipix* | midnightbsd* \ |
29 | | hpux* | solaris* | cygwin* | mingw* | msys* ) | 31 | | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) |
30 | ac_cv_func_malloc_0_nonnull="guessing yes" ;; | 32 | ac_cv_func_malloc_0_nonnull="guessing yes" ;; |
31 | # If we don't know, obey --enable-cross-guesses. | 33 | # If we don't know, obey --enable-cross-guesses. |
32 | *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; | 34 | *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; |
@@ -128,7 +130,7 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], | |||
128 | dnl except on those platforms where we have seen 'test-malloc-gnu', | 130 | dnl except on those platforms where we have seen 'test-malloc-gnu', |
129 | dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. | 131 | dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. |
130 | case "$host_os" in | 132 | case "$host_os" in |
131 | mingw*) | 133 | mingw* | windows*) |
132 | gl_cv_func_malloc_posix=no ;; | 134 | gl_cv_func_malloc_posix=no ;; |
133 | irix* | solaris*) | 135 | irix* | solaris*) |
134 | dnl On IRIX 6.5, the three functions return NULL with errno unset | 136 | dnl On IRIX 6.5, the three functions return NULL with errno unset |
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4 index 1d777ebe..9e09d22c 100644 --- a/gl/m4/malloca.m4 +++ b/gl/m4/malloca.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # malloca.m4 serial 2 | 1 | # malloca.m4 |
2 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 2 |
3 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index d2e90ff1..4b26c9e9 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # math_h.m4 serial 125 | 1 | # math_h.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 138 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -42,15 +43,21 @@ AC_DEFUN_ONCE([gl_MATH_H], | |||
42 | cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf | 43 | cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf |
43 | expf expl exp2 exp2f exp2l expm1 expm1f expm1l | 44 | expf expl exp2 exp2f exp2l expm1 expm1f expm1l |
44 | fabsf fabsl floorf floorl fma fmaf fmal | 45 | fabsf fabsl floorf floorl fma fmaf fmal |
45 | fmod fmodf fmodl frexpf frexpl hypotf hypotl | 46 | fmod fmodf fmodl frexpf frexpl |
47 | getpayload getpayloadf getpayloadl | ||
48 | hypotf hypotl | ||
46 | ilogb ilogbf ilogbl | 49 | ilogb ilogbf ilogbl |
47 | ldexpf ldexpl | 50 | ldexpf ldexpl |
48 | log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l | 51 | log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l |
49 | logb logbf logbl | 52 | logb logbf logbl |
50 | modf modff modfl powf | 53 | modf modff modfl powf |
51 | remainder remainderf remainderl | 54 | remainder remainderf remainderl |
52 | rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl | 55 | rint rintf rintl round roundf roundl |
53 | tanf tanl tanhf trunc truncf truncl]) | 56 | setpayload setpayloadf setpayloadl |
57 | setpayloadsig setpayloadsigf setpayloadsigl | ||
58 | sinf sinl sinhf sqrtf sqrtl | ||
59 | tanf tanl tanhf totalorder totalorderf totalorderl totalordermag | ||
60 | totalordermagf totalordermagl trunc truncf truncl]) | ||
54 | ]) | 61 | ]) |
55 | 62 | ||
56 | # gl_MATH_MODULE_INDICATOR([modulename]) | 63 | # gl_MATH_MODULE_INDICATOR([modulename]) |
@@ -113,6 +120,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) | 120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) |
114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) | 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) |
115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) | 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) |
123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOAD]) | ||
124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADF]) | ||
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADL]) | ||
116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) | 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) |
117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) | 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) |
118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) | 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) |
@@ -125,6 +135,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) | 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) |
126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) |
127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) | 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) |
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXP]) | ||
128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) | 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) |
129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) |
130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) |
@@ -155,6 +166,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) | 166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) |
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) | 167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) |
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) | 168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) |
169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOAD]) | ||
170 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADF]) | ||
171 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADL]) | ||
172 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIG]) | ||
173 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF]) | ||
174 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) | 175 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) |
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) | 176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) |
160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) | 177 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) |
@@ -164,6 +181,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) |
165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) | 182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) |
166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) | 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) |
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDER]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERF]) | ||
186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERL]) | ||
187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAG]) | ||
188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGF]) | ||
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGL]) | ||
167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) | 190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) |
168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) | 191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) |
169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) | 192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) |
@@ -209,6 +232,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
209 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) | 232 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) |
210 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) | 233 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) |
211 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) | 234 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) |
235 | HAVE_GETPAYLOAD=1; AC_SUBST([HAVE_GETPAYLOAD]) | ||
236 | HAVE_GETPAYLOADF=1; AC_SUBST([HAVE_GETPAYLOADF]) | ||
237 | HAVE_GETPAYLOADL=1; AC_SUBST([HAVE_GETPAYLOADL]) | ||
212 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) | 238 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) |
213 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) | 239 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) |
214 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) | 240 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) |
@@ -234,6 +260,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
234 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) | 260 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) |
235 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) | 261 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) |
236 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) | 262 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) |
263 | HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD]) | ||
264 | HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF]) | ||
265 | HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL]) | ||
266 | HAVE_SETPAYLOADSIG=1; AC_SUBST([HAVE_SETPAYLOADSIG]) | ||
267 | HAVE_SETPAYLOADSIGF=1; AC_SUBST([HAVE_SETPAYLOADSIGF]) | ||
268 | HAVE_SETPAYLOADSIGL=1; AC_SUBST([HAVE_SETPAYLOADSIGL]) | ||
237 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) | 269 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) |
238 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) | 270 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) |
239 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) | 271 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) |
@@ -242,6 +274,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
242 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) | 274 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) |
243 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) | 275 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) |
244 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) | 276 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) |
277 | HAVE_TOTALORDER=1; AC_SUBST([HAVE_TOTALORDER]) | ||
278 | HAVE_TOTALORDERF=1; AC_SUBST([HAVE_TOTALORDERF]) | ||
279 | HAVE_TOTALORDERL=1; AC_SUBST([HAVE_TOTALORDERL]) | ||
280 | HAVE_TOTALORDERMAG=1; AC_SUBST([HAVE_TOTALORDERMAG]) | ||
281 | HAVE_TOTALORDERMAGF=1; AC_SUBST([HAVE_TOTALORDERMAGF]) | ||
282 | HAVE_TOTALORDERMAGL=1; AC_SUBST([HAVE_TOTALORDERMAGL]) | ||
245 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) | 283 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) |
246 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) | 284 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) |
247 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) | 285 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) |
@@ -309,6 +347,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
309 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) | 347 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) |
310 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) | 348 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) |
311 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) | 349 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) |
350 | REPLACE_GETPAYLOAD=0; AC_SUBST([REPLACE_GETPAYLOAD]) | ||
351 | REPLACE_GETPAYLOADF=0; AC_SUBST([REPLACE_GETPAYLOADF]) | ||
352 | REPLACE_GETPAYLOADL=0; AC_SUBST([REPLACE_GETPAYLOADL]) | ||
312 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) | 353 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) |
313 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) | 354 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) |
314 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) | 355 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) |
@@ -319,6 +360,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
319 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) | 360 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) |
320 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) | 361 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) |
321 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) | 362 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) |
363 | REPLACE_LDEXP=0; AC_SUBST([REPLACE_LDEXP]) | ||
322 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) | 364 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) |
323 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) | 365 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) |
324 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) | 366 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) |
@@ -354,6 +396,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
354 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) | 396 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) |
355 | REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) | 397 | REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) |
356 | REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) | 398 | REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) |
399 | REPLACE_TOTALORDER=0; AC_SUBST([REPLACE_TOTALORDER]) | ||
400 | REPLACE_TOTALORDERF=0; AC_SUBST([REPLACE_TOTALORDERF]) | ||
401 | REPLACE_TOTALORDERL=0; AC_SUBST([REPLACE_TOTALORDERL]) | ||
402 | REPLACE_TOTALORDERMAG=0; AC_SUBST([REPLACE_TOTALORDERMAG]) | ||
403 | REPLACE_TOTALORDERMAGF=0; AC_SUBST([REPLACE_TOTALORDERMAGF]) | ||
404 | REPLACE_TOTALORDERMAGL=0; AC_SUBST([REPLACE_TOTALORDERMAGL]) | ||
357 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) | 405 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) |
358 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) | 406 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) |
359 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) | 407 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) |
@@ -364,7 +412,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
364 | # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines | 412 | # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines |
365 | # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. | 413 | # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. |
366 | # The currently known platforms where this is the case are: | 414 | # The currently known platforms where this is the case are: |
367 | # Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. | 415 | # Linux/HPPA, NetBSD/sparc32, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. |
368 | AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], | 416 | AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], |
369 | [ | 417 | [ |
370 | AC_CACHE_CHECK([whether long double and double are the same], | 418 | AC_CACHE_CHECK([whether long double and double are the same], |
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index bb393041..62c4fdb3 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mbrtowc.m4 serial 38 -*- coding: utf-8 -*- | 1 | # mbrtowc.m4 |
2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2023 Free Software Foundation, | 2 | # serial 44 -*- coding: utf-8 -*- |
3 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -91,20 +92,25 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
91 | fi | 92 | fi |
92 | if test $REPLACE_MBSTATE_T = 1; then | 93 | if test $REPLACE_MBSTATE_T = 1; then |
93 | case "$host_os" in | 94 | case "$host_os" in |
94 | mingw*) LIB_MBRTOWC= ;; | 95 | mingw* | windows*) |
96 | MBRTOWC_LIB= | ||
97 | ;; | ||
95 | *) | 98 | *) |
96 | gl_WEAK_SYMBOLS | 99 | gl_WEAK_SYMBOLS |
97 | case "$gl_cv_have_weak" in | 100 | case "$gl_cv_have_weak" in |
98 | *yes) LIB_MBRTOWC= ;; | 101 | *yes) MBRTOWC_LIB= ;; |
99 | *) LIB_MBRTOWC="$LIBPTHREAD" ;; | 102 | *) MBRTOWC_LIB="$LIBPTHREAD" ;; |
100 | esac | 103 | esac |
101 | ;; | 104 | ;; |
102 | esac | 105 | esac |
103 | else | 106 | else |
104 | LIB_MBRTOWC= | 107 | MBRTOWC_LIB= |
105 | fi | 108 | fi |
106 | dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX | 109 | dnl MBRTOWC_LIB is expected to be '-pthread' or '-lpthread' on AIX |
107 | dnl with gcc or xlc, and empty otherwise. | 110 | dnl with gcc or xlc, and empty otherwise. |
111 | AC_SUBST([MBRTOWC_LIB]) | ||
112 | dnl For backward compatibility. | ||
113 | LIB_MBRTOWC="$MBRTOWC_LIB" | ||
108 | AC_SUBST([LIB_MBRTOWC]) | 114 | AC_SUBST([LIB_MBRTOWC]) |
109 | ]) | 115 | ]) |
110 | 116 | ||
@@ -114,7 +120,7 @@ dnl Result is REPLACE_MBSTATE_T. | |||
114 | dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to | 120 | dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to |
115 | dnl avoid inconsistencies. | 121 | dnl avoid inconsistencies. |
116 | 122 | ||
117 | AC_DEFUN([gl_MBSTATE_T_BROKEN], | 123 | AC_DEFUN_ONCE([gl_MBSTATE_T_BROKEN], |
118 | [ | 124 | [ |
119 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 125 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
120 | AC_REQUIRE([AC_CANONICAL_HOST]) | 126 | AC_REQUIRE([AC_CANONICAL_HOST]) |
@@ -126,7 +132,7 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], | |||
126 | dnl to override it, even if - like on MSVC - mbsinit() is only defined as | 132 | dnl to override it, even if - like on MSVC - mbsinit() is only defined as |
127 | dnl an inline function, not as a global function. | 133 | dnl an inline function, not as a global function. |
128 | if case "$host_os" in | 134 | if case "$host_os" in |
129 | mingw*) true ;; | 135 | mingw* | windows*) true ;; |
130 | *) test $ac_cv_func_mbsinit = yes ;; | 136 | *) test $ac_cv_func_mbsinit = yes ;; |
131 | esac \ | 137 | esac \ |
132 | && test $ac_cv_func_mbrtowc = yes; then | 138 | && test $ac_cv_func_mbrtowc = yes; then |
@@ -408,14 +414,16 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], | |||
408 | dnl is present. | 414 | dnl is present. |
409 | changequote(,)dnl | 415 | changequote(,)dnl |
410 | case "$host_os" in | 416 | case "$host_os" in |
411 | # Guess no on HP-UX, Solaris, native Windows. | 417 | # Guess no on HP-UX, Solaris, native Windows. |
412 | hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; | 418 | hpux* | solaris* | mingw* | windows*) |
413 | # Guess yes otherwise. | 419 | gl_cv_func_mbrtowc_retval="guessing no" ;; |
414 | *) gl_cv_func_mbrtowc_retval="guessing yes" ;; | 420 | # Guess yes otherwise. |
421 | *) | ||
422 | gl_cv_func_mbrtowc_retval="guessing yes" ;; | ||
415 | esac | 423 | esac |
416 | changequote([,])dnl | 424 | changequote([,])dnl |
417 | if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ | 425 | if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ |
418 | || { case "$host_os" in mingw*) true;; *) false;; esac; }; then | 426 | || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then |
419 | AC_RUN_IFELSE( | 427 | AC_RUN_IFELSE( |
420 | [AC_LANG_SOURCE([[ | 428 | [AC_LANG_SOURCE([[ |
421 | #include <locale.h> | 429 | #include <locale.h> |
@@ -426,7 +434,8 @@ int main () | |||
426 | int result = 0; | 434 | int result = 0; |
427 | int found_some_locale = 0; | 435 | int found_some_locale = 0; |
428 | /* This fails on Solaris. */ | 436 | /* This fails on Solaris. */ |
429 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 437 | if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 |
438 | && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
430 | { | 439 | { |
431 | char input[] = "B\303\274\303\237er"; /* "Büßer" */ | 440 | char input[] = "B\303\274\303\237er"; /* "Büßer" */ |
432 | mbstate_t state; | 441 | mbstate_t state; |
@@ -442,7 +451,8 @@ int main () | |||
442 | found_some_locale = 1; | 451 | found_some_locale = 1; |
443 | } | 452 | } |
444 | /* This fails on HP-UX 11.11. */ | 453 | /* This fails on HP-UX 11.11. */ |
445 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 454 | if (strcmp ("$LOCALE_JA", "none") != 0 |
455 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
446 | { | 456 | { |
447 | char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ | 457 | char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ |
448 | mbstate_t state; | 458 | mbstate_t state; |
@@ -577,13 +587,13 @@ AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], | |||
577 | dnl is present. | 587 | dnl is present. |
578 | changequote(,)dnl | 588 | changequote(,)dnl |
579 | case "$host_os" in | 589 | case "$host_os" in |
580 | # Guess yes on native Windows. | 590 | # Guess yes on native Windows. |
581 | mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; | 591 | mingw* | windows*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; |
582 | *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; | 592 | *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; |
583 | esac | 593 | esac |
584 | changequote([,])dnl | 594 | changequote([,])dnl |
585 | case "$host_os" in | 595 | case "$host_os" in |
586 | mingw*) | 596 | mingw* | windows*) |
587 | AC_RUN_IFELSE( | 597 | AC_RUN_IFELSE( |
588 | [AC_LANG_SOURCE([[ | 598 | [AC_LANG_SOURCE([[ |
589 | #include <locale.h> | 599 | #include <locale.h> |
@@ -677,31 +687,28 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], | |||
677 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 687 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
678 | AC_CACHE_CHECK([whether mbrtowc works on empty input], | 688 | AC_CACHE_CHECK([whether mbrtowc works on empty input], |
679 | [gl_cv_func_mbrtowc_empty_input], | 689 | [gl_cv_func_mbrtowc_empty_input], |
680 | [ | 690 | [AC_RUN_IFELSE( |
681 | dnl Initial guess, used when cross-compiling or when no suitable locale | 691 | [AC_LANG_SOURCE([[ |
682 | dnl is present. | 692 | #include <wchar.h> |
683 | changequote(,)dnl | 693 | static wchar_t wc; |
684 | case "$host_os" in | 694 | static mbstate_t mbs; |
685 | # Guess no on AIX and glibc systems. | 695 | int |
686 | aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; | 696 | main (void) |
687 | # Guess yes on native Windows. | 697 | { |
688 | mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | 698 | return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; |
689 | *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | 699 | }]])], |
690 | esac | 700 | [gl_cv_func_mbrtowc_empty_input=yes], |
691 | changequote([,])dnl | 701 | [gl_cv_func_mbrtowc_empty_input=no], |
692 | AC_RUN_IFELSE( | 702 | [case "$host_os" in |
693 | [AC_LANG_SOURCE([[ | 703 | # Guess no on AIX and glibc systems. |
694 | #include <wchar.h> | 704 | aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
695 | static wchar_t wc; | 705 | # Guess no on Android. |
696 | static mbstate_t mbs; | 706 | linux*-android*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
697 | int | 707 | # Guess no on native Windows. |
698 | main (void) | 708 | mingw* | windows*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
699 | { | 709 | *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; |
700 | return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; | 710 | esac |
701 | }]])], | 711 | ]) |
702 | [gl_cv_func_mbrtowc_empty_input=yes], | ||
703 | [gl_cv_func_mbrtowc_empty_input=no], | ||
704 | [:]) | ||
705 | ]) | 712 | ]) |
706 | ]) | 713 | ]) |
707 | 714 | ||
@@ -709,18 +716,17 @@ dnl Test whether mbrtowc reports encoding errors in the C locale. | |||
709 | dnl Although POSIX was never intended to allow this, the GNU C Library | 716 | dnl Although POSIX was never intended to allow this, the GNU C Library |
710 | dnl and other implementations do it. See: | 717 | dnl and other implementations do it. See: |
711 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 | 718 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 |
719 | dnl POSIX has now clarified it: | ||
720 | dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html> | ||
721 | dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte | ||
722 | dnl values are valid characters." | ||
712 | 723 | ||
713 | AC_DEFUN([gl_MBRTOWC_C_LOCALE], | 724 | AC_DEFUN([gl_MBRTOWC_C_LOCALE], |
714 | [ | 725 | [ |
715 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 726 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
716 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], | 727 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], |
717 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], | 728 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], |
718 | [ | 729 | [AC_RUN_IFELSE( |
719 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
720 | dnl is present. | ||
721 | gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" | ||
722 | |||
723 | AC_RUN_IFELSE( | ||
724 | [AC_LANG_PROGRAM( | 730 | [AC_LANG_PROGRAM( |
725 | [[#include <limits.h> | 731 | [[#include <limits.h> |
726 | #include <locale.h> | 732 | #include <locale.h> |
@@ -741,13 +747,14 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], | |||
741 | } | 747 | } |
742 | return 0; | 748 | return 0; |
743 | ]])], | 749 | ]])], |
744 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], | 750 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], |
745 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], | 751 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], |
746 | [case "$host_os" in | 752 | [case "$host_os" in |
747 | # Guess yes on native Windows. | 753 | # Guess yes on native Windows. |
748 | mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; | 754 | mingw* | windows*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; |
749 | esac | 755 | *) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; |
750 | ]) | 756 | esac |
757 | ]) | ||
751 | ]) | 758 | ]) |
752 | ]) | 759 | ]) |
753 | 760 | ||
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index c388a8b9..10c86ba9 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mbsinit.m4 serial 9 | 1 | # mbsinit.m4 |
2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
3 | dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -32,7 +33,7 @@ AC_DEFUN([gl_FUNC_MBSINIT], | |||
32 | dnl states produced by mbrtowc() for an incomplete multibyte character | 33 | dnl states produced by mbrtowc() for an incomplete multibyte character |
33 | dnl in multibyte locales. | 34 | dnl in multibyte locales. |
34 | case "$host_os" in | 35 | case "$host_os" in |
35 | mingw*) REPLACE_MBSINIT=1 ;; | 36 | mingw* | windows*) REPLACE_MBSINIT=1 ;; |
36 | esac | 37 | esac |
37 | fi | 38 | fi |
38 | fi | 39 | fi |
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index dcd66b96..66d65cd7 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mbstate_t.m4 serial 14 | 1 | # mbstate_t.m4 |
2 | dnl Copyright (C) 2000-2002, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2000-2002, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4 index 7823be0e..603b0c1a 100644 --- a/gl/m4/mbtowc.m4 +++ b/gl/m4/mbtowc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mbtowc.m4 serial 3 | 1 | # mbtowc.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,9 +9,12 @@ AC_DEFUN([gl_FUNC_MBTOWC], | |||
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
10 | 11 | ||
11 | AC_CHECK_FUNCS([mbtowc]) | 12 | gl_CHECK_FUNCS_ANDROID([mbtowc], [[#include <stdlib.h>]]) |
12 | if test $ac_cv_func_mbtowc = no; then | 13 | if test $ac_cv_func_mbtowc = no; then |
13 | HAVE_MBTOWC=0 | 14 | HAVE_MBTOWC=0 |
15 | case "$gl_cv_onwards_func_mbtowc" in | ||
16 | future*) REPLACE_MBTOWC=1 ;; | ||
17 | esac | ||
14 | else | 18 | else |
15 | if false; then | 19 | if false; then |
16 | REPLACE_MBTOWC=1 | 20 | REPLACE_MBTOWC=1 |
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 4f1aed01..346a2882 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # memchr.m4 serial 18 | 1 | # memchr.m4 |
2 | dnl Copyright (C) 2002-2004, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 19 |
3 | dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -85,12 +86,12 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | |||
85 | [gl_cv_func_memchr_works=yes], | 86 | [gl_cv_func_memchr_works=yes], |
86 | [gl_cv_func_memchr_works=no], | 87 | [gl_cv_func_memchr_works=no], |
87 | [case "$host_os" in | 88 | [case "$host_os" in |
88 | # Guess no on Android. | 89 | # Guess no on Android. |
89 | linux*-android*) gl_cv_func_memchr_works="guessing no" ;; | 90 | linux*-android*) gl_cv_func_memchr_works="guessing no" ;; |
90 | # Guess yes on native Windows. | 91 | # Guess yes on native Windows. |
91 | mingw*) gl_cv_func_memchr_works="guessing yes" ;; | 92 | mingw* | windows*) gl_cv_func_memchr_works="guessing yes" ;; |
92 | # If we don't know, obey --enable-cross-guesses. | 93 | # If we don't know, obey --enable-cross-guesses. |
93 | *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; | 94 | *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; |
94 | esac | 95 | esac |
95 | ]) | 96 | ]) |
96 | ]) | 97 | ]) |
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index fd09846f..bc7d0c34 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # minmax.m4 serial 4 | 1 | # minmax.m4 |
2 | dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index e9d31f35..85c52454 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 | |||
@@ -1,6 +1,6 @@ | |||
1 | # serial 37 | 1 | # mktime.m4 |
2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, | 2 | # serial 39 |
3 | dnl Inc. | 3 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -264,9 +264,9 @@ main () | |||
264 | [gl_cv_func_working_mktime=yes], | 264 | [gl_cv_func_working_mktime=yes], |
265 | [gl_cv_func_working_mktime=no], | 265 | [gl_cv_func_working_mktime=no], |
266 | [case "$host_os" in | 266 | [case "$host_os" in |
267 | # Guess no on native Windows. | 267 | # Guess no on native Windows. |
268 | mingw*) gl_cv_func_working_mktime="guessing no" ;; | 268 | mingw* | windows*) gl_cv_func_working_mktime="guessing no" ;; |
269 | *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; | 269 | *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; |
270 | esac | 270 | esac |
271 | ]) | 271 | ]) |
272 | fi | 272 | fi |
@@ -280,7 +280,6 @@ AC_DEFUN([gl_FUNC_MKTIME], | |||
280 | AC_REQUIRE([AC_CANONICAL_HOST]) | 280 | AC_REQUIRE([AC_CANONICAL_HOST]) |
281 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) | 281 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
282 | 282 | ||
283 | REPLACE_MKTIME=0 | ||
284 | if test "$gl_cv_func_working_mktime" != yes; then | 283 | if test "$gl_cv_func_working_mktime" != yes; then |
285 | REPLACE_MKTIME=1 | 284 | REPLACE_MKTIME=1 |
286 | AC_DEFINE([NEED_MKTIME_WORKING], [1], | 285 | AC_DEFINE([NEED_MKTIME_WORKING], [1], |
@@ -288,7 +287,7 @@ AC_DEFUN([gl_FUNC_MKTIME], | |||
288 | with the algorithmic workarounds.]) | 287 | with the algorithmic workarounds.]) |
289 | fi | 288 | fi |
290 | case "$host_os" in | 289 | case "$host_os" in |
291 | mingw*) | 290 | mingw* | windows*) |
292 | REPLACE_MKTIME=1 | 291 | REPLACE_MKTIME=1 |
293 | AC_DEFINE([NEED_MKTIME_WINDOWS], [1], | 292 | AC_DEFINE([NEED_MKTIME_WINDOWS], [1], |
294 | [Define if the compilation of mktime.c should define 'mktime' | 293 | [Define if the compilation of mktime.c should define 'mktime' |
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index d07d26e4..61ca0120 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mmap-anon.m4 serial 12 | 1 | # mmap-anon.m4 |
2 | dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 index 82197c02..0d5c2808 100644 --- a/gl/m4/mode_t.m4 +++ b/gl/m4/mode_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # mode_t.m4 serial 2 | 1 | # mode_t.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 2 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index a9b4edb9..ff414e66 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # serial 15 | 1 | # mountlist.m4 |
2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 17 |
3 | dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -106,7 +107,18 @@ $ac_includes_default | |||
106 | [Define if there is a function named getmntent for reading the list | 107 | [Define if there is a function named getmntent for reading the list |
107 | of mounted file systems, and that function takes a single argument. | 108 | of mounted file systems, and that function takes a single argument. |
108 | (4.3BSD, SunOS, HP-UX, Irix)]) | 109 | (4.3BSD, SunOS, HP-UX, Irix)]) |
109 | AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) | 110 | gl_CHECK_FUNCS_ANDROID([setmntent], |
111 | [[#include <stdio.h> | ||
112 | #include <mntent.h> | ||
113 | ]]) | ||
114 | gl_CHECK_FUNCS_ANDROID([endmntent], | ||
115 | [[#include <stdio.h> | ||
116 | #include <mntent.h> | ||
117 | ]]) | ||
118 | gl_CHECK_FUNCS_ANDROID([hasmntopt], | ||
119 | [[#include <stdio.h> | ||
120 | #include <mntent.h> | ||
121 | ]]) | ||
110 | fi | 122 | fi |
111 | fi | 123 | fi |
112 | 124 | ||
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 index 8d9d21b5..7919ff12 100644 --- a/gl/m4/msvc-inval.m4 +++ b/gl/m4/msvc-inval.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # msvc-inval.m4 serial 1 | 1 | # msvc-inval.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4 index 0263e490..007c7620 100644 --- a/gl/m4/msvc-nothrow.m4 +++ b/gl/m4/msvc-nothrow.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # msvc-nothrow.m4 serial 1 | 1 | # msvc-nothrow.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 3ba5b0f7..3af29d39 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # multiarch.m4 serial 9 | 1 | # multiarch.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/musl.m4 b/gl/m4/musl.m4 new file mode 100644 index 00000000..0d4de892 --- /dev/null +++ b/gl/m4/musl.m4 | |||
@@ -0,0 +1,21 @@ | |||
1 | # musl.m4 | ||
2 | # serial 4 | ||
3 | dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | # Test for musl libc, despite the musl libc authors don't like it | ||
9 | # <https://wiki.musl-libc.org/faq.html> | ||
10 | # <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>. | ||
11 | # From Bruno Haible. | ||
12 | |||
13 | AC_DEFUN_ONCE([gl_MUSL_LIBC], | ||
14 | [ | ||
15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
16 | case "$host_os" in | ||
17 | *-musl* | midipix*) | ||
18 | AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) | ||
19 | ;; | ||
20 | esac | ||
21 | ]) | ||
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index e6aa8925..d8c00217 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # netdb_h.m4 serial 15 | 1 | # netdb_h.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 71154191..926f7f95 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # netinet_in_h.m4 serial 6 | 1 | # netinet_in_h.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 index 51e783ce..f38f11bb 100644 --- a/gl/m4/nl_langinfo.m4 +++ b/gl/m4/nl_langinfo.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # nl_langinfo.m4 serial 8 | 1 | # nl_langinfo.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,7 +9,7 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_LANGINFO_H]) | 11 | AC_REQUIRE([gl_LANGINFO_H]) |
11 | AC_CHECK_FUNCS_ONCE([nl_langinfo]) | 12 | gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 13 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | 14 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) |
14 | AC_REQUIRE([gl_PTHREADLIB]) | 15 | AC_REQUIRE([gl_PTHREADLIB]) |
@@ -60,9 +61,12 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
60 | fi | 61 | fi |
61 | else | 62 | else |
62 | HAVE_NL_LANGINFO=0 | 63 | HAVE_NL_LANGINFO=0 |
64 | case "$gl_cv_onwards_func_nl_langinfo" in | ||
65 | future*) REPLACE_NL_LANGINFO=1 ;; | ||
66 | esac | ||
63 | fi | 67 | fi |
64 | if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then | 68 | if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then |
65 | LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" | 69 | LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB" |
66 | else | 70 | else |
67 | LIB_NL_LANGINFO= | 71 | LIB_NL_LANGINFO= |
68 | fi | 72 | fi |
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index 6a766387..cbe8fe82 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # nocrash.m4 serial 5 | 1 | # nocrash.m4 |
2 | dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4 index 880f3472..db6035db 100644 --- a/gl/m4/off_t.m4 +++ b/gl/m4/off_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # off_t.m4 serial 1 | 1 | # off_t.m4 |
2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4 index fd572fcd..6defdfb4 100644 --- a/gl/m4/open-cloexec.m4 +++ b/gl/m4/open-cloexec.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | # Test whether O_CLOEXEC is defined. | 1 | # open-cloexec.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2017-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2017-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # Test whether O_CLOEXEC is defined. | ||
9 | |||
8 | AC_DEFUN([gl_PREPROC_O_CLOEXEC], | 10 | AC_DEFUN([gl_PREPROC_O_CLOEXEC], |
9 | [ | 11 | [ |
10 | AC_CACHE_CHECK([for O_CLOEXEC], | 12 | AC_CACHE_CHECK([for O_CLOEXEC], |
diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4 index 1f731f8a..03460e42 100644 --- a/gl/m4/open-slash.m4 +++ b/gl/m4/open-slash.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # open-slash.m4 serial 2 | 1 | # open-slash.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 2 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 94fa2bb7..62a11a11 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # open.m4 serial 15 | 1 | # open.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,7 +10,7 @@ AC_DEFUN([gl_FUNC_OPEN], | |||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | 10 | AC_REQUIRE([AC_CANONICAL_HOST]) |
10 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) | 11 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) |
11 | case "$host_os" in | 12 | case "$host_os" in |
12 | mingw* | pw*) | 13 | mingw* | windows* | pw*) |
13 | REPLACE_OPEN=1 | 14 | REPLACE_OPEN=1 |
14 | ;; | 15 | ;; |
15 | *) | 16 | *) |
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 index 6d47d2c0..4280837f 100644 --- a/gl/m4/pathmax.m4 +++ b/gl/m4/pathmax.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # pathmax.m4 serial 11 | 1 | # pathmax.m4 |
2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2023 Free Software Foundation, | 2 | # serial 11 |
3 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4 index 0fd7d0a1..8bedcc6b 100644 --- a/gl/m4/pid_t.m4 +++ b/gl/m4/pid_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # pid_t.m4 serial 4 | 1 | # pid_t.m4 |
2 | dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 4e65abc6..0cb14d6f 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # printf.m4 serial 73 | 1 | # printf.m4 |
2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 91 |
3 | dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -63,7 +64,7 @@ changequote(,)dnl | |||
63 | # Guess yes on glibc systems. | 64 | # Guess yes on glibc systems. |
64 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; | 65 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; |
65 | # Guess yes on musl systems. | 66 | # Guess yes on musl systems. |
66 | *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; | 67 | *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";; |
67 | # Guess yes on FreeBSD >= 5. | 68 | # Guess yes on FreeBSD >= 5. |
68 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; | 69 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; |
69 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | 70 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; |
@@ -86,7 +87,8 @@ changequote(,)dnl | |||
86 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; | 87 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; |
87 | changequote([,])dnl | 88 | changequote([,])dnl |
88 | # Guess yes on MSVC, no on mingw. | 89 | # Guess yes on MSVC, no on mingw. |
89 | mingw*) AC_EGREP_CPP([Known], [ | 90 | windows*-msvc*) gl_cv_func_printf_sizes_c99="guessing yes" ;; |
91 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
90 | #ifdef _MSC_VER | 92 | #ifdef _MSC_VER |
91 | Known | 93 | Known |
92 | #endif | 94 | #endif |
@@ -101,6 +103,92 @@ changequote([,])dnl | |||
101 | ]) | 103 | ]) |
102 | ]) | 104 | ]) |
103 | 105 | ||
106 | dnl Test whether the *printf family of functions supports the 'w8', 'w16', | ||
107 | dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23) | ||
108 | dnl Result is gl_cv_func_printf_sizes_c23. | ||
109 | |||
110 | AC_DEFUN([gl_PRINTF_SIZES_C23], | ||
111 | [ | ||
112 | AC_REQUIRE([AC_PROG_CC]) | ||
113 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
114 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
115 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
116 | AC_CACHE_CHECK([whether printf supports size specifiers as in C23], | ||
117 | [gl_cv_func_printf_sizes_c23], | ||
118 | [ | ||
119 | AC_RUN_IFELSE( | ||
120 | [AC_LANG_SOURCE([[ | ||
121 | #include <stddef.h> | ||
122 | #include <stdio.h> | ||
123 | #include <string.h> | ||
124 | #include <sys/types.h> | ||
125 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
126 | # include <stdint.h> | ||
127 | #endif | ||
128 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
129 | # include <inttypes.h> | ||
130 | #endif | ||
131 | static char buf[100]; | ||
132 | int main () | ||
133 | { | ||
134 | int result = 0; | ||
135 | buf[0] = '\0'; | ||
136 | if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0 | ||
137 | || strcmp (buf, "123 33") != 0) | ||
138 | result |= 1; | ||
139 | buf[0] = '\0'; | ||
140 | if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0 | ||
141 | || strcmp (buf, "123 33") != 0) | ||
142 | result |= 1; | ||
143 | buf[0] = '\0'; | ||
144 | if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0 | ||
145 | || strcmp (buf, "12345 33") != 0) | ||
146 | result |= 2; | ||
147 | buf[0] = '\0'; | ||
148 | if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0 | ||
149 | || strcmp (buf, "12345 33") != 0) | ||
150 | result |= 2; | ||
151 | buf[0] = '\0'; | ||
152 | if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0 | ||
153 | || strcmp (buf, "12345671 33") != 0) | ||
154 | result |= 4; | ||
155 | buf[0] = '\0'; | ||
156 | if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0 | ||
157 | || strcmp (buf, "12345671 33") != 0) | ||
158 | result |= 4; | ||
159 | #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX | ||
160 | buf[0] = '\0'; | ||
161 | if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0 | ||
162 | || strcmp (buf, "12345671 33") != 0) | ||
163 | result |= 8; | ||
164 | buf[0] = '\0'; | ||
165 | if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0 | ||
166 | || strcmp (buf, "12345671 33") != 0) | ||
167 | result |= 8; | ||
168 | #else | ||
169 | result |= 8; | ||
170 | #endif | ||
171 | return result; | ||
172 | }]])], | ||
173 | [gl_cv_func_printf_sizes_c23=yes], | ||
174 | [gl_cv_func_printf_sizes_c23=no], | ||
175 | [ | ||
176 | case "$host_os" in | ||
177 | # Guess no on glibc systems. | ||
178 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
179 | # Guess no on musl systems. | ||
180 | *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
181 | # Guess no on Android. | ||
182 | linux*-android*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
183 | # Guess no on native Windows. | ||
184 | mingw* | windows*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
185 | # If we don't know, obey --enable-cross-guesses. | ||
186 | *) gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";; | ||
187 | esac | ||
188 | ]) | ||
189 | ]) | ||
190 | ]) | ||
191 | |||
104 | dnl Test whether the *printf family of functions supports 'long double' | 192 | dnl Test whether the *printf family of functions supports 'long double' |
105 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) | 193 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) |
106 | dnl Result is gl_cv_func_printf_long_double. | 194 | dnl Result is gl_cv_func_printf_long_double. |
@@ -137,20 +225,21 @@ int main () | |||
137 | [gl_cv_func_printf_long_double=yes], | 225 | [gl_cv_func_printf_long_double=yes], |
138 | [gl_cv_func_printf_long_double=no], | 226 | [gl_cv_func_printf_long_double=no], |
139 | [case "$host_os" in | 227 | [case "$host_os" in |
140 | # Guess no on BeOS. | 228 | # Guess no on BeOS. |
141 | beos*) gl_cv_func_printf_long_double="guessing no";; | 229 | beos*) gl_cv_func_printf_long_double="guessing no";; |
142 | # Guess yes on Android. | 230 | # Guess yes on Android. |
143 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; | 231 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; |
144 | # Guess yes on MSVC, no on mingw. | 232 | # Guess yes on MSVC, no on mingw. |
145 | mingw*) AC_EGREP_CPP([Known], [ | 233 | windows*-msvc*) gl_cv_func_printf_long_double="guessing yes" ;; |
234 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
146 | #ifdef _MSC_VER | 235 | #ifdef _MSC_VER |
147 | Known | 236 | Known |
148 | #endif | 237 | #endif |
149 | ], | 238 | ], |
150 | [gl_cv_func_printf_long_double="guessing yes"], | 239 | [gl_cv_func_printf_long_double="guessing yes"], |
151 | [gl_cv_func_printf_long_double="guessing no"]) | 240 | [gl_cv_func_printf_long_double="guessing no"]) |
152 | ;; | 241 | ;; |
153 | *) gl_cv_func_printf_long_double="guessing yes";; | 242 | *) gl_cv_func_printf_long_double="guessing yes";; |
154 | esac | 243 | esac |
155 | ]) | 244 | ]) |
156 | ]) | 245 | ]) |
@@ -244,7 +333,7 @@ changequote(,)dnl | |||
244 | # Guess yes on glibc systems. | 333 | # Guess yes on glibc systems. |
245 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; | 334 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; |
246 | # Guess yes on musl systems. | 335 | # Guess yes on musl systems. |
247 | *-musl*) gl_cv_func_printf_infinite="guessing yes";; | 336 | *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";; |
248 | # Guess yes on FreeBSD >= 6. | 337 | # Guess yes on FreeBSD >= 6. |
249 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | 338 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; |
250 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; | 339 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; |
@@ -268,7 +357,8 @@ changequote(,)dnl | |||
268 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; | 357 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; |
269 | changequote([,])dnl | 358 | changequote([,])dnl |
270 | # Guess yes on MSVC, no on mingw. | 359 | # Guess yes on MSVC, no on mingw. |
271 | mingw*) AC_EGREP_CPP([Known], [ | 360 | windows*-msvc*) gl_cv_func_printf_infinite="guessing yes" ;; |
361 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
272 | #ifdef _MSC_VER | 362 | #ifdef _MSC_VER |
273 | Known | 363 | Known |
274 | #endif | 364 | #endif |
@@ -467,7 +557,7 @@ changequote(,)dnl | |||
467 | # Guess yes on glibc systems. | 557 | # Guess yes on glibc systems. |
468 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 558 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
469 | # Guess yes on musl systems. | 559 | # Guess yes on musl systems. |
470 | *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 560 | *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
471 | # Guess yes on FreeBSD >= 6. | 561 | # Guess yes on FreeBSD >= 6. |
472 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; | 562 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; |
473 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 563 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
@@ -482,7 +572,8 @@ changequote(,)dnl | |||
482 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; | 572 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; |
483 | changequote([,])dnl | 573 | changequote([,])dnl |
484 | # Guess yes on MSVC, no on mingw. | 574 | # Guess yes on MSVC, no on mingw. |
485 | mingw*) AC_EGREP_CPP([Known], [ | 575 | windows*-msvc*) gl_cv_func_printf_infinite_long_double="guessing yes" ;; |
576 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
486 | #ifdef _MSC_VER | 577 | #ifdef _MSC_VER |
487 | Known | 578 | Known |
488 | #endif | 579 | #endif |
@@ -591,11 +682,11 @@ int main () | |||
591 | [gl_cv_func_printf_directive_a="guessing no"]) | 682 | [gl_cv_func_printf_directive_a="guessing no"]) |
592 | ;; | 683 | ;; |
593 | # Guess yes on musl systems. | 684 | # Guess yes on musl systems. |
594 | *-musl*) gl_cv_func_printf_directive_a="guessing yes";; | 685 | *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";; |
595 | # Guess no on Android. | 686 | # Guess no on Android. |
596 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; | 687 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; |
597 | # Guess no on native Windows. | 688 | # Guess no on native Windows. |
598 | mingw*) gl_cv_func_printf_directive_a="guessing no";; | 689 | mingw* | windows*) gl_cv_func_printf_directive_a="guessing no";; |
599 | # If we don't know, obey --enable-cross-guesses. | 690 | # If we don't know, obey --enable-cross-guesses. |
600 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; | 691 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; |
601 | esac | 692 | esac |
@@ -603,6 +694,116 @@ int main () | |||
603 | ]) | 694 | ]) |
604 | ]) | 695 | ]) |
605 | 696 | ||
697 | dnl Test whether the *printf family of functions supports the 'b' conversion | ||
698 | dnl specifier for binary output of integers. | ||
699 | dnl (ISO C23) | ||
700 | dnl Result is gl_cv_func_printf_directive_b. | ||
701 | |||
702 | AC_DEFUN([gl_PRINTF_DIRECTIVE_B], | ||
703 | [ | ||
704 | AC_REQUIRE([AC_PROG_CC]) | ||
705 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
706 | AC_CACHE_CHECK([whether printf supports the 'b' directive], | ||
707 | [gl_cv_func_printf_directive_b], | ||
708 | [ | ||
709 | AC_RUN_IFELSE( | ||
710 | [AC_LANG_SOURCE([[ | ||
711 | #include <stdio.h> | ||
712 | #include <string.h> | ||
713 | static char buf[100]; | ||
714 | int main () | ||
715 | { | ||
716 | int result = 0; | ||
717 | if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0 | ||
718 | || strcmp (buf, "11000000111001 33") != 0) | ||
719 | result |= 1; | ||
720 | return result; | ||
721 | }]])], | ||
722 | [gl_cv_func_printf_directive_b=yes], | ||
723 | [gl_cv_func_printf_directive_b=no], | ||
724 | [ | ||
725 | case "$host_os" in | ||
726 | # Guess yes on glibc >= 2.35 systems. | ||
727 | *-gnu* | gnu*) | ||
728 | AC_EGREP_CPP([Lucky], [ | ||
729 | #include <features.h> | ||
730 | #ifdef __GNU_LIBRARY__ | ||
731 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
732 | Lucky user | ||
733 | #endif | ||
734 | #endif | ||
735 | ], | ||
736 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
737 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
738 | ;; | ||
739 | # Guess no on musl systems. | ||
740 | *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";; | ||
741 | # Guess no on Android. | ||
742 | linux*-android*) gl_cv_func_printf_directive_b="guessing no";; | ||
743 | # Guess no on native Windows. | ||
744 | mingw* | windows*) gl_cv_func_printf_directive_b="guessing no";; | ||
745 | # If we don't know, obey --enable-cross-guesses. | ||
746 | *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";; | ||
747 | esac | ||
748 | ]) | ||
749 | ]) | ||
750 | ]) | ||
751 | |||
752 | dnl Test whether the *printf family of functions supports the 'B' conversion | ||
753 | dnl specifier for binary output of integers. | ||
754 | dnl (GNU, encouraged by ISO C23 § 7.23.6.1) | ||
755 | dnl Result is gl_cv_func_printf_directive_uppercase_b. | ||
756 | |||
757 | AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B], | ||
758 | [ | ||
759 | AC_REQUIRE([AC_PROG_CC]) | ||
760 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
761 | AC_CACHE_CHECK([whether printf supports the 'B' directive], | ||
762 | [gl_cv_func_printf_directive_uppercase_b], | ||
763 | [ | ||
764 | AC_RUN_IFELSE( | ||
765 | [AC_LANG_SOURCE([[ | ||
766 | #include <stdio.h> | ||
767 | #include <string.h> | ||
768 | static char buf[100]; | ||
769 | int main () | ||
770 | { | ||
771 | int result = 0; | ||
772 | if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0 | ||
773 | || strcmp (buf, "0B11000000111001 33") != 0) | ||
774 | result |= 1; | ||
775 | return result; | ||
776 | }]])], | ||
777 | [gl_cv_func_printf_directive_uppercase_b=yes], | ||
778 | [gl_cv_func_printf_directive_uppercase_b=no], | ||
779 | [ | ||
780 | case "$host_os" in | ||
781 | # Guess yes on glibc >= 2.35 systems. | ||
782 | *-gnu* | gnu*) | ||
783 | AC_EGREP_CPP([Lucky], [ | ||
784 | #include <features.h> | ||
785 | #ifdef __GNU_LIBRARY__ | ||
786 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
787 | Lucky user | ||
788 | #endif | ||
789 | #endif | ||
790 | ], | ||
791 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
792 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
793 | ;; | ||
794 | # Guess no on musl systems. | ||
795 | *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
796 | # Guess no on Android. | ||
797 | linux*-android*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
798 | # Guess no on native Windows. | ||
799 | mingw* | windows*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
800 | # If we don't know, obey --enable-cross-guesses. | ||
801 | *) gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";; | ||
802 | esac | ||
803 | ]) | ||
804 | ]) | ||
805 | ]) | ||
806 | |||
606 | dnl Test whether the *printf family of functions supports the %F format | 807 | dnl Test whether the *printf family of functions supports the %F format |
607 | dnl directive. (ISO C99, POSIX:2001) | 808 | dnl directive. (ISO C99, POSIX:2001) |
608 | dnl Result is gl_cv_func_printf_directive_f. | 809 | dnl Result is gl_cv_func_printf_directive_f. |
@@ -643,7 +844,7 @@ changequote(,)dnl | |||
643 | # Guess yes on glibc systems. | 844 | # Guess yes on glibc systems. |
644 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; | 845 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; |
645 | # Guess yes on musl systems. | 846 | # Guess yes on musl systems. |
646 | *-musl*) gl_cv_func_printf_directive_f="guessing yes";; | 847 | *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";; |
647 | # Guess yes on FreeBSD >= 6. | 848 | # Guess yes on FreeBSD >= 6. |
648 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | 849 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; |
649 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; | 850 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; |
@@ -661,7 +862,8 @@ changequote(,)dnl | |||
661 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; | 862 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; |
662 | changequote([,])dnl | 863 | changequote([,])dnl |
663 | # Guess yes on MSVC, no on mingw. | 864 | # Guess yes on MSVC, no on mingw. |
664 | mingw*) AC_EGREP_CPP([Known], [ | 865 | windows*-msvc*) gl_cv_func_printf_directive_f="guessing yes" ;; |
866 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
665 | #ifdef _MSC_VER | 867 | #ifdef _MSC_VER |
666 | Known | 868 | Known |
667 | #endif | 869 | #endif |
@@ -689,6 +891,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], | |||
689 | [ | 891 | [ |
690 | AC_RUN_IFELSE( | 892 | AC_RUN_IFELSE( |
691 | [AC_LANG_SOURCE([[ | 893 | [AC_LANG_SOURCE([[ |
894 | #include <signal.h> | ||
692 | #include <stdio.h> | 895 | #include <stdio.h> |
693 | #include <stdlib.h> | 896 | #include <stdlib.h> |
694 | #include <string.h> | 897 | #include <string.h> |
@@ -706,6 +909,12 @@ invalid_parameter_handler (const wchar_t *expression, | |||
706 | exit (1); | 909 | exit (1); |
707 | } | 910 | } |
708 | #endif | 911 | #endif |
912 | static void | ||
913 | abort_handler (int sig) | ||
914 | { | ||
915 | (void) sig; | ||
916 | _exit (1); | ||
917 | } | ||
709 | static char fmtstring[10]; | 918 | static char fmtstring[10]; |
710 | static char buf[100]; | 919 | static char buf[100]; |
711 | int main () | 920 | int main () |
@@ -714,6 +923,7 @@ int main () | |||
714 | #ifdef _MSC_VER | 923 | #ifdef _MSC_VER |
715 | _set_invalid_parameter_handler (invalid_parameter_handler); | 924 | _set_invalid_parameter_handler (invalid_parameter_handler); |
716 | #endif | 925 | #endif |
926 | signal (SIGABRT, abort_handler); | ||
717 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 927 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
718 | support %n in format strings in read-only memory but not in writable | 928 | support %n in format strings in read-only memory but not in writable |
719 | memory. */ | 929 | memory. */ |
@@ -727,21 +937,21 @@ int main () | |||
727 | [gl_cv_func_printf_directive_n=yes], | 937 | [gl_cv_func_printf_directive_n=yes], |
728 | [gl_cv_func_printf_directive_n=no], | 938 | [gl_cv_func_printf_directive_n=no], |
729 | [case "$host_os" in | 939 | [case "$host_os" in |
730 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. | 940 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. |
731 | *-gnu* | gnu*) AC_COMPILE_IFELSE( | 941 | *-gnu* | gnu*) AC_COMPILE_IFELSE( |
732 | [AC_LANG_SOURCE( | 942 | [AC_LANG_SOURCE( |
733 | [[#if _FORTIFY_SOURCE >= 2 | 943 | [[#if _FORTIFY_SOURCE >= 2 |
734 | error fail | 944 | error fail |
735 | #endif | 945 | #endif |
736 | ]])], | 946 | ]])], |
737 | [gl_cv_func_printf_directive_n="guessing yes"], | 947 | [gl_cv_func_printf_directive_n="guessing yes"], |
738 | [gl_cv_func_printf_directive_n="guessing no"]) | 948 | [gl_cv_func_printf_directive_n="guessing no"]) |
739 | ;; | 949 | ;; |
740 | # Guess no on Android. | 950 | # Guess no on Android. |
741 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; | 951 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; |
742 | # Guess no on native Windows. | 952 | # Guess no on native Windows. |
743 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | 953 | mingw* | windows*) gl_cv_func_printf_directive_n="guessing no";; |
744 | *) gl_cv_func_printf_directive_n="guessing yes";; | 954 | *) gl_cv_func_printf_directive_n="guessing yes";; |
745 | esac | 955 | esac |
746 | ]) | 956 | ]) |
747 | ]) | 957 | ]) |
@@ -811,18 +1021,64 @@ int main () | |||
811 | [ | 1021 | [ |
812 | changequote(,)dnl | 1022 | changequote(,)dnl |
813 | case "$host_os" in | 1023 | case "$host_os" in |
814 | # Guess yes on OpenBSD >= 6.0. | 1024 | # Guess yes on OpenBSD >= 6.0. |
815 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; | 1025 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; |
816 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; | 1026 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; |
817 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | 1027 | irix*) gl_cv_func_printf_directive_ls="guessing no";; |
818 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | 1028 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; |
819 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | 1029 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; |
820 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | 1030 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; |
821 | # Guess no on Android. | 1031 | # Guess no on Android. |
822 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; | 1032 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; |
823 | # Guess yes on native Windows. | 1033 | # Guess yes on native Windows. |
824 | mingw*) gl_cv_func_printf_directive_ls="guessing yes";; | 1034 | mingw* | windows*) gl_cv_func_printf_directive_ls="guessing yes";; |
825 | *) gl_cv_func_printf_directive_ls="guessing yes";; | 1035 | *) gl_cv_func_printf_directive_ls="guessing yes";; |
1036 | esac | ||
1037 | changequote([,])dnl | ||
1038 | ]) | ||
1039 | ]) | ||
1040 | ]) | ||
1041 | |||
1042 | dnl Test whether the *printf family of functions supports the %lc format | ||
1043 | dnl directive and in particular, when the argument is a null wide character, | ||
1044 | dnl whether the functions produce a NUL byte, as specified in ISO C 23 | ||
1045 | dnl after the issue GB-141 was fixed. | ||
1046 | dnl Result is gl_cv_func_printf_directive_lc. | ||
1047 | |||
1048 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LC], | ||
1049 | [ | ||
1050 | AC_REQUIRE([AC_PROG_CC]) | ||
1051 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1052 | AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly], | ||
1053 | [gl_cv_func_printf_directive_lc], | ||
1054 | [ | ||
1055 | AC_RUN_IFELSE( | ||
1056 | [AC_LANG_SOURCE([[ | ||
1057 | #include <stdio.h> | ||
1058 | #include <wchar.h> | ||
1059 | #include <string.h> | ||
1060 | int main () | ||
1061 | { | ||
1062 | int result = 0; | ||
1063 | char buf[100]; | ||
1064 | /* This test fails on musl libc 1.2.4. */ | ||
1065 | { | ||
1066 | buf[0] = '\0'; | ||
1067 | if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0 | ||
1068 | || memcmp (buf, "a\0z", 4) != 0) | ||
1069 | result |= 1; | ||
1070 | } | ||
1071 | return result; | ||
1072 | }]])], | ||
1073 | [gl_cv_func_printf_directive_lc=yes], | ||
1074 | [gl_cv_func_printf_directive_lc=no], | ||
1075 | [ | ||
1076 | changequote(,)dnl | ||
1077 | case "$host_os" in | ||
1078 | # Guess no on musl libc. | ||
1079 | *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing no";; | ||
1080 | # Guess yes otherwise. | ||
1081 | *) gl_cv_func_printf_directive_lc="guessing yes";; | ||
826 | esac | 1082 | esac |
827 | changequote([,])dnl | 1083 | changequote([,])dnl |
828 | ]) | 1084 | ]) |
@@ -833,7 +1089,7 @@ dnl Test whether the *printf family of functions supports POSIX/XSI format | |||
833 | dnl strings with positions. (POSIX:2001) | 1089 | dnl strings with positions. (POSIX:2001) |
834 | dnl Result is gl_cv_func_printf_positions. | 1090 | dnl Result is gl_cv_func_printf_positions. |
835 | 1091 | ||
836 | AC_DEFUN([gl_PRINTF_POSITIONS], | 1092 | AC_DEFUN_ONCE([gl_PRINTF_POSITIONS], |
837 | [ | 1093 | [ |
838 | AC_REQUIRE([AC_PROG_CC]) | 1094 | AC_REQUIRE([AC_PROG_CC]) |
839 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 1095 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
@@ -859,13 +1115,17 @@ int main () | |||
859 | changequote(,)dnl | 1115 | changequote(,)dnl |
860 | case "$host_os" in | 1116 | case "$host_os" in |
861 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) | 1117 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) |
862 | gl_cv_func_printf_positions="guessing no";; | 1118 | gl_cv_func_printf_positions="guessing no";; |
863 | beos*) gl_cv_func_printf_positions="guessing no";; | 1119 | beos*) |
864 | # Guess yes on Android. | 1120 | gl_cv_func_printf_positions="guessing no";; |
865 | linux*-android*) gl_cv_func_printf_positions="guessing yes";; | 1121 | # Guess yes on Android. |
866 | # Guess no on native Windows. | 1122 | linux*-android*) |
867 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | 1123 | gl_cv_func_printf_positions="guessing yes";; |
868 | *) gl_cv_func_printf_positions="guessing yes";; | 1124 | # Guess no on native Windows. |
1125 | mingw* | windows* | pw*) | ||
1126 | gl_cv_func_printf_positions="guessing no";; | ||
1127 | *) | ||
1128 | gl_cv_func_printf_positions="guessing yes";; | ||
869 | esac | 1129 | esac |
870 | changequote([,])dnl | 1130 | changequote([,])dnl |
871 | ]) | 1131 | ]) |
@@ -900,13 +1160,13 @@ int main () | |||
900 | [ | 1160 | [ |
901 | changequote(,)dnl | 1161 | changequote(,)dnl |
902 | case "$host_os" in | 1162 | case "$host_os" in |
903 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; | 1163 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; |
904 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; | 1164 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; |
905 | # Guess no on Android. | 1165 | # Guess no on Android. |
906 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; | 1166 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; |
907 | # Guess no on native Windows. | 1167 | # Guess no on native Windows. |
908 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | 1168 | mingw* | windows* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; |
909 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | 1169 | *) gl_cv_func_printf_flag_grouping="guessing yes";; |
910 | esac | 1170 | esac |
911 | changequote([,])dnl | 1171 | changequote([,])dnl |
912 | ]) | 1172 | ]) |
@@ -943,16 +1203,16 @@ int main () | |||
943 | [ | 1203 | [ |
944 | changequote(,)dnl | 1204 | changequote(,)dnl |
945 | case "$host_os" in | 1205 | case "$host_os" in |
946 | # Guess yes on HP-UX 11. | 1206 | # Guess yes on HP-UX 11. |
947 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1207 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
948 | # Guess no on HP-UX 10 and older. | 1208 | # Guess no on HP-UX 10 and older. |
949 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; | 1209 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; |
950 | # Guess yes on Android. | 1210 | # Guess yes on Android. |
951 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1211 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
952 | # Guess yes on native Windows. | 1212 | # Guess yes on native Windows. |
953 | mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1213 | mingw* | windows*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
954 | # Guess yes otherwise. | 1214 | # Guess yes otherwise. |
955 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1215 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
956 | esac | 1216 | esac |
957 | changequote([,])dnl | 1217 | changequote([,])dnl |
958 | ]) | 1218 | ]) |
@@ -990,18 +1250,62 @@ int main () | |||
990 | [ | 1250 | [ |
991 | changequote(,)dnl | 1251 | changequote(,)dnl |
992 | case "$host_os" in | 1252 | case "$host_os" in |
993 | # Guess yes on glibc systems. | 1253 | # Guess yes on glibc systems. |
994 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; | 1254 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; |
995 | # Guess yes on musl systems. | 1255 | # Guess yes on musl systems. |
996 | *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; | 1256 | *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";; |
997 | # Guess yes on BeOS. | 1257 | # Guess yes on BeOS. |
998 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; | 1258 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; |
999 | # Guess no on Android. | 1259 | # Guess no on Android. |
1000 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; | 1260 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; |
1001 | # Guess no on native Windows. | 1261 | # Guess no on native Windows. |
1002 | mingw*) gl_cv_func_printf_flag_zero="guessing no";; | 1262 | mingw* | windows*) gl_cv_func_printf_flag_zero="guessing no";; |
1003 | # If we don't know, obey --enable-cross-guesses. | 1263 | # If we don't know, obey --enable-cross-guesses. |
1004 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; | 1264 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; |
1265 | esac | ||
1266 | changequote([,])dnl | ||
1267 | ]) | ||
1268 | ]) | ||
1269 | ]) | ||
1270 | |||
1271 | dnl Test whether the *printf family of functions supports the # flag with a | ||
1272 | dnl zero precision and a zero value in the 'x' and 'X' directives correctly. | ||
1273 | dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X' | ||
1274 | dnl directives: "The result of converting a zero value with a precision of | ||
1275 | dnl zero is no characters." But on Mac OS X 10.5, for the 'x', 'X' directives, | ||
1276 | dnl when a # flag is present, the output is "0" instead of "". | ||
1277 | dnl Result is gl_cv_func_printf_flag_alt_precision_zero. | ||
1278 | |||
1279 | AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO], | ||
1280 | [ | ||
1281 | AC_REQUIRE([AC_PROG_CC]) | ||
1282 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1283 | AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision], | ||
1284 | [gl_cv_func_printf_flag_alt_precision_zero], | ||
1285 | [ | ||
1286 | AC_RUN_IFELSE( | ||
1287 | [AC_LANG_SOURCE([[ | ||
1288 | #include <stdio.h> | ||
1289 | static char buf[10]; | ||
1290 | int main () | ||
1291 | { | ||
1292 | int result = 0; | ||
1293 | if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3) | ||
1294 | result |= 1; | ||
1295 | return result; | ||
1296 | }]])], | ||
1297 | [gl_cv_func_printf_flag_alt_precision_zero=yes], | ||
1298 | [gl_cv_func_printf_flag_alt_precision_zero=no], | ||
1299 | [ | ||
1300 | changequote(,)dnl | ||
1301 | case "$host_os" in | ||
1302 | # Guess no only on macOS 10..12 systems. | ||
1303 | darwin[0-9] | darwin[0-9].* | \ | ||
1304 | darwin1[0-9] | darwin1[0-9].* | \ | ||
1305 | darwin2[0-1] | darwin2[0-1].*) | ||
1306 | gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;; | ||
1307 | darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
1308 | *) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
1005 | esac | 1309 | esac |
1006 | changequote([,])dnl | 1310 | changequote([,])dnl |
1007 | ]) | 1311 | ]) |
@@ -1054,12 +1358,12 @@ int main () | |||
1054 | changequote(,)dnl | 1358 | changequote(,)dnl |
1055 | case "$host_os" in | 1359 | case "$host_os" in |
1056 | # Guess no only on Solaris, native Windows, and BeOS systems. | 1360 | # Guess no only on Solaris, native Windows, and BeOS systems. |
1057 | solaris*) gl_cv_func_printf_precision="guessing no" ;; | 1361 | solaris*) gl_cv_func_printf_precision="guessing no" ;; |
1058 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; | 1362 | mingw* | windows* | pw*) gl_cv_func_printf_precision="guessing no" ;; |
1059 | beos*) gl_cv_func_printf_precision="guessing no" ;; | 1363 | beos*) gl_cv_func_printf_precision="guessing no" ;; |
1060 | # Guess yes on Android. | 1364 | # Guess yes on Android. |
1061 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; | 1365 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; |
1062 | *) gl_cv_func_printf_precision="guessing yes" ;; | 1366 | *) gl_cv_func_printf_precision="guessing yes" ;; |
1063 | esac | 1367 | esac |
1064 | changequote([,])dnl | 1368 | changequote([,])dnl |
1065 | ]) | 1369 | ]) |
@@ -1239,7 +1543,7 @@ changequote(,)dnl | |||
1239 | # Guess yes on glibc systems. | 1543 | # Guess yes on glibc systems. |
1240 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1544 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1241 | # Guess yes on musl systems. | 1545 | # Guess yes on musl systems. |
1242 | *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1546 | *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1243 | # Guess yes on FreeBSD >= 5. | 1547 | # Guess yes on FreeBSD >= 5. |
1244 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1548 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1245 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1549 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
@@ -1275,7 +1579,7 @@ changequote(,)dnl | |||
1275 | # Guess yes on Android. | 1579 | # Guess yes on Android. |
1276 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1580 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1277 | # Guess no on native Windows. | 1581 | # Guess no on native Windows. |
1278 | mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1582 | mingw* | windows*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1279 | # If we don't know, obey --enable-cross-guesses. | 1583 | # If we don't know, obey --enable-cross-guesses. |
1280 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; | 1584 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; |
1281 | esac | 1585 | esac |
@@ -1344,7 +1648,7 @@ changequote(,)dnl | |||
1344 | # Guess yes on glibc systems. | 1648 | # Guess yes on glibc systems. |
1345 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1649 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1346 | # Guess yes on musl systems. | 1650 | # Guess yes on musl systems. |
1347 | *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1651 | *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1348 | # Guess yes on FreeBSD >= 5. | 1652 | # Guess yes on FreeBSD >= 5. |
1349 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; | 1653 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; |
1350 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1654 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
@@ -1372,7 +1676,8 @@ changequote(,)dnl | |||
1372 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1676 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1373 | changequote([,])dnl | 1677 | changequote([,])dnl |
1374 | # Guess yes on MSVC, no on mingw. | 1678 | # Guess yes on MSVC, no on mingw. |
1375 | mingw*) AC_EGREP_CPP([Known], [ | 1679 | windows*-msvc*) gl_cv_func_snprintf_retval_c99="guessing yes" ;; |
1680 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
1376 | #ifdef _MSC_VER | 1681 | #ifdef _MSC_VER |
1377 | Known | 1682 | Known |
1378 | #endif | 1683 | #endif |
@@ -1401,6 +1706,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], | |||
1401 | [ | 1706 | [ |
1402 | AC_RUN_IFELSE( | 1707 | AC_RUN_IFELSE( |
1403 | [AC_LANG_SOURCE([[ | 1708 | [AC_LANG_SOURCE([[ |
1709 | #include <signal.h> | ||
1404 | #include <stdio.h> | 1710 | #include <stdio.h> |
1405 | #include <string.h> | 1711 | #include <string.h> |
1406 | #if HAVE_SNPRINTF | 1712 | #if HAVE_SNPRINTF |
@@ -1417,11 +1723,18 @@ static int my_snprintf (char *buf, int size, const char *format, ...) | |||
1417 | return ret; | 1723 | return ret; |
1418 | } | 1724 | } |
1419 | #endif | 1725 | #endif |
1726 | static void | ||
1727 | abort_handler (int sig) | ||
1728 | { | ||
1729 | (void) sig; | ||
1730 | _exit (1); | ||
1731 | } | ||
1420 | static char fmtstring[10]; | 1732 | static char fmtstring[10]; |
1421 | static char buf[100]; | 1733 | static char buf[100]; |
1422 | int main () | 1734 | int main () |
1423 | { | 1735 | { |
1424 | int count = -1; | 1736 | int count = -1; |
1737 | signal (SIGABRT, abort_handler); | ||
1425 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 1738 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
1426 | support %n in format strings in read-only memory but not in writable | 1739 | support %n in format strings in read-only memory but not in writable |
1427 | memory. */ | 1740 | memory. */ |
@@ -1447,7 +1760,7 @@ int main () | |||
1447 | ;; | 1760 | ;; |
1448 | changequote(,)dnl | 1761 | changequote(,)dnl |
1449 | # Guess yes on musl systems. | 1762 | # Guess yes on musl systems. |
1450 | *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1763 | *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";; |
1451 | # Guess yes on FreeBSD >= 5. | 1764 | # Guess yes on FreeBSD >= 5. |
1452 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; | 1765 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; |
1453 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1766 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; |
@@ -1476,7 +1789,7 @@ changequote(,)dnl | |||
1476 | # Guess no on Android. | 1789 | # Guess no on Android. |
1477 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; | 1790 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; |
1478 | # Guess no on native Windows. | 1791 | # Guess no on native Windows. |
1479 | mingw*) gl_cv_func_snprintf_directive_n="guessing no";; | 1792 | mingw* | windows*) gl_cv_func_snprintf_directive_n="guessing no";; |
1480 | # If we don't know, obey --enable-cross-guesses. | 1793 | # If we don't know, obey --enable-cross-guesses. |
1481 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; | 1794 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; |
1482 | changequote([,])dnl | 1795 | changequote([,])dnl |
@@ -1524,11 +1837,11 @@ int main() | |||
1524 | [gl_cv_func_snprintf_size1=yes], | 1837 | [gl_cv_func_snprintf_size1=yes], |
1525 | [gl_cv_func_snprintf_size1=no], | 1838 | [gl_cv_func_snprintf_size1=no], |
1526 | [case "$host_os" in | 1839 | [case "$host_os" in |
1527 | # Guess yes on Android. | 1840 | # Guess yes on Android. |
1528 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1841 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; |
1529 | # Guess yes on native Windows. | 1842 | # Guess yes on native Windows. |
1530 | mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1843 | mingw* | windows*) gl_cv_func_snprintf_size1="guessing yes" ;; |
1531 | *) gl_cv_func_snprintf_size1="guessing yes" ;; | 1844 | *) gl_cv_func_snprintf_size1="guessing yes" ;; |
1532 | esac | 1845 | esac |
1533 | ]) | 1846 | ]) |
1534 | ]) | 1847 | ]) |
@@ -1601,128 +1914,320 @@ int main() | |||
1601 | [ | 1914 | [ |
1602 | changequote(,)dnl | 1915 | changequote(,)dnl |
1603 | case "$host_os" in | 1916 | case "$host_os" in |
1604 | # Guess yes on glibc systems. | 1917 | # Guess yes on glibc systems. |
1605 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1918 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1606 | # Guess yes on musl systems. | 1919 | # Guess yes on musl systems. |
1607 | *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1920 | *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1608 | # Guess yes on FreeBSD >= 5. | 1921 | # Guess yes on FreeBSD >= 5. |
1609 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1922 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1610 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1923 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1611 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1924 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1612 | # Guess yes on Mac OS X >= 10.3. | 1925 | # Guess yes on Mac OS X >= 10.3. |
1613 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1926 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1614 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1927 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1615 | # Guess yes on Cygwin. | 1928 | # Guess yes on Cygwin. |
1616 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1929 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1617 | # Guess yes on Solaris >= 2.6. | 1930 | # Guess yes on Solaris >= 2.6. |
1618 | solaris2.[0-5] | solaris2.[0-5].*) | 1931 | solaris2.[0-5] | solaris2.[0-5].*) |
1619 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1932 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1620 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1933 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1621 | # Guess yes on AIX >= 4. | 1934 | # Guess yes on AIX >= 4. |
1622 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1935 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1623 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1936 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1624 | # Guess yes on IRIX >= 6.5. | 1937 | # Guess yes on IRIX >= 6.5. |
1625 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1938 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1626 | # Guess yes on NetBSD >= 3. | 1939 | # Guess yes on NetBSD >= 3. |
1627 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | 1940 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) |
1628 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1941 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1629 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1942 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1630 | # Guess yes on BeOS. | 1943 | # Guess yes on BeOS. |
1631 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1944 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1632 | # Guess yes on Android. | 1945 | # Guess yes on Android. |
1633 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1946 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1634 | # Guess yes on native Windows. | 1947 | # Guess yes on native Windows. |
1635 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1948 | mingw* | windows* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1636 | # If we don't know, obey --enable-cross-guesses. | 1949 | # If we don't know, obey --enable-cross-guesses. |
1637 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; | 1950 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; |
1638 | esac | 1951 | esac |
1639 | changequote([,])dnl | 1952 | changequote([,])dnl |
1640 | ]) | 1953 | ]) |
1641 | ]) | 1954 | ]) |
1642 | ]) | 1955 | ]) |
1643 | 1956 | ||
1957 | dnl Test whether the swprintf function works correctly when it produces output | ||
1958 | dnl that contains null wide characters. | ||
1959 | dnl Result is gl_cv_func_swprintf_works. | ||
1960 | |||
1961 | AC_DEFUN([gl_SWPRINTF_WORKS], | ||
1962 | [ | ||
1963 | AC_REQUIRE([AC_PROG_CC]) | ||
1964 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1965 | AC_CHECK_FUNCS_ONCE([swprintf]) | ||
1966 | AC_CACHE_CHECK([whether swprintf works], | ||
1967 | [gl_cv_func_swprintf_works], | ||
1968 | [ | ||
1969 | AC_RUN_IFELSE( | ||
1970 | [AC_LANG_SOURCE([[ | ||
1971 | #ifndef __USE_MINGW_ANSI_STDIO | ||
1972 | # define __USE_MINGW_ANSI_STDIO 1 | ||
1973 | #endif | ||
1974 | #include <stdio.h> | ||
1975 | #include <wchar.h> | ||
1976 | int main() | ||
1977 | { | ||
1978 | int result = 0; | ||
1979 | { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX. */ | ||
1980 | wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF }; | ||
1981 | int ret = swprintf (buf, 4, L"%cz", '\0'); | ||
1982 | /* Expected result: | ||
1983 | ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef | ||
1984 | musl libc 1.2.3: | ||
1985 | ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0 | ||
1986 | Reported at <https://www.openwall.com/lists/musl/2023/03/22/9>. | ||
1987 | FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2: | ||
1988 | ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef | ||
1989 | */ | ||
1990 | if (ret < 0 || buf[1] != 'z') | ||
1991 | result |= 1; | ||
1992 | } | ||
1993 | { /* This test fails on mingw. */ | ||
1994 | wchar_t buf[2]; | ||
1995 | int ret = swprintf (buf, 2, L"%lc", (wint_t)0); | ||
1996 | /* Expected: ret = 1 | ||
1997 | mingw: ret = 0 | ||
1998 | */ | ||
1999 | if (ret != 1) | ||
2000 | result |= 2; | ||
2001 | } | ||
2002 | return result; | ||
2003 | }]])], | ||
2004 | [gl_cv_func_swprintf_works=yes], | ||
2005 | [gl_cv_func_swprintf_works=no], | ||
2006 | [case "$host_os" in | ||
2007 | # Guess yes on glibc systems. | ||
2008 | *-gnu* | gnu*) gl_cv_func_swprintf_works="guessing yes";; | ||
2009 | # Guess no on musl systems. | ||
2010 | *-musl* | midipix*) gl_cv_func_swprintf_works="guessing no";; | ||
2011 | # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX. | ||
2012 | freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*) | ||
2013 | gl_cv_func_swprintf_works="guessing no";; | ||
2014 | # Guess no on native Windows. | ||
2015 | mingw* | windows* | pw*) gl_cv_func_swprintf_works="guessing no";; | ||
2016 | # If we don't know, obey --enable-cross-guesses. | ||
2017 | *) gl_cv_func_swprintf_works="$gl_cross_guess_normal";; | ||
2018 | esac | ||
2019 | ]) | ||
2020 | ]) | ||
2021 | ]) | ||
2022 | |||
2023 | dnl Test whether the *wprintf family of functions supports the 'a' and 'A' | ||
2024 | dnl conversion specifier for hexadecimal output of 'long double' numbers. | ||
2025 | dnl (ISO C99, POSIX:2001) | ||
2026 | dnl Result is gl_cv_func_swprintf_directive_la. | ||
2027 | |||
2028 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA], | ||
2029 | [ | ||
2030 | AC_REQUIRE([AC_PROG_CC]) | ||
2031 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
2032 | AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives], | ||
2033 | [gl_cv_func_swprintf_directive_la], | ||
2034 | [ | ||
2035 | AC_RUN_IFELSE( | ||
2036 | [AC_LANG_SOURCE([[ | ||
2037 | #include <stdio.h> | ||
2038 | #include <wchar.h> | ||
2039 | static wchar_t buf[100]; | ||
2040 | int main () | ||
2041 | { | ||
2042 | int result = 0; | ||
2043 | /* This catches a glibc 2.15, Haiku 2022, NetBSD 10.0 bug. */ | ||
2044 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
2045 | L"%La %d", 3.1416015625L, 33, 44, 55) < 0 | ||
2046 | || (wcscmp (buf, L"0x1.922p+1 33") != 0 | ||
2047 | && wcscmp (buf, L"0x3.244p+0 33") != 0 | ||
2048 | && wcscmp (buf, L"0x6.488p-1 33") != 0 | ||
2049 | && wcscmp (buf, L"0xc.91p-2 33") != 0)) | ||
2050 | result |= 1; | ||
2051 | return result; | ||
2052 | }]])], | ||
2053 | [gl_cv_func_swprintf_directive_la=yes], | ||
2054 | [gl_cv_func_swprintf_directive_la=no], | ||
2055 | [case "$host_os" in | ||
2056 | # Guess yes on glibc >= 2.17 systems. | ||
2057 | *-gnu* | gnu*) | ||
2058 | AC_EGREP_CPP([Unlucky], [ | ||
2059 | #include <features.h> | ||
2060 | #ifdef __GNU_LIBRARY__ | ||
2061 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__ | ||
2062 | Unlucky | ||
2063 | #endif | ||
2064 | #endif | ||
2065 | ], | ||
2066 | [gl_cv_func_swprintf_directive_la="guessing yes"], | ||
2067 | [gl_cv_func_swprintf_directive_la="guessing no"]) | ||
2068 | ;; | ||
2069 | # Guess yes on musl systems. | ||
2070 | *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
2071 | # Guess yes on Android. | ||
2072 | linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
2073 | # Guess no on NetBSD. | ||
2074 | netbsd*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
2075 | # Guess no on native Windows. | ||
2076 | mingw* | windows*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
2077 | # If we don't know, obey --enable-cross-guesses. | ||
2078 | *) gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";; | ||
2079 | esac | ||
2080 | ]) | ||
2081 | ]) | ||
2082 | ]) | ||
2083 | |||
2084 | dnl Test whether the *wprintf family of functions supports the 'lc' conversion | ||
2085 | dnl specifier for all wide characters. | ||
2086 | dnl (ISO C11, POSIX:2001) | ||
2087 | dnl Result is gl_cv_func_swprintf_directive_lc. | ||
2088 | |||
2089 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC], | ||
2090 | [ | ||
2091 | AC_REQUIRE([AC_PROG_CC]) | ||
2092 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
2093 | AC_CACHE_CHECK([whether swprintf supports the 'lc' directive], | ||
2094 | [gl_cv_func_swprintf_directive_lc], | ||
2095 | [ | ||
2096 | AC_RUN_IFELSE( | ||
2097 | [AC_LANG_SOURCE([[ | ||
2098 | #include <stdio.h> | ||
2099 | #include <wchar.h> | ||
2100 | static wchar_t buf[100]; | ||
2101 | static wint_t L_invalid = (wchar_t) 0x76543210; | ||
2102 | int main () | ||
2103 | { | ||
2104 | int result = 0; | ||
2105 | /* This catches a musl libc 1.2.4, Android bug. | ||
2106 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/3>. */ | ||
2107 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
2108 | L"%lc %d", L_invalid, 33, 44, 55) < 0) | ||
2109 | result |= 1; | ||
2110 | return result; | ||
2111 | }]])], | ||
2112 | [gl_cv_func_swprintf_directive_lc=yes], | ||
2113 | [gl_cv_func_swprintf_directive_lc=no], | ||
2114 | [case "$host_os" in | ||
2115 | # Guess yes on glibc systems. | ||
2116 | *-gnu* | gnu*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
2117 | # Guess no on musl systems. | ||
2118 | *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
2119 | # Guess no on Android. | ||
2120 | linux*-android*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
2121 | # Guess yes on native Windows. | ||
2122 | mingw* | windows*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
2123 | # If we don't know, obey --enable-cross-guesses. | ||
2124 | *) gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";; | ||
2125 | esac | ||
2126 | ]) | ||
2127 | ]) | ||
2128 | ]) | ||
2129 | |||
1644 | dnl The results of these tests on various platforms are: | 2130 | dnl The results of these tests on various platforms are: |
1645 | dnl | 2131 | dnl |
1646 | dnl 1 = gl_PRINTF_SIZES_C99 | 2132 | dnl 1 = gl_PRINTF_SIZES_C99 |
1647 | dnl 2 = gl_PRINTF_LONG_DOUBLE | 2133 | dnl 2 = gl_PRINTF_SIZES_C23 |
1648 | dnl 3 = gl_PRINTF_INFINITE | 2134 | dnl 3 = gl_PRINTF_LONG_DOUBLE |
1649 | dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE | 2135 | dnl 4 = gl_PRINTF_INFINITE |
1650 | dnl 5 = gl_PRINTF_DIRECTIVE_A | 2136 | dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE |
1651 | dnl 6 = gl_PRINTF_DIRECTIVE_F | 2137 | dnl 6 = gl_PRINTF_DIRECTIVE_A |
1652 | dnl 7 = gl_PRINTF_DIRECTIVE_N | 2138 | dnl 7 = gl_PRINTF_DIRECTIVE_B |
1653 | dnl 8 = gl_PRINTF_DIRECTIVE_LS | 2139 | dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B |
1654 | dnl 9 = gl_PRINTF_POSITIONS | 2140 | dnl 9 = gl_PRINTF_DIRECTIVE_F |
1655 | dnl 10 = gl_PRINTF_FLAG_GROUPING | 2141 | dnl 10 = gl_PRINTF_DIRECTIVE_N |
1656 | dnl 11 = gl_PRINTF_FLAG_LEFTADJUST | 2142 | dnl 11 = gl_PRINTF_DIRECTIVE_LS |
1657 | dnl 12 = gl_PRINTF_FLAG_ZERO | 2143 | dnl 12 = gl_PRINTF_DIRECTIVE_LC |
1658 | dnl 13 = gl_PRINTF_PRECISION | 2144 | dnl 13 = gl_PRINTF_POSITIONS |
1659 | dnl 14 = gl_PRINTF_ENOMEM | 2145 | dnl 14 = gl_PRINTF_FLAG_GROUPING |
1660 | dnl 15 = gl_SNPRINTF_PRESENCE | 2146 | dnl 15 = gl_PRINTF_FLAG_LEFTADJUST |
1661 | dnl 16 = gl_SNPRINTF_TRUNCATION_C99 | 2147 | dnl 16 = gl_PRINTF_FLAG_ZERO |
1662 | dnl 17 = gl_SNPRINTF_RETVAL_C99 | 2148 | dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO |
1663 | dnl 18 = gl_SNPRINTF_DIRECTIVE_N | 2149 | dnl 18 = gl_PRINTF_PRECISION |
1664 | dnl 19 = gl_SNPRINTF_SIZE1 | 2150 | dnl 19 = gl_PRINTF_ENOMEM |
1665 | dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 | 2151 | dnl 20 = gl_SNPRINTF_PRESENCE |
2152 | dnl 21 = gl_SNPRINTF_TRUNCATION_C99 | ||
2153 | dnl 22 = gl_SNPRINTF_RETVAL_C99 | ||
2154 | dnl 23 = gl_SNPRINTF_DIRECTIVE_N | ||
2155 | dnl 24 = gl_SNPRINTF_SIZE1 | ||
2156 | dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 | ||
2157 | dnl 26 = gl_SWPRINTF_WORKS | ||
2158 | dnl 27 = gl_SWPRINTF_DIRECTIVE_LA | ||
2159 | dnl 28 = gl_SWPRINTF_DIRECTIVE_LC | ||
1666 | dnl | 2160 | dnl |
1667 | dnl 1 = checking whether printf supports size specifiers as in C99... | 2161 | dnl 1 = checking whether printf supports size specifiers as in C99... |
1668 | dnl 2 = checking whether printf supports 'long double' arguments... | 2162 | dnl 2 = checking whether printf supports size specifiers as in C23... |
1669 | dnl 3 = checking whether printf supports infinite 'double' arguments... | 2163 | dnl 3 = checking whether printf supports 'long double' arguments... |
1670 | dnl 4 = checking whether printf supports infinite 'long double' arguments... | 2164 | dnl 4 = checking whether printf supports infinite 'double' arguments... |
1671 | dnl 5 = checking whether printf supports the 'a' and 'A' directives... | 2165 | dnl 5 = checking whether printf supports infinite 'long double' arguments... |
1672 | dnl 6 = checking whether printf supports the 'F' directive... | 2166 | dnl 6 = checking whether printf supports the 'a' and 'A' directives... |
1673 | dnl 7 = checking whether printf supports the 'n' directive... | 2167 | dnl 7 = checking whether printf supports the 'b' directive... |
1674 | dnl 8 = checking whether printf supports the 'ls' directive... | 2168 | dnl 8 = checking whether printf supports the 'B' directive... |
1675 | dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... | 2169 | dnl 9 = checking whether printf supports the 'F' directive... |
1676 | dnl 10 = checking whether printf supports the grouping flag... | 2170 | dnl 10 = checking whether printf supports the 'n' directive... |
1677 | dnl 11 = checking whether printf supports the left-adjust flag correctly... | 2171 | dnl 11 = checking whether printf supports the 'ls' directive... |
1678 | dnl 12 = checking whether printf supports the zero flag correctly... | 2172 | dnl 12 = checking whether printf supports the 'lc' directive correctly... |
1679 | dnl 13 = checking whether printf supports large precisions... | 2173 | dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... |
1680 | dnl 14 = checking whether printf survives out-of-memory conditions... | 2174 | dnl 14 = checking whether printf supports the grouping flag... |
1681 | dnl 15 = checking for snprintf... | 2175 | dnl 15 = checking whether printf supports the left-adjust flag correctly... |
1682 | dnl 16 = checking whether snprintf truncates the result as in C99... | 2176 | dnl 16 = checking whether printf supports the zero flag correctly... |
1683 | dnl 17 = checking whether snprintf returns a byte count as in C99... | 2177 | dnl 17 = checking whether printf supports the alternative flag with a zero precision... |
1684 | dnl 18 = checking whether snprintf fully supports the 'n' directive... | 2178 | dnl 18 = checking whether printf supports large precisions... |
1685 | dnl 19 = checking whether snprintf respects a size of 1... | 2179 | dnl 19 = checking whether printf survives out-of-memory conditions... |
1686 | dnl 20 = checking whether vsnprintf respects a zero size as in C99... | 2180 | dnl 20 = checking for snprintf... |
2181 | dnl 21 = checking whether snprintf truncates the result as in C99... | ||
2182 | dnl 22 = checking whether snprintf returns a byte count as in C99... | ||
2183 | dnl 23 = checking whether snprintf fully supports the 'n' directive... | ||
2184 | dnl 24 = checking whether snprintf respects a size of 1... | ||
2185 | dnl 25 = checking whether vsnprintf respects a zero size as in C99... | ||
2186 | dnl 26 = checking whether swprintf works... | ||
2187 | dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... | ||
2188 | dnl 28 = checking whether swprintf supports the 'lc' directive... | ||
1687 | dnl | 2189 | dnl |
1688 | dnl . = yes, # = no. | 2190 | dnl . = yes, # = no. |
1689 | dnl | 2191 | dnl |
1690 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 2192 | dnl 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 |
1691 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . | 2193 | dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # |
1692 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . | 2194 | dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . |
1693 | dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . | 2195 | dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . |
1694 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . | 2196 | dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . |
1695 | dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . | 2197 | dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # |
1696 | dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . | 2198 | dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # |
1697 | dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . | 2199 | dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? |
1698 | dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . | 2200 | dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? |
1699 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . | 2201 | dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? |
1700 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . | 2202 | dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? |
1701 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . | 2203 | dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # |
1702 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . | 2204 | dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? |
1703 | dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . | 2205 | dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? |
1704 | dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . | 2206 | dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? |
1705 | dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . | 2207 | dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? |
1706 | dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . | 2208 | dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . |
1707 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . | 2209 | dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . |
1708 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # | 2210 | dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? |
1709 | dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . | 2211 | dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . |
1710 | dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . | 2212 | dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? |
1711 | dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . | 2213 | dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? |
1712 | dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . | 2214 | dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . |
1713 | dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # | 2215 | dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? |
1714 | dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # | 2216 | dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? |
1715 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . | 2217 | dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? |
1716 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # | 2218 | dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? |
1717 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # | 2219 | dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? |
1718 | dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . | 2220 | dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? |
1719 | dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . | 2221 | dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? |
1720 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? | 2222 | dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? |
1721 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . | 2223 | dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # |
1722 | dnl Haiku . . . # # # . # . . . . . ? . . ? . . . | 2224 | dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? |
1723 | dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . | 2225 | dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? |
1724 | dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . | 2226 | dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? |
1725 | dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . | 2227 | dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . |
1726 | dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . | 2228 | dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? |
1727 | dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . | 2229 | dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? |
1728 | dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . | 2230 | dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? |
2231 | dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? | ||
2232 | dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? | ||
2233 | dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? | ||
diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4 index ae6a8853..b8b5b117 100644 --- a/gl/m4/pthread_rwlock_rdlock.m4 +++ b/gl/m4/pthread_rwlock_rdlock.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # pthread_rwlock_rdlock.m4 serial 4 | 1 | # pthread_rwlock_rdlock.m4 |
2 | dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -34,11 +35,11 @@ dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 | |||
34 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 | 35 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 |
35 | AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], | 36 | AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], |
36 | [ | 37 | [ |
37 | AC_REQUIRE([gl_THREADLIB_EARLY]) | 38 | AC_REQUIRE([gl_THREADLIB]) |
38 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 39 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
39 | AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], | 40 | AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], |
40 | [gl_cv_pthread_rwlock_rdlock_prefer_writer], | 41 | [gl_cv_pthread_rwlock_rdlock_prefer_writer], |
41 | [save_LIBS="$LIBS" | 42 | [saved_LIBS="$LIBS" |
42 | LIBS="$LIBS $LIBMULTITHREAD" | 43 | LIBS="$LIBS $LIBMULTITHREAD" |
43 | AC_RUN_IFELSE( | 44 | AC_RUN_IFELSE( |
44 | [AC_LANG_SOURCE([[ | 45 | [AC_LANG_SOURCE([[ |
@@ -156,25 +157,25 @@ main () | |||
156 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], | 157 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], |
157 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], | 158 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], |
158 | [case "$host_os" in | 159 | [case "$host_os" in |
159 | # Guess no on glibc systems. | 160 | # Guess no on glibc systems. |
160 | *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 161 | *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
161 | # Guess no on musl systems. | 162 | # Guess no on musl systems. |
162 | *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 163 | *-musl* | midipix*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
163 | # Guess no on bionic systems. | 164 | # Guess no on bionic systems. |
164 | *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 165 | *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
165 | # Guess yes on native Windows with the mingw-w64 winpthreads library. | 166 | # Guess yes on native Windows with the mingw-w64 winpthreads library. |
166 | # Guess no on native Windows with the gnulib windows-rwlock module. | 167 | # Guess no on native Windows with the gnulib windows-rwlock module. |
167 | mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | 168 | mingw* | windows*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then |
168 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" | 169 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" |
169 | else | 170 | else |
170 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" | 171 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" |
171 | fi | 172 | fi |
172 | ;; | 173 | ;; |
173 | # If we don't know, obey --enable-cross-guesses. | 174 | # If we don't know, obey --enable-cross-guesses. |
174 | *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; | 175 | *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; |
175 | esac | 176 | esac |
176 | ]) | 177 | ]) |
177 | LIBS="$save_LIBS" | 178 | LIBS="$saved_LIBS" |
178 | ]) | 179 | ]) |
179 | case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in | 180 | case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in |
180 | *yes) | 181 | *yes) |
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index d22138fc..eb90d588 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # realloc.m4 serial 26 | 1 | # realloc.m4 |
2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 29 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -16,7 +17,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], | |||
16 | [[#include <stdlib.h> | 17 | [[#include <stdlib.h> |
17 | ]], | 18 | ]], |
18 | [[void *p = realloc (0, 0); | 19 | [[void *p = realloc (0, 0); |
19 | int result = !p; | 20 | void * volatile vp = p; |
21 | int result = !vp; | ||
20 | free (p); | 22 | free (p); |
21 | return result;]]) | 23 | return result;]]) |
22 | ], | 24 | ], |
@@ -25,8 +27,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], | |||
25 | [case "$host_os" in | 27 | [case "$host_os" in |
26 | # Guess yes on platforms where we know the result. | 28 | # Guess yes on platforms where we know the result. |
27 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | 29 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ |
28 | | gnu* | *-musl* | midnightbsd* \ | 30 | | gnu* | *-musl* | midipix* | midnightbsd* \ |
29 | | hpux* | solaris* | cygwin* | mingw* | msys* ) | 31 | | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) |
30 | ac_cv_func_realloc_0_nonnull="guessing yes" ;; | 32 | ac_cv_func_realloc_0_nonnull="guessing yes" ;; |
31 | # If we don't know, obey --enable-cross-guesses. | 33 | # If we don't know, obey --enable-cross-guesses. |
32 | *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; | 34 | *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; |
diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4 index 1607b7a9..958095e1 100644 --- a/gl/m4/reallocarray.m4 +++ b/gl/m4/reallocarray.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # reallocarray.m4 serial 3 | 1 | # reallocarray.m4 |
2 | dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -11,9 +12,12 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY], | |||
11 | 12 | ||
12 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 13 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
13 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) | 14 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) |
14 | AC_CHECK_FUNCS([reallocarray]) | 15 | gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]]) |
15 | if test "$ac_cv_func_reallocarray" = no; then | 16 | if test "$ac_cv_func_reallocarray" = no; then |
16 | HAVE_REALLOCARRAY=0 | 17 | HAVE_REALLOCARRAY=0 |
18 | case "$gl_cv_onwards_func_reallocarray" in | ||
19 | future*) REPLACE_REALLOCARRAY=1 ;; | ||
20 | esac | ||
17 | elif test "$gl_cv_malloc_ptrdiff" = no; then | 21 | elif test "$gl_cv_malloc_ptrdiff" = no; then |
18 | REPLACE_REALLOCARRAY=1 | 22 | REPLACE_REALLOCARRAY=1 |
19 | fi | 23 | fi |
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index c89a1432..f0101fe6 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 | |||
@@ -1,10 +1,9 @@ | |||
1 | # serial 73 | 1 | # regex.m4 |
2 | 2 | # serial 75 | |
3 | # Copyright (C) 1996-2001, 2003-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. |
4 | # | 4 | dnl This file is free software; the Free Software Foundation |
5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 7 | ||
9 | dnl Initially derived from code in GNU grep. | 8 | dnl Initially derived from code in GNU grep. |
10 | dnl Mostly written by Jim Meyering. | 9 | dnl Mostly written by Jim Meyering. |
@@ -15,7 +14,7 @@ AC_DEFUN([gl_REGEX], | |||
15 | [ | 14 | [ |
16 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 15 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
17 | AC_ARG_WITH([included-regex], | 16 | AC_ARG_WITH([included-regex], |
18 | [AS_HELP_STRING([--without-included-regex], | 17 | [AS_HELP_STRING([[--without-included-regex]], |
19 | [don't compile regex; this is the default on systems | 18 | [don't compile regex; this is the default on systems |
20 | with recent-enough versions of the GNU C Library | 19 | with recent-enough versions of the GNU C Library |
21 | (use with caution on other systems).])]) | 20 | (use with caution on other systems).])]) |
@@ -327,10 +326,10 @@ AC_DEFUN([gl_REGEX], | |||
327 | [gl_cv_func_re_compile_pattern_working=yes], | 326 | [gl_cv_func_re_compile_pattern_working=yes], |
328 | [gl_cv_func_re_compile_pattern_working=no], | 327 | [gl_cv_func_re_compile_pattern_working=no], |
329 | [case "$host_os" in | 328 | [case "$host_os" in |
330 | # Guess no on native Windows. | 329 | # Guess no on native Windows. |
331 | mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; | 330 | mingw* | windows*) gl_cv_func_re_compile_pattern_working="guessing no" ;; |
332 | # Otherwise obey --enable-cross-guesses. | 331 | # Otherwise obey --enable-cross-guesses. |
333 | *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; | 332 | *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; |
334 | esac | 333 | esac |
335 | ]) | 334 | ]) |
336 | ]) | 335 | ]) |
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 0f35b8b8..422003b4 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # servent.m4 serial 4 | 1 | # servent.m4 |
2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -28,7 +29,7 @@ AC_DEFUN([gl_SERVENT], | |||
28 | AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], | 29 | AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], |
29 | [gl_cv_w32_getservbyname], | 30 | [gl_cv_w32_getservbyname], |
30 | [gl_cv_w32_getservbyname=no | 31 | [gl_cv_w32_getservbyname=no |
31 | gl_save_LIBS="$LIBS" | 32 | gl_saved_LIBS="$LIBS" |
32 | LIBS="$LIBS -lws2_32" | 33 | LIBS="$LIBS -lws2_32" |
33 | AC_LINK_IFELSE( | 34 | AC_LINK_IFELSE( |
34 | [AC_LANG_PROGRAM( | 35 | [AC_LANG_PROGRAM( |
@@ -40,7 +41,7 @@ AC_DEFUN([gl_SERVENT], | |||
40 | ]], | 41 | ]], |
41 | [[getservbyname(NULL,NULL);]])], | 42 | [[getservbyname(NULL,NULL);]])], |
42 | [gl_cv_w32_getservbyname=yes]) | 43 | [gl_cv_w32_getservbyname=yes]) |
43 | LIBS="$gl_save_LIBS" | 44 | LIBS="$gl_saved_LIBS" |
44 | ]) | 45 | ]) |
45 | if test "$gl_cv_w32_getservbyname" = "yes"; then | 46 | if test "$gl_cv_w32_getservbyname" = "yes"; then |
46 | SERVENT_LIB="-lws2_32" | 47 | SERVENT_LIB="-lws2_32" |
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index 16f9eb55..e7f00f39 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # setenv.m4 serial 30 | 1 | # setenv.m4 |
2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 33 |
3 | dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -35,12 +36,12 @@ AC_DEFUN([gl_FUNC_SETENV], | |||
35 | ]])], | 36 | ]])], |
36 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], | 37 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], |
37 | [case "$host_os" in | 38 | [case "$host_os" in |
38 | # Guess yes on glibc systems. | 39 | # Guess yes on glibc systems. |
39 | *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; | 40 | *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; |
40 | # Guess yes on musl systems. | 41 | # Guess yes on musl systems. |
41 | *-musl*) gl_cv_func_setenv_works="guessing yes" ;; | 42 | *-musl* | midipix*) gl_cv_func_setenv_works="guessing yes" ;; |
42 | # If we don't know, obey --enable-cross-guesses. | 43 | # If we don't know, obey --enable-cross-guesses. |
43 | *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; | 44 | *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; |
44 | esac | 45 | esac |
45 | ])]) | 46 | ])]) |
46 | case "$gl_cv_func_setenv_works" in | 47 | case "$gl_cv_func_setenv_works" in |
@@ -151,11 +152,10 @@ int unsetenv (const char *name); | |||
151 | # Prerequisites of lib/setenv.c. | 152 | # Prerequisites of lib/setenv.c. |
152 | AC_DEFUN([gl_PREREQ_SETENV], | 153 | AC_DEFUN([gl_PREREQ_SETENV], |
153 | [ | 154 | [ |
154 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
155 | AC_REQUIRE([gl_ENVIRON]) | 155 | AC_REQUIRE([gl_ENVIRON]) |
156 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 156 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
157 | AC_CHECK_HEADERS([search.h]) | 157 | AC_CHECK_HEADERS([search.h]) |
158 | AC_CHECK_FUNCS([tsearch]) | 158 | gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) |
159 | ]) | 159 | ]) |
160 | 160 | ||
161 | # Prerequisites of lib/unsetenv.c. | 161 | # Prerequisites of lib/unsetenv.c. |
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 index 032119d0..e5b7d28b 100644 --- a/gl/m4/setlocale_null.m4 +++ b/gl/m4/setlocale_null.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # setlocale_null.m4 serial 5 | 1 | # setlocale_null.m4 |
2 | dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
3 | dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -13,11 +14,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
13 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], | 14 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], |
14 | [gl_cv_func_setlocale_null_all_mtsafe], | 15 | [gl_cv_func_setlocale_null_all_mtsafe], |
15 | [case "$host_os" in | 16 | [case "$host_os" in |
16 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. | 17 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku. |
17 | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) | 18 | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku*) |
18 | gl_cv_func_setlocale_null_all_mtsafe=no ;; | 19 | gl_cv_func_setlocale_null_all_mtsafe=no ;; |
20 | # Guess no on Cygwin < 3.4.6. | ||
21 | cygwin*) | ||
22 | AC_EGREP_CPP([Lucky user], | ||
23 | [ | ||
24 | #if defined __CYGWIN__ | ||
25 | #include <cygwin/version.h> | ||
26 | #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6) | ||
27 | Lucky user | ||
28 | #endif | ||
29 | #endif | ||
30 | ], | ||
31 | [gl_cv_func_setlocale_null_all_mtsafe=yes], | ||
32 | [gl_cv_func_setlocale_null_all_mtsafe=no]) | ||
33 | ;; | ||
19 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. | 34 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. |
20 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) | 35 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*) |
21 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; | 36 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; |
22 | # If we don't know, obey --enable-cross-guesses. | 37 | # If we don't know, obey --enable-cross-guesses. |
23 | *) | 38 | *) |
@@ -26,7 +41,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
26 | ]) | 41 | ]) |
27 | dnl On platforms without multithreading, there is no issue. | 42 | dnl On platforms without multithreading, there is no issue. |
28 | case "$host_os" in | 43 | case "$host_os" in |
29 | mingw*) ;; | 44 | mingw* | windows*) ;; |
30 | *) | 45 | *) |
31 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | 46 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then |
32 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" | 47 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" |
@@ -48,7 +63,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
48 | openbsd* | aix*) | 63 | openbsd* | aix*) |
49 | gl_cv_func_setlocale_null_one_mtsafe=no ;; | 64 | gl_cv_func_setlocale_null_one_mtsafe=no ;; |
50 | # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. | 65 | # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. |
51 | *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) | 66 | *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*) |
52 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; | 67 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; |
53 | # If we don't know, obey --enable-cross-guesses. | 68 | # If we don't know, obey --enable-cross-guesses. |
54 | *) | 69 | *) |
@@ -57,7 +72,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
57 | ]) | 72 | ]) |
58 | dnl On platforms without multithreading, there is no issue. | 73 | dnl On platforms without multithreading, there is no issue. |
59 | case "$host_os" in | 74 | case "$host_os" in |
60 | mingw*) ;; | 75 | mingw* | windows*) ;; |
61 | *) | 76 | *) |
62 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | 77 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then |
63 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" | 78 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" |
@@ -74,20 +89,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
74 | dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. | 89 | dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. |
75 | if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then | 90 | if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then |
76 | case "$host_os" in | 91 | case "$host_os" in |
77 | mingw*) LIB_SETLOCALE_NULL= ;; | 92 | mingw* | windows*) |
93 | SETLOCALE_NULL_LIB= | ||
94 | ;; | ||
78 | *) | 95 | *) |
79 | gl_WEAK_SYMBOLS | 96 | gl_WEAK_SYMBOLS |
80 | case "$gl_cv_have_weak" in | 97 | case "$gl_cv_have_weak" in |
81 | *yes) LIB_SETLOCALE_NULL= ;; | 98 | *yes) SETLOCALE_NULL_LIB= ;; |
82 | *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; | 99 | *) SETLOCALE_NULL_LIB="$LIBPTHREAD" ;; |
83 | esac | 100 | esac |
84 | ;; | 101 | ;; |
85 | esac | 102 | esac |
86 | else | 103 | else |
87 | LIB_SETLOCALE_NULL= | 104 | SETLOCALE_NULL_LIB= |
88 | fi | 105 | fi |
89 | dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX | 106 | dnl SETLOCALE_NULL_LIB is expected to be '-pthread' or '-lpthread' on AIX |
90 | dnl with gcc or xlc, and empty otherwise. | 107 | dnl with gcc or xlc, and empty otherwise. |
108 | AC_SUBST([SETLOCALE_NULL_LIB]) | ||
109 | dnl For backward compatibility. | ||
110 | LIB_SETLOCALE_NULL="$SETLOCALE_NULL_LIB" | ||
91 | AC_SUBST([LIB_SETLOCALE_NULL]) | 111 | AC_SUBST([LIB_SETLOCALE_NULL]) |
92 | ]) | 112 | ]) |
93 | 113 | ||
diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4 index 4d1d1dda..ad5596a4 100644 --- a/gl/m4/sha256.m4 +++ b/gl/m4/sha256.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sha256.m4 serial 8 | 1 | # sha256.m4 |
2 | dnl Copyright (C) 2005, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
3 | dnl Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index 0763366d..df91cf06 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # size_max.m4 serial 12 | 1 | # size_max.m4 |
2 | dnl Copyright (C) 2003, 2005-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2003, 2005-2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 4b5fbdbf..6dbe146f 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # snprintf.m4 serial 7 | 1 | # snprintf.m4 |
2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
3 | dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index a556af1e..09f01161 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # socketlib.m4 serial 3 | 1 | # socketlib.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -18,7 +19,7 @@ AC_DEFUN([gl_SOCKETLIB], | |||
18 | dnl defined through -lws2_32), we need to call it. | 19 | dnl defined through -lws2_32), we need to call it. |
19 | AC_CACHE_CHECK([for WSAStartup], | 20 | AC_CACHE_CHECK([for WSAStartup], |
20 | [gl_cv_func_wsastartup], [ | 21 | [gl_cv_func_wsastartup], [ |
21 | gl_save_LIBS="$LIBS" | 22 | gl_saved_LIBS="$LIBS" |
22 | LIBS="$LIBS -lws2_32" | 23 | LIBS="$LIBS -lws2_32" |
23 | AC_LINK_IFELSE( | 24 | AC_LINK_IFELSE( |
24 | [AC_LANG_PROGRAM([[ | 25 | [AC_LANG_PROGRAM([[ |
@@ -33,7 +34,7 @@ AC_DEFUN([gl_SOCKETLIB], | |||
33 | ], | 34 | ], |
34 | [gl_cv_func_wsastartup=yes], | 35 | [gl_cv_func_wsastartup=yes], |
35 | [gl_cv_func_wsastartup=no]) | 36 | [gl_cv_func_wsastartup=no]) |
36 | LIBS="$gl_save_LIBS" | 37 | LIBS="$gl_saved_LIBS" |
37 | ]) | 38 | ]) |
38 | if test "$gl_cv_func_wsastartup" = "yes"; then | 39 | if test "$gl_cv_func_wsastartup" = "yes"; then |
39 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) | 40 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) |
@@ -56,8 +57,8 @@ AC_DEFUN([gl_SOCKETLIB], | |||
56 | #endif | 57 | #endif |
57 | char setsockopt();]], [[setsockopt();]])], | 58 | char setsockopt();]], [[setsockopt();]])], |
58 | [], | 59 | [], |
59 | [gl_save_LIBS="$LIBS" | 60 | [gl_saved_LIBS="$LIBS" |
60 | LIBS="$gl_save_LIBS -lsocket" | 61 | LIBS="$gl_saved_LIBS -lsocket" |
61 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 62 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
62 | #ifdef __cplusplus | 63 | #ifdef __cplusplus |
63 | "C" | 64 | "C" |
@@ -65,7 +66,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
65 | char setsockopt();]], [[setsockopt();]])], | 66 | char setsockopt();]], [[setsockopt();]])], |
66 | [gl_cv_lib_socket="-lsocket"]) | 67 | [gl_cv_lib_socket="-lsocket"]) |
67 | if test -z "$gl_cv_lib_socket"; then | 68 | if test -z "$gl_cv_lib_socket"; then |
68 | LIBS="$gl_save_LIBS -lnetwork" | 69 | LIBS="$gl_saved_LIBS -lnetwork" |
69 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 70 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
70 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
71 | "C" | 72 | "C" |
@@ -73,7 +74,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
73 | char setsockopt();]], [[setsockopt();]])], | 74 | char setsockopt();]], [[setsockopt();]])], |
74 | [gl_cv_lib_socket="-lnetwork"]) | 75 | [gl_cv_lib_socket="-lnetwork"]) |
75 | if test -z "$gl_cv_lib_socket"; then | 76 | if test -z "$gl_cv_lib_socket"; then |
76 | LIBS="$gl_save_LIBS -lnet" | 77 | LIBS="$gl_saved_LIBS -lnet" |
77 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 78 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
78 | #ifdef __cplusplus | 79 | #ifdef __cplusplus |
79 | "C" | 80 | "C" |
@@ -82,7 +83,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
82 | [gl_cv_lib_socket="-lnet"]) | 83 | [gl_cv_lib_socket="-lnet"]) |
83 | fi | 84 | fi |
84 | fi | 85 | fi |
85 | LIBS="$gl_save_LIBS" | 86 | LIBS="$gl_saved_LIBS" |
86 | ]) | 87 | ]) |
87 | if test -z "$gl_cv_lib_socket"; then | 88 | if test -z "$gl_cv_lib_socket"; then |
88 | gl_cv_lib_socket="none needed" | 89 | gl_cv_lib_socket="none needed" |
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index ed9cb873..a3dfe92f 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sockets.m4 serial 7 | 1 | # sockets.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 1c63a853..9ece0abb 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # socklen.m4 serial 11 | 1 | # socklen.m4 |
2 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
3 | dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 6c6dc2f7..c68b3abb 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sockpfaf.m4 serial 10 | 1 | # sockpfaf.m4 |
2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
3 | dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 1c12c33e..c15f948a 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 | |||
@@ -1,23 +1,38 @@ | |||
1 | # ssize_t.m4 serial 5 (gettext-0.18.2) | 1 | # ssize_t.m4 |
2 | dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
3 | dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | dnl Test whether ssize_t is defined. | 9 | dnl Define ssize_t if it does not already exist. |
9 | 10 | ||
10 | AC_DEFUN([gt_TYPE_SSIZE_T], | 11 | AC_DEFUN([gt_TYPE_SSIZE_T], |
11 | [ | 12 | [ |
12 | AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], | 13 | AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t], |
13 | [AC_COMPILE_IFELSE( | 14 | [AC_COMPILE_IFELSE( |
14 | [AC_LANG_PROGRAM( | 15 | [AC_LANG_PROGRAM( |
15 | [[#include <sys/types.h>]], | 16 | [[#include <sys/types.h>]], |
16 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); | 17 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); |
17 | return !x;]])], | 18 | return !x;]])], |
18 | [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) | 19 | [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])]) |
19 | if test $gt_cv_ssize_t = no; then | 20 | if test $gl_cv_ssize_t = no; then |
20 | AC_DEFINE([ssize_t], [int], | 21 | dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long', |
21 | [Define as a signed type of the same size as size_t.]) | 22 | dnl for consistency with the 64-bit size_t. |
23 | AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large], | ||
24 | [AC_COMPILE_IFELSE( | ||
25 | [AC_LANG_PROGRAM( | ||
26 | [[#include <sys/types.h> | ||
27 | typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1]; | ||
28 | ]])], | ||
29 | [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])]) | ||
30 | if test $gl_cv_size_t_large = yes; then | ||
31 | gl_def_ssize_t='long long' | ||
32 | else | ||
33 | gl_def_ssize_t='long' | ||
34 | fi | ||
35 | AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t], | ||
36 | [Define as a signed type of the same size as size_t.]) | ||
22 | fi | 37 | fi |
23 | ]) | 38 | ]) |
diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 index 40993d57..e8ee7d51 100644 --- a/gl/m4/stat-time.m4 +++ b/gl/m4/stat-time.m4 | |||
@@ -1,11 +1,11 @@ | |||
1 | # Checks for stat-related time functions. | 1 | # stat-time.m4 |
2 | 2 | # serial 1 | |
3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2023 Free Software | 3 | dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. |
4 | # Foundation, Inc. | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
5 | 7 | ||
6 | # This file is free software; the Free Software Foundation | 8 | # Checks for stat-related time functions. |
7 | # gives unlimited permission to copy and/or distribute it, | ||
8 | # with or without modifications, as long as this notice is preserved. | ||
9 | 9 | ||
10 | dnl From Paul Eggert. | 10 | dnl From Paul Eggert. |
11 | 11 | ||
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 index 4d241e27..fabd360c 100644 --- a/gl/m4/stat.m4 +++ b/gl/m4/stat.m4 | |||
@@ -1,10 +1,9 @@ | |||
1 | # serial 18 | 1 | # stat.m4 |
2 | 2 | # serial 21 | |
3 | # Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. |
4 | # | 4 | dnl This file is free software; the Free Software Foundation |
5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 7 | ||
9 | AC_DEFUN([gl_FUNC_STAT], | 8 | AC_DEFUN([gl_FUNC_STAT], |
10 | [ | 9 | [ |
@@ -12,7 +11,7 @@ AC_DEFUN([gl_FUNC_STAT], | |||
12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) |
13 | AC_CHECK_FUNCS_ONCE([lstat]) | 12 | AC_CHECK_FUNCS_ONCE([lstat]) |
14 | case "$host_os" in | 13 | case "$host_os" in |
15 | mingw*) | 14 | mingw* | windows*) |
16 | dnl On this platform, the original stat() returns st_atime, st_mtime, | 15 | dnl On this platform, the original stat() returns st_atime, st_mtime, |
17 | dnl st_ctime values that are affected by the time zone. | 16 | dnl st_ctime values that are affected by the time zone. |
18 | REPLACE_STAT=1 | 17 | REPLACE_STAT=1 |
@@ -45,6 +44,8 @@ AC_DEFUN([gl_FUNC_STAT], | |||
45 | [case "$host_os" in | 44 | [case "$host_os" in |
46 | # Guess yes on Linux systems. | 45 | # Guess yes on Linux systems. |
47 | linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; | 46 | linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; |
47 | # Guess yes on systems that emulate the Linux system calls. | ||
48 | midipix*) gl_cv_func_stat_file_slash="guessing yes" ;; | ||
48 | # Guess yes on glibc systems. | 49 | # Guess yes on glibc systems. |
49 | *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; | 50 | *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; |
50 | # If we don't know, obey --enable-cross-guesses. | 51 | # If we don't know, obey --enable-cross-guesses. |
@@ -59,8 +60,8 @@ AC_DEFUN([gl_FUNC_STAT], | |||
59 | help when passed a file name with a trailing slash]);; | 60 | help when passed a file name with a trailing slash]);; |
60 | esac | 61 | esac |
61 | case $host_os in | 62 | case $host_os in |
62 | dnl Solaris stat can return a negative tv_nsec. | 63 | dnl macOS and Solaris stat can return a negative tv_nsec. |
63 | solaris*) | 64 | darwin* | solaris*) |
64 | REPLACE_FSTAT=1 ;; | 65 | REPLACE_FSTAT=1 ;; |
65 | esac | 66 | esac |
66 | ;; | 67 | ;; |
@@ -78,7 +79,7 @@ AC_DEFUN([gl_PREREQ_STAT], [ | |||
78 | AC_DEFUN([gl_PREREQ_STAT_W32], [ | 79 | AC_DEFUN([gl_PREREQ_STAT_W32], [ |
79 | AC_REQUIRE([AC_CANONICAL_HOST]) | 80 | AC_REQUIRE([AC_CANONICAL_HOST]) |
80 | case "$host_os" in | 81 | case "$host_os" in |
81 | mingw*) | 82 | mingw* | windows*) |
82 | AC_CHECK_HEADERS([sdkddkver.h]) | 83 | AC_CHECK_HEADERS([sdkddkver.h]) |
83 | ;; | 84 | ;; |
84 | esac | 85 | esac |
diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4 index 4179470e..37324c15 100644 --- a/gl/m4/std-gnu11.m4 +++ b/gl/m4/std-gnu11.m4 | |||
@@ -1,3 +1,6 @@ | |||
1 | # std-gnu11.m4 | ||
2 | # serial 1 | ||
3 | |||
1 | # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- | 4 | # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- |
2 | 5 | ||
3 | # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 | 6 | # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 |
@@ -9,7 +12,7 @@ | |||
9 | m4_version_prereq([2.70], [], [ | 12 | m4_version_prereq([2.70], [], [ |
10 | 13 | ||
11 | 14 | ||
12 | # Copyright (C) 2001-2023 Free Software Foundation, Inc. | 15 | # Copyright (C) 2001-2024 Free Software Foundation, Inc. |
13 | 16 | ||
14 | # This program is free software; you can redistribute it and/or modify | 17 | # This program is free software; you can redistribute it and/or modify |
15 | # it under the terms of the GNU General Public License as published by | 18 | # it under the terms of the GNU General Public License as published by |
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4 index dc297175..2b4762f3 100644 --- a/gl/m4/stdalign.m4 +++ b/gl/m4/stdalign.m4 | |||
@@ -1,20 +1,24 @@ | |||
1 | # Check for alignas and alignof that conform to C23. | 1 | # stdalign.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright 2011-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2011-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # Check for alignas and alignof that conform to C23. | ||
9 | |||
10 | dnl Written by Paul Eggert and Bruno Haible. | ||
11 | |||
8 | # Prepare for substituting <stdalign.h> if it is not supported. | 12 | # Prepare for substituting <stdalign.h> if it is not supported. |
9 | 13 | ||
10 | AC_DEFUN([gl_STDALIGN_H], | 14 | AC_DEFUN([gl_ALIGNASOF], |
11 | [ | 15 | [ |
12 | AC_CACHE_CHECK([for alignas and alignof], | 16 | AC_CACHE_CHECK([for alignas and alignof], |
13 | [gl_cv_header_working_stdalign_h], | 17 | [gl_cv_header_working_stdalign_h], |
14 | [gl_save_CFLAGS=$CFLAGS | 18 | [gl_saved_CFLAGS=$CFLAGS |
15 | for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do | 19 | for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do |
16 | AS_CASE([$gl_working], | 20 | AS_CASE([$gl_working], |
17 | [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"]) | 21 | [*stdalign.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_STDALIGN_H"]) |
18 | AC_COMPILE_IFELSE( | 22 | AC_COMPILE_IFELSE( |
19 | [AC_LANG_PROGRAM( | 23 | [AC_LANG_PROGRAM( |
20 | [[#include <stdint.h> | 24 | [[#include <stdint.h> |
@@ -54,85 +58,151 @@ AC_DEFUN([gl_STDALIGN_H], | |||
54 | [gl_cv_header_working_stdalign_h=$gl_working], | 58 | [gl_cv_header_working_stdalign_h=$gl_working], |
55 | [gl_cv_header_working_stdalign_h=no]) | 59 | [gl_cv_header_working_stdalign_h=no]) |
56 | 60 | ||
57 | CFLAGS=$gl_save_CFLAGS | 61 | CFLAGS=$gl_saved_CFLAGS |
58 | test "$gl_cv_header_working_stdalign_h" != no && break | 62 | test "$gl_cv_header_working_stdalign_h" != no && break |
59 | done]) | 63 | done]) |
60 | 64 | ||
61 | GL_GENERATE_STDALIGN_H=false | ||
62 | AS_CASE([$gl_cv_header_working_stdalign_h], | 65 | AS_CASE([$gl_cv_header_working_stdalign_h], |
63 | [no], | ||
64 | [GL_GENERATE_STDALIGN_H=true], | ||
65 | [yes*keyword*], | 66 | [yes*keyword*], |
66 | [AC_DEFINE([HAVE_C_ALIGNASOF], [1], | 67 | [AC_DEFINE([HAVE_C_ALIGNASOF], [1], |
67 | [Define to 1 if the alignas and alignof keywords work.])]) | 68 | [Define to 1 if the alignas and alignof keywords work.])]) |
68 | 69 | ||
69 | AC_CHECK_HEADERS_ONCE([stdalign.h]) | ||
70 | |||
71 | dnl The "zz" puts this toward config.h's end, to avoid potential | 70 | dnl The "zz" puts this toward config.h's end, to avoid potential |
72 | dnl collisions with other definitions. | 71 | dnl collisions with other definitions. |
73 | AH_VERBATIM([zzalignas], | 72 | AH_VERBATIM([zzalignas], |
74 | [#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof | 73 | [#if !defined HAVE_C_ALIGNASOF \ |
75 | # if HAVE_STDALIGN_H | 74 | && !(defined __cplusplus && 201103 <= __cplusplus) \ |
75 | && !defined alignof | ||
76 | # if defined HAVE_STDALIGN_H | ||
76 | # include <stdalign.h> | 77 | # include <stdalign.h> |
77 | # else | 78 | # endif |
78 | /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */ | 79 | |
79 | # ifndef _GL_STDALIGN_H | 80 | /* ISO C23 alignas and alignof for platforms that lack it. |
80 | # define _GL_STDALIGN_H | 81 | |
81 | # undef _Alignas | 82 | References: |
82 | # undef _Alignof | 83 | ISO C23 (latest free draft |
83 | # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | 84 | <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf>) |
84 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | 85 | sections 6.5.3.4, 6.7.5, 7.15. |
85 | && !defined __clang__) \ | 86 | C++11 (latest free draft |
86 | || (defined __clang__ && __clang_major__ < 8)) | 87 | <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) |
87 | # ifdef __cplusplus | 88 | section 18.10. */ |
88 | # if (201103 <= __cplusplus || defined _MSC_VER) | 89 | |
89 | # define _Alignof(type) alignof (type) | 90 | /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment |
90 | # else | 91 | requirement of a structure member (i.e., slot or field) that is of |
91 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | 92 | type TYPE, as an integer constant expression. |
92 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) | 93 | |
93 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | 94 | This differs from GCC's and clang's __alignof__ operator, which can |
94 | # endif | 95 | yield a better-performing alignment for an object of that type. For |
96 | example, on x86 with GCC and on Linux/x86 with clang, | ||
97 | __alignof__ (double) and __alignof__ (long long) are 8, whereas | ||
98 | alignof (double) and alignof (long long) are 4 unless the option | ||
99 | '-malign-double' is used. | ||
100 | |||
101 | The result cannot be used as a value for an 'enum' constant, if you | ||
102 | want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
103 | |||
104 | /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 | ||
105 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. | ||
106 | clang versions < 8.0.0 have the same bug. */ | ||
107 | # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | ||
108 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | ||
109 | && !defined __clang__) \ | ||
110 | || (defined __clang__ && __clang_major__ < 8)) | ||
111 | # undef/**/_Alignof | ||
112 | # ifdef __cplusplus | ||
113 | # if (201103 <= __cplusplus || defined _MSC_VER) | ||
114 | # define _Alignof(type) alignof (type) | ||
95 | # else | 115 | # else |
116 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | ||
96 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ | 117 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ |
97 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | 118 | # define _Alignof(type) __builtin_offsetof (__alignof_helper<type>, __b) |
98 | # else | 119 | # else |
99 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) | 120 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) |
100 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
101 | # endif | 121 | # endif |
122 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
102 | # endif | 123 | # endif |
103 | # endif | 124 | # else |
104 | # if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) | 125 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ |
105 | # define alignof _Alignof | 126 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) |
106 | # endif | 127 | # else |
107 | # define __alignof_is_defined 1 | 128 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) |
108 | # if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | 129 | # define _GL_STDALIGN_NEEDS_STDDEF 1 |
109 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
110 | # define _Alignas(a) alignas (a) | ||
111 | # elif (!defined __attribute__ \ | ||
112 | && ((defined __APPLE__ && defined __MACH__ \ | ||
113 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
114 | : __GNUC__ && !defined __ibmxl__) \ | ||
115 | || (4 <= __clang_major__) \ | ||
116 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
117 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
118 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
119 | # elif 1300 <= _MSC_VER | ||
120 | # define _Alignas(a) __declspec (align (a)) | ||
121 | # endif | 130 | # endif |
122 | # endif | 131 | # endif |
123 | # if ((defined _Alignas \ | 132 | # endif |
124 | && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ | 133 | # if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) |
125 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | 134 | # undef/**/alignof |
126 | # define alignas _Alignas | 135 | # define alignof _Alignof |
127 | # endif | 136 | # endif |
128 | # if (defined alignas \ | 137 | |
129 | || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) | 138 | /* alignas (A), also known as _Alignas (A), aligns a variable or type |
130 | # define __alignas_is_defined 1 | 139 | to the alignment A, where A is an integer constant expression. For |
131 | # endif | 140 | example: |
132 | # if _GL_STDALIGN_NEEDS_STDDEF | 141 | |
133 | # include <stddef.h> | 142 | int alignas (8) foo; |
134 | # endif | 143 | struct s { int a; int alignas (8) bar; }; |
135 | # endif /* _GL_STDALIGN_H */ | 144 | |
145 | aligns the address of FOO and the offset of BAR to be multiples of 8. | ||
146 | |||
147 | A should be a power of two that is at least the type's alignment | ||
148 | and at most the implementation's alignment limit. This limit is | ||
149 | 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable | ||
150 | to MSVC through at least version 10.0, A should be an integer | ||
151 | constant, as MSVC does not support expressions such as 1 << 3. | ||
152 | To be portable to Sun C 5.11, do not align auto variables to | ||
153 | anything stricter than their default alignment. | ||
154 | |||
155 | The following C23 requirements are not supported here: | ||
156 | |||
157 | - If A is zero, alignas has no effect. | ||
158 | - alignas can be used multiple times; the strictest one wins. | ||
159 | - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). | ||
160 | |||
161 | */ | ||
162 | # if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | ||
163 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
164 | # define _Alignas(a) alignas (a) | ||
165 | # elif (!defined __attribute__ \ | ||
166 | && ((defined __APPLE__ && defined __MACH__ \ | ||
167 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
168 | : __GNUC__ && !defined __ibmxl__) \ | ||
169 | || (4 <= __clang_major__) \ | ||
170 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
171 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
172 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
173 | # elif 1300 <= _MSC_VER | ||
174 | # define _Alignas(a) __declspec (align (a)) | ||
175 | # endif | ||
176 | # endif | ||
177 | # if !defined HAVE_STDALIGN_H | ||
178 | # if ((defined _Alignas \ | ||
179 | && !(defined __cplusplus \ | ||
180 | && (201103 <= __cplusplus || defined _MSC_VER))) \ | ||
181 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||
182 | # define alignas _Alignas | ||
183 | # endif | ||
184 | # endif | ||
185 | |||
186 | # if defined _GL_STDALIGN_NEEDS_STDDEF | ||
187 | # include <stddef.h> | ||
136 | # endif | 188 | # endif |
137 | #endif]) | 189 | #endif]) |
138 | ]) | 190 | ]) |
191 | |||
192 | AC_DEFUN([gl_STDALIGN_H], | ||
193 | [ | ||
194 | AC_REQUIRE([gl_ALIGNASOF]) | ||
195 | if test "$gl_cv_header_working_stdalign_h" = no; then | ||
196 | GL_GENERATE_STDALIGN_H=true | ||
197 | else | ||
198 | GL_GENERATE_STDALIGN_H=false | ||
199 | fi | ||
200 | |||
201 | gl_CHECK_NEXT_HEADERS([stdalign.h]) | ||
202 | if test $ac_cv_header_stdalign_h = yes; then | ||
203 | HAVE_STDALIGN_H=1 | ||
204 | else | ||
205 | HAVE_STDALIGN_H=0 | ||
206 | fi | ||
207 | AC_SUBST([HAVE_STDALIGN_H]) | ||
208 | ]) | ||
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index a2322ebb..84d3bae8 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # stddef_h.m4 serial 13 | 1 | # stddef_h.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -68,6 +69,21 @@ AC_DEFUN_ONCE([gl_STDDEF_H], | |||
68 | GL_GENERATE_STDDEF_H=true | 69 | GL_GENERATE_STDDEF_H=true |
69 | fi | 70 | fi |
70 | 71 | ||
72 | AC_CACHE_CHECK([for unreachable], | ||
73 | [gl_cv_func_unreachable], | ||
74 | [AC_LINK_IFELSE( | ||
75 | [AC_LANG_PROGRAM( | ||
76 | [[#include <stddef.h> | ||
77 | ]], | ||
78 | [[unreachable (); | ||
79 | ]])], | ||
80 | [gl_cv_func_unreachable=yes], | ||
81 | [gl_cv_func_unreachable=no]) | ||
82 | ]) | ||
83 | if test $gl_cv_func_unreachable = no; then | ||
84 | GL_GENERATE_STDDEF_H=true | ||
85 | fi | ||
86 | |||
71 | if $GL_GENERATE_STDDEF_H; then | 87 | if $GL_GENERATE_STDDEF_H; then |
72 | gl_NEXT_HEADERS([stddef.h]) | 88 | gl_NEXT_HEADERS([stddef.h]) |
73 | fi | 89 | fi |
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index d6961b09..2dea8469 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # stdint.m4 serial 61 | 1 | # stdint.m4 |
2 | dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. | 2 | # serial 63 |
3 | dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -150,7 +151,10 @@ intmax_t i = INTMAX_MAX; | |||
150 | uintmax_t j = UINTMAX_MAX; | 151 | uintmax_t j = UINTMAX_MAX; |
151 | 152 | ||
152 | /* Check that SIZE_MAX has the correct type, if possible. */ | 153 | /* Check that SIZE_MAX has the correct type, if possible. */ |
153 | #if 201112 <= __STDC_VERSION__ | 154 | /* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it. */ |
155 | #if 201112 <= __STDC_VERSION__ \ | ||
156 | && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \ | ||
157 | || defined __clang__) | ||
154 | int k = _Generic (SIZE_MAX, size_t: 0); | 158 | int k = _Generic (SIZE_MAX, size_t: 0); |
155 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ | 159 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ |
156 | || (0x5110 <= __SUNPRO_C && !__STDC__)) | 160 | || (0x5110 <= __SUNPRO_C && !__STDC__)) |
@@ -283,10 +287,10 @@ static const char *macro_values[] = | |||
283 | [gl_cv_header_working_stdint_h=yes], | 287 | [gl_cv_header_working_stdint_h=yes], |
284 | [], | 288 | [], |
285 | [case "$host_os" in | 289 | [case "$host_os" in |
286 | # Guess yes on native Windows. | 290 | # Guess yes on native Windows. |
287 | mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; | 291 | mingw* | windows*) gl_cv_header_working_stdint_h="guessing yes" ;; |
288 | # In general, assume it works. | 292 | # In general, assume it works. |
289 | *) gl_cv_header_working_stdint_h="guessing yes" ;; | 293 | *) gl_cv_header_working_stdint_h="guessing yes" ;; |
290 | esac | 294 | esac |
291 | ]) | 295 | ]) |
292 | ]) | 296 | ]) |
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 70349f6c..29f42160 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # stdint_h.m4 serial 9 | 1 | # stdint_h.m4 |
2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
3 | dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 94271e11..8eb5816a 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 | |||
@@ -1,12 +1,23 @@ | |||
1 | # stdio_h.m4 serial 59 | 1 | # stdio_h.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 63 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
7 | AC_DEFUN_ONCE([gl_STDIO_H], | 8 | AC_DEFUN([gl_STDIO_H_EARLY], |
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 10 | dnl Defining __USE_MINGW_ANSI_STDIO to 1 must be done early, because |
11 | dnl the results of several configure tests depend on it: The tests | ||
12 | dnl - checking whether snprintf returns a byte count as in C99... | ||
13 | dnl - checking whether snprintf truncates the result as in C99... | ||
14 | dnl - checking whether printf supports the 'F' directive... | ||
15 | dnl - checking whether printf supports the grouping flag... | ||
16 | dnl - checking whether printf supports the zero flag correctly... | ||
17 | dnl - checking whether printf supports infinite 'double' arguments... | ||
18 | dnl - checking whether printf supports large precisions... | ||
19 | dnl report 'yes' if __USE_MINGW_ANSI_STDIO is 1 but 'no' if | ||
20 | dnl __USE_MINGW_ANSI_STDIO is not set. | ||
10 | AH_VERBATIM([MINGW_ANSI_STDIO], | 21 | AH_VERBATIM([MINGW_ANSI_STDIO], |
11 | [/* Use GNU style printf and scanf. */ | 22 | [/* Use GNU style printf and scanf. */ |
12 | #ifndef __USE_MINGW_ANSI_STDIO | 23 | #ifndef __USE_MINGW_ANSI_STDIO |
@@ -14,6 +25,11 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
14 | #endif | 25 | #endif |
15 | ]) | 26 | ]) |
16 | AC_DEFINE([__USE_MINGW_ANSI_STDIO]) | 27 | AC_DEFINE([__USE_MINGW_ANSI_STDIO]) |
28 | ]) | ||
29 | |||
30 | AC_DEFUN_ONCE([gl_STDIO_H], | ||
31 | [ | ||
32 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
17 | gl_NEXT_HEADERS([stdio.h]) | 33 | gl_NEXT_HEADERS([stdio.h]) |
18 | 34 | ||
19 | dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and | 35 | dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and |
@@ -40,6 +56,9 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
40 | attribute "__gnu_printf__" instead of "__printf__"]) | 56 | attribute "__gnu_printf__" instead of "__printf__"]) |
41 | fi | 57 | fi |
42 | 58 | ||
59 | dnl For defining _PRINTF_NAN_LEN_MAX. | ||
60 | gl_MUSL_LIBC | ||
61 | |||
43 | dnl This ifdef is an optimization, to avoid performing a configure check whose | 62 | dnl This ifdef is an optimization, to avoid performing a configure check whose |
44 | dnl result is not used. But it does not make the test of | 63 | dnl result is not used. But it does not make the test of |
45 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. | 64 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. |
@@ -82,6 +101,16 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
82 | if test $ac_cv_have_decl_fcloseall = no; then | 101 | if test $ac_cv_have_decl_fcloseall = no; then |
83 | HAVE_DECL_FCLOSEALL=0 | 102 | HAVE_DECL_FCLOSEALL=0 |
84 | fi | 103 | fi |
104 | |||
105 | AC_CHECK_DECLS_ONCE([getw]) | ||
106 | if test $ac_cv_have_decl_getw = no; then | ||
107 | HAVE_DECL_GETW=0 | ||
108 | fi | ||
109 | |||
110 | AC_CHECK_DECLS_ONCE([putw]) | ||
111 | if test $ac_cv_have_decl_putw = no; then | ||
112 | HAVE_DECL_PUTW=0 | ||
113 | fi | ||
85 | ]) | 114 | ]) |
86 | 115 | ||
87 | # gl_STDIO_MODULE_INDICATOR([modulename]) | 116 | # gl_STDIO_MODULE_INDICATOR([modulename]) |
@@ -178,7 +207,9 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], | |||
178 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) | 207 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) |
179 | HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) | 208 | HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) |
180 | HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) | 209 | HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) |
210 | HAVE_DECL_GETW=1; AC_SUBST([HAVE_DECL_GETW]) | ||
181 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) | 211 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) |
212 | HAVE_DECL_PUTW=1; AC_SUBST([HAVE_DECL_PUTW]) | ||
182 | HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) | 213 | HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) |
183 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) | 214 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) |
184 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) | 215 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) |
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index e96be22f..a4662f29 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # stdlib_h.m4 serial 66 | 1 | # stdlib_h.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 77 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -23,15 +24,58 @@ AC_DEFUN_ONCE([gl_STDLIB_H], | |||
23 | # include <random.h> | 24 | # include <random.h> |
24 | #endif | 25 | #endif |
25 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free | 26 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free |
26 | getloadavg getsubopt grantpt | 27 | getloadavg getprogname getsubopt grantpt |
27 | initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps | 28 | initstate initstate_r mbstowcs mbtowc mkdtemp mkostemp mkostemps mkstemp |
28 | posix_memalign posix_openpt ptsname ptsname_r qsort_r | 29 | mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r |
29 | random random_r reallocarray realpath rpmatch secure_getenv setenv | 30 | random random_r reallocarray realpath rpmatch secure_getenv setenv |
30 | setstate setstate_r srandom srandom_r | 31 | setstate setstate_r srandom srandom_r |
31 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) | 32 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) |
32 | 33 | ||
33 | AC_REQUIRE([AC_C_RESTRICT]) | 34 | AC_REQUIRE([AC_C_RESTRICT]) |
34 | 35 | ||
36 | dnl Test whether MB_CUR_MAX needs to be overridden. | ||
37 | dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. | ||
38 | dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. | ||
39 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
40 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
41 | AC_CACHE_CHECK([whether MB_CUR_MAX is correct], | ||
42 | [gl_cv_macro_MB_CUR_MAX_good], | ||
43 | [ | ||
44 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
45 | dnl is present. | ||
46 | changequote(,)dnl | ||
47 | case "$host_os" in | ||
48 | # Guess no on Solaris. | ||
49 | solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; | ||
50 | # Guess yes otherwise. | ||
51 | *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; | ||
52 | esac | ||
53 | changequote([,])dnl | ||
54 | if test $LOCALE_FR_UTF8 != none; then | ||
55 | AC_RUN_IFELSE( | ||
56 | [AC_LANG_SOURCE([[ | ||
57 | #include <locale.h> | ||
58 | #include <stdlib.h> | ||
59 | int main () | ||
60 | { | ||
61 | int result = 0; | ||
62 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
63 | { | ||
64 | if (MB_CUR_MAX < 4) | ||
65 | result |= 1; | ||
66 | } | ||
67 | return result; | ||
68 | }]])], | ||
69 | [gl_cv_macro_MB_CUR_MAX_good=yes], | ||
70 | [gl_cv_macro_MB_CUR_MAX_good=no], | ||
71 | [:]) | ||
72 | fi | ||
73 | ]) | ||
74 | case "$gl_cv_macro_MB_CUR_MAX_good" in | ||
75 | *yes) ;; | ||
76 | *) REPLACE_MB_CUR_MAX=1 ;; | ||
77 | esac | ||
78 | |||
35 | AC_CHECK_DECLS_ONCE([ecvt]) | 79 | AC_CHECK_DECLS_ONCE([ecvt]) |
36 | if test $ac_cv_have_decl_ecvt = no; then | 80 | if test $ac_cv_have_decl_ecvt = no; then |
37 | HAVE_DECL_ECVT=0 | 81 | HAVE_DECL_ECVT=0 |
@@ -73,10 +117,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) | 117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) |
74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) | 118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) |
75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) | 119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) |
120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPROGNAME]) | ||
76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) | 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) |
77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) | 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) |
78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) | 123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) |
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) | 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) |
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOWCS]) | ||
80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) | 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) |
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) | 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) |
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) | 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) |
@@ -89,6 +135,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) | 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) |
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) |
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) | 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) |
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAND]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) | 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) |
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) |
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) |
@@ -99,6 +146,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) | 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) |
100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) | 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) |
101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) |
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) | ||
102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) | 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) |
103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) | 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) |
104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) | 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) |
@@ -130,6 +178,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
130 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) | 178 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) |
131 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) | 179 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) |
132 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) | 180 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) |
181 | HAVE_DECL_PROGRAM_INVOCATION_NAME=1; AC_SUBST([HAVE_DECL_PROGRAM_INVOCATION_NAME]) | ||
182 | HAVE_GETPROGNAME=1; AC_SUBST([HAVE_GETPROGNAME]) | ||
133 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) | 183 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) |
134 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) | 184 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) |
135 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) | 185 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) |
@@ -157,6 +207,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
157 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) | 207 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) |
158 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) | 208 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) |
159 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) | 209 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) |
210 | HAVE_STRTOF=1; AC_SUBST([HAVE_STRTOF]) | ||
160 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) | 211 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) |
161 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) | 212 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) |
162 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) | 213 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) |
@@ -166,21 +217,31 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
166 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) | 217 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) |
167 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) | 218 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) |
168 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) | 219 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) |
220 | REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) | ||
169 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) | 221 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) |
170 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) | 222 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) |
171 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) | 223 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) |
172 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) | 224 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) |
173 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) | 225 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) |
226 | REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG]) | ||
227 | REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME]) | ||
228 | REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT]) | ||
174 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) | 229 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) |
175 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) | 230 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) |
176 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) | 231 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) |
232 | REPLACE_MB_CUR_MAX=0; AC_SUBST([REPLACE_MB_CUR_MAX]) | ||
233 | REPLACE_MBSTOWCS=0; AC_SUBST([REPLACE_MBSTOWCS]) | ||
177 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | 234 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) |
235 | REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP]) | ||
236 | REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS]) | ||
178 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 237 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
179 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) | 238 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) |
239 | REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT]) | ||
180 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) | 240 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) |
181 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) | 241 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) |
182 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 242 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
183 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) | 243 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) |
244 | REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) | ||
184 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) | 245 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) |
185 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) | 246 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) |
186 | REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) | 247 | REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) |
@@ -190,6 +251,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
190 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) | 251 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) |
191 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) | 252 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) |
192 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) | 253 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) |
254 | REPLACE_STRTOF=0; AC_SUBST([REPLACE_STRTOF]) | ||
193 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) | 255 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) |
194 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) | 256 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) |
195 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) | 257 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) |
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 index 3cf740d2..63021733 100644 --- a/gl/m4/strcase.m4 +++ b/gl/m4/strcase.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # strcase.m4 serial 12 | 1 | # strcase.m4 |
2 | dnl Copyright (C) 2002, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2002, 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 index 971e0b23..d2548716 100644 --- a/gl/m4/strcasestr.m4 +++ b/gl/m4/strcasestr.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # strcasestr.m4 serial 28 | 1 | # strcasestr.m4 |
2 | dnl Copyright (C) 2005, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 28 |
3 | dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 8879eb08..0272c6f4 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # strerror.m4 serial 23 | 1 | # strerror.m4 |
2 | dnl Copyright (C) 2002, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 25 |
3 | dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -24,12 +25,12 @@ AC_DEFUN([gl_FUNC_STRERROR], | |||
24 | [gl_cv_func_working_strerror=yes], | 25 | [gl_cv_func_working_strerror=yes], |
25 | [gl_cv_func_working_strerror=no], | 26 | [gl_cv_func_working_strerror=no], |
26 | [case "$host_os" in | 27 | [case "$host_os" in |
27 | # Guess yes on glibc systems. | 28 | # Guess yes on glibc systems. |
28 | *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; | 29 | *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; |
29 | # Guess yes on musl systems. | 30 | # Guess yes on musl systems. |
30 | *-musl*) gl_cv_func_working_strerror="guessing yes" ;; | 31 | *-musl* | midipix*) gl_cv_func_working_strerror="guessing yes" ;; |
31 | # If we don't know, obey --enable-cross-guesses. | 32 | # If we don't know, obey --enable-cross-guesses. |
32 | *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; | 33 | *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; |
33 | esac | 34 | esac |
34 | ]) | 35 | ]) |
35 | ]) | 36 | ]) |
@@ -80,14 +81,14 @@ AC_DEFUN([gl_FUNC_STRERROR_0], | |||
80 | [gl_cv_func_strerror_0_works=yes], | 81 | [gl_cv_func_strerror_0_works=yes], |
81 | [gl_cv_func_strerror_0_works=no], | 82 | [gl_cv_func_strerror_0_works=no], |
82 | [case "$host_os" in | 83 | [case "$host_os" in |
83 | # Guess yes on glibc systems. | 84 | # Guess yes on glibc systems. |
84 | *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; | 85 | *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; |
85 | # Guess yes on musl systems. | 86 | # Guess yes on musl systems. |
86 | *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; | 87 | *-musl* | midipix*) gl_cv_func_strerror_0_works="guessing yes" ;; |
87 | # Guess yes on native Windows. | 88 | # Guess yes on native Windows. |
88 | mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; | 89 | mingw* | windows*) gl_cv_func_strerror_0_works="guessing yes" ;; |
89 | # If we don't know, obey --enable-cross-guesses. | 90 | # If we don't know, obey --enable-cross-guesses. |
90 | *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; | 91 | *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; |
91 | esac | 92 | esac |
92 | ]) | 93 | ]) |
93 | ]) | 94 | ]) |
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index 5da3cc25..f31264ae 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 | |||
@@ -1,11 +1,11 @@ | |||
1 | # Configure a GNU-like replacement for <string.h>. | 1 | # string_h.m4 |
2 | 2 | # serial 39 | |
3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # serial 35 | 8 | # Configure a GNU-like replacement for <string.h>. |
9 | 9 | ||
10 | # Written by Paul Eggert. | 10 | # Written by Paul Eggert. |
11 | 11 | ||
@@ -131,6 +131,9 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], | |||
131 | REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) | 131 | REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) |
132 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) | 132 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) |
133 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) | 133 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) |
134 | REPLACE_MEMPCPY=0; AC_SUBST([REPLACE_MEMPCPY]) | ||
135 | REPLACE_MEMSET_EXPLICIT=0; AC_SUBST([REPLACE_MEMSET_EXPLICIT]) | ||
136 | REPLACE_STPCPY=0; AC_SUBST([REPLACE_STPCPY]) | ||
134 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) | 137 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) |
135 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) | 138 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) |
136 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) | 139 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) |
@@ -144,5 +147,6 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], | |||
144 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) | 147 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) |
145 | REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) | 148 | REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) |
146 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) | 149 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) |
150 | REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) | ||
147 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) | 151 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) |
148 | ]) | 152 | ]) |
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index 4c41221b..aaafb559 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 | |||
@@ -1,10 +1,11 @@ | |||
1 | # Configure a replacement for <strings.h>. | 1 | # strings_h.m4 |
2 | # serial 9 | 2 | # serial 9 |
3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
3 | 7 | ||
4 | # Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 8 | # Configure a replacement for <strings.h>. |
5 | # This file is free software; the Free Software Foundation | ||
6 | # gives unlimited permission to copy and/or distribute it, | ||
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 9 | ||
9 | AC_DEFUN_ONCE([gl_STRINGS_H], | 10 | AC_DEFUN_ONCE([gl_STRINGS_H], |
10 | [ | 11 | [ |
diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4 index e0da09a3..cfde87a5 100644 --- a/gl/m4/strsep.m4 +++ b/gl/m4/strsep.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # strsep.m4 serial 11 | 1 | # strsep.m4 |
2 | dnl Copyright (C) 2002-2004, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
3 | dnl Copyright (C) 2002-2004, 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 index 7de203a7..957ed2e3 100644 --- a/gl/m4/strstr.m4 +++ b/gl/m4/strstr.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # strstr.m4 serial 24 | 1 | # strstr.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 24 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 98a10416..3bf3cb47 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sys_socket_h.m4 serial 29 | 1 | # sys_socket_h.m4 |
2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 29 |
3 | dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index ca57398a..3cc50ce6 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sys_stat_h.m4 serial 42 -*- Autoconf -*- | 1 | # sys_stat_h.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 42 -*- Autoconf -*- |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 index 627671fb..00d2437b 100644 --- a/gl/m4/sys_types_h.m4 +++ b/gl/m4/sys_types_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sys_types_h.m4 serial 13 | 1 | # sys_types_h.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 13 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4 index 93a65d26..a471c720 100644 --- a/gl/m4/sys_uio_h.m4 +++ b/gl/m4/sys_uio_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # sys_uio_h.m4 serial 3 | 1 | # sys_uio_h.m4 |
2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index b536b047..f5e81479 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # threadlib.m4 serial 32a | 1 | # threadlib.m4 |
2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 42 |
3 | dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -85,10 +86,11 @@ AC_DEFUN([gl_WEAK_SYMBOLS], | |||
85 | AC_CACHE_CHECK([whether imported symbols can be declared weak], | 86 | AC_CACHE_CHECK([whether imported symbols can be declared weak], |
86 | [gl_cv_have_weak], | 87 | [gl_cv_have_weak], |
87 | [case "$host_os" in | 88 | [case "$host_os" in |
88 | cygwin*) | 89 | cygwin* | mingw* | windows*) |
89 | dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but | 90 | dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with |
90 | dnl programs that use pthread_in_use() with weak symbol references | 91 | dnl gcc 11.3, the test below would succeed, but programs that use |
91 | dnl crash miserably at runtime. | 92 | dnl pthread_in_use() with weak symbol references crash miserably at |
93 | dnl runtime. | ||
92 | gl_cv_have_weak="guessing no" | 94 | gl_cv_have_weak="guessing no" |
93 | ;; | 95 | ;; |
94 | *) | 96 | *) |
@@ -174,7 +176,7 @@ dnl Sets the variable LIBPMULTITHREAD, for programs that really need | |||
174 | dnl multithread functionality. The difference between LIBPTHREAD and | 176 | dnl multithread functionality. The difference between LIBPTHREAD and |
175 | dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically | 177 | dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically |
176 | dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. | 178 | dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. |
177 | dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the | 179 | dnl Sets the variable SCHED_YIELD_LIB to the linker options needed to use the |
178 | dnl sched_yield() function. | 180 | dnl sched_yield() function. |
179 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | 181 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for |
180 | dnl multithread-safe programs. | 182 | dnl multithread-safe programs. |
@@ -205,7 +207,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
205 | # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 | 207 | # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 |
206 | # needs -pthread for some reason. See: | 208 | # needs -pthread for some reason. See: |
207 | # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html | 209 | # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html |
208 | save_LIBS=$LIBS | 210 | saved_LIBS="$LIBS" |
209 | for gl_pthread in '' '-pthread'; do | 211 | for gl_pthread in '' '-pthread'; do |
210 | LIBS="$LIBS $gl_pthread" | 212 | LIBS="$LIBS $gl_pthread" |
211 | AC_LINK_IFELSE( | 213 | AC_LINK_IFELSE( |
@@ -219,7 +221,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
219 | [gl_pthread_api=yes | 221 | [gl_pthread_api=yes |
220 | LIBPTHREAD=$gl_pthread | 222 | LIBPTHREAD=$gl_pthread |
221 | LIBPMULTITHREAD=$gl_pthread]) | 223 | LIBPMULTITHREAD=$gl_pthread]) |
222 | LIBS=$save_LIBS | 224 | LIBS="$saved_LIBS" |
223 | test $gl_pthread_api = yes && break | 225 | test $gl_pthread_api = yes && break |
224 | done | 226 | done |
225 | echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD | 227 | echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD |
@@ -268,6 +270,15 @@ changequote([,])dnl | |||
268 | [Define if the pthread_in_use() detection is hard.]) | 270 | [Define if the pthread_in_use() detection is hard.]) |
269 | esac | 271 | esac |
270 | fi | 272 | fi |
273 | ], | ||
274 | [dnl This is needed on FreeBSD 5.2.1. | ||
275 | AC_CHECK_LIB([thr], [pthread_kill], | ||
276 | [if test $gl_pthread_in_glibc = yes; then | ||
277 | LIBPMULTITHREAD= | ||
278 | else | ||
279 | LIBPMULTITHREAD=-lthr | ||
280 | fi | ||
281 | ]) | ||
271 | ]) | 282 | ]) |
272 | elif test $gl_pthread_api != yes; then | 283 | elif test $gl_pthread_api != yes; then |
273 | # Some library is needed. Try libpthread and libc_r. | 284 | # Some library is needed. Try libpthread and libc_r. |
@@ -299,13 +310,16 @@ changequote([,])dnl | |||
299 | [AC_LANG_PROGRAM( | 310 | [AC_LANG_PROGRAM( |
300 | [[#include <sched.h>]], | 311 | [[#include <sched.h>]], |
301 | [[sched_yield ();]])], | 312 | [[sched_yield ();]])], |
302 | [LIB_SCHED_YIELD= | 313 | [SCHED_YIELD_LIB= |
303 | ], | 314 | ], |
304 | [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. | 315 | [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. |
305 | AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], | 316 | AC_CHECK_LIB([rt], [sched_yield], [SCHED_YIELD_LIB=-lrt], |
306 | [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. | 317 | [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. |
307 | AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) | 318 | AC_CHECK_LIB([posix4], [sched_yield], [SCHED_YIELD_LIB=-lposix4])]) |
308 | ]) | 319 | ]) |
320 | AC_SUBST([SCHED_YIELD_LIB]) | ||
321 | dnl For backward compatibility. | ||
322 | LIB_SCHED_YIELD="$SCHED_YIELD_LIB" | ||
309 | AC_SUBST([LIB_SCHED_YIELD]) | 323 | AC_SUBST([LIB_SCHED_YIELD]) |
310 | 324 | ||
311 | gl_pthreadlib_body_done=done | 325 | gl_pthreadlib_body_done=done |
@@ -340,7 +354,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], | |||
340 | AC_CHECK_HEADERS_ONCE([threads.h]) | 354 | AC_CHECK_HEADERS_ONCE([threads.h]) |
341 | 355 | ||
342 | case "$host_os" in | 356 | case "$host_os" in |
343 | mingw*) | 357 | mingw* | windows*) |
344 | LIBSTDTHREAD= | 358 | LIBSTDTHREAD= |
345 | ;; | 359 | ;; |
346 | *) | 360 | *) |
@@ -351,7 +365,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], | |||
351 | dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). | 365 | dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). |
352 | dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in | 366 | dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in |
353 | dnl libc. | 367 | dnl libc. |
354 | AC_CHECK_FUNCS([thrd_create]) | 368 | gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]]) |
355 | if test $ac_cv_func_thrd_create = yes; then | 369 | if test $ac_cv_func_thrd_create = yes; then |
356 | LIBSTDTHREAD= | 370 | LIBSTDTHREAD= |
357 | else | 371 | else |
@@ -364,7 +378,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], | |||
364 | fi | 378 | fi |
365 | else | 379 | else |
366 | dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. | 380 | dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. |
367 | LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" | 381 | LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" |
368 | fi | 382 | fi |
369 | ;; | 383 | ;; |
370 | esac | 384 | esac |
@@ -435,10 +449,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], | |||
435 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], | 449 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], |
436 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], | 450 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], |
437 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) | 451 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) |
438 | m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) | 452 | dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like |
453 | dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. | ||
454 | m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) | ||
439 | AC_ARG_ENABLE([threads], | 455 | AC_ARG_ENABLE([threads], |
440 | AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ | 456 | AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ |
441 | AS_HELP_STRING([--disable-threads], [build without multithread safety])]), | 457 | AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), |
442 | [gl_use_threads=$enableval], | 458 | [gl_use_threads=$enableval], |
443 | [if test -n "$gl_use_threads_default"; then | 459 | [if test -n "$gl_use_threads_default"; then |
444 | gl_use_threads="$gl_use_threads_default" | 460 | gl_use_threads="$gl_use_threads_default" |
@@ -459,7 +475,7 @@ changequote(,)dnl | |||
459 | esac | 475 | esac |
460 | ;; | 476 | ;; |
461 | dnl Obey gl_AVOID_WINPTHREAD on mingw. | 477 | dnl Obey gl_AVOID_WINPTHREAD on mingw. |
462 | mingw*) | 478 | mingw* | windows*) |
463 | case "$gl_use_winpthreads_default" in | 479 | case "$gl_use_winpthreads_default" in |
464 | yes) gl_use_threads=posix ;; | 480 | yes) gl_use_threads=posix ;; |
465 | no) gl_use_threads=windows ;; | 481 | no) gl_use_threads=windows ;; |
@@ -558,7 +574,7 @@ AC_DEFUN([gl_THREADLIB_BODY], | |||
558 | case "$gl_use_threads" in | 574 | case "$gl_use_threads" in |
559 | yes | windows | win32) # The 'win32' is for backward compatibility. | 575 | yes | windows | win32) # The 'win32' is for backward compatibility. |
560 | if { case "$host_os" in | 576 | if { case "$host_os" in |
561 | mingw*) true;; | 577 | mingw* | windows*) true;; |
562 | *) false;; | 578 | *) false;; |
563 | esac | 579 | esac |
564 | }; then | 580 | }; then |
@@ -569,6 +585,10 @@ AC_DEFUN([gl_THREADLIB_BODY], | |||
569 | ;; | 585 | ;; |
570 | esac | 586 | esac |
571 | fi | 587 | fi |
588 | else | ||
589 | dnl "$gl_use_threads" is "no". | ||
590 | AC_DEFINE([AVOID_ANY_THREADS], [1], | ||
591 | [Define if no multithread safety and no multithreading is desired.]) | ||
572 | fi | 592 | fi |
573 | AC_MSG_CHECKING([for multithread API to use]) | 593 | AC_MSG_CHECKING([for multithread API to use]) |
574 | AC_MSG_RESULT([$gl_threads_api]) | 594 | AC_MSG_RESULT([$gl_threads_api]) |
@@ -601,7 +621,8 @@ dnl ------------------- | |||
601 | dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the | 621 | dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the |
602 | dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. | 622 | dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. |
603 | dnl The user can still override it at installation time, by using the | 623 | dnl The user can still override it at installation time, by using the |
604 | dnl configure option '--enable-threads'. | 624 | dnl configure option '--enable-threads=posix'. |
625 | dnl As of 2023, this is now the default. | ||
605 | 626 | ||
606 | AC_DEFUN([gl_AVOID_WINPTHREAD], [ | 627 | AC_DEFUN([gl_AVOID_WINPTHREAD], [ |
607 | m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) | 628 | m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) |
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index f6bf3a4f..d2f3c970 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 | |||
@@ -1,12 +1,11 @@ | |||
1 | # Configure a more-standard replacement for <time.h>. | 1 | # time_h.m4 |
2 | 2 | # serial 25 | |
3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | dnl This file is free software; the Free Software Foundation | |
5 | # serial 20 | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | 7 | ||
7 | # This file is free software; the Free Software Foundation | 8 | # Configure a more-standard replacement for <time.h>. |
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | 9 | ||
11 | # Written by Paul Eggert and Jim Meyering. | 10 | # Written by Paul Eggert and Jim Meyering. |
12 | 11 | ||
@@ -23,7 +22,10 @@ AC_DEFUN_ONCE([gl_TIME_H], | |||
23 | dnl corresponding gnulib module is not in use. | 22 | dnl corresponding gnulib module is not in use. |
24 | gl_WARN_ON_USE_PREPARE([[ | 23 | gl_WARN_ON_USE_PREPARE([[ |
25 | #include <time.h> | 24 | #include <time.h> |
26 | ]], [asctime_r ctime_r]) | 25 | ]], [ |
26 | asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime | ||
27 | nanosleep strftime strptime time timegm timespec_get timespec_getres tzset | ||
28 | ]) | ||
27 | 29 | ||
28 | AC_REQUIRE([AC_C_RESTRICT]) | 30 | AC_REQUIRE([AC_C_RESTRICT]) |
29 | 31 | ||
@@ -137,6 +139,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], | |||
137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) | 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) |
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) |
139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) |
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME]) | ||
140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) | 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) |
141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) | 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) |
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) | 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) |
@@ -161,23 +164,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], | |||
161 | HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) | 164 | HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) |
162 | dnl Even GNU libc does not have timezone_t yet. | 165 | dnl Even GNU libc does not have timezone_t yet. |
163 | HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) | 166 | HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) |
164 | dnl If another module says to replace or to not replace, do that. | 167 | REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) |
165 | dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; | ||
166 | dnl this lets maintainers check for portability. | ||
167 | REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) | ||
168 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) | ||
169 | REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) | ||
170 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) | ||
171 | REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) | ||
172 | REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) | ||
173 | REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) | ||
174 | |||
175 | dnl Hack so that the time module doesn't depend on the sys_time module. | ||
176 | dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. | ||
177 | : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) | ||
178 | dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME | ||
179 | dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier | ||
180 | dnl is no longer a big deal. | ||
181 | REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) | 168 | REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) |
182 | REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) | 169 | REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) |
170 | REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) | ||
171 | REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) | ||
172 | REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) | ||
173 | REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) | ||
174 | REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) | ||
175 | REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM]) | ||
176 | REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET]) | ||
177 | REPLACE_TIMESPEC_GETRES=0; AC_SUBST([REPLACE_TIMESPEC_GETRES]) | ||
178 | REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET]) | ||
183 | ]) | 179 | ]) |
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index adce438a..3675390e 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 | |||
@@ -1,10 +1,12 @@ | |||
1 | dnl Reentrant time functions: localtime_r, gmtime_r. | 1 | # time_r.m4 |
2 | 2 | # serial 1 | |
3 | dnl Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl Reentrant time functions: localtime_r, gmtime_r. | ||
9 | |||
8 | dnl Written by Paul Eggert. | 10 | dnl Written by Paul Eggert. |
9 | 11 | ||
10 | AC_DEFUN([gl_TIME_R], | 12 | AC_DEFUN([gl_TIME_R], |
@@ -57,9 +59,7 @@ AC_DEFUN([gl_TIME_R], | |||
57 | [gl_cv_time_r_posix=yes], | 59 | [gl_cv_time_r_posix=yes], |
58 | [gl_cv_time_r_posix=no]) | 60 | [gl_cv_time_r_posix=no]) |
59 | ]) | 61 | ]) |
60 | if test $gl_cv_time_r_posix = yes; then | 62 | if test $gl_cv_time_r_posix != yes; then |
61 | REPLACE_LOCALTIME_R=0 | ||
62 | else | ||
63 | REPLACE_LOCALTIME_R=1 | 63 | REPLACE_LOCALTIME_R=1 |
64 | fi | 64 | fi |
65 | else | 65 | else |
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index 6079f1a3..c1ff2677 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # timegm.m4 serial 13 | 1 | # timegm.m4 |
2 | dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
3 | dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,8 +9,7 @@ AC_DEFUN([gl_FUNC_TIMEGM], | |||
8 | [ | 9 | [ |
9 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) | 11 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
11 | REPLACE_TIMEGM=0 | 12 | gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]]) |
12 | AC_CHECK_FUNCS_ONCE([timegm]) | ||
13 | if test $ac_cv_func_timegm = yes; then | 13 | if test $ac_cv_func_timegm = yes; then |
14 | if test "$gl_cv_func_working_mktime" != yes; then | 14 | if test "$gl_cv_func_working_mktime" != yes; then |
15 | # Assume that timegm is buggy if mktime is. | 15 | # Assume that timegm is buggy if mktime is. |
@@ -17,6 +17,9 @@ AC_DEFUN([gl_FUNC_TIMEGM], | |||
17 | fi | 17 | fi |
18 | else | 18 | else |
19 | HAVE_TIMEGM=0 | 19 | HAVE_TIMEGM=0 |
20 | case "$gl_cv_onwards_func_timegm" in | ||
21 | future*) REPLACE_TIMEGM=1 ;; | ||
22 | esac | ||
20 | fi | 23 | fi |
21 | ]) | 24 | ]) |
22 | 25 | ||
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index 8977a346..42f7ec32 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # ungetc.m4 serial 10 | 1 | # ungetc.m4 |
2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
3 | dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -42,16 +43,16 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], | |||
42 | ]])], | 43 | ]])], |
43 | [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], | 44 | [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], |
44 | [case "$host_os" in | 45 | [case "$host_os" in |
45 | # Guess yes on glibc systems. | 46 | # Guess yes on glibc systems. |
46 | *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; | 47 | *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; |
47 | # Guess yes on musl systems. | 48 | # Guess yes on musl systems. |
48 | *-musl*) gl_cv_func_ungetc_works="guessing yes" ;; | 49 | *-musl* | midipix*) gl_cv_func_ungetc_works="guessing yes" ;; |
49 | # Guess yes on bionic systems. | 50 | # Guess yes on bionic systems. |
50 | *-android*) gl_cv_func_ungetc_works="guessing yes" ;; | 51 | *-android*) gl_cv_func_ungetc_works="guessing yes" ;; |
51 | # Guess yes on native Windows. | 52 | # Guess yes on native Windows. |
52 | mingw*) gl_cv_func_ungetc_works="guessing yes" ;; | 53 | mingw* | windows*) gl_cv_func_ungetc_works="guessing yes" ;; |
53 | # If we don't know, obey --enable-cross-guesses. | 54 | # If we don't know, obey --enable-cross-guesses. |
54 | *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; | 55 | *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; |
55 | esac | 56 | esac |
56 | ]) | 57 | ]) |
57 | ]) | 58 | ]) |
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index f4384027..81d1b9f6 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # unistd_h.m4 serial 90 | 1 | # unistd_h.m4 |
2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 95 |
3 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -225,6 +226,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
225 | REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) | 226 | REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) |
226 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) | 227 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) |
227 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) | 228 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) |
229 | REPLACE_DUP3=0; AC_SUBST([REPLACE_DUP3]) | ||
228 | REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) | 230 | REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) |
229 | REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) | 231 | REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) |
230 | REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) | 232 | REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) |
@@ -233,11 +235,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
233 | REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) | 235 | REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) |
234 | REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) | 236 | REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) |
235 | REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) | 237 | REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) |
238 | REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) | ||
236 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) | 239 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) |
240 | REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC]) | ||
237 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) | 241 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) |
238 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) | 242 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) |
239 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) | 243 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) |
240 | REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) | 244 | REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) |
245 | REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) | ||
241 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) | 246 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) |
242 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) | 247 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) |
243 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) | 248 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) |
@@ -248,12 +253,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
248 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) | 253 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) |
249 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) | 254 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) |
250 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) | 255 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) |
256 | REPLACE_PIPE2=0; AC_SUBST([REPLACE_PIPE2]) | ||
251 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) | 257 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) |
252 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) | 258 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) |
253 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) | 259 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) |
254 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) | 260 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) |
255 | REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) | 261 | REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) |
256 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) | 262 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) |
263 | REPLACE_SETHOSTNAME=0; AC_SUBST([REPLACE_SETHOSTNAME]) | ||
257 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) | 264 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) |
258 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) | 265 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) |
259 | REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) | 266 | REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) |
diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4 index 407c0bac..e96cf5f8 100644 --- a/gl/m4/unlocked-io.m4 +++ b/gl/m4/unlocked-io.m4 | |||
@@ -1,10 +1,9 @@ | |||
1 | # unlocked-io.m4 serial 16 | 1 | # unlocked-io.m4 |
2 | 2 | # serial 16 | |
3 | # Copyright (C) 1998-2006, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. |
4 | # | 4 | dnl This file is free software; the Free Software Foundation |
5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | # with or without modifications, as long as this notice is preserved. | ||
8 | 7 | ||
9 | dnl From Jim Meyering. | 8 | dnl From Jim Meyering. |
10 | dnl | 9 | dnl |
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 index fd6230c2..9211f69d 100644 --- a/gl/m4/vararrays.m4 +++ b/gl/m4/vararrays.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | # Check for variable-length arrays. | 1 | # vararrays.m4 |
2 | |||
3 | # serial 6 | 2 | # serial 6 |
3 | dnl Copyright (C) 2001, 2009-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
4 | 7 | ||
5 | # From Paul Eggert | 8 | # Check for variable-length arrays. |
6 | 9 | ||
7 | # Copyright (C) 2001, 2009-2023 Free Software Foundation, Inc. | 10 | # From Paul Eggert |
8 | # This file is free software; the Free Software Foundation | ||
9 | # gives unlimited permission to copy and/or distribute it, | ||
10 | # with or without modifications, as long as this notice is preserved. | ||
11 | 11 | ||
12 | m4_version_prereq([2.70], [], [ | 12 | m4_version_prereq([2.70], [], [ |
13 | 13 | ||
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 6361c843..1ea2055e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # vasnprintf.m4 serial 38 | 1 | # vasnprintf.m4 |
2 | dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 52 |
3 | dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -29,6 +30,15 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], | |||
29 | gl_PREREQ_ASNPRINTF | 30 | gl_PREREQ_ASNPRINTF |
30 | ]) | 31 | ]) |
31 | 32 | ||
33 | AC_DEFUN([gl_FUNC_VASNWPRINTF], | ||
34 | [ | ||
35 | AC_LIBOBJ([printf-args]) | ||
36 | gl_PREREQ_PRINTF_ARGS | ||
37 | gl_PREREQ_PRINTF_PARSE | ||
38 | gl_PREREQ_VASNWPRINTF | ||
39 | gl_PREREQ_ASNPRINTF | ||
40 | ]) | ||
41 | |||
32 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. | 42 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. |
33 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | 43 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], |
34 | [ | 44 | [ |
@@ -37,6 +47,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | |||
37 | ]) | 47 | ]) |
38 | 48 | ||
39 | # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. | 49 | # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. |
50 | # Prerequisites of lib/wprintf-parse.h, lib/wprintf-parse.c. | ||
40 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | 51 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], |
41 | [ | 52 | [ |
42 | AC_REQUIRE([gl_FEATURES_H]) | 53 | AC_REQUIRE([gl_FEATURES_H]) |
@@ -50,19 +61,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | |||
50 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) | 61 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) |
51 | ]) | 62 | ]) |
52 | 63 | ||
53 | # Prerequisites of lib/vasnprintf.c. | 64 | # Prerequisites of lib/vasnprintf.c if !WIDE_CHAR_VERSION. |
54 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | 65 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], |
55 | [ | 66 | [ |
56 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 67 | AC_CHECK_FUNCS([snprintf strnlen wcrtomb]) |
57 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
58 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
59 | AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) | ||
60 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | 68 | dnl Use the _snprintf function only if it is declared (because on NetBSD it |
61 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | 69 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). |
62 | AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) | 70 | AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) |
63 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | ||
64 | dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. | ||
65 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
66 | dnl We can avoid a lot of code by assuming that snprintf's return value | 71 | dnl We can avoid a lot of code by assuming that snprintf's return value |
67 | dnl conforms to ISO C99. So check that. | 72 | dnl conforms to ISO C99. So check that. |
68 | AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) | 73 | AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) |
@@ -84,6 +89,108 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | |||
84 | terminated.]) | 89 | terminated.]) |
85 | ;; | 90 | ;; |
86 | esac | 91 | esac |
92 | gl_PREREQ_VASNXPRINTF | ||
93 | ]) | ||
94 | |||
95 | # Prerequisites of lib/vasnwprintf.c. | ||
96 | AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF], | ||
97 | [ | ||
98 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
99 | AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc]) | ||
100 | AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]]) | ||
101 | AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]]) | ||
102 | gl_SWPRINTF_WORKS | ||
103 | case "$gl_cv_func_swprintf_works" in | ||
104 | *yes) | ||
105 | AC_DEFINE([HAVE_WORKING_SWPRINTF], [1], | ||
106 | [Define if the swprintf function works correctly when it produces output | ||
107 | that contains null wide characters.]) | ||
108 | ;; | ||
109 | esac | ||
110 | gl_MBRTOWC_C_LOCALE | ||
111 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
112 | *yes) | ||
113 | AC_CACHE_CHECK([whether swprintf in the C locale is free of encoding errors], | ||
114 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ], | ||
115 | [ | ||
116 | AC_RUN_IFELSE( | ||
117 | [AC_LANG_SOURCE([[ | ||
118 | #ifndef __USE_MINGW_ANSI_STDIO | ||
119 | # define __USE_MINGW_ANSI_STDIO 1 | ||
120 | #endif | ||
121 | #include <stdio.h> | ||
122 | #include <wchar.h> | ||
123 | int main() | ||
124 | { | ||
125 | int result = 0; | ||
126 | { /* This test fails on glibc 2.35, musl libc 1.2.4, FreeBSD 13.2, NetBSD 9.3, | ||
127 | OpenBSD 7.2, Cygwin 2.9.0. | ||
128 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/2>. */ | ||
129 | wchar_t buf[12]; | ||
130 | int ret = swprintf (buf, 12, L"%c", '\377'); | ||
131 | if (ret < 0) | ||
132 | result |= 1; | ||
133 | } | ||
134 | return result; | ||
135 | }]])], | ||
136 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=yes], | ||
137 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=no], | ||
138 | [case "$host_os" in | ||
139 | # Guess no on glibc systems. | ||
140 | *-gnu* | gnu*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing yes";; | ||
141 | # Guess no on musl systems. | ||
142 | *-musl* | midipix*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing no";; | ||
143 | # If we don't know, obey --enable-cross-guesses. | ||
144 | *) gl_cv_func_swprintf_C_locale_sans_EILSEQ="$gl_cross_guess_normal";; | ||
145 | esac | ||
146 | ]) | ||
147 | ]) | ||
148 | ;; | ||
149 | esac | ||
150 | if case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
151 | *yes) false ;; | ||
152 | *) true ;; | ||
153 | esac \ | ||
154 | || case "$gl_cv_func_swprintf_C_locale_sans_EILSEQ" in | ||
155 | *yes) false ;; | ||
156 | *) true ;; | ||
157 | esac; then | ||
158 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_C], [1], | ||
159 | [Define if the vasnwprintf implementation needs special code for | ||
160 | the 'c' directive.]) | ||
161 | fi | ||
162 | gl_SWPRINTF_DIRECTIVE_LA | ||
163 | case "$gl_cv_func_swprintf_directive_la" in | ||
164 | *yes) ;; | ||
165 | *) | ||
166 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LA], [1], | ||
167 | [Define if the vasnwprintf implementation needs special code for | ||
168 | the 'a' directive with 'long double' arguments.]) | ||
169 | ;; | ||
170 | esac | ||
171 | gl_SWPRINTF_DIRECTIVE_LC | ||
172 | case "$gl_cv_func_swprintf_directive_lc" in | ||
173 | *yes) ;; | ||
174 | *) | ||
175 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LC], [1], | ||
176 | [Define if the vasnwprintf implementation needs special code for | ||
177 | the 'lc' directive.]) | ||
178 | ;; | ||
179 | esac | ||
180 | gl_MUSL_LIBC | ||
181 | gl_PREREQ_VASNXPRINTF | ||
182 | ]) | ||
183 | |||
184 | # Common prerequisites of lib/vasnprintf.c and lib/vasnwprintf.c. | ||
185 | AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], | ||
186 | [ | ||
187 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
188 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
189 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
190 | AC_CHECK_FUNCS([wcslen]) | ||
191 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | ||
192 | dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. | ||
193 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
87 | ]) | 194 | ]) |
88 | 195 | ||
89 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' | 196 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' |
@@ -152,7 +259,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], | |||
152 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], | 259 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], |
153 | [Define if the vasnprintf implementation needs special code for | 260 | [Define if the vasnprintf implementation needs special code for |
154 | the 'a' and 'A' directives.]) | 261 | the 'a' and 'A' directives.]) |
155 | AC_CHECK_FUNCS([nl_langinfo]) | 262 | gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) |
263 | ;; | ||
264 | esac | ||
265 | ]) | ||
266 | |||
267 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive. | ||
268 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B], | ||
269 | [ | ||
270 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) | ||
271 | case "$gl_cv_func_printf_directive_b" in | ||
272 | *yes) | ||
273 | ;; | ||
274 | *) | ||
275 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1], | ||
276 | [Define if the vasnprintf implementation needs special code for | ||
277 | the 'b' directive.]) | ||
156 | ;; | 278 | ;; |
157 | esac | 279 | esac |
158 | ]) | 280 | ]) |
@@ -187,6 +309,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], | |||
187 | esac | 309 | esac |
188 | ]) | 310 | ]) |
189 | 311 | ||
312 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive. | ||
313 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], | ||
314 | [ | ||
315 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) | ||
316 | case "$gl_cv_func_printf_directive_lc" in | ||
317 | *yes) | ||
318 | ;; | ||
319 | *) | ||
320 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1], | ||
321 | [Define if the vasnprintf implementation needs special code for | ||
322 | the 'lc' directive.]) | ||
323 | ;; | ||
324 | esac | ||
325 | ]) | ||
326 | |||
190 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | 327 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. |
191 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | 328 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], |
192 | [ | 329 | [ |
@@ -232,6 +369,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], | |||
232 | esac | 369 | esac |
233 | ]) | 370 | ]) |
234 | 371 | ||
372 | # Extra prerequisites of lib/vasnprintf.c for supporting the # flag with a | ||
373 | # zero precision and a zero value in the 'x' and 'X' directives. | ||
374 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO], | ||
375 | [ | ||
376 | AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO]) | ||
377 | case "$gl_cv_func_printf_flag_alt_precision_zero" in | ||
378 | *yes) | ||
379 | ;; | ||
380 | *) | ||
381 | AC_DEFINE([NEED_PRINTF_FLAG_ALT_PRECISION_ZERO], [1], | ||
382 | [Define if the vasnprintf implementation needs special code for the | ||
383 | # flag with a zero precision and a zero value in the 'x' and 'X' directives.]) | ||
384 | ;; | ||
385 | esac | ||
386 | ]) | ||
387 | |||
235 | # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. | 388 | # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. |
236 | AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], | 389 | AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], |
237 | [ | 390 | [ |
@@ -276,23 +429,53 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], | |||
276 | ]) | 429 | ]) |
277 | 430 | ||
278 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. | 431 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. |
279 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], | 432 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS], |
280 | [ | 433 | [ |
281 | AC_REQUIRE([gl_PREREQ_VASNPRINTF]) | 434 | AC_REQUIRE([gl_PREREQ_VASNPRINTF]) |
282 | gl_PREREQ_VASNPRINTF_LONG_DOUBLE | 435 | gl_PREREQ_VASNPRINTF_LONG_DOUBLE |
283 | gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE | 436 | gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE |
284 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE | 437 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE |
285 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A | 438 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A |
439 | gl_PREREQ_VASNPRINTF_DIRECTIVE_B | ||
286 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F | 440 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F |
287 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS | 441 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS |
442 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LC | ||
288 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING | 443 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING |
289 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST | 444 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST |
290 | gl_PREREQ_VASNPRINTF_FLAG_ZERO | 445 | gl_PREREQ_VASNPRINTF_FLAG_ZERO |
446 | gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO | ||
291 | gl_PREREQ_VASNPRINTF_PRECISION | 447 | gl_PREREQ_VASNPRINTF_PRECISION |
292 | gl_PREREQ_VASNPRINTF_ENOMEM | 448 | gl_PREREQ_VASNPRINTF_ENOMEM |
293 | ]) | 449 | ]) |
294 | 450 | ||
451 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'B' directive. | ||
452 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B], | ||
453 | [ | ||
454 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B]) | ||
455 | case "$gl_cv_func_printf_directive_uppercase_b" in | ||
456 | *yes) | ||
457 | ;; | ||
458 | *) | ||
459 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_UPPERCASE_B], [1], | ||
460 | [Define if the vasnprintf implementation needs special code for | ||
461 | the 'B' directive.]) | ||
462 | ;; | ||
463 | esac | ||
464 | ]) | ||
465 | |||
466 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance | ||
467 | # and GNU compatibility. | ||
468 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS], | ||
469 | [ | ||
470 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
471 | AC_DEFINE([SUPPORT_GNU_PRINTF_DIRECTIVES], [1], | ||
472 | [Define if the vasnprintf implementation should support GNU compatible | ||
473 | printf directives.]) | ||
474 | gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B | ||
475 | ]) | ||
476 | |||
295 | # Prerequisites of lib/asnprintf.c. | 477 | # Prerequisites of lib/asnprintf.c. |
478 | # Prerequisites of lib/asnwprintf.c. | ||
296 | AC_DEFUN([gl_PREREQ_ASNPRINTF], | 479 | AC_DEFUN([gl_PREREQ_ASNPRINTF], |
297 | [ | 480 | [ |
298 | ]) | 481 | ]) |
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 6e6156a7..73f7b807 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # vasprintf.m4 serial 6 | 1 | # vasprintf.m4 |
2 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 6 |
3 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, | ||
3 | dnl Inc. | 4 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index f0468e89..ecf09686 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # visibility.m4 serial 8 | 1 | # visibility.m4 |
2 | dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
3 | dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -31,18 +32,18 @@ AC_DEFUN([gl_VISIBILITY], | |||
31 | dnl user has put into $CC $CFLAGS $CPPFLAGS. | 32 | dnl user has put into $CC $CFLAGS $CPPFLAGS. |
32 | AC_CACHE_CHECK([whether the -Werror option is usable], | 33 | AC_CACHE_CHECK([whether the -Werror option is usable], |
33 | [gl_cv_cc_vis_werror], | 34 | [gl_cv_cc_vis_werror], |
34 | [gl_save_CFLAGS="$CFLAGS" | 35 | [gl_saved_CFLAGS="$CFLAGS" |
35 | CFLAGS="$CFLAGS -Werror" | 36 | CFLAGS="$CFLAGS -Werror" |
36 | AC_COMPILE_IFELSE( | 37 | AC_COMPILE_IFELSE( |
37 | [AC_LANG_PROGRAM([[]], [[]])], | 38 | [AC_LANG_PROGRAM([[]], [[]])], |
38 | [gl_cv_cc_vis_werror=yes], | 39 | [gl_cv_cc_vis_werror=yes], |
39 | [gl_cv_cc_vis_werror=no]) | 40 | [gl_cv_cc_vis_werror=no]) |
40 | CFLAGS="$gl_save_CFLAGS" | 41 | CFLAGS="$gl_saved_CFLAGS" |
41 | ]) | 42 | ]) |
42 | dnl Now check whether visibility declarations are supported. | 43 | dnl Now check whether visibility declarations are supported. |
43 | AC_CACHE_CHECK([for simple visibility declarations], | 44 | AC_CACHE_CHECK([for simple visibility declarations], |
44 | [gl_cv_cc_visibility], | 45 | [gl_cv_cc_visibility], |
45 | [gl_save_CFLAGS="$CFLAGS" | 46 | [gl_saved_CFLAGS="$CFLAGS" |
46 | CFLAGS="$CFLAGS -fvisibility=hidden" | 47 | CFLAGS="$CFLAGS -fvisibility=hidden" |
47 | dnl We use the option -Werror and a function dummyfunc, because on some | 48 | dnl We use the option -Werror and a function dummyfunc, because on some |
48 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning | 49 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning |
@@ -68,7 +69,7 @@ AC_DEFUN([gl_VISIBILITY], | |||
68 | [[]])], | 69 | [[]])], |
69 | [gl_cv_cc_visibility=yes], | 70 | [gl_cv_cc_visibility=yes], |
70 | [gl_cv_cc_visibility=no]) | 71 | [gl_cv_cc_visibility=no]) |
71 | CFLAGS="$gl_save_CFLAGS" | 72 | CFLAGS="$gl_saved_CFLAGS" |
72 | ]) | 73 | ]) |
73 | if test $gl_cv_cc_visibility = yes; then | 74 | if test $gl_cv_cc_visibility = yes; then |
74 | CFLAG_VISIBILITY="-fvisibility=hidden" | 75 | CFLAG_VISIBILITY="-fvisibility=hidden" |
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 7fbb11c4..9f321f3f 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # vsnprintf.m4 serial 7 | 1 | # vsnprintf.m4 |
2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
3 | dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index 10649c5c..6c8c76b8 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # warn-on-use.m4 serial 10 | 1 | # warn-on-use.m4 |
2 | dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
3 | dnl Copyright (C) 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -36,7 +37,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], | |||
36 | dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead | 37 | dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead |
37 | dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC | 38 | dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC |
38 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. | 39 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. |
39 | ac_save_ac_compile="$ac_compile" | 40 | ac_saved_ac_compile="$ac_compile" |
40 | if test -n "$ac_compile_for_check_decl"; then | 41 | if test -n "$ac_compile_for_check_decl"; then |
41 | ac_compile="$ac_compile_for_check_decl" | 42 | ac_compile="$ac_compile_for_check_decl" |
42 | fi | 43 | fi |
@@ -46,7 +47,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], | |||
46 | [[#undef $gl_func | 47 | [[#undef $gl_func |
47 | (void) $gl_func;]])], | 48 | (void) $gl_func;]])], |
48 | [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) | 49 | [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) |
49 | ac_compile="$ac_save_ac_compile" | 50 | ac_compile="$ac_saved_ac_compile" |
50 | AS_VAR_IF([gl_Symbol], [yes], | 51 | AS_VAR_IF([gl_Symbol], [yes], |
51 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) | 52 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) |
52 | dnl Shortcut for an AC_CHECK_DECL invocation that may come later: | 53 | dnl Shortcut for an AC_CHECK_DECL invocation that may come later: |
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index 8ec66193..995bdc65 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. | 1 | # wchar_h.m4 |
2 | 2 | # serial 64 | |
3 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl Written by Eric Blake. | 8 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. |
9 | 9 | ||
10 | # wchar_h.m4 serial 55 | 10 | dnl Written by Eric Blake. |
11 | 11 | ||
12 | AC_DEFUN_ONCE([gl_WCHAR_H], | 12 | AC_DEFUN_ONCE([gl_WCHAR_H], |
13 | [ | 13 | [ |
@@ -86,8 +86,8 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
86 | dnl z/OS when using the XPLINK object format (due to duplicate | 86 | dnl z/OS when using the XPLINK object format (due to duplicate |
87 | dnl CSECT names). Instead, temporarily redefine $ac_compile so | 87 | dnl CSECT names). Instead, temporarily redefine $ac_compile so |
88 | dnl that the object file has the latter name from the start. | 88 | dnl that the object file has the latter name from the start. |
89 | save_ac_compile="$ac_compile" | 89 | saved_ac_compile="$ac_compile" |
90 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` | 90 | ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest1/` |
91 | if echo '#include "conftest.c"' >conftest1.c \ | 91 | if echo '#include "conftest.c"' >conftest1.c \ |
92 | && AC_TRY_EVAL([ac_compile]); then | 92 | && AC_TRY_EVAL([ac_compile]); then |
93 | AC_LANG_CONFTEST([ | 93 | AC_LANG_CONFTEST([ |
@@ -97,7 +97,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
97 | int zero (void) { return 0; } | 97 | int zero (void) { return 0; } |
98 | ]])]) | 98 | ]])]) |
99 | dnl See note above about renaming object files. | 99 | dnl See note above about renaming object files. |
100 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` | 100 | ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest2/` |
101 | if echo '#include "conftest.c"' >conftest2.c \ | 101 | if echo '#include "conftest.c"' >conftest2.c \ |
102 | && AC_TRY_EVAL([ac_compile]); then | 102 | && AC_TRY_EVAL([ac_compile]); then |
103 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then | 103 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then |
@@ -107,7 +107,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
107 | fi | 107 | fi |
108 | fi | 108 | fi |
109 | fi | 109 | fi |
110 | ac_compile="$save_ac_compile" | 110 | ac_compile="$saved_ac_compile" |
111 | rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext | 111 | rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext |
112 | ;; | 112 | ;; |
113 | esac | 113 | esac |
@@ -147,6 +147,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], | |||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) | 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) |
148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) |
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) | 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) |
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSZERO]) | ||
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) | 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) |
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) | 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) |
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) | 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) |
@@ -185,6 +186,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], | |||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) | 186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) |
186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) | 187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) |
187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) | 188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) |
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WGETCWD]) | ||
188 | dnl Support Microsoft deprecated alias function names by default. | 190 | dnl Support Microsoft deprecated alias function names by default. |
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) | 191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) |
190 | ]) | 192 | ]) |
@@ -253,5 +255,10 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
253 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) | 255 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) |
254 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) | 256 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) |
255 | REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) | 257 | REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) |
258 | REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) | ||
259 | REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) | ||
260 | REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) | ||
256 | REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) | 261 | REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) |
262 | REPLACE_WMEMCMP=0; AC_SUBST([REPLACE_WMEMCMP]) | ||
263 | REPLACE_WMEMPCPY=0; AC_SUBST([REPLACE_WMEMPCPY]) | ||
257 | ]) | 264 | ]) |
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index 50bde08a..968832cb 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # wchar_t.m4 serial 4 (gettext-0.18.2) | 1 | # wchar_t.m4 |
2 | dnl Copyright (C) 2002-2003, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 4 (gettext-0.18.2) |
3 | dnl Copyright (C) 2002-2003, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index d51b36e1..35dff6f0 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # wcrtomb.m4 serial 17 | 1 | # wcrtomb.m4 |
2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 19 |
3 | dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -82,9 +83,11 @@ int main () | |||
82 | changequote(,)dnl | 83 | changequote(,)dnl |
83 | case "$host_os" in | 84 | case "$host_os" in |
84 | # Guess no on AIX 4, OSF/1, Solaris, native Windows. | 85 | # Guess no on AIX 4, OSF/1, Solaris, native Windows. |
85 | aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; | 86 | aix4* | osf* | solaris* | mingw* | windows*) |
87 | gl_cv_func_wcrtomb_retval="guessing no" ;; | ||
86 | # Guess yes otherwise. | 88 | # Guess yes otherwise. |
87 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; | 89 | *) |
90 | gl_cv_func_wcrtomb_retval="guessing yes" ;; | ||
88 | esac | 91 | esac |
89 | changequote([,])dnl | 92 | changequote([,])dnl |
90 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | 93 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then |
@@ -97,12 +100,14 @@ changequote([,])dnl | |||
97 | int main () | 100 | int main () |
98 | { | 101 | { |
99 | int result = 0; | 102 | int result = 0; |
100 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) | 103 | if (strcmp ("$LOCALE_FR", "none") != 0 |
104 | && setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
101 | { | 105 | { |
102 | if (wcrtomb (NULL, 0, NULL) != 1) | 106 | if (wcrtomb (NULL, 0, NULL) != 1) |
103 | result |= 1; | 107 | result |= 1; |
104 | } | 108 | } |
105 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 109 | if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 |
110 | && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
106 | { | 111 | { |
107 | if (wcrtomb (NULL, 0, NULL) != 1) | 112 | if (wcrtomb (NULL, 0, NULL) != 1) |
108 | result |= 2; | 113 | result |= 2; |
@@ -113,12 +118,14 @@ int main () | |||
113 | result |= 2; | 118 | result |= 2; |
114 | } | 119 | } |
115 | } | 120 | } |
116 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 121 | if (strcmp ("$LOCALE_JA", "none") != 0 |
122 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
117 | { | 123 | { |
118 | if (wcrtomb (NULL, 0, NULL) != 1) | 124 | if (wcrtomb (NULL, 0, NULL) != 1) |
119 | result |= 4; | 125 | result |= 4; |
120 | } | 126 | } |
121 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | 127 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 |
128 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
122 | { | 129 | { |
123 | if (wcrtomb (NULL, 0, NULL) != 1) | 130 | if (wcrtomb (NULL, 0, NULL) != 1) |
124 | result |= 8; | 131 | result |= 8; |
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4 new file mode 100644 index 00000000..e5d70740 --- /dev/null +++ b/gl/m4/wctype.m4 | |||
@@ -0,0 +1,52 @@ | |||
1 | # wctype.m4 | ||
2 | # serial 6 | ||
3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | AC_DEFUN_ONCE([gl_FUNC_WCTYPE], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
11 | AC_REQUIRE([gl_WCTYPE_H]) | ||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | HAVE_WCTYPE=$HAVE_WCTYPE_T | ||
14 | if test $HAVE_WCTYPE = 1; then | ||
15 | AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes], | ||
16 | [gl_cv_func_wctype_works], | ||
17 | [AC_RUN_IFELSE( | ||
18 | [AC_LANG_SOURCE([[ | ||
19 | #include <ctype.h> | ||
20 | #include <wchar.h> | ||
21 | #include <wctype.h> | ||
22 | int main () | ||
23 | { | ||
24 | /* This test fails on mingw. */ | ||
25 | if (wctype ("blank") == (wctype_t)0) | ||
26 | return 1; | ||
27 | /* This test fails on MSVC 14. */ | ||
28 | if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t'))) | ||
29 | return 2; | ||
30 | /* This test fails on Android 11. */ | ||
31 | if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`'))) | ||
32 | return 4; | ||
33 | return 0; | ||
34 | } | ||
35 | ]])], | ||
36 | [gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no], | ||
37 | [case "$host_os" in | ||
38 | # Guess no on native Windows. | ||
39 | mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;; | ||
40 | # Guess no on Android. | ||
41 | android*) gl_cv_func_wctype_works="guessing no" ;; | ||
42 | # Guess yes otherwise. | ||
43 | *) gl_cv_func_wctype_works="guessing yes" ;; | ||
44 | esac | ||
45 | ]) | ||
46 | ]) | ||
47 | case "$gl_cv_func_wctype_works" in | ||
48 | *yes) ;; | ||
49 | *) REPLACE_WCTYPE=1 ;; | ||
50 | esac | ||
51 | fi | ||
52 | ]) | ||
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index 6856a735..a3b07c2a 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 | |||
@@ -1,8 +1,9 @@ | |||
1 | # wctype_h.m4 serial 30 | 1 | # wctype_h.m4 |
2 | # serial 33 | ||
2 | 3 | ||
3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. | 4 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. |
4 | 5 | ||
5 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 6 | dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. |
6 | dnl This file is free software; the Free Software Foundation | 7 | dnl This file is free software; the Free Software Foundation |
7 | dnl gives unlimited permission to copy and/or distribute it, | 8 | dnl gives unlimited permission to copy and/or distribute it, |
8 | dnl with or without modifications, as long as this notice is preserved. | 9 | dnl with or without modifications, as long as this notice is preserved. |
@@ -178,6 +179,7 @@ AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], | |||
178 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ | 179 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ |
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) | 180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) |
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) |
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWPUNCT]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) | 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) |
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) | 184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) |
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) | 185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) |
@@ -196,5 +198,8 @@ AC_DEFUN([gl_WCTYPE_H_DEFAULTS], | |||
196 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) | 198 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) |
197 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) | 199 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) |
198 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) | 200 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) |
201 | REPLACE_ISWPUNCT=0; AC_SUBST([REPLACE_ISWPUNCT]) | ||
199 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) | 202 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) |
203 | REPLACE_WCTRANS=0; AC_SUBST([REPLACE_WCTRANS]) | ||
204 | REPLACE_WCTYPE=0; AC_SUBST([REPLACE_WCTYPE]) | ||
200 | ]) | 205 | ]) |
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index dfd743b3..883fac28 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # wint_t.m4 serial 11 | 1 | # wint_t.m4 |
2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
3 | dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index fc56f59a..d44d0f08 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # xalloc.m4 serial 18 | 1 | # xalloc.m4 |
2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
3 | dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index 649db9c5..e5784973 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # xsize.m4 serial 5 | 1 | # xsize.m4 |
2 | dnl Copyright (C) 2003-2004, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
3 | dnl Copyright (C) 2003-2004, 2008-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4 index 362102b6..710fba4e 100644 --- a/gl/m4/zzgnulib.m4 +++ b/gl/m4/zzgnulib.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # zzgnulib.m4 serial 1 | 1 | # zzgnulib.m4 |
2 | dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
3 | dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/malloc.c b/gl/malloc.c index 3ade35cb..2a7867a1 100644 --- a/gl/malloc.c +++ b/gl/malloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* malloc() function that is glibc compatible. | 1 | /* malloc() function that is glibc compatible. |
2 | 2 | ||
3 | Copyright (C) 1997-1998, 2006-2007, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1997-1998, 2006-2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/malloc/dynarray-skeleton.c b/gl/malloc/dynarray-skeleton.c index 580c278b..a95241ab 100644 --- a/gl/malloc/dynarray-skeleton.c +++ b/gl/malloc/dynarray-skeleton.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Type-safe arrays which grow dynamically. | 1 | /* Type-safe arrays which grow dynamically. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/malloc/dynarray.h b/gl/malloc/dynarray.h index a9a3b085..3163e278 100644 --- a/gl/malloc/dynarray.h +++ b/gl/malloc/dynarray.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Type-safe arrays which grow dynamically. Shared definitions. | 1 | /* Type-safe arrays which grow dynamically. Shared definitions. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/malloc/dynarray_at_failure.c b/gl/malloc/dynarray_at_failure.c index ebc93109..95e34e7a 100644 --- a/gl/malloc/dynarray_at_failure.c +++ b/gl/malloc/dynarray_at_failure.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Report an dynamic array index out of bounds condition. | 1 | /* Report an dynamic array index out of bounds condition. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/malloc/dynarray_emplace_enlarge.c b/gl/malloc/dynarray_emplace_enlarge.c index 7da53931..7bdba159 100644 --- a/gl/malloc/dynarray_emplace_enlarge.c +++ b/gl/malloc/dynarray_emplace_enlarge.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Increase the size of a dynamic array in preparation of an emplace operation. | 1 | /* Increase the size of a dynamic array in preparation of an emplace operation. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <dynarray.h> | 23 | #include <dynarray.h> |
24 | #include <errno.h> | 24 | #include <errno.h> |
25 | #include <intprops.h> | 25 | #include <stdckdint.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | 28 | ||
@@ -56,7 +56,7 @@ __libc_dynarray_emplace_enlarge (struct dynarray_header *list, | |||
56 | } | 56 | } |
57 | 57 | ||
58 | size_t new_size; | 58 | size_t new_size; |
59 | if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size)) | 59 | if (ckd_mul (&new_size, new_allocated, element_size)) |
60 | return false; | 60 | return false; |
61 | void *new_array; | 61 | void *new_array; |
62 | if (list->array == scratch) | 62 | if (list->array == scratch) |
diff --git a/gl/malloc/dynarray_finalize.c b/gl/malloc/dynarray_finalize.c index 673595a5..52764f73 100644 --- a/gl/malloc/dynarray_finalize.c +++ b/gl/malloc/dynarray_finalize.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Copy the dynamically-allocated area to an explicitly-sized heap allocation. | 1 | /* Copy the dynamically-allocated area to an explicitly-sized heap allocation. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/malloc/dynarray_resize.c b/gl/malloc/dynarray_resize.c index 7ecd4de6..7323f8ee 100644 --- a/gl/malloc/dynarray_resize.c +++ b/gl/malloc/dynarray_resize.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Increase the size of a dynamic array. | 1 | /* Increase the size of a dynamic array. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <dynarray.h> | 23 | #include <dynarray.h> |
24 | #include <errno.h> | 24 | #include <errno.h> |
25 | #include <intprops.h> | 25 | #include <stdckdint.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | 28 | ||
@@ -42,7 +42,7 @@ __libc_dynarray_resize (struct dynarray_header *list, size_t size, | |||
42 | over-allocation here. */ | 42 | over-allocation here. */ |
43 | 43 | ||
44 | size_t new_size_bytes; | 44 | size_t new_size_bytes; |
45 | if (INT_MULTIPLY_WRAPV (size, element_size, &new_size_bytes)) | 45 | if (ckd_mul (&new_size_bytes, size, element_size)) |
46 | { | 46 | { |
47 | /* Overflow. */ | 47 | /* Overflow. */ |
48 | __set_errno (ENOMEM); | 48 | __set_errno (ENOMEM); |
diff --git a/gl/malloc/dynarray_resize_clear.c b/gl/malloc/dynarray_resize_clear.c index bb23c522..aa17f740 100644 --- a/gl/malloc/dynarray_resize_clear.c +++ b/gl/malloc/dynarray_resize_clear.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Increase the size of a dynamic array and clear the new part. | 1 | /* Increase the size of a dynamic array and clear the new part. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 5 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/malloca.c b/gl/malloca.c index f055b1e5..e75c72df 100644 --- a/gl/malloca.c +++ b/gl/malloca.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Safe automatic memory allocation. | 1 | /* Safe automatic memory allocation. |
2 | Copyright (C) 2003, 2006-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2006-2007, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2003, 2018. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2003, 2018. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -22,6 +22,9 @@ | |||
22 | #include "malloca.h" | 22 | #include "malloca.h" |
23 | 23 | ||
24 | #include <stdckdint.h> | 24 | #include <stdckdint.h> |
25 | #if defined __CHERI_PURE_CAPABILITY__ | ||
26 | # include <cheri.h> | ||
27 | #endif | ||
25 | 28 | ||
26 | #include "idx.h" | 29 | #include "idx.h" |
27 | 30 | ||
@@ -36,10 +39,15 @@ | |||
36 | allocation. | 39 | allocation. |
37 | - NULL comes from a failed heap allocation. */ | 40 | - NULL comes from a failed heap allocation. */ |
38 | 41 | ||
42 | #if defined __CHERI_PURE_CAPABILITY__ | ||
43 | /* Type for holding the original malloc() result. */ | ||
44 | typedef uintptr_t small_t; | ||
45 | #else | ||
39 | /* Type for holding very small pointer differences. */ | 46 | /* Type for holding very small pointer differences. */ |
40 | typedef unsigned char small_t; | 47 | typedef unsigned char small_t; |
41 | /* Verify that it is wide enough. */ | 48 | /* Verify that it is wide enough. */ |
42 | static_assert (2 * sa_alignment_max - 1 <= (small_t) -1); | 49 | static_assert (2 * sa_alignment_max - 1 <= (small_t) -1); |
50 | #endif | ||
43 | 51 | ||
44 | void * | 52 | void * |
45 | mmalloca (size_t n) | 53 | mmalloca (size_t n) |
@@ -56,20 +64,28 @@ mmalloca (size_t n) | |||
56 | 64 | ||
57 | if (mem != NULL) | 65 | if (mem != NULL) |
58 | { | 66 | { |
59 | uintptr_t umem = (uintptr_t)mem, umemplus; | 67 | uintptr_t umem = (uintptr_t) mem; |
60 | /* The ckd_add avoids signed integer overflow on | 68 | /* The ckd_add avoids signed integer overflow on |
61 | theoretical platforms where UINTPTR_MAX <= INT_MAX. */ | 69 | theoretical platforms where UINTPTR_MAX <= INT_MAX. */ |
70 | uintptr_t umemplus; | ||
62 | ckd_add (&umemplus, umem, sizeof (small_t) + sa_alignment_max - 1); | 71 | ckd_add (&umemplus, umem, sizeof (small_t) + sa_alignment_max - 1); |
63 | idx_t offset = ((umemplus & ~alignment2_mask) | 72 | idx_t offset = (umemplus - umemplus % (2 * sa_alignment_max) |
64 | + sa_alignment_max - umem); | 73 | + sa_alignment_max - umem); |
65 | void *vp = mem + offset; | 74 | void *p = mem + offset; |
66 | small_t *p = vp; | ||
67 | /* Here p >= mem + sizeof (small_t), | 75 | /* Here p >= mem + sizeof (small_t), |
68 | and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 | 76 | and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 |
69 | hence p + n <= mem + nplus. | 77 | hence p + n <= mem + nplus. |
70 | So, the memory range [p, p+n) lies in the allocated memory range | 78 | So, the memory range [p, p+n) lies in the allocated memory range |
71 | [mem, mem + nplus). */ | 79 | [mem, mem + nplus). */ |
72 | p[-1] = offset; | 80 | small_t *sp = p; |
81 | # if defined __CHERI_PURE_CAPABILITY__ | ||
82 | sp[-1] = umem; | ||
83 | p = (char *) cheri_bounds_set ((char *) p - sizeof (small_t), | ||
84 | sizeof (small_t) + n) | ||
85 | + sizeof (small_t); | ||
86 | # else | ||
87 | sp[-1] = offset; | ||
88 | # endif | ||
73 | /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ | 89 | /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ |
74 | return p; | 90 | return p; |
75 | } | 91 | } |
@@ -90,15 +106,22 @@ void | |||
90 | freea (void *p) | 106 | freea (void *p) |
91 | { | 107 | { |
92 | /* Check argument. */ | 108 | /* Check argument. */ |
93 | if ((uintptr_t) p & (sa_alignment_max - 1)) | 109 | uintptr_t u = (uintptr_t) p; |
110 | if (u & (sa_alignment_max - 1)) | ||
94 | { | 111 | { |
95 | /* p was not the result of a malloca() call. Invalid argument. */ | 112 | /* p was not the result of a malloca() call. Invalid argument. */ |
96 | abort (); | 113 | abort (); |
97 | } | 114 | } |
98 | /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ | 115 | /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ |
99 | if ((uintptr_t) p & sa_alignment_max) | 116 | if (u & sa_alignment_max) |
100 | { | 117 | { |
101 | void *mem = (char *) p - ((small_t *) p)[-1]; | 118 | char *cp = p; |
119 | small_t *sp = p; | ||
120 | # if defined __CHERI_PURE_CAPABILITY__ | ||
121 | void *mem = sp[-1]; | ||
122 | # else | ||
123 | void *mem = cp - sp[-1]; | ||
124 | # endif | ||
102 | free (mem); | 125 | free (mem); |
103 | } | 126 | } |
104 | } | 127 | } |
diff --git a/gl/malloca.h b/gl/malloca.h index 325c7277..c5208421 100644 --- a/gl/malloca.h +++ b/gl/malloca.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Safe automatic memory allocation. | 1 | /* Safe automatic memory allocation. |
2 | Copyright (C) 2003-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2003. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2003. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -18,10 +18,19 @@ | |||
18 | #ifndef _MALLOCA_H | 18 | #ifndef _MALLOCA_H |
19 | #define _MALLOCA_H | 19 | #define _MALLOCA_H |
20 | 20 | ||
21 | /* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_DEALLOC, | ||
22 | _GL_ATTRIBUTE_MALLOC, HAVE_ALLOCA. */ | ||
23 | #if !_GL_CONFIG_H_INCLUDED | ||
24 | #error "Please include config.h first." | ||
25 | #endif | ||
26 | |||
21 | #include <alloca.h> | 27 | #include <alloca.h> |
22 | #include <stddef.h> | 28 | #include <stddef.h> |
23 | #include <stdlib.h> | 29 | #include <stdlib.h> |
24 | #include <stdint.h> | 30 | #include <stdint.h> |
31 | #if defined __CHERI_PURE_CAPABILITY__ | ||
32 | # include <cheri.h> | ||
33 | #endif | ||
25 | 34 | ||
26 | #include "xalloc-oversized.h" | 35 | #include "xalloc-oversized.h" |
27 | 36 | ||
@@ -62,12 +71,24 @@ extern void freea (void *p); | |||
62 | memory allocated on the stack, that must be freed using freea() before | 71 | memory allocated on the stack, that must be freed using freea() before |
63 | the function returns. Upon failure, it returns NULL. */ | 72 | the function returns. Upon failure, it returns NULL. */ |
64 | #if HAVE_ALLOCA | 73 | #if HAVE_ALLOCA |
65 | # define malloca(N) \ | 74 | # if defined __CHERI_PURE_CAPABILITY__ |
66 | ((N) < 4032 - (2 * sa_alignment_max - 1) \ | 75 | # define malloca(N) \ |
67 | ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ | 76 | ((N) < 4032 - (2 * sa_alignment_max - 1) \ |
68 | + (2 * sa_alignment_max - 1)) \ | 77 | ? cheri_bounds_set ((void *) (((uintptr_t) \ |
69 | & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ | 78 | (char *) \ |
70 | : mmalloca (N)) | 79 | alloca ((N) + 2 * sa_alignment_max - 1) \ |
80 | + (2 * sa_alignment_max - 1)) \ | ||
81 | & ~(uintptr_t)(2 * sa_alignment_max - 1)), \ | ||
82 | (N)) \ | ||
83 | : mmalloca (N)) | ||
84 | # else | ||
85 | # define malloca(N) \ | ||
86 | ((N) < 4032 - (2 * sa_alignment_max - 1) \ | ||
87 | ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ | ||
88 | + (2 * sa_alignment_max - 1)) \ | ||
89 | & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ | ||
90 | : mmalloca (N)) | ||
91 | # endif | ||
71 | #else | 92 | #else |
72 | # define malloca(N) \ | 93 | # define malloca(N) \ |
73 | mmalloca (N) | 94 | mmalloca (N) |
@@ -1,6 +1,6 @@ | |||
1 | /* Inline functions for <math.h>. | 1 | /* Inline functions for <math.h>. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,5 +18,5 @@ | |||
18 | #include <config.h> | 18 | #include <config.h> |
19 | 19 | ||
20 | #define _GL_MATH_INLINE _GL_EXTERN_INLINE | 20 | #define _GL_MATH_INLINE _GL_EXTERN_INLINE |
21 | #include "math.h" | 21 | #include <math.h> |
22 | typedef int dummy; | 22 | typedef int dummy; |
diff --git a/gl/math.in.h b/gl/math.in.h index f3d58afc..96d0da44 100644 --- a/gl/math.in.h +++ b/gl/math.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <math.h>. | 1 | /* A GNU-like <math.h>. |
2 | 2 | ||
3 | Copyright (C) 2002-2003, 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -15,6 +15,11 @@ | |||
15 | You should have received a copy of the GNU Lesser General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | /* On Android, in C++ mode, when /usr/include/c++/v1/math.h is being included | ||
19 | and /usr/include/math.h has not yet been included, skip this file, since it | ||
20 | would lead to many syntax errors. */ | ||
21 | #if !(defined __ANDROID__ && defined _LIBCPP_MATH_H && !defined INFINITY) | ||
22 | |||
18 | #ifndef _@GUARD_PREFIX@_MATH_H | 23 | #ifndef _@GUARD_PREFIX@_MATH_H |
19 | 24 | ||
20 | #if __GNUC__ >= 3 | 25 | #if __GNUC__ >= 3 |
@@ -43,14 +48,17 @@ | |||
43 | #ifndef _@GUARD_PREFIX@_MATH_H | 48 | #ifndef _@GUARD_PREFIX@_MATH_H |
44 | #define _@GUARD_PREFIX@_MATH_H | 49 | #define _@GUARD_PREFIX@_MATH_H |
45 | 50 | ||
51 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST, | ||
52 | GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
53 | #if !_GL_CONFIG_H_INCLUDED | ||
54 | #error "Please include config.h first." | ||
55 | #endif | ||
56 | |||
46 | /* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */ | 57 | /* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */ |
47 | #if defined __VMS && ! defined NAN | 58 | #if defined __VMS && ! defined NAN |
48 | # include <fp.h> | 59 | # include <fp.h> |
49 | #endif | 60 | #endif |
50 | 61 | ||
51 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
52 | #error "Please include config.h first." | ||
53 | #endif | ||
54 | _GL_INLINE_HEADER_BEGIN | 62 | _GL_INLINE_HEADER_BEGIN |
55 | #ifndef _GL_MATH_INLINE | 63 | #ifndef _GL_MATH_INLINE |
56 | # define _GL_MATH_INLINE _GL_INLINE | 64 | # define _GL_MATH_INLINE _GL_INLINE |
@@ -1427,6 +1435,29 @@ _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - " | |||
1427 | #endif | 1435 | #endif |
1428 | 1436 | ||
1429 | /* Return x * 2^exp. */ | 1437 | /* Return x * 2^exp. */ |
1438 | #if @GNULIB_LDEXP@ | ||
1439 | # if @REPLACE_LDEXP@ | ||
1440 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1441 | # undef ldexp | ||
1442 | # define ldexp rpl_ldexp | ||
1443 | # endif | ||
1444 | _GL_FUNCDECL_RPL (ldexp, double, (double x, int exp)); | ||
1445 | _GL_CXXALIAS_RPL (ldexp, double, (double x, int exp)); | ||
1446 | # else | ||
1447 | /* Assume ldexp is always declared. */ | ||
1448 | _GL_CXXALIAS_SYS (ldexp, double, (double x, int exp)); | ||
1449 | # endif | ||
1450 | # if __GLIBC__ >= 2 | ||
1451 | _GL_CXXALIASWARN1 (ldexp, double, (double x, int exp)); | ||
1452 | # endif | ||
1453 | #elif defined GNULIB_POSIXCHECK | ||
1454 | # undef ldexp | ||
1455 | /* Assume ldexp is always declared. */ | ||
1456 | _GL_WARN_ON_USE (ldexp, "ldexp is unportable - " | ||
1457 | "use gnulib module ldexp for portability"); | ||
1458 | #endif | ||
1459 | |||
1460 | /* Return x * 2^exp. */ | ||
1430 | #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ | 1461 | #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ |
1431 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1462 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1432 | # undef ldexpl | 1463 | # undef ldexpl |
@@ -1691,7 +1722,9 @@ _GL_FUNCDECL_SYS (log2f, float, (float x)); | |||
1691 | # endif | 1722 | # endif |
1692 | _GL_CXXALIAS_SYS (log2f, float, (float x)); | 1723 | _GL_CXXALIAS_SYS (log2f, float, (float x)); |
1693 | # endif | 1724 | # endif |
1725 | # if __GLIBC__ >= 2 | ||
1694 | _GL_CXXALIASWARN (log2f); | 1726 | _GL_CXXALIASWARN (log2f); |
1727 | # endif | ||
1695 | #elif defined GNULIB_POSIXCHECK | 1728 | #elif defined GNULIB_POSIXCHECK |
1696 | # undef log2f | 1729 | # undef log2f |
1697 | # if HAVE_RAW_DECL_LOG2F | 1730 | # if HAVE_RAW_DECL_LOG2F |
@@ -2512,16 +2545,22 @@ _GL_WARN_REAL_FLOATING_DECL (isinf); | |||
2512 | #if @GNULIB_ISNANF@ | 2545 | #if @GNULIB_ISNANF@ |
2513 | /* Test for NaN for 'float' numbers. */ | 2546 | /* Test for NaN for 'float' numbers. */ |
2514 | # if @HAVE_ISNANF@ | 2547 | # if @HAVE_ISNANF@ |
2548 | # if defined __sun || defined __sgi | ||
2549 | /* Solaris and IRIX have isnanf() and declare it in <ieeefp.h>. We cannot | ||
2550 | define isnanf as a macro, because that would conflict with <ieeefp.h>. */ | ||
2551 | _GL_EXTERN_C int isnanf (float x); | ||
2552 | # else | ||
2515 | /* The original <math.h> included above provides a declaration of isnan macro | 2553 | /* The original <math.h> included above provides a declaration of isnan macro |
2516 | or (older) isnanf function. */ | 2554 | or (older) isnanf function. */ |
2517 | # if (__GNUC__ >= 4) || (__clang_major__ >= 4) | 2555 | # if (__GNUC__ >= 4) || (__clang_major__ >= 4) |
2518 | /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. | 2556 | /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. |
2519 | GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */ | 2557 | GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */ |
2520 | # undef isnanf | 2558 | # undef isnanf |
2521 | # define isnanf(x) __builtin_isnan ((float)(x)) | 2559 | # define isnanf(x) __builtin_isnan ((float)(x)) |
2522 | # elif defined isnan | 2560 | # elif defined isnan |
2523 | # undef isnanf | 2561 | # undef isnanf |
2524 | # define isnanf(x) isnan ((float)(x)) | 2562 | # define isnanf(x) isnan ((float)(x)) |
2563 | # endif | ||
2525 | # endif | 2564 | # endif |
2526 | # else | 2565 | # else |
2527 | /* Test whether X is a NaN. */ | 2566 | /* Test whether X is a NaN. */ |
@@ -2536,15 +2575,21 @@ _GL_EXTERN_C int isnanf (float x); | |||
2536 | This function is a gnulib extension, unlike isnan() which applied only | 2575 | This function is a gnulib extension, unlike isnan() which applied only |
2537 | to 'double' numbers earlier but now is a type-generic macro. */ | 2576 | to 'double' numbers earlier but now is a type-generic macro. */ |
2538 | # if @HAVE_ISNAND@ | 2577 | # if @HAVE_ISNAND@ |
2578 | # if defined __sun || defined __sgi | ||
2579 | /* Solaris and IRIX have isnand() and declare it in <ieeefp.h>. We cannot | ||
2580 | define isnand as a macro, because that would conflict with <ieeefp.h>. */ | ||
2581 | _GL_EXTERN_C int isnand (double x); | ||
2582 | # else | ||
2539 | /* The original <math.h> included above provides a declaration of isnan | 2583 | /* The original <math.h> included above provides a declaration of isnan |
2540 | macro. */ | 2584 | macro. */ |
2541 | # if (__GNUC__ >= 4) || (__clang_major__ >= 4) | 2585 | # if (__GNUC__ >= 4) || (__clang_major__ >= 4) |
2542 | /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */ | 2586 | /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */ |
2543 | # undef isnand | 2587 | # undef isnand |
2544 | # define isnand(x) __builtin_isnan ((double)(x)) | 2588 | # define isnand(x) __builtin_isnan ((double)(x)) |
2545 | # else | 2589 | # else |
2546 | # undef isnand | 2590 | # undef isnand |
2547 | # define isnand(x) isnan ((double)(x)) | 2591 | # define isnand(x) isnan ((double)(x)) |
2592 | # endif | ||
2548 | # endif | 2593 | # endif |
2549 | # else | 2594 | # else |
2550 | /* Test whether X is a NaN. */ | 2595 | /* Test whether X is a NaN. */ |
@@ -2617,12 +2662,17 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; | |||
2617 | # if defined isnan || defined GNULIB_NAMESPACE | 2662 | # if defined isnan || defined GNULIB_NAMESPACE |
2618 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) | 2663 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) |
2619 | # undef isnan | 2664 | # undef isnan |
2620 | # if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) | 2665 | # if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) |
2621 | /* This platform's <cmath> possibly defines isnan through a set of inline | 2666 | /* This platform's <cmath> possibly defines isnan through a set of inline |
2622 | functions. */ | 2667 | functions. */ |
2623 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) | 2668 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) |
2624 | # define isnan rpl_isnan | 2669 | # define isnan rpl_isnan |
2625 | # define GNULIB_NAMESPACE_LACKS_ISNAN 1 | 2670 | # define GNULIB_NAMESPACE_LACKS_ISNAN 1 |
2671 | # elif __clang_major__ >= 14 | ||
2672 | /* Neither of the two possible _GL_MATH_CXX_REAL_FLOATING_DECL_2 invocations | ||
2673 | works. Inline functions are already present in /usr/include/c++/v1/math.h, | ||
2674 | which comes from LLVM. */ | ||
2675 | # define GNULIB_NAMESPACE_LACKS_ISNAN 1 | ||
2626 | # else | 2676 | # else |
2627 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool) | 2677 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool) |
2628 | # endif | 2678 | # endif |
@@ -2657,12 +2707,13 @@ _GL_WARN_REAL_FLOATING_DECL (isnan); | |||
2657 | _GL_EXTERN_C int gl_signbitf (float arg); | 2707 | _GL_EXTERN_C int gl_signbitf (float arg); |
2658 | _GL_EXTERN_C int gl_signbitd (double arg); | 2708 | _GL_EXTERN_C int gl_signbitd (double arg); |
2659 | _GL_EXTERN_C int gl_signbitl (long double arg); | 2709 | _GL_EXTERN_C int gl_signbitl (long double arg); |
2660 | # if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__ | 2710 | # if __GNUC__ >= 2 || defined __clang__ |
2661 | # define _GL_NUM_UINT_WORDS(type) \ | 2711 | # define _GL_NUM_UINT_WORDS(type) \ |
2662 | ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | 2712 | ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) |
2663 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf | 2713 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf |
2664 | # define gl_signbitf_OPTIMIZED_MACRO | 2714 | # define gl_signbitf_OPTIMIZED_MACRO |
2665 | # define gl_signbitf(arg) \ | 2715 | # define gl_signbitf(arg) \ |
2716 | __extension__ \ | ||
2666 | ({ union { float _value; \ | 2717 | ({ union { float _value; \ |
2667 | unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \ | 2718 | unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \ |
2668 | } _m; \ | 2719 | } _m; \ |
@@ -2673,6 +2724,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg); | |||
2673 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd | 2724 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd |
2674 | # define gl_signbitd_OPTIMIZED_MACRO | 2725 | # define gl_signbitd_OPTIMIZED_MACRO |
2675 | # define gl_signbitd(arg) \ | 2726 | # define gl_signbitd(arg) \ |
2727 | __extension__ \ | ||
2676 | ({ union { double _value; \ | 2728 | ({ union { double _value; \ |
2677 | unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \ | 2729 | unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \ |
2678 | } _m; \ | 2730 | } _m; \ |
@@ -2683,6 +2735,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg); | |||
2683 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl | 2735 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl |
2684 | # define gl_signbitl_OPTIMIZED_MACRO | 2736 | # define gl_signbitl_OPTIMIZED_MACRO |
2685 | # define gl_signbitl(arg) \ | 2737 | # define gl_signbitl(arg) \ |
2738 | __extension__ \ | ||
2686 | ({ union { long double _value; \ | 2739 | ({ union { long double _value; \ |
2687 | unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \ | 2740 | unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \ |
2688 | } _m; \ | 2741 | } _m; \ |
@@ -2720,8 +2773,323 @@ _GL_WARN_REAL_FLOATING_DECL (signbit); | |||
2720 | # endif | 2773 | # endif |
2721 | #endif | 2774 | #endif |
2722 | 2775 | ||
2776 | |||
2777 | #if @GNULIB_GETPAYLOADF@ | ||
2778 | # if @REPLACE_GETPAYLOADF@ | ||
2779 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2780 | # undef getpayloadf | ||
2781 | # define getpayloadf rpl_getpayloadf | ||
2782 | # endif | ||
2783 | _GL_FUNCDECL_RPL (getpayloadf, float, (const float *)); | ||
2784 | _GL_CXXALIAS_RPL (getpayloadf, float, (const float *)); | ||
2785 | # else | ||
2786 | # if !@HAVE_GETPAYLOADF@ | ||
2787 | _GL_FUNCDECL_SYS (getpayloadf, float, (const float *)); | ||
2788 | # endif | ||
2789 | _GL_CXXALIAS_SYS (getpayloadf, float, (const float *)); | ||
2790 | # endif | ||
2791 | _GL_CXXALIASWARN (getpayloadf); | ||
2792 | #elif defined GNULIB_POSIXCHECK | ||
2793 | # undef getpayloadf | ||
2794 | # if HAVE_RAW_DECL_GETPAYLOADF | ||
2795 | _GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - " | ||
2796 | "use gnulib module getpayloadf for portability"); | ||
2797 | # endif | ||
2798 | #endif | ||
2799 | |||
2800 | #if @GNULIB_GETPAYLOAD@ | ||
2801 | # if @REPLACE_GETPAYLOAD@ | ||
2802 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2803 | # undef getpayload | ||
2804 | # define getpayload rpl_getpayload | ||
2805 | # endif | ||
2806 | _GL_FUNCDECL_RPL (getpayload, double, (const double *)); | ||
2807 | _GL_CXXALIAS_RPL (getpayload, double, (const double *)); | ||
2808 | # else | ||
2809 | # if !@HAVE_GETPAYLOAD@ | ||
2810 | _GL_FUNCDECL_SYS (getpayload, double, (const double *)); | ||
2811 | # endif | ||
2812 | _GL_CXXALIAS_SYS (getpayload, double, (const double *)); | ||
2813 | # endif | ||
2814 | _GL_CXXALIASWARN (getpayload); | ||
2815 | #elif defined GNULIB_POSIXCHECK | ||
2816 | # undef getpayload | ||
2817 | # if HAVE_RAW_DECL_GETPAYLOAD | ||
2818 | _GL_WARN_ON_USE (getpayload, "getpayload is unportable - " | ||
2819 | "use gnulib module getpayload for portability"); | ||
2820 | # endif | ||
2821 | #endif | ||
2822 | |||
2823 | #if @GNULIB_GETPAYLOADL@ | ||
2824 | # if @REPLACE_GETPAYLOADL@ | ||
2825 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2826 | # undef getpayloadl | ||
2827 | # define getpayloadl rpl_getpayloadl | ||
2828 | # endif | ||
2829 | _GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *)); | ||
2830 | _GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *)); | ||
2831 | # else | ||
2832 | # if !@HAVE_GETPAYLOADL@ | ||
2833 | _GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *)); | ||
2834 | # endif | ||
2835 | _GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *)); | ||
2836 | # endif | ||
2837 | _GL_CXXALIASWARN (getpayloadl); | ||
2838 | #elif defined GNULIB_POSIXCHECK | ||
2839 | # undef getpayloadl | ||
2840 | # if HAVE_RAW_DECL_GETPAYLOADL | ||
2841 | _GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - " | ||
2842 | "use gnulib module getpayloadl for portability"); | ||
2843 | # endif | ||
2844 | #endif | ||
2845 | |||
2846 | |||
2847 | #if @GNULIB_SETPAYLOADF@ | ||
2848 | # if !@HAVE_SETPAYLOADF@ | ||
2849 | _GL_FUNCDECL_SYS (setpayloadf, int, (float *, float)); | ||
2850 | # endif | ||
2851 | _GL_CXXALIAS_SYS (setpayloadf, int, (float *, float)); | ||
2852 | _GL_CXXALIASWARN (setpayloadf); | ||
2853 | #elif defined GNULIB_POSIXCHECK | ||
2854 | # undef setpayloadf | ||
2855 | # if HAVE_RAW_DECL_SETPAYLOADF | ||
2856 | _GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - " | ||
2857 | "use gnulib module setpayloadf for portability"); | ||
2858 | # endif | ||
2859 | #endif | ||
2860 | |||
2861 | #if @GNULIB_SETPAYLOAD@ | ||
2862 | # if !@HAVE_SETPAYLOAD@ | ||
2863 | _GL_FUNCDECL_SYS (setpayload, int, (double *, double)); | ||
2864 | # endif | ||
2865 | _GL_CXXALIAS_SYS (setpayload, int, (double *, double)); | ||
2866 | _GL_CXXALIASWARN (setpayload); | ||
2867 | #elif defined GNULIB_POSIXCHECK | ||
2868 | # undef setpayload | ||
2869 | # if HAVE_RAW_DECL_SETPAYLOAD | ||
2870 | _GL_WARN_ON_USE (setpayload, "setpayload is unportable - " | ||
2871 | "use gnulib module setpayload for portability"); | ||
2872 | # endif | ||
2873 | #endif | ||
2874 | |||
2875 | #if @GNULIB_SETPAYLOADL@ | ||
2876 | # if !@HAVE_SETPAYLOADL@ | ||
2877 | _GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double)); | ||
2878 | # endif | ||
2879 | _GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double)); | ||
2880 | _GL_CXXALIASWARN (setpayloadl); | ||
2881 | #elif defined GNULIB_POSIXCHECK | ||
2882 | # undef setpayloadl | ||
2883 | # if HAVE_RAW_DECL_SETPAYLOADL | ||
2884 | _GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - " | ||
2885 | "use gnulib module setpayloadl for portability"); | ||
2886 | # endif | ||
2887 | #endif | ||
2888 | |||
2889 | |||
2890 | #if @GNULIB_SETPAYLOADSIGF@ | ||
2891 | # if !@HAVE_SETPAYLOADSIGF@ | ||
2892 | _GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float)); | ||
2893 | # endif | ||
2894 | _GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float)); | ||
2895 | _GL_CXXALIASWARN (setpayloadsigf); | ||
2896 | #elif defined GNULIB_POSIXCHECK | ||
2897 | # undef setpayloadsigf | ||
2898 | # if HAVE_RAW_DECL_SETPAYLOADSIGF | ||
2899 | _GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - " | ||
2900 | "use gnulib module setpayloadsigf for portability"); | ||
2901 | # endif | ||
2902 | #endif | ||
2903 | |||
2904 | #if @GNULIB_SETPAYLOADSIG@ | ||
2905 | # if !@HAVE_SETPAYLOADSIG@ | ||
2906 | _GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double)); | ||
2907 | # endif | ||
2908 | _GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double)); | ||
2909 | _GL_CXXALIASWARN (setpayloadsig); | ||
2910 | #elif defined GNULIB_POSIXCHECK | ||
2911 | # undef setpayloadsig | ||
2912 | # if HAVE_RAW_DECL_SETPAYLOADSIG | ||
2913 | _GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - " | ||
2914 | "use gnulib module setpayloadsig for portability"); | ||
2915 | # endif | ||
2916 | #endif | ||
2917 | |||
2918 | #if @GNULIB_SETPAYLOADSIGL@ | ||
2919 | # if !@HAVE_SETPAYLOADSIGL@ | ||
2920 | _GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double)); | ||
2921 | # endif | ||
2922 | _GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double)); | ||
2923 | _GL_CXXALIASWARN (setpayloadsigl); | ||
2924 | #elif defined GNULIB_POSIXCHECK | ||
2925 | # undef setpayloadsigl | ||
2926 | # if HAVE_RAW_DECL_SETPAYLOADSIGL | ||
2927 | _GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - " | ||
2928 | "use gnulib module setpayloadsigl for portability"); | ||
2929 | # endif | ||
2930 | #endif | ||
2931 | |||
2932 | |||
2933 | #if @GNULIB_TOTALORDERF@ | ||
2934 | # if @REPLACE_TOTALORDERF@ | ||
2935 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2936 | # undef totalorderf | ||
2937 | # define totalorderf rpl_totalorderf | ||
2938 | # endif | ||
2939 | _GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *)); | ||
2940 | _GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *)); | ||
2941 | # else | ||
2942 | # if !@HAVE_TOTALORDERF@ | ||
2943 | _GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *)); | ||
2944 | # endif | ||
2945 | _GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *)); | ||
2946 | # endif | ||
2947 | _GL_CXXALIASWARN (totalorderf); | ||
2948 | #elif defined GNULIB_POSIXCHECK | ||
2949 | # undef totalorderf | ||
2950 | # if HAVE_RAW_DECL_TOTALORDERF | ||
2951 | _GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - " | ||
2952 | "use gnulib module totalorderf for portability"); | ||
2953 | # endif | ||
2954 | #endif | ||
2955 | |||
2956 | #if @GNULIB_TOTALORDER@ | ||
2957 | # if @REPLACE_TOTALORDER@ | ||
2958 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2959 | # undef totalorder | ||
2960 | # define totalorder rpl_totalorder | ||
2961 | # endif | ||
2962 | _GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *)); | ||
2963 | _GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *)); | ||
2964 | # else | ||
2965 | # if !@HAVE_TOTALORDER@ | ||
2966 | _GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *)); | ||
2967 | # endif | ||
2968 | _GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *)); | ||
2969 | # endif | ||
2970 | # if __GLIBC__ >= 2 | ||
2971 | _GL_CXXALIASWARN1 (totalorder, int, (double const *, double const *)); | ||
2972 | # endif | ||
2973 | #elif defined GNULIB_POSIXCHECK | ||
2974 | # undef totalorder | ||
2975 | # if HAVE_RAW_DECL_TOTALORDER | ||
2976 | _GL_WARN_ON_USE (totalorder, "totalorder is unportable - " | ||
2977 | "use gnulib module totalorder for portability"); | ||
2978 | # endif | ||
2979 | #endif | ||
2980 | |||
2981 | #if @GNULIB_TOTALORDERL@ | ||
2982 | # if @REPLACE_TOTALORDERL@ | ||
2983 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2984 | # undef totalorderl | ||
2985 | # define totalorderl rpl_totalorderl | ||
2986 | # endif | ||
2987 | _GL_FUNCDECL_RPL (totalorderl, int, | ||
2988 | (long double const *, long double const *)); | ||
2989 | _GL_CXXALIAS_RPL (totalorderl, int, | ||
2990 | (long double const *, long double const *)); | ||
2991 | # else | ||
2992 | # if !@HAVE_TOTALORDERL@ | ||
2993 | _GL_FUNCDECL_SYS (totalorderl, int, | ||
2994 | (long double const *, long double const *)); | ||
2995 | # endif | ||
2996 | _GL_CXXALIAS_SYS (totalorderl, int, | ||
2997 | (long double const *, long double const *)); | ||
2998 | # endif | ||
2999 | _GL_CXXALIASWARN (totalorderl); | ||
3000 | #elif defined GNULIB_POSIXCHECK | ||
3001 | # undef totalorderl | ||
3002 | # if HAVE_RAW_DECL_TOTALORDERL | ||
3003 | _GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - " | ||
3004 | "use gnulib module totalorderl for portability"); | ||
3005 | # endif | ||
3006 | #endif | ||
3007 | |||
3008 | |||
3009 | #if @GNULIB_TOTALORDERMAGF@ | ||
3010 | # if @REPLACE_TOTALORDERMAGF@ | ||
3011 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
3012 | # undef totalordermagf | ||
3013 | # define totalordermagf rpl_totalordermagf | ||
3014 | # endif | ||
3015 | _GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *)); | ||
3016 | _GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *)); | ||
3017 | # else | ||
3018 | # if !@HAVE_TOTALORDERMAGF@ | ||
3019 | _GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *)); | ||
3020 | # endif | ||
3021 | _GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *)); | ||
3022 | # endif | ||
3023 | # if __GLIBC__ >= 2 | ||
3024 | _GL_CXXALIASWARN1 (totalordermagf, int, (float const *, float const *)); | ||
3025 | # endif | ||
3026 | #elif defined GNULIB_POSIXCHECK | ||
3027 | # undef totalordermagf | ||
3028 | # if HAVE_RAW_DECL_TOTALORDERMAGF | ||
3029 | _GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - " | ||
3030 | "use gnulib module totalordermagf for portability"); | ||
3031 | # endif | ||
3032 | #endif | ||
3033 | |||
3034 | #if @GNULIB_TOTALORDERMAG@ | ||
3035 | # if @REPLACE_TOTALORDERMAG@ | ||
3036 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
3037 | # undef totalordermag | ||
3038 | # define totalordermag rpl_totalordermag | ||
3039 | # endif | ||
3040 | _GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *)); | ||
3041 | _GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *)); | ||
3042 | # else | ||
3043 | # if !@HAVE_TOTALORDERMAG@ | ||
3044 | _GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *)); | ||
3045 | # endif | ||
3046 | _GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *)); | ||
3047 | # endif | ||
3048 | # if __GLIBC__ >= 2 | ||
3049 | _GL_CXXALIASWARN1 (totalordermag, int, (double const *, double const *)); | ||
3050 | # endif | ||
3051 | #elif defined GNULIB_POSIXCHECK | ||
3052 | # undef totalordermag | ||
3053 | # if HAVE_RAW_DECL_TOTALORDERMAG | ||
3054 | _GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - " | ||
3055 | "use gnulib module totalordermag for portability"); | ||
3056 | # endif | ||
3057 | #endif | ||
3058 | |||
3059 | #if @GNULIB_TOTALORDERMAGL@ | ||
3060 | # if @REPLACE_TOTALORDERMAGL@ | ||
3061 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
3062 | # undef totalordermagl | ||
3063 | # define totalordermagl rpl_totalordermagl | ||
3064 | # endif | ||
3065 | _GL_FUNCDECL_RPL (totalordermagl, int, | ||
3066 | (long double const *, long double const *)); | ||
3067 | _GL_CXXALIAS_RPL (totalordermagl, int, | ||
3068 | (long double const *, long double const *)); | ||
3069 | # else | ||
3070 | # if !@HAVE_TOTALORDERMAGL@ | ||
3071 | _GL_FUNCDECL_SYS (totalordermagl, int, | ||
3072 | (long double const *, long double const *)); | ||
3073 | # endif | ||
3074 | _GL_CXXALIAS_SYS (totalordermagl, int, | ||
3075 | (long double const *, long double const *)); | ||
3076 | # endif | ||
3077 | # if __GLIBC__ >= 2 | ||
3078 | _GL_CXXALIASWARN1 (totalordermagl, int, | ||
3079 | (long double const *, long double const *)); | ||
3080 | # endif | ||
3081 | #elif defined GNULIB_POSIXCHECK | ||
3082 | # undef totalordermagl | ||
3083 | # if HAVE_RAW_DECL_TOTALORDERMAGL | ||
3084 | _GL_WARN_ON_USE (totalordermagl, "totalordermagl is unportable - " | ||
3085 | "use gnulib module totalordermagl for portability"); | ||
3086 | # endif | ||
3087 | #endif | ||
3088 | |||
3089 | |||
2723 | _GL_INLINE_HEADER_END | 3090 | _GL_INLINE_HEADER_END |
2724 | 3091 | ||
2725 | #endif /* _@GUARD_PREFIX@_MATH_H */ | 3092 | #endif /* _@GUARD_PREFIX@_MATH_H */ |
2726 | #endif /* _GL_INCLUDING_MATH_H */ | 3093 | #endif /* _GL_INCLUDING_MATH_H */ |
2727 | #endif /* _@GUARD_PREFIX@_MATH_H */ | 3094 | #endif /* _@GUARD_PREFIX@_MATH_H */ |
3095 | #endif | ||
diff --git a/gl/mbrtowc-impl-utf8.h b/gl/mbrtowc-impl-utf8.h index 4fdd65d8..3a3ba13c 100644 --- a/gl/mbrtowc-impl-utf8.h +++ b/gl/mbrtowc-impl-utf8.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 1999-2002, 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/mbrtowc-impl.h b/gl/mbrtowc-impl.h index e9c04ed7..963631ca 100644 --- a/gl/mbrtowc-impl.h +++ b/gl/mbrtowc-impl.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 1999-2002, 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/mbrtowc.c b/gl/mbrtowc.c index c1a689a2..8a1646d2 100644 --- a/gl/mbrtowc.c +++ b/gl/mbrtowc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 1999-2002, 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -28,7 +28,11 @@ | |||
28 | # include <stdint.h> | 28 | # include <stdint.h> |
29 | # include <stdlib.h> | 29 | # include <stdlib.h> |
30 | 30 | ||
31 | # if defined _WIN32 && !defined __CYGWIN__ | 31 | # if AVOID_ANY_THREADS |
32 | |||
33 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
34 | |||
35 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
32 | 36 | ||
33 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ | 37 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ |
34 | # include <windows.h> | 38 | # include <windows.h> |
diff --git a/gl/mbsinit.c b/gl/mbsinit.c index 6e600798..d1b8475c 100644 --- a/gl/mbsinit.c +++ b/gl/mbsinit.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Test for initial conversion state. | 1 | /* Test for initial conversion state. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -36,7 +36,7 @@ | |||
36 | buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. | 36 | buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. |
37 | See mbrtowc.c. | 37 | See mbrtowc.c. |
38 | - In wc -> mb direction, mbstate_t contains no information. In other | 38 | - In wc -> mb direction, mbstate_t contains no information. In other |
39 | words, it is always in the initial state. */ | 39 | words, it is always in an initial state. */ |
40 | 40 | ||
41 | static_assert (sizeof (mbstate_t) >= 4); | 41 | static_assert (sizeof (mbstate_t) >= 4); |
42 | 42 | ||
diff --git a/gl/mbszero.c b/gl/mbszero.c new file mode 100644 index 00000000..25af2848 --- /dev/null +++ b/gl/mbszero.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* Put an mbstate_t into an initial conversion state. | ||
2 | Copyright (C) 2023-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | /* Written by Bruno Haible <bruno@clisp.org>, 2023. */ | ||
18 | |||
19 | #include <config.h> | ||
20 | |||
21 | #define IN_MBSZERO | ||
22 | /* Specification and implementation. */ | ||
23 | #include <wchar.h> | ||
diff --git a/gl/mbtowc-impl.h b/gl/mbtowc-impl.h index 39b977be..92efb4a7 100644 --- a/gl/mbtowc-impl.h +++ b/gl/mbtowc-impl.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2011. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -30,7 +30,7 @@ mbtowc (wchar_t *pwc, const char *s, size_t n) | |||
30 | wchar_t wc; | 30 | wchar_t wc; |
31 | size_t result; | 31 | size_t result; |
32 | 32 | ||
33 | memset (&state, 0, sizeof (mbstate_t)); | 33 | mbszero (&state); |
34 | result = mbrtowc (&wc, s, n, &state); | 34 | result = mbrtowc (&wc, s, n, &state); |
35 | if (result == (size_t)-1 || result == (size_t)-2) | 35 | if (result == (size_t)-1 || result == (size_t)-2) |
36 | { | 36 | { |
diff --git a/gl/mbtowc-lock.c b/gl/mbtowc-lock.c index 6ca6e10f..9001c5af 100644 --- a/gl/mbtowc-lock.c +++ b/gl/mbtowc-lock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Return the internal lock used by mbrtowc and mbrtoc32. | 1 | /* Return the internal lock used by mbrtowc and mbrtoc32. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -18,9 +18,10 @@ | |||
18 | 18 | ||
19 | #include <config.h> | 19 | #include <config.h> |
20 | 20 | ||
21 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
21 | /* When it is known that the gl_get_mbtowc_lock function is defined | 22 | /* When it is known that the gl_get_mbtowc_lock function is defined |
22 | by a dependency library, it should not be defined here. */ | 23 | by a dependency library, it should not be defined here. */ |
23 | #if OMIT_MBTOWC_LOCK | 24 | #if AVOID_ANY_THREADS || OMIT_MBTOWC_LOCK |
24 | 25 | ||
25 | /* This declaration is solely to ensure that after preprocessing | 26 | /* This declaration is solely to ensure that after preprocessing |
26 | this file is never empty. */ | 27 | this file is never empty. */ |
@@ -37,14 +38,14 @@ typedef int dummy; | |||
37 | 38 | ||
38 | /* Macro for exporting a symbol (function, not variable) defined in this file, | 39 | /* Macro for exporting a symbol (function, not variable) defined in this file, |
39 | when compiled into a shared library. */ | 40 | when compiled into a shared library. */ |
40 | # ifndef DLL_EXPORTED | 41 | # ifndef SHLIB_EXPORTED |
41 | # if HAVE_VISIBILITY | 42 | # if HAVE_VISIBILITY |
42 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ | 43 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ |
43 | # define DLL_EXPORTED __attribute__((__visibility__("default"))) | 44 | # define SHLIB_EXPORTED __attribute__((__visibility__("default"))) |
44 | # elif defined _WIN32 || defined __CYGWIN__ | 45 | # elif defined _WIN32 || defined __CYGWIN__ |
45 | # define DLL_EXPORTED __declspec(dllexport) | 46 | # define SHLIB_EXPORTED __declspec(dllexport) |
46 | # else | 47 | # else |
47 | # define DLL_EXPORTED | 48 | # define SHLIB_EXPORTED |
48 | # endif | 49 | # endif |
49 | # endif | 50 | # endif |
50 | 51 | ||
@@ -59,7 +60,7 @@ typedef int dummy; | |||
59 | because the latter is not guaranteed to be a stable ABI in the future. */ | 60 | because the latter is not guaranteed to be a stable ABI in the future. */ |
60 | 61 | ||
61 | /* Make sure the function gets exported from DLLs. */ | 62 | /* Make sure the function gets exported from DLLs. */ |
62 | DLL_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void); | 63 | SHLIB_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void); |
63 | 64 | ||
64 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; | 65 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; |
65 | static CRITICAL_SECTION lock; | 66 | static CRITICAL_SECTION lock; |
@@ -96,7 +97,7 @@ gl_get_mbtowc_lock (void) | |||
96 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; | 97 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
97 | 98 | ||
98 | /* Make sure the function gets exported from shared libraries. */ | 99 | /* Make sure the function gets exported from shared libraries. */ |
99 | DLL_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void); | 100 | SHLIB_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void); |
100 | 101 | ||
101 | /* Returns the internal lock used by mbrtowc and mbrtoc32. */ | 102 | /* Returns the internal lock used by mbrtowc and mbrtoc32. */ |
102 | pthread_mutex_t * | 103 | pthread_mutex_t * |
@@ -123,7 +124,7 @@ atomic_init (void) | |||
123 | } | 124 | } |
124 | 125 | ||
125 | /* Make sure the function gets exported from shared libraries. */ | 126 | /* Make sure the function gets exported from shared libraries. */ |
126 | DLL_EXPORTED mtx_t *gl_get_mbtowc_lock (void); | 127 | SHLIB_EXPORTED mtx_t *gl_get_mbtowc_lock (void); |
127 | 128 | ||
128 | /* Returns the internal lock used by mbrtowc and mbrtoc32. */ | 129 | /* Returns the internal lock used by mbrtowc and mbrtoc32. */ |
129 | mtx_t * | 130 | mtx_t * |
diff --git a/gl/mbtowc-lock.h b/gl/mbtowc-lock.h index 2dc22ace..10f7dc7c 100644 --- a/gl/mbtowc-lock.h +++ b/gl/mbtowc-lock.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Use the internal lock used by mbrtowc and mbrtoc32. | 1 | /* Use the internal lock used by mbrtowc and mbrtoc32. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -21,7 +21,7 @@ | |||
21 | static inline int | 21 | static inline int |
22 | mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m) | 22 | mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m) |
23 | { | 23 | { |
24 | /* Put the hidden internal state of mbtowc into its initial state. | 24 | /* Put the hidden internal state of mbtowc into an initial state. |
25 | This is needed at least with glibc, uClibc, and MSVC CRT. | 25 | This is needed at least with glibc, uClibc, and MSVC CRT. |
26 | See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */ | 26 | See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */ |
27 | mbtowc (NULL, NULL, 0); | 27 | mbtowc (NULL, NULL, 0); |
@@ -32,7 +32,7 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m) | |||
32 | /* Prohibit renaming this symbol. */ | 32 | /* Prohibit renaming this symbol. */ |
33 | #undef gl_get_mbtowc_lock | 33 | #undef gl_get_mbtowc_lock |
34 | 34 | ||
35 | #if GNULIB_MBRTOWC_SINGLE_THREAD | 35 | #if AVOID_ANY_THREADS || GNULIB_MBRTOWC_SINGLE_THREAD |
36 | 36 | ||
37 | /* All uses of this function are in a single thread. No locking needed. */ | 37 | /* All uses of this function are in a single thread. No locking needed. */ |
38 | 38 | ||
diff --git a/gl/mbtowc.c b/gl/mbtowc.c index 8d9b06d2..31a2d635 100644 --- a/gl/mbtowc.c +++ b/gl/mbtowc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2011. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/memchr.c b/gl/memchr.c index 8e955793..67687a8f 100644 --- a/gl/memchr.c +++ b/gl/memchr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2023 | 1 | /* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2024 |
2 | Free Software Foundation, Inc. | 2 | Free Software Foundation, Inc. |
3 | 3 | ||
4 | Based on strlen implementation by Torbjorn Granlund (tege@sics.se), | 4 | Based on strlen implementation by Torbjorn Granlund (tege@sics.se), |
diff --git a/gl/memchr.valgrind b/gl/memchr.valgrind index 97690f2c..0295d7e6 100644 --- a/gl/memchr.valgrind +++ b/gl/memchr.valgrind | |||
@@ -1,6 +1,6 @@ | |||
1 | # Suppress a valgrind message about use of uninitialized memory in memchr(). | 1 | # Suppress a valgrind message about use of uninitialized memory in memchr(). |
2 | 2 | ||
3 | # Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | # Copyright (C) 2009-2024 Free Software Foundation, Inc. |
4 | # | 4 | # |
5 | # This file is free software: you can redistribute it and/or modify | 5 | # This file is free software: you can redistribute it and/or modify |
6 | # it under the terms of the GNU Lesser General Public License as | 6 | # it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/minmax.h b/gl/minmax.h index 1fbfc661..f3df58b0 100644 --- a/gl/minmax.h +++ b/gl/minmax.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* MIN, MAX macros. | 1 | /* MIN, MAX macros. |
2 | Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2023 Free Software | 2 | Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -23,6 +23,11 @@ | |||
23 | MIN, MAX macro redefinitions on some systems; the workaround is to | 23 | MIN, MAX macro redefinitions on some systems; the workaround is to |
24 | #include this file as the last one among the #include list. */ | 24 | #include this file as the last one among the #include list. */ |
25 | 25 | ||
26 | /* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H. */ | ||
27 | #if !_GL_CONFIG_H_INCLUDED | ||
28 | #error "Please include config.h first." | ||
29 | #endif | ||
30 | |||
26 | /* Before we define the following symbols we get the <limits.h> file | 31 | /* Before we define the following symbols we get the <limits.h> file |
27 | since otherwise we get redefinitions on some systems if <limits.h> is | 32 | since otherwise we get redefinitions on some systems if <limits.h> is |
28 | included after this file. Likewise for <sys/param.h>. | 33 | included after this file. Likewise for <sys/param.h>. |
diff --git a/gl/mktime-internal.h b/gl/mktime-internal.h index 709c36bd..0693aaf1 100644 --- a/gl/mktime-internal.h +++ b/gl/mktime-internal.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Internals of mktime and related functions | 1 | /* Internals of mktime and related functions |
2 | Copyright 2016-2023 Free Software Foundation, Inc. | 2 | Copyright 2016-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Paul Eggert <eggert@cs.ucla.edu>. | 4 | Contributed by Paul Eggert <eggert@cs.ucla.edu>. |
5 | 5 | ||
diff --git a/gl/mktime.c b/gl/mktime.c index 94a4320e..c704f415 100644 --- a/gl/mktime.c +++ b/gl/mktime.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert a 'struct tm' to a time_t value. | 1 | /* Convert a 'struct tm' to a time_t value. |
2 | Copyright (C) 1993-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1993-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Paul Eggert <eggert@twinsun.com>. | 4 | Contributed by Paul Eggert <eggert@twinsun.com>. |
5 | 5 | ||
@@ -46,6 +46,7 @@ | |||
46 | #include <errno.h> | 46 | #include <errno.h> |
47 | #include <limits.h> | 47 | #include <limits.h> |
48 | #include <stdbool.h> | 48 | #include <stdbool.h> |
49 | #include <stdckdint.h> | ||
49 | #include <stdlib.h> | 50 | #include <stdlib.h> |
50 | #include <string.h> | 51 | #include <string.h> |
51 | 52 | ||
@@ -379,7 +380,7 @@ __mktime_internal (struct tm *tp, | |||
379 | /* Invert CONVERT by probing. First assume the same offset as last | 380 | /* Invert CONVERT by probing. First assume the same offset as last |
380 | time. */ | 381 | time. */ |
381 | 382 | ||
382 | INT_SUBTRACT_WRAPV (0, off, &negative_offset_guess); | 383 | ckd_sub (&negative_offset_guess, 0, off); |
383 | long_int t0 = ydhms_diff (year, yday, hour, min, sec, | 384 | long_int t0 = ydhms_diff (year, yday, hour, min, sec, |
384 | EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, | 385 | EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, |
385 | negative_offset_guess); | 386 | negative_offset_guess); |
@@ -465,7 +466,7 @@ __mktime_internal (struct tm *tp, | |||
465 | for (direction = -1; direction <= 1; direction += 2) | 466 | for (direction = -1; direction <= 1; direction += 2) |
466 | { | 467 | { |
467 | long_int ot; | 468 | long_int ot; |
468 | if (! INT_ADD_WRAPV (t, delta * direction, &ot)) | 469 | if (! ckd_add (&ot, t, delta * direction)) |
469 | { | 470 | { |
470 | struct tm otm; | 471 | struct tm otm; |
471 | if (! ranged_convert (convert, &ot, &otm)) | 472 | if (! ranged_convert (convert, &ot, &otm)) |
@@ -503,8 +504,8 @@ __mktime_internal (struct tm *tp, | |||
503 | /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS. | 504 | /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS. |
504 | This is just a heuristic to speed up the next mktime call, and | 505 | This is just a heuristic to speed up the next mktime call, and |
505 | correctness is unaffected if integer overflow occurs here. */ | 506 | correctness is unaffected if integer overflow occurs here. */ |
506 | INT_SUBTRACT_WRAPV (t, t0, offset); | 507 | ckd_sub (offset, t, t0); |
507 | INT_SUBTRACT_WRAPV (*offset, negative_offset_guess, offset); | 508 | ckd_sub (offset, *offset, negative_offset_guess); |
508 | 509 | ||
509 | if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec) | 510 | if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec) |
510 | { | 511 | { |
@@ -513,7 +514,7 @@ __mktime_internal (struct tm *tp, | |||
513 | long_int sec_adjustment = sec == 0 && tm.tm_sec == 60; | 514 | long_int sec_adjustment = sec == 0 && tm.tm_sec == 60; |
514 | sec_adjustment -= sec; | 515 | sec_adjustment -= sec; |
515 | sec_adjustment += sec_requested; | 516 | sec_adjustment += sec_requested; |
516 | if (INT_ADD_WRAPV (t, sec_adjustment, &t) | 517 | if (ckd_add (&t, t, sec_adjustment) |
517 | || ! (mktime_min <= t && t <= mktime_max)) | 518 | || ! (mktime_min <= t && t <= mktime_max)) |
518 | { | 519 | { |
519 | __set_errno (EOVERFLOW); | 520 | __set_errno (EOVERFLOW); |
diff --git a/gl/mountlist.c b/gl/mountlist.c index 6d384812..06300d6b 100644 --- a/gl/mountlist.c +++ b/gl/mountlist.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* mountlist.c -- return a list of mounted file systems | 1 | /* mountlist.c -- return a list of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991-1992, 1997-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1991-1992, 1997-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
@@ -154,11 +154,18 @@ | |||
154 | 154 | ||
155 | /* The results of opendir() in this file are not used with dirfd and fchdir, | 155 | /* The results of opendir() in this file are not used with dirfd and fchdir, |
156 | therefore save some unnecessary work in fchdir.c. */ | 156 | therefore save some unnecessary work in fchdir.c. */ |
157 | #ifdef GNULIB_defined_opendir | 157 | #ifdef GNULIB_defined_DIR |
158 | # undef DIR | ||
158 | # undef opendir | 159 | # undef opendir |
159 | #endif | ||
160 | #ifdef GNULIB_defined_closedir | ||
161 | # undef closedir | 160 | # undef closedir |
161 | # undef readdir | ||
162 | #else | ||
163 | # ifdef GNULIB_defined_opendir | ||
164 | # undef opendir | ||
165 | # endif | ||
166 | # ifdef GNULIB_defined_closedir | ||
167 | # undef closedir | ||
168 | # endif | ||
162 | #endif | 169 | #endif |
163 | 170 | ||
164 | #define ME_DUMMY_0(Fs_name, Fs_type) \ | 171 | #define ME_DUMMY_0(Fs_name, Fs_type) \ |
@@ -185,11 +192,11 @@ | |||
185 | we grant an exception to any with "bind" in its list of mount options. | 192 | we grant an exception to any with "bind" in its list of mount options. |
186 | I.e., those are *not* dummy entries. */ | 193 | I.e., those are *not* dummy entries. */ |
187 | #ifdef MOUNTED_GETMNTENT1 | 194 | #ifdef MOUNTED_GETMNTENT1 |
188 | # define ME_DUMMY(Fs_name, Fs_type, Bind) \ | 195 | # define ME_DUMMY(Fs_name, Fs_type, Bind) \ |
189 | (ME_DUMMY_0 (Fs_name, Fs_type) \ | 196 | (ME_DUMMY_0 (Fs_name, Fs_type) \ |
190 | || (strcmp (Fs_type, "none") == 0 && !Bind)) | 197 | || (strcmp (Fs_type, "none") == 0 && !Bind)) |
191 | #else | 198 | #else |
192 | # define ME_DUMMY(Fs_name, Fs_type) \ | 199 | # define ME_DUMMY(Fs_name, Fs_type) \ |
193 | (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0) | 200 | (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0) |
194 | #endif | 201 | #endif |
195 | 202 | ||
diff --git a/gl/mountlist.h b/gl/mountlist.h index aed7f887..9728e38b 100644 --- a/gl/mountlist.h +++ b/gl/mountlist.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* mountlist.h -- declarations for list of mounted file systems | 1 | /* mountlist.h -- declarations for list of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2023 Free Software | 3 | Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
@@ -17,9 +17,19 @@ | |||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
18 | 18 | ||
19 | #ifndef MOUNTLIST_H_ | 19 | #ifndef MOUNTLIST_H_ |
20 | # define MOUNTLIST_H_ | 20 | #define MOUNTLIST_H_ |
21 | |||
22 | /* This file uses _GL_ATTRIBUTE_MALLOC. */ | ||
23 | #if !_GL_CONFIG_H_INCLUDED | ||
24 | # error "Please include config.h first." | ||
25 | #endif | ||
26 | |||
27 | #include <sys/types.h> | ||
28 | |||
29 | #ifdef __cplusplus | ||
30 | extern "C" { | ||
31 | #endif | ||
21 | 32 | ||
22 | # include <sys/types.h> | ||
23 | 33 | ||
24 | /* A mount table entry. */ | 34 | /* A mount table entry. */ |
25 | struct mount_entry | 35 | struct mount_entry |
@@ -40,4 +50,9 @@ struct mount_entry *read_file_system_list (bool need_fs_type) | |||
40 | _GL_ATTRIBUTE_MALLOC; | 50 | _GL_ATTRIBUTE_MALLOC; |
41 | void free_mount_entry (struct mount_entry *entry); | 51 | void free_mount_entry (struct mount_entry *entry); |
42 | 52 | ||
53 | |||
54 | #ifdef __cplusplus | ||
55 | } | ||
56 | #endif | ||
57 | |||
43 | #endif | 58 | #endif |
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c index c5149a8f..da3fc86a 100644 --- a/gl/msvc-inval.c +++ b/gl/msvc-inval.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Invalid parameter handler for MSVC runtime libraries. | 1 | /* Invalid parameter handler for MSVC runtime libraries. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/msvc-inval.h b/gl/msvc-inval.h index ed00461f..7aee6e5d 100644 --- a/gl/msvc-inval.h +++ b/gl/msvc-inval.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Invalid parameter handler for MSVC runtime libraries. | 1 | /* Invalid parameter handler for MSVC runtime libraries. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -52,6 +52,11 @@ | |||
52 | AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) | 52 | AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) |
53 | */ | 53 | */ |
54 | 54 | ||
55 | /* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER. */ | ||
56 | #if !_GL_CONFIG_H_INCLUDED | ||
57 | #error "Please include config.h first." | ||
58 | #endif | ||
59 | |||
55 | #define DEFAULT_HANDLING 0 | 60 | #define DEFAULT_HANDLING 0 |
56 | #define HAIRY_LIBRARY_HANDLING 1 | 61 | #define HAIRY_LIBRARY_HANDLING 1 |
57 | #define SANE_LIBRARY_HANDLING 2 | 62 | #define SANE_LIBRARY_HANDLING 2 |
diff --git a/gl/msvc-nothrow.c b/gl/msvc-nothrow.c index f729fe66..06b35a61 100644 --- a/gl/msvc-nothrow.c +++ b/gl/msvc-nothrow.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Wrappers that don't throw invalid parameter notifications | 1 | /* Wrappers that don't throw invalid parameter notifications |
2 | with MSVC runtime libraries. | 2 | with MSVC runtime libraries. |
3 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/msvc-nothrow.h b/gl/msvc-nothrow.h index 82d3f6a2..121773d1 100644 --- a/gl/msvc-nothrow.h +++ b/gl/msvc-nothrow.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Wrappers that don't throw invalid parameter notifications | 1 | /* Wrappers that don't throw invalid parameter notifications |
2 | with MSVC runtime libraries. | 2 | with MSVC runtime libraries. |
3 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -25,11 +25,20 @@ | |||
25 | This file defines wrappers that turn such an invalid parameter notification | 25 | This file defines wrappers that turn such an invalid parameter notification |
26 | into an error code. */ | 26 | into an error code. */ |
27 | 27 | ||
28 | /* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER. */ | ||
29 | #if !_GL_CONFIG_H_INCLUDED | ||
30 | #error "Please include config.h first." | ||
31 | #endif | ||
32 | |||
28 | #if defined _WIN32 && ! defined __CYGWIN__ | 33 | #if defined _WIN32 && ! defined __CYGWIN__ |
29 | 34 | ||
30 | /* Get original declaration of _get_osfhandle. */ | 35 | /* Get original declaration of _get_osfhandle. */ |
31 | # include <io.h> | 36 | # include <io.h> |
32 | 37 | ||
38 | # ifdef __cplusplus | ||
39 | extern "C" { | ||
40 | # endif | ||
41 | |||
33 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER | 42 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
34 | 43 | ||
35 | /* Override _get_osfhandle. */ | 44 | /* Override _get_osfhandle. */ |
@@ -38,6 +47,10 @@ extern intptr_t _gl_nothrow_get_osfhandle (int fd); | |||
38 | 47 | ||
39 | # endif | 48 | # endif |
40 | 49 | ||
50 | # ifdef __cplusplus | ||
51 | } | ||
52 | # endif | ||
53 | |||
41 | #endif | 54 | #endif |
42 | 55 | ||
43 | #endif /* _MSVC_NOTHROW_H */ | 56 | #endif /* _MSVC_NOTHROW_H */ |
diff --git a/gl/netdb.in.h b/gl/netdb.in.h index 9549cd73..43409b2f 100644 --- a/gl/netdb.in.h +++ b/gl/netdb.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Provide a netdb.h header file for systems lacking it (read: MinGW). | 1 | /* Provide a netdb.h header file for systems lacking it (read: MinGW). |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson. | 3 | Written by Simon Josefsson. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -36,6 +36,11 @@ | |||
36 | #ifndef _@GUARD_PREFIX@_NETDB_H | 36 | #ifndef _@GUARD_PREFIX@_NETDB_H |
37 | #define _@GUARD_PREFIX@_NETDB_H | 37 | #define _@GUARD_PREFIX@_NETDB_H |
38 | 38 | ||
39 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
40 | #if !_GL_CONFIG_H_INCLUDED | ||
41 | #error "Please include config.h first." | ||
42 | #endif | ||
43 | |||
39 | /* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and | 44 | /* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and |
40 | 'struct hostent' on MinGW. */ | 45 | 'struct hostent' on MinGW. */ |
41 | #include <sys/socket.h> | 46 | #include <sys/socket.h> |
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h index f88923a3..4e9f6f2d 100644 --- a/gl/netinet_in.in.h +++ b/gl/netinet_in.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for <netinet/in.h>. | 1 | /* Substitute for <netinet/in.h>. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/nl_langinfo-lock.c b/gl/nl_langinfo-lock.c index e5cdcd3e..5a248ed8 100644 --- a/gl/nl_langinfo-lock.c +++ b/gl/nl_langinfo-lock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Return the internal lock used by nl_langinfo. | 1 | /* Return the internal lock used by nl_langinfo. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -18,9 +18,10 @@ | |||
18 | 18 | ||
19 | #include <config.h> | 19 | #include <config.h> |
20 | 20 | ||
21 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
21 | /* When it is known that the gl_get_nl_langinfo_lock function is defined | 22 | /* When it is known that the gl_get_nl_langinfo_lock function is defined |
22 | by a dependency library, it should not be defined here. */ | 23 | by a dependency library, it should not be defined here. */ |
23 | #if OMIT_NL_LANGINFO_LOCK | 24 | #if AVOID_ANY_THREADS || OMIT_NL_LANGINFO_LOCK |
24 | 25 | ||
25 | /* This declaration is solely to ensure that after preprocessing | 26 | /* This declaration is solely to ensure that after preprocessing |
26 | this file is never empty. */ | 27 | this file is never empty. */ |
@@ -37,14 +38,14 @@ typedef int dummy; | |||
37 | 38 | ||
38 | /* Macro for exporting a symbol (function, not variable) defined in this file, | 39 | /* Macro for exporting a symbol (function, not variable) defined in this file, |
39 | when compiled into a shared library. */ | 40 | when compiled into a shared library. */ |
40 | # ifndef DLL_EXPORTED | 41 | # ifndef SHLIB_EXPORTED |
41 | # if HAVE_VISIBILITY | 42 | # if HAVE_VISIBILITY |
42 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ | 43 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ |
43 | # define DLL_EXPORTED __attribute__((__visibility__("default"))) | 44 | # define SHLIB_EXPORTED __attribute__((__visibility__("default"))) |
44 | # elif defined _WIN32 || defined __CYGWIN__ | 45 | # elif defined _WIN32 || defined __CYGWIN__ |
45 | # define DLL_EXPORTED __declspec(dllexport) | 46 | # define SHLIB_EXPORTED __declspec(dllexport) |
46 | # else | 47 | # else |
47 | # define DLL_EXPORTED | 48 | # define SHLIB_EXPORTED |
48 | # endif | 49 | # endif |
49 | # endif | 50 | # endif |
50 | 51 | ||
@@ -59,7 +60,7 @@ typedef int dummy; | |||
59 | because the latter is not guaranteed to be a stable ABI in the future. */ | 60 | because the latter is not guaranteed to be a stable ABI in the future. */ |
60 | 61 | ||
61 | /* Make sure the function gets exported from DLLs. */ | 62 | /* Make sure the function gets exported from DLLs. */ |
62 | DLL_EXPORTED CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); | 63 | SHLIB_EXPORTED CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); |
63 | 64 | ||
64 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; | 65 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; |
65 | static CRITICAL_SECTION lock; | 66 | static CRITICAL_SECTION lock; |
@@ -96,7 +97,7 @@ gl_get_nl_langinfo_lock (void) | |||
96 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; | 97 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
97 | 98 | ||
98 | /* Make sure the function gets exported from shared libraries. */ | 99 | /* Make sure the function gets exported from shared libraries. */ |
99 | DLL_EXPORTED pthread_mutex_t *gl_get_nl_langinfo_lock (void); | 100 | SHLIB_EXPORTED pthread_mutex_t *gl_get_nl_langinfo_lock (void); |
100 | 101 | ||
101 | /* Returns the internal lock used by nl_langinfo. */ | 102 | /* Returns the internal lock used by nl_langinfo. */ |
102 | pthread_mutex_t * | 103 | pthread_mutex_t * |
@@ -123,7 +124,7 @@ atomic_init (void) | |||
123 | } | 124 | } |
124 | 125 | ||
125 | /* Make sure the function gets exported from shared libraries. */ | 126 | /* Make sure the function gets exported from shared libraries. */ |
126 | DLL_EXPORTED mtx_t *gl_get_nl_langinfo_lock (void); | 127 | SHLIB_EXPORTED mtx_t *gl_get_nl_langinfo_lock (void); |
127 | 128 | ||
128 | /* Returns the internal lock used by nl_langinfo. */ | 129 | /* Returns the internal lock used by nl_langinfo. */ |
129 | mtx_t * | 130 | mtx_t * |
diff --git a/gl/nl_langinfo.c b/gl/nl_langinfo.c index 131166fd..64ff93b0 100644 --- a/gl/nl_langinfo.c +++ b/gl/nl_langinfo.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* nl_langinfo() replacement: query locale dependent information. | 1 | /* nl_langinfo() replacement: query locale dependent information. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -30,7 +30,12 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE | 32 | #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE |
33 | # if defined _WIN32 && !defined __CYGWIN__ | 33 | |
34 | # if AVOID_ANY_THREADS | ||
35 | |||
36 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
37 | |||
38 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
34 | 39 | ||
35 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ | 40 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ |
36 | # include <windows.h> | 41 | # include <windows.h> |
@@ -51,6 +56,7 @@ | |||
51 | # include <threads.h> | 56 | # include <threads.h> |
52 | 57 | ||
53 | # endif | 58 | # endif |
59 | |||
54 | #endif | 60 | #endif |
55 | 61 | ||
56 | /* nl_langinfo() must be multithread-safe. To achieve this without using | 62 | /* nl_langinfo() must be multithread-safe. To achieve this without using |
@@ -70,6 +76,8 @@ | |||
70 | static char * | 76 | static char * |
71 | ctype_codeset (void) | 77 | ctype_codeset (void) |
72 | { | 78 | { |
79 | /* This function is only used on platforms which don't have uselocale(). | ||
80 | Therefore we don't need to look at the per-thread locale first, here. */ | ||
73 | static char result[2 + 10 + 1]; | 81 | static char result[2 + 10 + 1]; |
74 | char buf[2 + 10 + 1]; | 82 | char buf[2 + 10 + 1]; |
75 | char locale[SETLOCALE_NULL_MAX]; | 83 | char locale[SETLOCALE_NULL_MAX]; |
@@ -184,7 +192,12 @@ nl_langinfo_unlocked (nl_item item) | |||
184 | /* Prohibit renaming this symbol. */ | 192 | /* Prohibit renaming this symbol. */ |
185 | # undef gl_get_nl_langinfo_lock | 193 | # undef gl_get_nl_langinfo_lock |
186 | 194 | ||
187 | # if defined _WIN32 && !defined __CYGWIN__ | 195 | # if AVOID_ANY_THREADS |
196 | |||
197 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
198 | # define nl_langinfo_with_lock nl_langinfo_unlocked | ||
199 | |||
200 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
188 | 201 | ||
189 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); | 202 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); |
190 | 203 | ||
@@ -449,7 +462,7 @@ nl_langinfo (nl_item item) | |||
449 | { | 462 | { |
450 | static char const months[][sizeof "September"] = { | 463 | static char const months[][sizeof "September"] = { |
451 | "January", "February", "March", "April", "May", "June", "July", | 464 | "January", "February", "March", "April", "May", "June", "July", |
452 | "September", "October", "November", "December" | 465 | "August", "September", "October", "November", "December" |
453 | }; | 466 | }; |
454 | case MON_1: | 467 | case MON_1: |
455 | case MON_2: | 468 | case MON_2: |
@@ -513,7 +526,7 @@ nl_langinfo (nl_item item) | |||
513 | static char result[12][30]; | 526 | static char result[12][30]; |
514 | static char const abmonths[][sizeof "Jan"] = { | 527 | static char const abmonths[][sizeof "Jan"] = { |
515 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", | 528 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", |
516 | "Sep", "Oct", "Nov", "Dec" | 529 | "Aug", "Sep", "Oct", "Nov", "Dec" |
517 | }; | 530 | }; |
518 | tmm.tm_mon = item - ABMON_1; | 531 | tmm.tm_mon = item - ABMON_1; |
519 | if (!strftime (buf, sizeof result[0], "%b", &tmm)) | 532 | if (!strftime (buf, sizeof result[0], "%b", &tmm)) |
@@ -1,5 +1,5 @@ | |||
1 | /* Open a descriptor to a file. | 1 | /* Open a descriptor to a file. |
2 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -38,9 +38,13 @@ orig_open (const char *filename, int flags, mode_t mode) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | /* Specification. */ | 40 | /* Specification. */ |
41 | #ifdef __osf__ | ||
41 | /* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates | 42 | /* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates |
42 | this include because of the preliminary #include <fcntl.h> above. */ | 43 | this include because of the preliminary #include <fcntl.h> above. */ |
43 | #include "fcntl.h" | 44 | # include "fcntl.h" |
45 | #else | ||
46 | # include <fcntl.h> | ||
47 | #endif | ||
44 | 48 | ||
45 | #include "cloexec.h" | 49 | #include "cloexec.h" |
46 | 50 | ||
diff --git a/gl/pathmax.h b/gl/pathmax.h index 0dd8f3bc..d6512c6f 100644 --- a/gl/pathmax.h +++ b/gl/pathmax.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Define PATH_MAX somehow. Requires sys/types.h. | 1 | /* Define PATH_MAX somehow. Requires sys/types.h. |
2 | Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2023 Free Software | 2 | Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -39,6 +39,11 @@ | |||
39 | #endif | 39 | #endif |
40 | */ | 40 | */ |
41 | 41 | ||
42 | /* This file uses HAVE_SYS_PARAM_H. */ | ||
43 | # if !_GL_CONFIG_H_INCLUDED | ||
44 | # error "Please include config.h first." | ||
45 | # endif | ||
46 | |||
42 | # include <unistd.h> | 47 | # include <unistd.h> |
43 | 48 | ||
44 | # include <limits.h> | 49 | # include <limits.h> |
diff --git a/gl/printf-args.c b/gl/printf-args.c index 5e14f654..eb0d2cdc 100644 --- a/gl/printf-args.c +++ b/gl/printf-args.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Decomposed printf argument list. | 1 | /* Decomposed printf argument list. |
2 | Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2023 Free Software | 2 | Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -29,6 +29,9 @@ | |||
29 | # include "printf-args.h" | 29 | # include "printf-args.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | /* Get INT_WIDTH. */ | ||
33 | #include <limits.h> | ||
34 | |||
32 | #ifdef STATIC | 35 | #ifdef STATIC |
33 | STATIC | 36 | STATIC |
34 | #endif | 37 | #endif |
@@ -71,6 +74,102 @@ PRINTF_FETCHARGS (va_list args, arguments *a) | |||
71 | case TYPE_ULONGLONGINT: | 74 | case TYPE_ULONGLONGINT: |
72 | ap->a.a_ulonglongint = va_arg (args, unsigned long long int); | 75 | ap->a.a_ulonglongint = va_arg (args, unsigned long long int); |
73 | break; | 76 | break; |
77 | case TYPE_INT8_T: | ||
78 | #if INT8_WIDTH < INT_WIDTH | ||
79 | ap->a.a_int8_t = va_arg (args, /* int8_t */ int); | ||
80 | #else | ||
81 | ap->a.a_int8_t = va_arg (args, int8_t); | ||
82 | #endif | ||
83 | break; | ||
84 | case TYPE_UINT8_T: | ||
85 | #if UINT8_WIDTH < INT_WIDTH | ||
86 | ap->a.a_uint8_t = va_arg (args, /* uint8_t */ int); | ||
87 | #else | ||
88 | ap->a.a_uint8_t = va_arg (args, uint8_t); | ||
89 | #endif | ||
90 | break; | ||
91 | case TYPE_INT16_T: | ||
92 | #if INT16_WIDTH < INT_WIDTH | ||
93 | ap->a.a_int16_t = va_arg (args, /* int16_t */ int); | ||
94 | #else | ||
95 | ap->a.a_int16_t = va_arg (args, int16_t); | ||
96 | #endif | ||
97 | break; | ||
98 | case TYPE_UINT16_T: | ||
99 | #if UINT16_WIDTH < INT_WIDTH | ||
100 | ap->a.a_uint16_t = va_arg (args, /* uint16_t */ int); | ||
101 | #else | ||
102 | ap->a.a_uint16_t = va_arg (args, uint16_t); | ||
103 | #endif | ||
104 | break; | ||
105 | case TYPE_INT32_T: | ||
106 | #if INT32_WIDTH < INT_WIDTH | ||
107 | ap->a.a_int32_t = va_arg (args, /* int32_t */ int); | ||
108 | #else | ||
109 | ap->a.a_int32_t = va_arg (args, int32_t); | ||
110 | #endif | ||
111 | break; | ||
112 | case TYPE_UINT32_T: | ||
113 | #if UINT32_WIDTH < INT_WIDTH | ||
114 | ap->a.a_uint32_t = va_arg (args, /* uint32_t */ int); | ||
115 | #else | ||
116 | ap->a.a_uint32_t = va_arg (args, uint32_t); | ||
117 | #endif | ||
118 | break; | ||
119 | case TYPE_INT64_T: | ||
120 | ap->a.a_int64_t = va_arg (args, int64_t); | ||
121 | break; | ||
122 | case TYPE_UINT64_T: | ||
123 | ap->a.a_uint64_t = va_arg (args, uint64_t); | ||
124 | break; | ||
125 | case TYPE_INT_FAST8_T: | ||
126 | #if INT_FAST8_WIDTH < INT_WIDTH | ||
127 | ap->a.a_int_fast8_t = va_arg (args, /* int_fast8_t */ int); | ||
128 | #else | ||
129 | ap->a.a_int_fast8_t = va_arg (args, int_fast8_t); | ||
130 | #endif | ||
131 | break; | ||
132 | case TYPE_UINT_FAST8_T: | ||
133 | #if UINT_FAST8_WIDTH < INT_WIDTH | ||
134 | ap->a.a_uint_fast8_t = va_arg (args, /* uint_fast8_t */ int); | ||
135 | #else | ||
136 | ap->a.a_uint_fast8_t = va_arg (args, uint_fast8_t); | ||
137 | #endif | ||
138 | break; | ||
139 | case TYPE_INT_FAST16_T: | ||
140 | #if INT_FAST16_WIDTH < INT_WIDTH | ||
141 | ap->a.a_int_fast16_t = va_arg (args, /* int_fast16_t */ int); | ||
142 | #else | ||
143 | ap->a.a_int_fast16_t = va_arg (args, int_fast16_t); | ||
144 | #endif | ||
145 | break; | ||
146 | case TYPE_UINT_FAST16_T: | ||
147 | #if UINT_FAST16_WIDTH < INT_WIDTH | ||
148 | ap->a.a_uint_fast16_t = va_arg (args, /* uint_fast16_t */ int); | ||
149 | #else | ||
150 | ap->a.a_uint_fast16_t = va_arg (args, uint_fast16_t); | ||
151 | #endif | ||
152 | break; | ||
153 | case TYPE_INT_FAST32_T: | ||
154 | #if INT_FAST32_WIDTH < INT_WIDTH | ||
155 | ap->a.a_int_fast32_t = va_arg (args, /* int_fast32_t */ int); | ||
156 | #else | ||
157 | ap->a.a_int_fast32_t = va_arg (args, int_fast32_t); | ||
158 | #endif | ||
159 | break; | ||
160 | case TYPE_UINT_FAST32_T: | ||
161 | #if UINT_FAST32_WIDTH < INT_WIDTH | ||
162 | ap->a.a_uint_fast32_t = va_arg (args, /* uint_fast32_t */ int); | ||
163 | #else | ||
164 | ap->a.a_uint_fast32_t = va_arg (args, uint_fast32_t); | ||
165 | #endif | ||
166 | break; | ||
167 | case TYPE_INT_FAST64_T: | ||
168 | ap->a.a_int_fast64_t = va_arg (args, int_fast64_t); | ||
169 | break; | ||
170 | case TYPE_UINT_FAST64_T: | ||
171 | ap->a.a_uint_fast64_t = va_arg (args, uint_fast64_t); | ||
172 | break; | ||
74 | case TYPE_DOUBLE: | 173 | case TYPE_DOUBLE: |
75 | ap->a.a_double = va_arg (args, double); | 174 | ap->a.a_double = va_arg (args, double); |
76 | break; | 175 | break; |
@@ -136,6 +235,30 @@ PRINTF_FETCHARGS (va_list args, arguments *a) | |||
136 | case TYPE_COUNT_LONGLONGINT_POINTER: | 235 | case TYPE_COUNT_LONGLONGINT_POINTER: |
137 | ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); | 236 | ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); |
138 | break; | 237 | break; |
238 | case TYPE_COUNT_INT8_T_POINTER: | ||
239 | ap->a.a_count_int8_t_pointer = va_arg (args, int8_t *); | ||
240 | break; | ||
241 | case TYPE_COUNT_INT16_T_POINTER: | ||
242 | ap->a.a_count_int16_t_pointer = va_arg (args, int16_t *); | ||
243 | break; | ||
244 | case TYPE_COUNT_INT32_T_POINTER: | ||
245 | ap->a.a_count_int32_t_pointer = va_arg (args, int32_t *); | ||
246 | break; | ||
247 | case TYPE_COUNT_INT64_T_POINTER: | ||
248 | ap->a.a_count_int64_t_pointer = va_arg (args, int64_t *); | ||
249 | break; | ||
250 | case TYPE_COUNT_INT_FAST8_T_POINTER: | ||
251 | ap->a.a_count_int_fast8_t_pointer = va_arg (args, int_fast8_t *); | ||
252 | break; | ||
253 | case TYPE_COUNT_INT_FAST16_T_POINTER: | ||
254 | ap->a.a_count_int_fast16_t_pointer = va_arg (args, int_fast16_t *); | ||
255 | break; | ||
256 | case TYPE_COUNT_INT_FAST32_T_POINTER: | ||
257 | ap->a.a_count_int_fast32_t_pointer = va_arg (args, int_fast32_t *); | ||
258 | break; | ||
259 | case TYPE_COUNT_INT_FAST64_T_POINTER: | ||
260 | ap->a.a_count_int_fast64_t_pointer = va_arg (args, int_fast64_t *); | ||
261 | break; | ||
139 | #if ENABLE_UNISTDIO | 262 | #if ENABLE_UNISTDIO |
140 | /* The unistdio extensions. */ | 263 | /* The unistdio extensions. */ |
141 | case TYPE_U8_STRING: | 264 | case TYPE_U8_STRING: |
diff --git a/gl/printf-args.h b/gl/printf-args.h index f303cb19..9b80bb39 100644 --- a/gl/printf-args.h +++ b/gl/printf-args.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Decomposed printf argument list. | 1 | /* Decomposed printf argument list. |
2 | Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2023 Free Software | 2 | Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -41,6 +41,9 @@ | |||
41 | # include <wchar.h> | 41 | # include <wchar.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* Get intN_t, uintN_t, intN_fast_t, uintN_fast_t. */ | ||
45 | #include <stdint.h> | ||
46 | |||
44 | /* Get va_list. */ | 47 | /* Get va_list. */ |
45 | #include <stdarg.h> | 48 | #include <stdarg.h> |
46 | 49 | ||
@@ -59,6 +62,26 @@ typedef enum | |||
59 | TYPE_ULONGINT, | 62 | TYPE_ULONGINT, |
60 | TYPE_LONGLONGINT, | 63 | TYPE_LONGLONGINT, |
61 | TYPE_ULONGLONGINT, | 64 | TYPE_ULONGLONGINT, |
65 | /* According to ISO C 23 § 7.23.6.1, "all exact-width integer types", | ||
66 | "all minimum-width integer types", and "all fastest minimum-width integer | ||
67 | types" defined in <stdint.h> should be supported. But for portability | ||
68 | between platforms, we support only those with N = 8, 16, 32, 64. */ | ||
69 | TYPE_INT8_T, | ||
70 | TYPE_UINT8_T, | ||
71 | TYPE_INT16_T, | ||
72 | TYPE_UINT16_T, | ||
73 | TYPE_INT32_T, | ||
74 | TYPE_UINT32_T, | ||
75 | TYPE_INT64_T, | ||
76 | TYPE_UINT64_T, | ||
77 | TYPE_INT_FAST8_T, | ||
78 | TYPE_UINT_FAST8_T, | ||
79 | TYPE_INT_FAST16_T, | ||
80 | TYPE_UINT_FAST16_T, | ||
81 | TYPE_INT_FAST32_T, | ||
82 | TYPE_UINT_FAST32_T, | ||
83 | TYPE_INT_FAST64_T, | ||
84 | TYPE_UINT_FAST64_T, | ||
62 | TYPE_DOUBLE, | 85 | TYPE_DOUBLE, |
63 | TYPE_LONGDOUBLE, | 86 | TYPE_LONGDOUBLE, |
64 | TYPE_CHAR, | 87 | TYPE_CHAR, |
@@ -74,7 +97,15 @@ typedef enum | |||
74 | TYPE_COUNT_SHORT_POINTER, | 97 | TYPE_COUNT_SHORT_POINTER, |
75 | TYPE_COUNT_INT_POINTER, | 98 | TYPE_COUNT_INT_POINTER, |
76 | TYPE_COUNT_LONGINT_POINTER, | 99 | TYPE_COUNT_LONGINT_POINTER, |
77 | TYPE_COUNT_LONGLONGINT_POINTER | 100 | TYPE_COUNT_LONGLONGINT_POINTER, |
101 | TYPE_COUNT_INT8_T_POINTER, | ||
102 | TYPE_COUNT_INT16_T_POINTER, | ||
103 | TYPE_COUNT_INT32_T_POINTER, | ||
104 | TYPE_COUNT_INT64_T_POINTER, | ||
105 | TYPE_COUNT_INT_FAST8_T_POINTER, | ||
106 | TYPE_COUNT_INT_FAST16_T_POINTER, | ||
107 | TYPE_COUNT_INT_FAST32_T_POINTER, | ||
108 | TYPE_COUNT_INT_FAST64_T_POINTER | ||
78 | #if ENABLE_UNISTDIO | 109 | #if ENABLE_UNISTDIO |
79 | /* The unistdio extensions. */ | 110 | /* The unistdio extensions. */ |
80 | , TYPE_U8_STRING | 111 | , TYPE_U8_STRING |
@@ -99,7 +130,23 @@ typedef struct | |||
99 | unsigned long int a_ulongint; | 130 | unsigned long int a_ulongint; |
100 | long long int a_longlongint; | 131 | long long int a_longlongint; |
101 | unsigned long long int a_ulonglongint; | 132 | unsigned long long int a_ulonglongint; |
102 | float a_float; | 133 | int8_t a_int8_t; |
134 | uint8_t a_uint8_t; | ||
135 | int16_t a_int16_t; | ||
136 | uint16_t a_uint16_t; | ||
137 | int32_t a_int32_t; | ||
138 | uint32_t a_uint32_t; | ||
139 | int64_t a_int64_t; | ||
140 | uint64_t a_uint64_t; | ||
141 | int_fast8_t a_int_fast8_t; | ||
142 | uint_fast8_t a_uint_fast8_t; | ||
143 | int_fast16_t a_int_fast16_t; | ||
144 | uint_fast16_t a_uint_fast16_t; | ||
145 | int_fast32_t a_int_fast32_t; | ||
146 | uint_fast32_t a_uint_fast32_t; | ||
147 | int_fast64_t a_int_fast64_t; | ||
148 | uint_fast64_t a_uint_fast64_t; | ||
149 | float a_float; /* unused */ | ||
103 | double a_double; | 150 | double a_double; |
104 | long double a_longdouble; | 151 | long double a_longdouble; |
105 | int a_char; | 152 | int a_char; |
@@ -116,6 +163,14 @@ typedef struct | |||
116 | int * a_count_int_pointer; | 163 | int * a_count_int_pointer; |
117 | long int * a_count_longint_pointer; | 164 | long int * a_count_longint_pointer; |
118 | long long int * a_count_longlongint_pointer; | 165 | long long int * a_count_longlongint_pointer; |
166 | int8_t * a_count_int8_t_pointer; | ||
167 | int16_t * a_count_int16_t_pointer; | ||
168 | int32_t * a_count_int32_t_pointer; | ||
169 | int64_t * a_count_int64_t_pointer; | ||
170 | int_fast8_t * a_count_int_fast8_t_pointer; | ||
171 | int_fast16_t * a_count_int_fast16_t_pointer; | ||
172 | int_fast32_t * a_count_int_fast32_t_pointer; | ||
173 | int_fast64_t * a_count_int_fast64_t_pointer; | ||
119 | #if ENABLE_UNISTDIO | 174 | #if ENABLE_UNISTDIO |
120 | /* The unistdio extensions. */ | 175 | /* The unistdio extensions. */ |
121 | const uint8_t * a_u8_string; | 176 | const uint8_t * a_u8_string; |
diff --git a/gl/printf-parse.c b/gl/printf-parse.c index 3040749a..a33e27a0 100644 --- a/gl/printf-parse.c +++ b/gl/printf-parse.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999-2000, 2002-2003, 2006-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2000, 2002-2003, 2006-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -326,226 +326,320 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) | |||
326 | arg_type type; | 326 | arg_type type; |
327 | 327 | ||
328 | /* Parse argument type/size specifiers. */ | 328 | /* Parse argument type/size specifiers. */ |
329 | { | 329 | /* Relevant for the conversion characters d, i. */ |
330 | int flags = 0; | 330 | arg_type signed_type = TYPE_INT; |
331 | 331 | /* Relevant for the conversion characters b, o, u, x, X. */ | |
332 | for (;;) | 332 | arg_type unsigned_type = TYPE_UINT; |
333 | { | 333 | /* Relevant for the conversion characters n. */ |
334 | if (*cp == 'h') | 334 | arg_type pointer_type = TYPE_COUNT_INT_POINTER; |
335 | { | 335 | /* Relevant for the conversion characters a, A, e, E, f, F, g, G. */ |
336 | flags |= (1 << (flags & 1)); | 336 | arg_type floatingpoint_type = TYPE_DOUBLE; |
337 | cp++; | 337 | |
338 | } | 338 | if (*cp == 'h') |
339 | else if (*cp == 'L') | 339 | { |
340 | { | 340 | if (cp[1] == 'h') |
341 | flags |= 4; | 341 | { |
342 | cp++; | 342 | signed_type = TYPE_SCHAR; |
343 | } | 343 | unsigned_type = TYPE_UCHAR; |
344 | else if (*cp == 'l') | 344 | pointer_type = TYPE_COUNT_SCHAR_POINTER; |
345 | { | 345 | cp += 2; |
346 | flags += 8; | 346 | } |
347 | cp++; | 347 | else |
348 | } | 348 | { |
349 | else if (*cp == 'j') | 349 | signed_type = TYPE_SHORT; |
350 | { | 350 | unsigned_type = TYPE_USHORT; |
351 | if (sizeof (intmax_t) > sizeof (long)) | 351 | pointer_type = TYPE_COUNT_SHORT_POINTER; |
352 | { | 352 | cp++; |
353 | /* intmax_t = long long */ | 353 | } |
354 | flags += 16; | 354 | } |
355 | } | 355 | else if (*cp == 'l') |
356 | else if (sizeof (intmax_t) > sizeof (int)) | 356 | { |
357 | { | 357 | if (cp[1] == 'l') |
358 | /* intmax_t = long */ | 358 | { |
359 | flags += 8; | 359 | signed_type = TYPE_LONGLONGINT; |
360 | } | 360 | unsigned_type = TYPE_ULONGLONGINT; |
361 | cp++; | 361 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; |
362 | } | 362 | /* For backward compatibility only. */ |
363 | else if (*cp == 'z' || *cp == 'Z') | 363 | floatingpoint_type = TYPE_LONGDOUBLE; |
364 | { | 364 | cp += 2; |
365 | /* 'z' is standardized in ISO C 99, but glibc uses 'Z' | 365 | } |
366 | because the warning facility in gcc-2.95.2 understands | 366 | else |
367 | only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ | 367 | { |
368 | if (sizeof (size_t) > sizeof (long)) | 368 | signed_type = TYPE_LONGINT; |
369 | { | 369 | unsigned_type = TYPE_ULONGINT; |
370 | /* size_t = long long */ | 370 | pointer_type = TYPE_COUNT_LONGINT_POINTER; |
371 | flags += 16; | 371 | cp++; |
372 | } | 372 | } |
373 | else if (sizeof (size_t) > sizeof (int)) | 373 | } |
374 | { | 374 | else if (*cp == 'j') |
375 | /* size_t = long */ | 375 | { |
376 | flags += 8; | 376 | if (sizeof (intmax_t) > sizeof (long)) |
377 | } | 377 | { |
378 | cp++; | 378 | /* intmax_t = long long */ |
379 | } | 379 | signed_type = TYPE_LONGLONGINT; |
380 | else if (*cp == 't') | 380 | unsigned_type = TYPE_ULONGLONGINT; |
381 | { | 381 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; |
382 | if (sizeof (ptrdiff_t) > sizeof (long)) | 382 | /* For backward compatibility only. */ |
383 | { | 383 | floatingpoint_type = TYPE_LONGDOUBLE; |
384 | /* ptrdiff_t = long long */ | 384 | } |
385 | flags += 16; | 385 | else if (sizeof (intmax_t) > sizeof (int)) |
386 | } | 386 | { |
387 | else if (sizeof (ptrdiff_t) > sizeof (int)) | 387 | /* intmax_t = long */ |
388 | { | 388 | signed_type = TYPE_LONGINT; |
389 | /* ptrdiff_t = long */ | 389 | unsigned_type = TYPE_ULONGINT; |
390 | flags += 8; | 390 | pointer_type = TYPE_COUNT_LONGINT_POINTER; |
391 | } | 391 | } |
392 | cp++; | 392 | cp++; |
393 | } | 393 | } |
394 | else if (*cp == 'z' || *cp == 'Z') | ||
395 | { | ||
396 | /* 'z' is standardized in ISO C 99, but glibc uses 'Z' | ||
397 | because the warning facility in gcc-2.95.2 understands | ||
398 | only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ | ||
399 | if (sizeof (size_t) > sizeof (long)) | ||
400 | { | ||
401 | /* size_t = unsigned long long */ | ||
402 | signed_type = TYPE_LONGLONGINT; | ||
403 | unsigned_type = TYPE_ULONGLONGINT; | ||
404 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; | ||
405 | /* For backward compatibility only. */ | ||
406 | floatingpoint_type = TYPE_LONGDOUBLE; | ||
407 | } | ||
408 | else if (sizeof (size_t) > sizeof (int)) | ||
409 | { | ||
410 | /* size_t = unsigned long */ | ||
411 | signed_type = TYPE_LONGINT; | ||
412 | unsigned_type = TYPE_ULONGINT; | ||
413 | pointer_type = TYPE_COUNT_LONGINT_POINTER; | ||
414 | } | ||
415 | cp++; | ||
416 | } | ||
417 | else if (*cp == 't') | ||
418 | { | ||
419 | if (sizeof (ptrdiff_t) > sizeof (long)) | ||
420 | { | ||
421 | /* ptrdiff_t = long long */ | ||
422 | signed_type = TYPE_LONGLONGINT; | ||
423 | unsigned_type = TYPE_ULONGLONGINT; | ||
424 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; | ||
425 | /* For backward compatibility only. */ | ||
426 | floatingpoint_type = TYPE_LONGDOUBLE; | ||
427 | } | ||
428 | else if (sizeof (ptrdiff_t) > sizeof (int)) | ||
429 | { | ||
430 | /* ptrdiff_t = long */ | ||
431 | signed_type = TYPE_LONGINT; | ||
432 | unsigned_type = TYPE_ULONGINT; | ||
433 | pointer_type = TYPE_COUNT_LONGINT_POINTER; | ||
434 | } | ||
435 | cp++; | ||
436 | } | ||
437 | else if (*cp == 'w') | ||
438 | { | ||
439 | /* wN and wfN are standardized in ISO C 23. */ | ||
440 | if (cp[1] == 'f') | ||
441 | { | ||
442 | if (cp[2] == '8') | ||
443 | { | ||
444 | signed_type = TYPE_INT_FAST8_T; | ||
445 | unsigned_type = TYPE_UINT_FAST8_T; | ||
446 | pointer_type = TYPE_COUNT_INT_FAST8_T_POINTER; | ||
447 | cp += 3; | ||
448 | } | ||
449 | else if (cp[2] == '1' && cp[3] == '6') | ||
450 | { | ||
451 | signed_type = TYPE_INT_FAST16_T; | ||
452 | unsigned_type = TYPE_UINT_FAST16_T; | ||
453 | pointer_type = TYPE_COUNT_INT_FAST16_T_POINTER; | ||
454 | cp += 4; | ||
455 | } | ||
456 | else if (cp[2] == '3' && cp[3] == '2') | ||
457 | { | ||
458 | signed_type = TYPE_INT_FAST32_T; | ||
459 | unsigned_type = TYPE_UINT_FAST32_T; | ||
460 | pointer_type = TYPE_COUNT_INT_FAST32_T_POINTER; | ||
461 | cp += 4; | ||
462 | } | ||
463 | else if (cp[2] == '6' && cp[3] == '4') | ||
464 | { | ||
465 | signed_type = TYPE_INT_FAST64_T; | ||
466 | unsigned_type = TYPE_UINT_FAST64_T; | ||
467 | pointer_type = TYPE_COUNT_INT_FAST64_T_POINTER; | ||
468 | cp += 4; | ||
469 | } | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | if (cp[1] == '8') | ||
474 | { | ||
475 | signed_type = TYPE_INT8_T; | ||
476 | unsigned_type = TYPE_UINT8_T; | ||
477 | pointer_type = TYPE_COUNT_INT8_T_POINTER; | ||
478 | cp += 2; | ||
479 | } | ||
480 | else if (cp[1] == '1' && cp[2] == '6') | ||
481 | { | ||
482 | signed_type = TYPE_INT16_T; | ||
483 | unsigned_type = TYPE_UINT16_T; | ||
484 | pointer_type = TYPE_COUNT_INT16_T_POINTER; | ||
485 | cp += 3; | ||
486 | } | ||
487 | else if (cp[1] == '3' && cp[2] == '2') | ||
488 | { | ||
489 | signed_type = TYPE_INT32_T; | ||
490 | unsigned_type = TYPE_UINT32_T; | ||
491 | pointer_type = TYPE_COUNT_INT32_T_POINTER; | ||
492 | cp += 3; | ||
493 | } | ||
494 | else if (cp[1] == '6' && cp[2] == '4') | ||
495 | { | ||
496 | signed_type = TYPE_INT64_T; | ||
497 | unsigned_type = TYPE_UINT64_T; | ||
498 | pointer_type = TYPE_COUNT_INT64_T_POINTER; | ||
499 | cp += 3; | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | else if (*cp == 'L') | ||
504 | { | ||
505 | signed_type = TYPE_LONGLONGINT; | ||
506 | unsigned_type = TYPE_ULONGLONGINT; | ||
507 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; | ||
508 | floatingpoint_type = TYPE_LONGDOUBLE; | ||
509 | cp++; | ||
510 | } | ||
394 | #if defined __APPLE__ && defined __MACH__ | 511 | #if defined __APPLE__ && defined __MACH__ |
395 | /* On Mac OS X 10.3, PRIdMAX is defined as "qd". | 512 | /* On Mac OS X 10.3, PRIdMAX is defined as "qd". |
396 | We cannot change it to "lld" because PRIdMAX must also | 513 | We cannot change it to "lld" because PRIdMAX must also |
397 | be understood by the system's printf routines. */ | 514 | be understood by the system's printf routines. */ |
398 | else if (*cp == 'q') | 515 | else if (*cp == 'q') |
399 | { | 516 | { |
400 | if (64 / 8 > sizeof (long)) | 517 | if (64 / 8 > sizeof (long)) |
401 | { | 518 | { |
402 | /* int64_t = long long */ | 519 | /* int64_t = long long */ |
403 | flags += 16; | 520 | signed_type = TYPE_LONGLONGINT; |
404 | } | 521 | unsigned_type = TYPE_ULONGLONGINT; |
405 | else | 522 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; |
406 | { | 523 | /* For backward compatibility only. */ |
407 | /* int64_t = long */ | 524 | floatingpoint_type = TYPE_LONGDOUBLE; |
408 | flags += 8; | 525 | } |
409 | } | 526 | else |
410 | cp++; | 527 | { |
411 | } | 528 | /* int64_t = long */ |
529 | signed_type = TYPE_LONGINT; | ||
530 | unsigned_type = TYPE_ULONGINT; | ||
531 | pointer_type = TYPE_COUNT_LONGINT_POINTER; | ||
532 | } | ||
533 | cp++; | ||
534 | } | ||
412 | #endif | 535 | #endif |
413 | #if defined _WIN32 && ! defined __CYGWIN__ | 536 | #if defined _WIN32 && ! defined __CYGWIN__ |
414 | /* On native Windows, PRIdMAX is defined as "I64d". | 537 | /* On native Windows, PRIdMAX is defined as "I64d". |
415 | We cannot change it to "lld" because PRIdMAX must also | 538 | We cannot change it to "lld" because PRIdMAX must also |
416 | be understood by the system's printf routines. */ | 539 | be understood by the system's printf routines. */ |
417 | else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') | 540 | else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') |
418 | { | 541 | { |
419 | if (64 / 8 > sizeof (long)) | 542 | if (64 / 8 > sizeof (long)) |
420 | { | 543 | { |
421 | /* __int64 = long long */ | 544 | /* __int64_t = long long */ |
422 | flags += 16; | 545 | signed_type = TYPE_LONGLONGINT; |
423 | } | 546 | unsigned_type = TYPE_ULONGLONGINT; |
424 | else | 547 | pointer_type = TYPE_COUNT_LONGLONGINT_POINTER; |
425 | { | 548 | /* For backward compatibility only. */ |
426 | /* __int64 = long */ | 549 | floatingpoint_type = TYPE_LONGDOUBLE; |
427 | flags += 8; | 550 | } |
428 | } | 551 | else |
429 | cp += 3; | 552 | { |
430 | } | 553 | /* __int64_t = long */ |
554 | signed_type = TYPE_LONGINT; | ||
555 | unsigned_type = TYPE_ULONGINT; | ||
556 | pointer_type = TYPE_COUNT_LONGINT_POINTER; | ||
557 | } | ||
558 | cp += 3; | ||
559 | } | ||
431 | #endif | 560 | #endif |
432 | else | 561 | (void) pointer_type; |
433 | break; | ||
434 | } | ||
435 | 562 | ||
436 | /* Read the conversion character. */ | 563 | /* Read the conversion character. */ |
437 | c = *cp++; | 564 | c = *cp++; |
438 | switch (c) | 565 | switch (c) |
439 | { | 566 | { |
440 | case 'd': case 'i': | 567 | case 'd': case 'i': |
441 | /* If 'long long' is larger than 'long': */ | 568 | type = signed_type; |
442 | if (flags >= 16 || (flags & 4)) | 569 | break; |
443 | type = TYPE_LONGLONGINT; | 570 | case 'b': case 'o': case 'u': case 'x': case 'X': |
444 | else | 571 | #if SUPPORT_GNU_PRINTF_DIRECTIVES \ |
445 | /* If 'long long' is the same as 'long', we parse "lld" into | 572 | || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2) |
446 | TYPE_LONGINT. */ | 573 | case 'B': |
447 | if (flags >= 8) | 574 | #endif |
448 | type = TYPE_LONGINT; | 575 | type = unsigned_type; |
449 | else if (flags & 2) | 576 | break; |
450 | type = TYPE_SCHAR; | 577 | case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': |
451 | else if (flags & 1) | 578 | case 'a': case 'A': |
452 | type = TYPE_SHORT; | 579 | type = floatingpoint_type; |
453 | else | 580 | break; |
454 | type = TYPE_INT; | 581 | case 'c': |
455 | break; | 582 | if (signed_type == TYPE_LONGINT |
456 | case 'o': case 'u': case 'x': case 'X': | 583 | /* For backward compatibility only. */ |
457 | /* If 'unsigned long long' is larger than 'unsigned long': */ | 584 | || signed_type == TYPE_LONGLONGINT) |
458 | if (flags >= 16 || (flags & 4)) | ||
459 | type = TYPE_ULONGLONGINT; | ||
460 | else | ||
461 | /* If 'unsigned long long' is the same as 'unsigned long', we | ||
462 | parse "llu" into TYPE_ULONGINT. */ | ||
463 | if (flags >= 8) | ||
464 | type = TYPE_ULONGINT; | ||
465 | else if (flags & 2) | ||
466 | type = TYPE_UCHAR; | ||
467 | else if (flags & 1) | ||
468 | type = TYPE_USHORT; | ||
469 | else | ||
470 | type = TYPE_UINT; | ||
471 | break; | ||
472 | case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': | ||
473 | case 'a': case 'A': | ||
474 | if (flags >= 16 || (flags & 4)) | ||
475 | type = TYPE_LONGDOUBLE; | ||
476 | else | ||
477 | type = TYPE_DOUBLE; | ||
478 | break; | ||
479 | case 'c': | ||
480 | if (flags >= 8) | ||
481 | #if HAVE_WINT_T | 585 | #if HAVE_WINT_T |
482 | type = TYPE_WIDE_CHAR; | 586 | type = TYPE_WIDE_CHAR; |
483 | #else | 587 | #else |
484 | goto error; | 588 | goto error; |
485 | #endif | 589 | #endif |
486 | else | 590 | else |
487 | type = TYPE_CHAR; | 591 | type = TYPE_CHAR; |
488 | break; | 592 | break; |
489 | #if HAVE_WINT_T | 593 | #if HAVE_WINT_T |
490 | case 'C': | 594 | case 'C': |
491 | type = TYPE_WIDE_CHAR; | 595 | type = TYPE_WIDE_CHAR; |
492 | c = 'c'; | 596 | c = 'c'; |
493 | break; | 597 | break; |
494 | #endif | 598 | #endif |
495 | case 's': | 599 | case 's': |
496 | if (flags >= 8) | 600 | if (signed_type == TYPE_LONGINT |
601 | /* For backward compatibility only. */ | ||
602 | || signed_type == TYPE_LONGLONGINT) | ||
497 | #if HAVE_WCHAR_T | 603 | #if HAVE_WCHAR_T |
498 | type = TYPE_WIDE_STRING; | 604 | type = TYPE_WIDE_STRING; |
499 | #else | 605 | #else |
500 | goto error; | 606 | goto error; |
501 | #endif | 607 | #endif |
502 | else | 608 | else |
503 | type = TYPE_STRING; | 609 | type = TYPE_STRING; |
504 | break; | 610 | break; |
505 | #if HAVE_WCHAR_T | 611 | #if HAVE_WCHAR_T |
506 | case 'S': | 612 | case 'S': |
507 | type = TYPE_WIDE_STRING; | 613 | type = TYPE_WIDE_STRING; |
508 | c = 's'; | 614 | c = 's'; |
509 | break; | 615 | break; |
616 | #endif | ||
617 | case 'p': | ||
618 | type = TYPE_POINTER; | ||
619 | break; | ||
620 | #if NEED_PRINTF_WITH_N_DIRECTIVE | ||
621 | case 'n': | ||
622 | type = pointer_type; | ||
623 | break; | ||
510 | #endif | 624 | #endif |
511 | case 'p': | ||
512 | type = TYPE_POINTER; | ||
513 | break; | ||
514 | case 'n': | ||
515 | /* If 'long long' is larger than 'long': */ | ||
516 | if (flags >= 16 || (flags & 4)) | ||
517 | type = TYPE_COUNT_LONGLONGINT_POINTER; | ||
518 | else | ||
519 | /* If 'long long' is the same as 'long', we parse "lln" into | ||
520 | TYPE_COUNT_LONGINT_POINTER. */ | ||
521 | if (flags >= 8) | ||
522 | type = TYPE_COUNT_LONGINT_POINTER; | ||
523 | else if (flags & 2) | ||
524 | type = TYPE_COUNT_SCHAR_POINTER; | ||
525 | else if (flags & 1) | ||
526 | type = TYPE_COUNT_SHORT_POINTER; | ||
527 | else | ||
528 | type = TYPE_COUNT_INT_POINTER; | ||
529 | break; | ||
530 | #if ENABLE_UNISTDIO | 625 | #if ENABLE_UNISTDIO |
531 | /* The unistdio extensions. */ | 626 | /* The unistdio extensions. */ |
532 | case 'U': | 627 | case 'U': |
533 | if (flags >= 16) | 628 | if (signed_type == TYPE_LONGLONGINT) |
534 | type = TYPE_U32_STRING; | 629 | type = TYPE_U32_STRING; |
535 | else if (flags >= 8) | 630 | else if (signed_type == TYPE_LONGINT) |
536 | type = TYPE_U16_STRING; | 631 | type = TYPE_U16_STRING; |
537 | else | 632 | else |
538 | type = TYPE_U8_STRING; | 633 | type = TYPE_U8_STRING; |
539 | break; | 634 | break; |
540 | #endif | 635 | #endif |
541 | case '%': | 636 | case '%': |
542 | type = TYPE_NONE; | 637 | type = TYPE_NONE; |
543 | break; | 638 | break; |
544 | default: | 639 | default: |
545 | /* Unknown conversion character. */ | 640 | /* Unknown conversion character. */ |
546 | goto error; | 641 | goto error; |
547 | } | 642 | } |
548 | } | ||
549 | 643 | ||
550 | if (type != TYPE_NONE) | 644 | if (type != TYPE_NONE) |
551 | { | 645 | { |
diff --git a/gl/printf-parse.h b/gl/printf-parse.h index 1f86e32c..949b8754 100644 --- a/gl/printf-parse.h +++ b/gl/printf-parse.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Parse printf format string. | 1 | /* Parse printf format string. |
2 | Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2023 Free Software | 2 | Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2024 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -61,7 +61,7 @@ typedef struct | |||
61 | const char* precision_start; | 61 | const char* precision_start; |
62 | const char* precision_end; | 62 | const char* precision_end; |
63 | size_t precision_arg_index; | 63 | size_t precision_arg_index; |
64 | char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ | 64 | char conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */ |
65 | size_t arg_index; | 65 | size_t arg_index; |
66 | } | 66 | } |
67 | char_directive; | 67 | char_directive; |
@@ -91,7 +91,7 @@ typedef struct | |||
91 | const uint8_t* precision_start; | 91 | const uint8_t* precision_start; |
92 | const uint8_t* precision_end; | 92 | const uint8_t* precision_end; |
93 | size_t precision_arg_index; | 93 | size_t precision_arg_index; |
94 | uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ | 94 | uint8_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */ |
95 | size_t arg_index; | 95 | size_t arg_index; |
96 | } | 96 | } |
97 | u8_directive; | 97 | u8_directive; |
@@ -119,7 +119,7 @@ typedef struct | |||
119 | const uint16_t* precision_start; | 119 | const uint16_t* precision_start; |
120 | const uint16_t* precision_end; | 120 | const uint16_t* precision_end; |
121 | size_t precision_arg_index; | 121 | size_t precision_arg_index; |
122 | uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ | 122 | uint16_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */ |
123 | size_t arg_index; | 123 | size_t arg_index; |
124 | } | 124 | } |
125 | u16_directive; | 125 | u16_directive; |
@@ -147,7 +147,7 @@ typedef struct | |||
147 | const uint32_t* precision_start; | 147 | const uint32_t* precision_start; |
148 | const uint32_t* precision_end; | 148 | const uint32_t* precision_end; |
149 | size_t precision_arg_index; | 149 | size_t precision_arg_index; |
150 | uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ | 150 | uint32_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */ |
151 | size_t arg_index; | 151 | size_t arg_index; |
152 | } | 152 | } |
153 | u32_directive; | 153 | u32_directive; |
diff --git a/gl/realloc.c b/gl/realloc.c index 1063eb09..05731396 100644 --- a/gl/realloc.c +++ b/gl/realloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* realloc() function that is glibc compatible. | 1 | /* realloc() function that is glibc compatible. |
2 | 2 | ||
3 | Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2023 Free Software | 3 | Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/reallocarray.c b/gl/reallocarray.c index 8c99250f..09711a0e 100644 --- a/gl/reallocarray.c +++ b/gl/reallocarray.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* reallocarray function that is glibc compatible. | 1 | /* reallocarray function that is glibc compatible. |
2 | 2 | ||
3 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/regcomp.c b/gl/regcomp.c index 89478396..696cf813 100644 --- a/gl/regcomp.c +++ b/gl/regcomp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
@@ -905,7 +905,7 @@ init_word_char (re_dfa_t *dfa) | |||
905 | bitset_word_t bits3 = 0x07fffffe; | 905 | bitset_word_t bits3 = 0x07fffffe; |
906 | if (BITSET_WORD_BITS == 64) | 906 | if (BITSET_WORD_BITS == 64) |
907 | { | 907 | { |
908 | /* Pacify gcc -Woverflow on 32-bit platformns. */ | 908 | /* Pacify gcc -Woverflow on 32-bit platforms. */ |
909 | dfa->word_char[0] = bits1 << 31 << 1 | bits0; | 909 | dfa->word_char[0] = bits1 << 31 << 1 | bits0; |
910 | dfa->word_char[1] = bits3 << 31 << 1 | bits2; | 910 | dfa->word_char[1] = bits3 << 31 << 1 | bits2; |
911 | i = 2; | 911 | i = 2; |
@@ -1,5 +1,5 @@ | |||
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
@@ -26,10 +26,6 @@ | |||
26 | # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" | 26 | # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" |
27 | # pragma GCC diagnostic ignored "-Wvla" | 27 | # pragma GCC diagnostic ignored "-Wvla" |
28 | # endif | 28 | # endif |
29 | # if __GNUC_PREREQ (4, 3) | ||
30 | # pragma GCC diagnostic ignored "-Wold-style-definition" | ||
31 | # pragma GCC diagnostic ignored "-Wtype-limits" | ||
32 | # endif | ||
33 | #endif | 29 | #endif |
34 | 30 | ||
35 | /* Make sure no one compiles this code with a C++ compiler. */ | 31 | /* Make sure no one compiles this code with a C++ compiler. */ |
@@ -1,6 +1,6 @@ | |||
1 | /* Definitions for data structures and routines for the regular | 1 | /* Definitions for data structures and routines for the regular |
2 | expression library. | 2 | expression library. |
3 | Copyright (C) 1985, 1989-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1985, 1989-2024 Free Software Foundation, Inc. |
4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
5 | 5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | 6 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/regex_internal.c b/gl/regex_internal.c index 998a19b7..8cd096eb 100644 --- a/gl/regex_internal.c +++ b/gl/regex_internal.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
diff --git a/gl/regex_internal.h b/gl/regex_internal.h index 149ec2e8..6165cb17 100644 --- a/gl/regex_internal.h +++ b/gl/regex_internal.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
@@ -29,6 +29,7 @@ | |||
29 | #include <locale.h> | 29 | #include <locale.h> |
30 | #include <wchar.h> | 30 | #include <wchar.h> |
31 | #include <wctype.h> | 31 | #include <wctype.h> |
32 | #include <stdckdint.h> | ||
32 | #include <stdint.h> | 33 | #include <stdint.h> |
33 | 34 | ||
34 | #ifndef _LIBC | 35 | #ifndef _LIBC |
@@ -150,9 +151,6 @@ | |||
150 | as some non-GCC platforms lack them, an issue when this code is | 151 | as some non-GCC platforms lack them, an issue when this code is |
151 | used in Gnulib. */ | 152 | used in Gnulib. */ |
152 | 153 | ||
153 | #ifndef SSIZE_MAX | ||
154 | # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) | ||
155 | #endif | ||
156 | #ifndef ULONG_WIDTH | 154 | #ifndef ULONG_WIDTH |
157 | # define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX) | 155 | # define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX) |
158 | /* The number of usable bits in an unsigned integer type with maximum | 156 | /* The number of usable bits in an unsigned integer type with maximum |
@@ -822,7 +820,7 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) | |||
822 | } | 820 | } |
823 | 821 | ||
824 | #ifdef _LIBC | 822 | #ifdef _LIBC |
825 | # if __GNUC__ >= 7 | 823 | # if __glibc_has_attribute (__fallthrough__) |
826 | # define FALLTHROUGH __attribute__ ((__fallthrough__)) | 824 | # define FALLTHROUGH __attribute__ ((__fallthrough__)) |
827 | # else | 825 | # else |
828 | # define FALLTHROUGH ((void) 0) | 826 | # define FALLTHROUGH ((void) 0) |
diff --git a/gl/regexec.c b/gl/regexec.c index 13e0349e..9f065dfa 100644 --- a/gl/regexec.c +++ b/gl/regexec.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
@@ -324,7 +324,7 @@ re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, | |||
324 | char *s = NULL; | 324 | char *s = NULL; |
325 | 325 | ||
326 | if (__glibc_unlikely ((length1 < 0 || length2 < 0 || stop < 0 | 326 | if (__glibc_unlikely ((length1 < 0 || length2 < 0 || stop < 0 |
327 | || INT_ADD_WRAPV (length1, length2, &len)))) | 327 | || ckd_add (&len, length1, length2)))) |
328 | return -2; | 328 | return -2; |
329 | 329 | ||
330 | /* Concatenate the strings. */ | 330 | /* Concatenate the strings. */ |
diff --git a/gl/setenv.c b/gl/setenv.c index f0b88996..9e2e9e2f 100644 --- a/gl/setenv.c +++ b/gl/setenv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1992, 1995-2003, 2005-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
@@ -82,6 +82,7 @@ typedef int (*compar_fn_t) (const void *, const void *); | |||
82 | static void *known_values; | 82 | static void *known_values; |
83 | 83 | ||
84 | # define KNOWN_VALUE(Str) \ | 84 | # define KNOWN_VALUE(Str) \ |
85 | __extension__ \ | ||
85 | ({ \ | 86 | ({ \ |
86 | void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ | 87 | void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ |
87 | value != NULL ? *(char **) value : NULL; \ | 88 | value != NULL ? *(char **) value : NULL; \ |
@@ -375,6 +376,11 @@ rpl_setenv (const char *name, const char *value, int replace) | |||
375 | int saved_errno; | 376 | int saved_errno; |
376 | size_t len = strlen (value); | 377 | size_t len = strlen (value); |
377 | tmp = malloca (len + 2); | 378 | tmp = malloca (len + 2); |
379 | if (tmp == NULL) | ||
380 | { | ||
381 | errno = ENOMEM; | ||
382 | return -1; | ||
383 | } | ||
378 | /* Since leading '=' is eaten, double it up. */ | 384 | /* Since leading '=' is eaten, double it up. */ |
379 | *tmp = '='; | 385 | *tmp = '='; |
380 | memcpy (tmp + 1, value, len + 1); | 386 | memcpy (tmp + 1, value, len + 1); |
diff --git a/gl/setlocale-lock.c b/gl/setlocale-lock.c index b70ba09b..192489c4 100644 --- a/gl/setlocale-lock.c +++ b/gl/setlocale-lock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Return the internal lock used by setlocale_null_r. | 1 | /* Return the internal lock used by setlocale_null_r. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -18,9 +18,10 @@ | |||
18 | 18 | ||
19 | #include <config.h> | 19 | #include <config.h> |
20 | 20 | ||
21 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
21 | /* When it is known that the gl_get_setlocale_null_lock function is defined | 22 | /* When it is known that the gl_get_setlocale_null_lock function is defined |
22 | by a dependency library, it should not be defined here. */ | 23 | by a dependency library, it should not be defined here. */ |
23 | #if OMIT_SETLOCALE_LOCK | 24 | #if AVOID_ANY_THREADS || OMIT_SETLOCALE_LOCK |
24 | 25 | ||
25 | /* This declaration is solely to ensure that after preprocessing | 26 | /* This declaration is solely to ensure that after preprocessing |
26 | this file is never empty. */ | 27 | this file is never empty. */ |
@@ -37,14 +38,14 @@ typedef int dummy; | |||
37 | 38 | ||
38 | /* Macro for exporting a symbol (function, not variable) defined in this file, | 39 | /* Macro for exporting a symbol (function, not variable) defined in this file, |
39 | when compiled into a shared library. */ | 40 | when compiled into a shared library. */ |
40 | # ifndef DLL_EXPORTED | 41 | # ifndef SHLIB_EXPORTED |
41 | # if HAVE_VISIBILITY | 42 | # if HAVE_VISIBILITY |
42 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ | 43 | /* Override the effect of the compiler option '-fvisibility=hidden'. */ |
43 | # define DLL_EXPORTED __attribute__((__visibility__("default"))) | 44 | # define SHLIB_EXPORTED __attribute__((__visibility__("default"))) |
44 | # elif defined _WIN32 || defined __CYGWIN__ | 45 | # elif defined _WIN32 || defined __CYGWIN__ |
45 | # define DLL_EXPORTED __declspec(dllexport) | 46 | # define SHLIB_EXPORTED __declspec(dllexport) |
46 | # else | 47 | # else |
47 | # define DLL_EXPORTED | 48 | # define SHLIB_EXPORTED |
48 | # endif | 49 | # endif |
49 | # endif | 50 | # endif |
50 | 51 | ||
@@ -59,7 +60,7 @@ typedef int dummy; | |||
59 | because the latter is not guaranteed to be a stable ABI in the future. */ | 60 | because the latter is not guaranteed to be a stable ABI in the future. */ |
60 | 61 | ||
61 | /* Make sure the function gets exported from DLLs. */ | 62 | /* Make sure the function gets exported from DLLs. */ |
62 | DLL_EXPORTED CRITICAL_SECTION *gl_get_setlocale_null_lock (void); | 63 | SHLIB_EXPORTED CRITICAL_SECTION *gl_get_setlocale_null_lock (void); |
63 | 64 | ||
64 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; | 65 | static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT; |
65 | static CRITICAL_SECTION lock; | 66 | static CRITICAL_SECTION lock; |
@@ -96,7 +97,7 @@ gl_get_setlocale_null_lock (void) | |||
96 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; | 97 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
97 | 98 | ||
98 | /* Make sure the function gets exported from shared libraries. */ | 99 | /* Make sure the function gets exported from shared libraries. */ |
99 | DLL_EXPORTED pthread_mutex_t *gl_get_setlocale_null_lock (void); | 100 | SHLIB_EXPORTED pthread_mutex_t *gl_get_setlocale_null_lock (void); |
100 | 101 | ||
101 | /* Returns the internal lock used by setlocale_null_r. */ | 102 | /* Returns the internal lock used by setlocale_null_r. */ |
102 | pthread_mutex_t * | 103 | pthread_mutex_t * |
@@ -123,7 +124,7 @@ atomic_init (void) | |||
123 | } | 124 | } |
124 | 125 | ||
125 | /* Make sure the function gets exported from shared libraries. */ | 126 | /* Make sure the function gets exported from shared libraries. */ |
126 | DLL_EXPORTED mtx_t *gl_get_setlocale_null_lock (void); | 127 | SHLIB_EXPORTED mtx_t *gl_get_setlocale_null_lock (void); |
127 | 128 | ||
128 | /* Returns the internal lock used by setlocale_null_r. */ | 129 | /* Returns the internal lock used by setlocale_null_r. */ |
129 | mtx_t * | 130 | mtx_t * |
diff --git a/gl/setlocale_null-unlocked.c b/gl/setlocale_null-unlocked.c new file mode 100644 index 00000000..0a86f0df --- /dev/null +++ b/gl/setlocale_null-unlocked.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* Query the name of the current global locale, without locking. | ||
2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as | ||
6 | published by the Free Software Foundation; either version 2.1 of the | ||
7 | License, or (at your option) any later version. | ||
8 | |||
9 | This file is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ | ||
18 | |||
19 | #include <config.h> | ||
20 | |||
21 | /* Specification. */ | ||
22 | #include "setlocale_null.h" | ||
23 | |||
24 | #include <errno.h> | ||
25 | #include <locale.h> | ||
26 | #include <string.h> | ||
27 | #if defined _WIN32 && !defined __CYGWIN__ | ||
28 | # include <wchar.h> | ||
29 | #endif | ||
30 | |||
31 | /* Use the system's setlocale() function, not the gnulib override, here. */ | ||
32 | #undef setlocale | ||
33 | |||
34 | const char * | ||
35 | setlocale_null_unlocked (int category) | ||
36 | { | ||
37 | const char *result = setlocale (category, NULL); | ||
38 | |||
39 | #ifdef __ANDROID__ | ||
40 | if (result == NULL) | ||
41 | switch (category) | ||
42 | { | ||
43 | case LC_CTYPE: | ||
44 | case LC_NUMERIC: | ||
45 | case LC_TIME: | ||
46 | case LC_COLLATE: | ||
47 | case LC_MONETARY: | ||
48 | case LC_MESSAGES: | ||
49 | case LC_ALL: | ||
50 | case LC_PAPER: | ||
51 | case LC_NAME: | ||
52 | case LC_ADDRESS: | ||
53 | case LC_TELEPHONE: | ||
54 | case LC_MEASUREMENT: | ||
55 | result = "C"; | ||
56 | break; | ||
57 | default: | ||
58 | break; | ||
59 | } | ||
60 | #endif | ||
61 | |||
62 | return result; | ||
63 | } | ||
64 | |||
65 | int | ||
66 | setlocale_null_r_unlocked (int category, char *buf, size_t bufsize) | ||
67 | { | ||
68 | #if defined _WIN32 && !defined __CYGWIN__ && defined _MSC_VER | ||
69 | /* On native Windows, nowadays, the setlocale() implementation is based | ||
70 | on _wsetlocale() and uses malloc() for the result. We are better off | ||
71 | using _wsetlocale() directly. */ | ||
72 | const wchar_t *result = _wsetlocale (category, NULL); | ||
73 | |||
74 | if (result == NULL) | ||
75 | { | ||
76 | /* CATEGORY is invalid. */ | ||
77 | if (bufsize > 0) | ||
78 | /* Return an empty string in BUF. | ||
79 | This is a convenience for callers that don't want to write explicit | ||
80 | code for handling EINVAL. */ | ||
81 | buf[0] = '\0'; | ||
82 | return EINVAL; | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | size_t length = wcslen (result); | ||
87 | if (length < bufsize) | ||
88 | { | ||
89 | size_t i; | ||
90 | |||
91 | /* Convert wchar_t[] -> char[], assuming plain ASCII. */ | ||
92 | for (i = 0; i <= length; i++) | ||
93 | buf[i] = result[i]; | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | if (bufsize > 0) | ||
100 | { | ||
101 | /* Return a truncated result in BUF. | ||
102 | This is a convenience for callers that don't want to write | ||
103 | explicit code for handling ERANGE. */ | ||
104 | size_t i; | ||
105 | |||
106 | /* Convert wchar_t[] -> char[], assuming plain ASCII. */ | ||
107 | for (i = 0; i < bufsize; i++) | ||
108 | buf[i] = result[i]; | ||
109 | buf[bufsize - 1] = '\0'; | ||
110 | } | ||
111 | return ERANGE; | ||
112 | } | ||
113 | } | ||
114 | #else | ||
115 | const char *result = setlocale_null_unlocked (category); | ||
116 | |||
117 | if (result == NULL) | ||
118 | { | ||
119 | /* CATEGORY is invalid. */ | ||
120 | if (bufsize > 0) | ||
121 | /* Return an empty string in BUF. | ||
122 | This is a convenience for callers that don't want to write explicit | ||
123 | code for handling EINVAL. */ | ||
124 | buf[0] = '\0'; | ||
125 | return EINVAL; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | size_t length = strlen (result); | ||
130 | if (length < bufsize) | ||
131 | { | ||
132 | memcpy (buf, result, length + 1); | ||
133 | return 0; | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | if (bufsize > 0) | ||
138 | { | ||
139 | /* Return a truncated result in BUF. | ||
140 | This is a convenience for callers that don't want to write | ||
141 | explicit code for handling ERANGE. */ | ||
142 | memcpy (buf, result, bufsize - 1); | ||
143 | buf[bufsize - 1] = '\0'; | ||
144 | } | ||
145 | return ERANGE; | ||
146 | } | ||
147 | } | ||
148 | #endif | ||
149 | } | ||
diff --git a/gl/setlocale_null.c b/gl/setlocale_null.c index 6ac563db..5ecf413d 100644 --- a/gl/setlocale_null.c +++ b/gl/setlocale_null.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Query the name of the current global locale. | 1 | /* Query the name of the current global locale. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -25,12 +25,14 @@ | |||
25 | #include <locale.h> | 25 | #include <locale.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | #if defined _WIN32 && !defined __CYGWIN__ | ||
29 | # include <wchar.h> | ||
30 | #endif | ||
31 | 28 | ||
32 | #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) | 29 | #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) |
33 | # if defined _WIN32 && !defined __CYGWIN__ | 30 | |
31 | # if AVOID_ANY_THREADS | ||
32 | |||
33 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
34 | |||
35 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
34 | 36 | ||
35 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ | 37 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ |
36 | # include <windows.h> | 38 | # include <windows.h> |
@@ -51,154 +53,40 @@ | |||
51 | # include <threads.h> | 53 | # include <threads.h> |
52 | 54 | ||
53 | # endif | 55 | # endif |
54 | #endif | ||
55 | 56 | ||
56 | /* Use the system's setlocale() function, not the gnulib override, here. */ | ||
57 | #undef setlocale | ||
58 | |||
59 | static const char * | ||
60 | setlocale_null_androidfix (int category) | ||
61 | { | ||
62 | const char *result = setlocale (category, NULL); | ||
63 | |||
64 | #ifdef __ANDROID__ | ||
65 | if (result == NULL) | ||
66 | switch (category) | ||
67 | { | ||
68 | case LC_CTYPE: | ||
69 | case LC_NUMERIC: | ||
70 | case LC_TIME: | ||
71 | case LC_COLLATE: | ||
72 | case LC_MONETARY: | ||
73 | case LC_MESSAGES: | ||
74 | case LC_ALL: | ||
75 | case LC_PAPER: | ||
76 | case LC_NAME: | ||
77 | case LC_ADDRESS: | ||
78 | case LC_TELEPHONE: | ||
79 | case LC_MEASUREMENT: | ||
80 | result = "C"; | ||
81 | break; | ||
82 | default: | ||
83 | break; | ||
84 | } | ||
85 | #endif | 57 | #endif |
86 | 58 | ||
87 | return result; | 59 | #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */ |
88 | } | ||
89 | |||
90 | static int | ||
91 | setlocale_null_unlocked (int category, char *buf, size_t bufsize) | ||
92 | { | ||
93 | #if defined _WIN32 && !defined __CYGWIN__ && defined _MSC_VER | ||
94 | /* On native Windows, nowadays, the setlocale() implementation is based | ||
95 | on _wsetlocale() and uses malloc() for the result. We are better off | ||
96 | using _wsetlocale() directly. */ | ||
97 | const wchar_t *result = _wsetlocale (category, NULL); | ||
98 | |||
99 | if (result == NULL) | ||
100 | { | ||
101 | /* CATEGORY is invalid. */ | ||
102 | if (bufsize > 0) | ||
103 | /* Return an empty string in BUF. | ||
104 | This is a convenience for callers that don't want to write explicit | ||
105 | code for handling EINVAL. */ | ||
106 | buf[0] = '\0'; | ||
107 | return EINVAL; | ||
108 | } | ||
109 | else | ||
110 | { | ||
111 | size_t length = wcslen (result); | ||
112 | if (length < bufsize) | ||
113 | { | ||
114 | size_t i; | ||
115 | |||
116 | /* Convert wchar_t[] -> char[], assuming plain ASCII. */ | ||
117 | for (i = 0; i <= length; i++) | ||
118 | buf[i] = result[i]; | ||
119 | 60 | ||
120 | return 0; | 61 | /* Use a lock, so that no two threads can invoke setlocale_null_r_unlocked |
121 | } | ||
122 | else | ||
123 | { | ||
124 | if (bufsize > 0) | ||
125 | { | ||
126 | /* Return a truncated result in BUF. | ||
127 | This is a convenience for callers that don't want to write | ||
128 | explicit code for handling ERANGE. */ | ||
129 | size_t i; | ||
130 | |||
131 | /* Convert wchar_t[] -> char[], assuming plain ASCII. */ | ||
132 | for (i = 0; i < bufsize; i++) | ||
133 | buf[i] = result[i]; | ||
134 | buf[bufsize - 1] = '\0'; | ||
135 | } | ||
136 | return ERANGE; | ||
137 | } | ||
138 | } | ||
139 | #else | ||
140 | const char *result = setlocale_null_androidfix (category); | ||
141 | |||
142 | if (result == NULL) | ||
143 | { | ||
144 | /* CATEGORY is invalid. */ | ||
145 | if (bufsize > 0) | ||
146 | /* Return an empty string in BUF. | ||
147 | This is a convenience for callers that don't want to write explicit | ||
148 | code for handling EINVAL. */ | ||
149 | buf[0] = '\0'; | ||
150 | return EINVAL; | ||
151 | } | ||
152 | else | ||
153 | { | ||
154 | size_t length = strlen (result); | ||
155 | if (length < bufsize) | ||
156 | { | ||
157 | memcpy (buf, result, length + 1); | ||
158 | return 0; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | if (bufsize > 0) | ||
163 | { | ||
164 | /* Return a truncated result in BUF. | ||
165 | This is a convenience for callers that don't want to write | ||
166 | explicit code for handling ERANGE. */ | ||
167 | memcpy (buf, result, bufsize - 1); | ||
168 | buf[bufsize - 1] = '\0'; | ||
169 | } | ||
170 | return ERANGE; | ||
171 | } | ||
172 | } | ||
173 | #endif | ||
174 | } | ||
175 | |||
176 | #if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */ | ||
177 | |||
178 | /* Use a lock, so that no two threads can invoke setlocale_null_unlocked | ||
179 | at the same time. */ | 62 | at the same time. */ |
180 | 63 | ||
181 | /* Prohibit renaming this symbol. */ | 64 | /* Prohibit renaming this symbol. */ |
182 | # undef gl_get_setlocale_null_lock | 65 | # undef gl_get_setlocale_null_lock |
183 | 66 | ||
184 | # if defined _WIN32 && !defined __CYGWIN__ | 67 | # if AVOID_ANY_THREADS |
68 | |||
69 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
70 | # define setlocale_null_r_with_lock setlocale_null_r_unlocked | ||
71 | |||
72 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
185 | 73 | ||
186 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_setlocale_null_lock (void); | 74 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_setlocale_null_lock (void); |
187 | 75 | ||
188 | static int | 76 | static int |
189 | setlocale_null_with_lock (int category, char *buf, size_t bufsize) | 77 | setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) |
190 | { | 78 | { |
191 | CRITICAL_SECTION *lock = gl_get_setlocale_null_lock (); | 79 | CRITICAL_SECTION *lock = gl_get_setlocale_null_lock (); |
192 | int ret; | 80 | int ret; |
193 | 81 | ||
194 | EnterCriticalSection (lock); | 82 | EnterCriticalSection (lock); |
195 | ret = setlocale_null_unlocked (category, buf, bufsize); | 83 | ret = setlocale_null_r_unlocked (category, buf, bufsize); |
196 | LeaveCriticalSection (lock); | 84 | LeaveCriticalSection (lock); |
197 | 85 | ||
198 | return ret; | 86 | return ret; |
199 | } | 87 | } |
200 | 88 | ||
201 | # elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */ | 89 | # elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */ |
202 | 90 | ||
203 | extern | 91 | extern |
204 | # if defined _WIN32 || defined __CYGWIN__ | 92 | # if defined _WIN32 || defined __CYGWIN__ |
@@ -223,7 +111,7 @@ extern | |||
223 | # endif | 111 | # endif |
224 | 112 | ||
225 | static int | 113 | static int |
226 | setlocale_null_with_lock (int category, char *buf, size_t bufsize) | 114 | setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) |
227 | { | 115 | { |
228 | if (pthread_in_use()) | 116 | if (pthread_in_use()) |
229 | { | 117 | { |
@@ -232,14 +120,14 @@ setlocale_null_with_lock (int category, char *buf, size_t bufsize) | |||
232 | 120 | ||
233 | if (pthread_mutex_lock (lock)) | 121 | if (pthread_mutex_lock (lock)) |
234 | abort (); | 122 | abort (); |
235 | ret = setlocale_null_unlocked (category, buf, bufsize); | 123 | ret = setlocale_null_r_unlocked (category, buf, bufsize); |
236 | if (pthread_mutex_unlock (lock)) | 124 | if (pthread_mutex_unlock (lock)) |
237 | abort (); | 125 | abort (); |
238 | 126 | ||
239 | return ret; | 127 | return ret; |
240 | } | 128 | } |
241 | else | 129 | else |
242 | return setlocale_null_unlocked (category, buf, bufsize); | 130 | return setlocale_null_r_unlocked (category, buf, bufsize); |
243 | } | 131 | } |
244 | 132 | ||
245 | # elif HAVE_THREADS_H | 133 | # elif HAVE_THREADS_H |
@@ -247,14 +135,14 @@ setlocale_null_with_lock (int category, char *buf, size_t bufsize) | |||
247 | extern mtx_t *gl_get_setlocale_null_lock (void); | 135 | extern mtx_t *gl_get_setlocale_null_lock (void); |
248 | 136 | ||
249 | static int | 137 | static int |
250 | setlocale_null_with_lock (int category, char *buf, size_t bufsize) | 138 | setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) |
251 | { | 139 | { |
252 | mtx_t *lock = gl_get_setlocale_null_lock (); | 140 | mtx_t *lock = gl_get_setlocale_null_lock (); |
253 | int ret; | 141 | int ret; |
254 | 142 | ||
255 | if (mtx_lock (lock) != thrd_success) | 143 | if (mtx_lock (lock) != thrd_success) |
256 | abort (); | 144 | abort (); |
257 | ret = setlocale_null_unlocked (category, buf, bufsize); | 145 | ret = setlocale_null_r_unlocked (category, buf, bufsize); |
258 | if (mtx_unlock (lock) != thrd_success) | 146 | if (mtx_unlock (lock) != thrd_success) |
259 | abort (); | 147 | abort (); |
260 | 148 | ||
@@ -271,27 +159,27 @@ setlocale_null_r (int category, char *buf, size_t bufsize) | |||
271 | #if SETLOCALE_NULL_ALL_MTSAFE | 159 | #if SETLOCALE_NULL_ALL_MTSAFE |
272 | # if SETLOCALE_NULL_ONE_MTSAFE | 160 | # if SETLOCALE_NULL_ONE_MTSAFE |
273 | 161 | ||
274 | return setlocale_null_unlocked (category, buf, bufsize); | 162 | return setlocale_null_r_unlocked (category, buf, bufsize); |
275 | 163 | ||
276 | # else | 164 | # else |
277 | 165 | ||
278 | if (category == LC_ALL) | 166 | if (category == LC_ALL) |
279 | return setlocale_null_unlocked (category, buf, bufsize); | 167 | return setlocale_null_r_unlocked (category, buf, bufsize); |
280 | else | 168 | else |
281 | return setlocale_null_with_lock (category, buf, bufsize); | 169 | return setlocale_null_r_with_lock (category, buf, bufsize); |
282 | 170 | ||
283 | # endif | 171 | # endif |
284 | #else | 172 | #else |
285 | # if SETLOCALE_NULL_ONE_MTSAFE | 173 | # if SETLOCALE_NULL_ONE_MTSAFE |
286 | 174 | ||
287 | if (category == LC_ALL) | 175 | if (category == LC_ALL) |
288 | return setlocale_null_with_lock (category, buf, bufsize); | 176 | return setlocale_null_r_with_lock (category, buf, bufsize); |
289 | else | 177 | else |
290 | return setlocale_null_unlocked (category, buf, bufsize); | 178 | return setlocale_null_r_unlocked (category, buf, bufsize); |
291 | 179 | ||
292 | # else | 180 | # else |
293 | 181 | ||
294 | return setlocale_null_with_lock (category, buf, bufsize); | 182 | return setlocale_null_r_with_lock (category, buf, bufsize); |
295 | 183 | ||
296 | # endif | 184 | # endif |
297 | #endif | 185 | #endif |
@@ -301,7 +189,7 @@ const char * | |||
301 | setlocale_null (int category) | 189 | setlocale_null (int category) |
302 | { | 190 | { |
303 | #if SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE | 191 | #if SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE |
304 | return setlocale_null_androidfix (category); | 192 | return setlocale_null_unlocked (category); |
305 | #else | 193 | #else |
306 | 194 | ||
307 | /* This call must be multithread-safe. To achieve this without using | 195 | /* This call must be multithread-safe. To achieve this without using |
@@ -317,7 +205,7 @@ setlocale_null (int category) | |||
317 | if (category == LC_ALL) | 205 | if (category == LC_ALL) |
318 | { | 206 | { |
319 | # if SETLOCALE_NULL_ALL_MTSAFE | 207 | # if SETLOCALE_NULL_ALL_MTSAFE |
320 | return setlocale_null_androidfix (LC_ALL); | 208 | return setlocale_null_unlocked (LC_ALL); |
321 | # else | 209 | # else |
322 | char buf[SETLOCALE_NULL_ALL_MAX]; | 210 | char buf[SETLOCALE_NULL_ALL_MAX]; |
323 | static char resultbuf[SETLOCALE_NULL_ALL_MAX]; | 211 | static char resultbuf[SETLOCALE_NULL_ALL_MAX]; |
@@ -331,7 +219,7 @@ setlocale_null (int category) | |||
331 | else | 219 | else |
332 | { | 220 | { |
333 | # if SETLOCALE_NULL_ONE_MTSAFE | 221 | # if SETLOCALE_NULL_ONE_MTSAFE |
334 | return setlocale_null_androidfix (category); | 222 | return setlocale_null_unlocked (category); |
335 | # else | 223 | # else |
336 | enum | 224 | enum |
337 | { | 225 | { |
diff --git a/gl/setlocale_null.h b/gl/setlocale_null.h index c740fa0f..966c53cf 100644 --- a/gl/setlocale_null.h +++ b/gl/setlocale_null.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Query the name of the current global locale. | 1 | /* Query the name of the current global locale. |
2 | Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2019-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -44,6 +44,34 @@ extern "C" { | |||
44 | 55+5*58. */ | 44 | 55+5*58. */ |
45 | #define SETLOCALE_NULL_ALL_MAX (148+12*256+1) | 45 | #define SETLOCALE_NULL_ALL_MAX (148+12*256+1) |
46 | 46 | ||
47 | /* setlocale_null_r_unlocked (CATEGORY, BUF, BUFSIZE) is like | ||
48 | setlocale (CATEGORY, NULL), except that | ||
49 | - it returns the resulting locale category name or locale name in the | ||
50 | user-supplied buffer BUF, which must be BUFSIZE bytes long. | ||
51 | The recommended minimum buffer size is | ||
52 | - SETLOCALE_NULL_MAX for CATEGORY != LC_ALL, and | ||
53 | - SETLOCALE_NULL_ALL_MAX for CATEGORY == LC_ALL. | ||
54 | The return value is an error code: 0 if the call is successful, EINVAL if | ||
55 | CATEGORY is invalid, or ERANGE if BUFSIZE is smaller than the length needed | ||
56 | size (including the trailing NUL byte). In the latter case, a truncated | ||
57 | result is returned in BUF, but still NUL-terminated if BUFSIZE > 0. | ||
58 | This call is guaranteed to be multithread-safe only if | ||
59 | - CATEGORY != LC_ALL and SETLOCALE_NULL_ONE_MTSAFE is true, or | ||
60 | - CATEGORY == LC_ALL and SETLOCALE_NULL_ALL_MTSAFE is true, | ||
61 | and the other threads must not make other setlocale invocations (since | ||
62 | changing the global locale has side effects on all threads). */ | ||
63 | extern int setlocale_null_r_unlocked (int category, char *buf, size_t bufsize) | ||
64 | _GL_ARG_NONNULL ((2)); | ||
65 | |||
66 | /* setlocale_null_unlocked (CATEGORY) is like setlocale (CATEGORY, NULL). | ||
67 | The return value is NULL if CATEGORY is invalid. | ||
68 | This call is guaranteed to be multithread-safe only if | ||
69 | - CATEGORY != LC_ALL and SETLOCALE_NULL_ONE_MTSAFE is true, or | ||
70 | - CATEGORY == LC_ALL and SETLOCALE_NULL_ALL_MTSAFE is true, | ||
71 | and the other threads must not make other setlocale invocations (since | ||
72 | changing the global locale has side effects on all threads). */ | ||
73 | extern const char *setlocale_null_unlocked (int category); | ||
74 | |||
47 | /* setlocale_null_r (CATEGORY, BUF, BUFSIZE) is like setlocale (CATEGORY, NULL), | 75 | /* setlocale_null_r (CATEGORY, BUF, BUFSIZE) is like setlocale (CATEGORY, NULL), |
48 | except that | 76 | except that |
49 | - it is guaranteed to be multithread-safe, | 77 | - it is guaranteed to be multithread-safe, |
diff --git a/gl/sha256-stream.c b/gl/sha256-stream.c index 0e83380a..08d24b7b 100644 --- a/gl/sha256-stream.c +++ b/gl/sha256-stream.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or | 1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or |
2 | memory blocks according to the NIST specification FIPS-180-2. | 2 | memory blocks according to the NIST specification FIPS-180-2. |
3 | 3 | ||
4 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 4 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
7 | it under the terms of the GNU Lesser General Public License as | 7 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/sha256.c b/gl/sha256.c index e5fea02b..fe7c5446 100644 --- a/gl/sha256.c +++ b/gl/sha256.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or | 1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or |
2 | memory blocks according to the NIST specification FIPS-180-2. | 2 | memory blocks according to the NIST specification FIPS-180-2. |
3 | 3 | ||
4 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 4 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
7 | it under the terms of the GNU Lesser General Public License as | 7 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/sha256.h b/gl/sha256.h index 2879477e..a9d7abb8 100644 --- a/gl/sha256.h +++ b/gl/sha256.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Declarations of functions and data types used for SHA256 and SHA224 sum | 1 | /* Declarations of functions and data types used for SHA256 and SHA224 sum |
2 | library functions. | 2 | library functions. |
3 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,6 +18,11 @@ | |||
18 | #ifndef SHA256_H | 18 | #ifndef SHA256_H |
19 | # define SHA256_H 1 | 19 | # define SHA256_H 1 |
20 | 20 | ||
21 | /* This file uses HAVE_OPENSSL_SHA256. */ | ||
22 | # if !_GL_CONFIG_H_INCLUDED | ||
23 | # error "Please include config.h first." | ||
24 | # endif | ||
25 | |||
21 | # include <stdio.h> | 26 | # include <stdio.h> |
22 | # include <stdint.h> | 27 | # include <stdint.h> |
23 | 28 | ||
@@ -25,7 +30,21 @@ | |||
25 | # ifndef OPENSSL_API_COMPAT | 30 | # ifndef OPENSSL_API_COMPAT |
26 | # define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */ | 31 | # define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */ |
27 | # endif | 32 | # endif |
28 | # include <openssl/sha.h> | 33 | /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL. */ |
34 | # include <openssl/opensslv.h> | ||
35 | # if OPENSSL_VERSION_MAJOR >= 3 | ||
36 | # include <openssl/configuration.h> | ||
37 | # if (OPENSSL_CONFIGURED_API \ | ||
38 | < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \ | ||
39 | ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \ | ||
40 | + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \ | ||
41 | + ((OPENSSL_API_COMPAT >> 12) & 0xFF))) | ||
42 | # undef HAVE_OPENSSL_SHA256 | ||
43 | # endif | ||
44 | # endif | ||
45 | # if HAVE_OPENSSL_SHA256 | ||
46 | # include <openssl/sha.h> | ||
47 | # endif | ||
29 | # endif | 48 | # endif |
30 | 49 | ||
31 | # ifdef __cplusplus | 50 | # ifdef __cplusplus |
diff --git a/gl/size_max.h b/gl/size_max.h index 48af0250..bd2eb43e 100644 --- a/gl/size_max.h +++ b/gl/size_max.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* size_max.h -- declare SIZE_MAX through system headers | 1 | /* size_max.h -- declare SIZE_MAX through system headers |
2 | Copyright (C) 2005-2006, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson. | 3 | Written by Simon Josefsson. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -18,6 +18,11 @@ | |||
18 | #ifndef GNULIB_SIZE_MAX_H | 18 | #ifndef GNULIB_SIZE_MAX_H |
19 | #define GNULIB_SIZE_MAX_H | 19 | #define GNULIB_SIZE_MAX_H |
20 | 20 | ||
21 | /* This file uses HAVE_STDINT_H. */ | ||
22 | #if !_GL_CONFIG_H_INCLUDED | ||
23 | #error "Please include config.h first." | ||
24 | #endif | ||
25 | |||
21 | /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ | 26 | /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ |
22 | # include <limits.h> | 27 | # include <limits.h> |
23 | /* Get SIZE_MAX declaration on systems like glibc 2. */ | 28 | /* Get SIZE_MAX declaration on systems like glibc 2. */ |
diff --git a/gl/snprintf.c b/gl/snprintf.c index cdff3149..c1b93562 100644 --- a/gl/snprintf.c +++ b/gl/snprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 2004, 2006-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson and Paul Eggert. | 3 | Written by Simon Josefsson and Paul Eggert. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/sockets.c b/gl/sockets.c index ca99db8b..92beb7d3 100644 --- a/gl/sockets.c +++ b/gl/sockets.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* sockets.c --- wrappers for Windows socket functions | 1 | /* sockets.c --- wrappers for Windows socket functions |
2 | 2 | ||
3 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/sockets.h b/gl/sockets.h index a0b1601d..55077ae9 100644 --- a/gl/sockets.h +++ b/gl/sockets.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* sockets.h - wrappers for Windows socket functions | 1 | /* sockets.h - wrappers for Windows socket functions |
2 | 2 | ||
3 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -20,6 +20,15 @@ | |||
20 | #ifndef SOCKETS_H | 20 | #ifndef SOCKETS_H |
21 | #define SOCKETS_H 1 | 21 | #define SOCKETS_H 1 |
22 | 22 | ||
23 | /* This file uses _GL_ATTRIBUTE_CONST. */ | ||
24 | #if !_GL_CONFIG_H_INCLUDED | ||
25 | #error "Please include config.h first." | ||
26 | #endif | ||
27 | |||
28 | #ifdef __cplusplus | ||
29 | extern "C" { | ||
30 | #endif | ||
31 | |||
23 | #define SOCKETS_1_0 0x0001 | 32 | #define SOCKETS_1_0 0x0001 |
24 | #define SOCKETS_1_1 0x0101 | 33 | #define SOCKETS_1_1 0x0101 |
25 | #define SOCKETS_2_0 0x0002 | 34 | #define SOCKETS_2_0 0x0002 |
@@ -38,6 +47,11 @@ int gl_sockets_cleanup (void) | |||
38 | #endif | 47 | #endif |
39 | ; | 48 | ; |
40 | 49 | ||
50 | #ifdef __cplusplus | ||
51 | } | ||
52 | #endif | ||
53 | |||
54 | |||
41 | /* This function is useful it you create a socket using gnulib's | 55 | /* This function is useful it you create a socket using gnulib's |
42 | Winsock wrappers but needs to pass on the socket handle to some | 56 | Winsock wrappers but needs to pass on the socket handle to some |
43 | other library that only accepts sockets. */ | 57 | other library that only accepts sockets. */ |
diff --git a/gl/stat-time.c b/gl/stat-time.c index bc282232..1ab01f53 100644 --- a/gl/stat-time.c +++ b/gl/stat-time.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* stat-related time functions. | 1 | /* stat-related time functions. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/stat-time.h b/gl/stat-time.h index 92aa1e64..3cd8478f 100644 --- a/gl/stat-time.h +++ b/gl/stat-time.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* stat-related time functions. | 1 | /* stat-related time functions. |
2 | 2 | ||
3 | Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -20,15 +20,18 @@ | |||
20 | #ifndef STAT_TIME_H | 20 | #ifndef STAT_TIME_H |
21 | #define STAT_TIME_H 1 | 21 | #define STAT_TIME_H 1 |
22 | 22 | ||
23 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_UNUSED, | ||
24 | _GL_ATTRIBUTE_PURE, HAVE_STRUCT_STAT_*. */ | ||
25 | #if !_GL_CONFIG_H_INCLUDED | ||
26 | #error "Please include config.h first." | ||
27 | #endif | ||
28 | |||
23 | #include <errno.h> | 29 | #include <errno.h> |
24 | #include <stdckdint.h> | 30 | #include <stdckdint.h> |
25 | #include <stddef.h> | 31 | #include <stddef.h> |
26 | #include <sys/stat.h> | 32 | #include <sys/stat.h> |
27 | #include <time.h> | 33 | #include <time.h> |
28 | 34 | ||
29 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
30 | #error "Please include config.h first." | ||
31 | #endif | ||
32 | _GL_INLINE_HEADER_BEGIN | 35 | _GL_INLINE_HEADER_BEGIN |
33 | #ifndef _GL_STAT_TIME_INLINE | 36 | #ifndef _GL_STAT_TIME_INLINE |
34 | # define _GL_STAT_TIME_INLINE _GL_INLINE | 37 | # define _GL_STAT_TIME_INLINE _GL_INLINE |
@@ -49,11 +52,13 @@ extern "C" { | |||
49 | #if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC | 52 | #if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC |
50 | # if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC | 53 | # if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC |
51 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) | 54 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) |
55 | # define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim) | ||
52 | # else | 56 | # else |
53 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) | 57 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) |
54 | # endif | 58 | # endif |
55 | #elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC | 59 | #elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC |
56 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) | 60 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) |
61 | # define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim##espec) | ||
57 | #elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC | 62 | #elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC |
58 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) | 63 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) |
59 | #elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC | 64 | #elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC |
@@ -119,10 +124,8 @@ get_stat_atime (struct stat const *st) | |||
119 | #ifdef STAT_TIMESPEC | 124 | #ifdef STAT_TIMESPEC |
120 | return STAT_TIMESPEC (st, st_atim); | 125 | return STAT_TIMESPEC (st, st_atim); |
121 | #else | 126 | #else |
122 | struct timespec t; | 127 | return (struct timespec) { .tv_sec = st->st_atime, |
123 | t.tv_sec = st->st_atime; | 128 | .tv_nsec = get_stat_atime_ns (st) }; |
124 | t.tv_nsec = get_stat_atime_ns (st); | ||
125 | return t; | ||
126 | #endif | 129 | #endif |
127 | } | 130 | } |
128 | 131 | ||
@@ -133,10 +136,8 @@ get_stat_ctime (struct stat const *st) | |||
133 | #ifdef STAT_TIMESPEC | 136 | #ifdef STAT_TIMESPEC |
134 | return STAT_TIMESPEC (st, st_ctim); | 137 | return STAT_TIMESPEC (st, st_ctim); |
135 | #else | 138 | #else |
136 | struct timespec t; | 139 | return (struct timespec) { .tv_sec = st->st_ctime, |
137 | t.tv_sec = st->st_ctime; | 140 | .tv_nsec = get_stat_ctime_ns (st) }; |
138 | t.tv_nsec = get_stat_ctime_ns (st); | ||
139 | return t; | ||
140 | #endif | 141 | #endif |
141 | } | 142 | } |
142 | 143 | ||
@@ -147,10 +148,8 @@ get_stat_mtime (struct stat const *st) | |||
147 | #ifdef STAT_TIMESPEC | 148 | #ifdef STAT_TIMESPEC |
148 | return STAT_TIMESPEC (st, st_mtim); | 149 | return STAT_TIMESPEC (st, st_mtim); |
149 | #else | 150 | #else |
150 | struct timespec t; | 151 | return (struct timespec) { .tv_sec = st->st_mtime, |
151 | t.tv_sec = st->st_mtime; | 152 | .tv_nsec = get_stat_mtime_ns (st) }; |
152 | t.tv_nsec = get_stat_mtime_ns (st); | ||
153 | return t; | ||
154 | #endif | 153 | #endif |
155 | } | 154 | } |
156 | 155 | ||
@@ -165,8 +164,8 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) | |||
165 | || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) | 164 | || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) |
166 | t = STAT_TIMESPEC (st, st_birthtim); | 165 | t = STAT_TIMESPEC (st, st_birthtim); |
167 | #elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC | 166 | #elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC |
168 | t.tv_sec = st->st_birthtime; | 167 | t = (struct timespec) { .tv_sec = st->st_birthtime, |
169 | t.tv_nsec = st->st_birthtimensec; | 168 | .tv_nsec = st->st_birthtimensec }; |
170 | #elif defined _WIN32 && ! defined __CYGWIN__ | 169 | #elif defined _WIN32 && ! defined __CYGWIN__ |
171 | /* Native Windows platforms (but not Cygwin) put the "file creation | 170 | /* Native Windows platforms (but not Cygwin) put the "file creation |
172 | time" in st_ctime (!). See | 171 | time" in st_ctime (!). See |
@@ -174,13 +173,11 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) | |||
174 | # if _GL_WINDOWS_STAT_TIMESPEC | 173 | # if _GL_WINDOWS_STAT_TIMESPEC |
175 | t = st->st_ctim; | 174 | t = st->st_ctim; |
176 | # else | 175 | # else |
177 | t.tv_sec = st->st_ctime; | 176 | t = (struct timespec) { .tv_sec = st->st_ctime }; |
178 | t.tv_nsec = 0; | ||
179 | # endif | 177 | # endif |
180 | #else | 178 | #else |
181 | /* Birth time is not supported. */ | 179 | /* Birth time is not supported. */ |
182 | t.tv_sec = -1; | 180 | t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; |
183 | t.tv_nsec = -1; | ||
184 | #endif | 181 | #endif |
185 | 182 | ||
186 | #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ | 183 | #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ |
@@ -192,30 +189,28 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) | |||
192 | sometimes returns junk in the birth time fields; work around this | 189 | sometimes returns junk in the birth time fields; work around this |
193 | bug if it is detected. */ | 190 | bug if it is detected. */ |
194 | if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) | 191 | if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) |
195 | { | 192 | t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; |
196 | t.tv_sec = -1; | ||
197 | t.tv_nsec = -1; | ||
198 | } | ||
199 | #endif | 193 | #endif |
200 | 194 | ||
201 | return t; | 195 | return t; |
202 | } | 196 | } |
203 | 197 | ||
204 | /* If a stat-like function returned RESULT, normalize the timestamps | 198 | /* If a stat-like function returned RESULT, normalize the timestamps |
205 | in *ST, in case this platform suffers from the Solaris 11 bug where | 199 | in *ST, if this platform suffers from a macOS and Solaris bug where |
206 | tv_nsec might be negative. Return the adjusted RESULT, setting | 200 | tv_nsec might be negative. Return the adjusted RESULT, setting |
207 | errno to EOVERFLOW if normalization overflowed. This function | 201 | errno to EOVERFLOW if normalization overflowed. This function |
208 | is intended to be private to this .h file. */ | 202 | is intended to be private to this .h file. */ |
209 | _GL_STAT_TIME_INLINE int | 203 | _GL_STAT_TIME_INLINE int |
210 | stat_time_normalize (int result, _GL_UNUSED struct stat *st) | 204 | stat_time_normalize (int result, _GL_UNUSED struct stat *st) |
211 | { | 205 | { |
212 | #if defined __sun && defined STAT_TIMESPEC | 206 | #if (((defined __APPLE__ && defined __MACH__) || defined __sun) \ |
207 | && defined STAT_TIMESPEC_OFFSETOF) | ||
213 | if (result == 0) | 208 | if (result == 0) |
214 | { | 209 | { |
215 | long int timespec_hz = 1000000000; | 210 | long int timespec_hz = 1000000000; |
216 | short int const ts_off[] = { offsetof (struct stat, st_atim), | 211 | short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim), |
217 | offsetof (struct stat, st_mtim), | 212 | STAT_TIMESPEC_OFFSETOF (st_mtim), |
218 | offsetof (struct stat, st_ctim) }; | 213 | STAT_TIMESPEC_OFFSETOF (st_ctim) }; |
219 | int i; | 214 | int i; |
220 | for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) | 215 | for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) |
221 | { | 216 | { |
@@ -229,8 +224,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st) | |||
229 | } | 224 | } |
230 | ts->tv_nsec = r; | 225 | ts->tv_nsec = r; |
231 | /* Overflow is possible, as Solaris 11 stat can yield | 226 | /* Overflow is possible, as Solaris 11 stat can yield |
232 | tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. | 227 | tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. */ |
233 | INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ | ||
234 | if (ckd_add (&ts->tv_sec, q, ts->tv_sec)) | 228 | if (ckd_add (&ts->tv_sec, q, ts->tv_sec)) |
235 | { | 229 | { |
236 | errno = EOVERFLOW; | 230 | errno = EOVERFLOW; |
diff --git a/gl/stat-w32.c b/gl/stat-w32.c index 2f011975..ddd6f598 100644 --- a/gl/stat-w32.c +++ b/gl/stat-w32.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Core of implementation of fstat and stat for native Windows. | 1 | /* Core of implementation of fstat and stat for native Windows. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/stat-w32.h b/gl/stat-w32.h index c6738749..392faed1 100644 --- a/gl/stat-w32.h +++ b/gl/stat-w32.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Core of implementation of fstat and stat for native Windows. | 1 | /* Core of implementation of fstat and stat for native Windows. |
2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2017-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -1,5 +1,5 @@ | |||
1 | /* Work around platform bugs in stat. | 1 | /* Work around platform bugs in stat. |
2 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h deleted file mode 100644 index 7f9dbb46..00000000 --- a/gl/stdalign.in.h +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* A substitute for ISO C11 <stdalign.h>. | ||
2 | |||
3 | Copyright 2011-2023 Free Software Foundation, Inc. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | /* Written by Paul Eggert and Bruno Haible. */ | ||
19 | |||
20 | #ifndef _GL_STDALIGN_H | ||
21 | #define _GL_STDALIGN_H | ||
22 | |||
23 | /* ISO C11 <stdalign.h> for platforms that lack it. | ||
24 | |||
25 | References: | ||
26 | ISO C11 (latest free draft | ||
27 | <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>) | ||
28 | sections 6.5.3.4, 6.7.5, 7.15. | ||
29 | C++11 (latest free draft | ||
30 | <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) | ||
31 | section 18.10. */ | ||
32 | |||
33 | /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment | ||
34 | requirement of a structure member (i.e., slot or field) that is of | ||
35 | type TYPE, as an integer constant expression. | ||
36 | |||
37 | This differs from GCC's and clang's __alignof__ operator, which can | ||
38 | yield a better-performing alignment for an object of that type. For | ||
39 | example, on x86 with GCC and on Linux/x86 with clang, | ||
40 | __alignof__ (double) and __alignof__ (long long) are 8, whereas | ||
41 | alignof (double) and alignof (long long) are 4 unless the option | ||
42 | '-malign-double' is used. | ||
43 | |||
44 | The result cannot be used as a value for an 'enum' constant, if you | ||
45 | want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
46 | |||
47 | /* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other | ||
48 | standard headers, defines conflicting implementations of _Alignas | ||
49 | and _Alignof that are no better than ours; override them. */ | ||
50 | #undef _Alignas | ||
51 | #undef _Alignof | ||
52 | |||
53 | /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 | ||
54 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. | ||
55 | clang versions < 8.0.0 have the same bug. */ | ||
56 | #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | ||
57 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | ||
58 | && !defined __clang__) \ | ||
59 | || (defined __clang__ && __clang_major__ < 8)) | ||
60 | # ifdef __cplusplus | ||
61 | # if (201103 <= __cplusplus || defined _MSC_VER) | ||
62 | # define _Alignof(type) alignof (type) | ||
63 | # else | ||
64 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | ||
65 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) | ||
66 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
67 | # endif | ||
68 | # else | ||
69 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ | ||
70 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | ||
71 | # else | ||
72 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) | ||
73 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
74 | # endif | ||
75 | # endif | ||
76 | #endif | ||
77 | #if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) | ||
78 | # define alignof _Alignof | ||
79 | #endif | ||
80 | #define __alignof_is_defined 1 | ||
81 | |||
82 | /* alignas (A), also known as _Alignas (A), aligns a variable or type | ||
83 | to the alignment A, where A is an integer constant expression. For | ||
84 | example: | ||
85 | |||
86 | int alignas (8) foo; | ||
87 | struct s { int a; int alignas (8) bar; }; | ||
88 | |||
89 | aligns the address of FOO and the offset of BAR to be multiples of 8. | ||
90 | |||
91 | A should be a power of two that is at least the type's alignment | ||
92 | and at most the implementation's alignment limit. This limit is | ||
93 | 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable | ||
94 | to MSVC through at least version 10.0, A should be an integer | ||
95 | constant, as MSVC does not support expressions such as 1 << 3. | ||
96 | To be portable to Sun C 5.11, do not align auto variables to | ||
97 | anything stricter than their default alignment. | ||
98 | |||
99 | The following C11 requirements are not supported here: | ||
100 | |||
101 | - If A is zero, alignas has no effect. | ||
102 | - alignas can be used multiple times; the strictest one wins. | ||
103 | - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). | ||
104 | |||
105 | */ | ||
106 | |||
107 | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | ||
108 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
109 | # define _Alignas(a) alignas (a) | ||
110 | # elif (!defined __attribute__ \ | ||
111 | && ((defined __APPLE__ && defined __MACH__ \ | ||
112 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
113 | : __GNUC__ && !defined __ibmxl__) \ | ||
114 | || (4 <= __clang_major__) \ | ||
115 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
116 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
117 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
118 | # elif 1300 <= _MSC_VER | ||
119 | # define _Alignas(a) __declspec (align (a)) | ||
120 | # endif | ||
121 | #endif | ||
122 | #if ((defined _Alignas \ | ||
123 | && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ | ||
124 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||
125 | # define alignas _Alignas | ||
126 | #endif | ||
127 | #if (defined alignas \ | ||
128 | || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) | ||
129 | # define __alignas_is_defined 1 | ||
130 | #endif | ||
131 | |||
132 | /* Include <stddef.h> if needed for offsetof. */ | ||
133 | #if _GL_STDALIGN_NEEDS_STDDEF | ||
134 | # include <stddef.h> | ||
135 | #endif | ||
136 | |||
137 | #endif /* _GL_STDALIGN_H */ | ||
diff --git a/gl/stdckdint.in.h b/gl/stdckdint.in.h index 71bab5f0..91848806 100644 --- a/gl/stdckdint.in.h +++ b/gl/stdckdint.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* stdckdint.h -- checked integer arithmetic | 1 | /* stdckdint.h -- checked integer arithmetic |
2 | 2 | ||
3 | Copyright 2022-2023 Free Software Foundation, Inc. | 3 | Copyright 2022-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify it | 5 | This program is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Lesser General Public License as published | 6 | under the terms of the GNU Lesser General Public License as published |
diff --git a/gl/stddef.in.h b/gl/stddef.in.h index 6eadcc3d..fa8998d9 100644 --- a/gl/stddef.in.h +++ b/gl/stddef.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. | 1 | /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. |
2 | 2 | ||
3 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,7 +18,7 @@ | |||
18 | /* Written by Eric Blake. */ | 18 | /* Written by Eric Blake. */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * POSIX 2008 <stddef.h> for platforms that have issues. | 21 | * POSIX 2008 and ISO C 23 <stddef.h> for platforms that have issues. |
22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> | 22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -37,9 +37,9 @@ | |||
37 | remember if special invocation has ever been used to obtain wint_t, | 37 | remember if special invocation has ever been used to obtain wint_t, |
38 | in which case we need to clean up NULL yet again. */ | 38 | in which case we need to clean up NULL yet again. */ |
39 | 39 | ||
40 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) | 40 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _@GUARD_PREFIX@_STDDEF_WINT_T) |
41 | # ifdef __need_wint_t | 41 | # ifdef __need_wint_t |
42 | # define _GL_STDDEF_WINT_T | 42 | # define _@GUARD_PREFIX@_STDDEF_WINT_T |
43 | # endif | 43 | # endif |
44 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ | 44 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ |
45 | /* On TinyCC, make sure that the macros that indicate the special invocation | 45 | /* On TinyCC, make sure that the macros that indicate the special invocation |
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | /* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a | 59 | /* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a |
60 | type with alignment 4, but 'long' has alignment 8. */ | 60 | type with alignment 4, but 'long' has alignment 8. */ |
61 | # if defined _AIX && defined __LP64__ | 61 | # if defined _AIX && defined __LP64__ && !@HAVE_MAX_ALIGN_T@ |
62 | # if !GNULIB_defined_max_align_t | 62 | # if !GNULIB_defined_max_align_t |
63 | # ifdef _MAX_ALIGN_T | 63 | # ifdef _MAX_ALIGN_T |
64 | /* /usr/include/stddef.h has already defined max_align_t. Override it. */ | 64 | /* /usr/include/stddef.h has already defined max_align_t. Override it. */ |
@@ -69,6 +69,7 @@ typedef long rpl_max_align_t; | |||
69 | typedef long max_align_t; | 69 | typedef long max_align_t; |
70 | # define _MAX_ALIGN_T | 70 | # define _MAX_ALIGN_T |
71 | # endif | 71 | # endif |
72 | # define __CLANG_MAX_ALIGN_T_DEFINED | ||
72 | # define GNULIB_defined_max_align_t 1 | 73 | # define GNULIB_defined_max_align_t 1 |
73 | # endif | 74 | # endif |
74 | # endif | 75 | # endif |
@@ -79,7 +80,7 @@ typedef long max_align_t; | |||
79 | 80 | ||
80 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ | 81 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ |
81 | # if (@REPLACE_NULL@ \ | 82 | # if (@REPLACE_NULL@ \ |
82 | && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) | 83 | && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _@GUARD_PREFIX@_STDDEF_WINT_T)) |
83 | # undef NULL | 84 | # undef NULL |
84 | # ifdef __cplusplus | 85 | # ifdef __cplusplus |
85 | /* ISO C++ says that the macro NULL must expand to an integer constant | 86 | /* ISO C++ says that the macro NULL must expand to an integer constant |
@@ -100,6 +101,33 @@ typedef long max_align_t; | |||
100 | # ifndef _@GUARD_PREFIX@_STDDEF_H | 101 | # ifndef _@GUARD_PREFIX@_STDDEF_H |
101 | # define _@GUARD_PREFIX@_STDDEF_H | 102 | # define _@GUARD_PREFIX@_STDDEF_H |
102 | 103 | ||
104 | /* This file uses _Noreturn, _GL_ATTRIBUTE_NOTHROW. */ | ||
105 | #if !_GL_CONFIG_H_INCLUDED | ||
106 | #error "Please include config.h first." | ||
107 | #endif | ||
108 | |||
109 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
110 | */ | ||
111 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
112 | # if defined __cplusplus | ||
113 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
114 | # if __cplusplus >= 201103L | ||
115 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
116 | # else | ||
117 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
118 | # endif | ||
119 | # else | ||
120 | # define _GL_ATTRIBUTE_NOTHROW | ||
121 | # endif | ||
122 | # else | ||
123 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
124 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
125 | # else | ||
126 | # define _GL_ATTRIBUTE_NOTHROW | ||
127 | # endif | ||
128 | # endif | ||
129 | #endif | ||
130 | |||
103 | /* Some platforms lack wchar_t. */ | 131 | /* Some platforms lack wchar_t. */ |
104 | #if !@HAVE_WCHAR_T@ | 132 | #if !@HAVE_WCHAR_T@ |
105 | # define wchar_t int | 133 | # define wchar_t int |
@@ -137,11 +165,49 @@ typedef union | |||
137 | long int __i _GL_STDDEF_ALIGNAS (long int); | 165 | long int __i _GL_STDDEF_ALIGNAS (long int); |
138 | } rpl_max_align_t; | 166 | } rpl_max_align_t; |
139 | # define max_align_t rpl_max_align_t | 167 | # define max_align_t rpl_max_align_t |
168 | # define __CLANG_MAX_ALIGN_T_DEFINED | ||
140 | # define GNULIB_defined_max_align_t 1 | 169 | # define GNULIB_defined_max_align_t 1 |
141 | # endif | 170 | # endif |
142 | # endif | 171 | # endif |
143 | #endif | 172 | #endif |
144 | 173 | ||
174 | /* ISO C 23 § 7.21.1 The unreachable macro */ | ||
175 | #ifndef unreachable | ||
176 | |||
177 | /* Code borrowed from verify.h. */ | ||
178 | # ifndef _GL_HAS_BUILTIN_UNREACHABLE | ||
179 | # if defined __clang_major__ && __clang_major__ < 5 | ||
180 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | ||
181 | # elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) | ||
182 | # define _GL_HAS_BUILTIN_UNREACHABLE 1 | ||
183 | # elif defined __has_builtin | ||
184 | # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) | ||
185 | # else | ||
186 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | ||
187 | # endif | ||
188 | # endif | ||
189 | |||
190 | # if _GL_HAS_BUILTIN_UNREACHABLE | ||
191 | # define unreachable() __builtin_unreachable () | ||
192 | # elif 1200 <= _MSC_VER | ||
193 | # define unreachable() __assume (0) | ||
194 | # else | ||
195 | /* Declare abort(), without including <stdlib.h>. */ | ||
196 | extern | ||
197 | # if defined __cplusplus | ||
198 | "C" | ||
199 | # endif | ||
200 | _Noreturn | ||
201 | void abort (void) | ||
202 | # if defined __cplusplus && (__GLIBC__ >= 2) | ||
203 | _GL_ATTRIBUTE_NOTHROW | ||
204 | # endif | ||
205 | ; | ||
206 | # define unreachable() abort () | ||
207 | # endif | ||
208 | |||
209 | #endif | ||
210 | |||
145 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ | 211 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ |
146 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ | 212 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ |
147 | #endif /* __need_XXX */ | 213 | #endif /* __need_XXX */ |
diff --git a/gl/stdint.in.h b/gl/stdint.in.h index 5ddc644b..fea7483b 100644 --- a/gl/stdint.in.h +++ b/gl/stdint.in.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2001-2002, 2004-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2001-2002, 2004-2024 Free Software Foundation, Inc. |
2 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. | 2 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. |
3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
4 | 4 | ||
@@ -306,6 +306,8 @@ typedef gl_uint_fast32_t gl_uint_fast16_t; | |||
306 | uintptr_t to avoid conflicting declarations of system functions like | 306 | uintptr_t to avoid conflicting declarations of system functions like |
307 | _findclose in <io.h>. */ | 307 | _findclose in <io.h>. */ |
308 | # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ | 308 | # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ |
309 | || (defined __INTPTR_WIDTH__ \ | ||
310 | && __INTPTR_WIDTH__ != (defined _WIN64 ? LLONG_WIDTH : LONG_WIDTH)) \ | ||
309 | || defined __MINGW32__) | 311 | || defined __MINGW32__) |
310 | # undef intptr_t | 312 | # undef intptr_t |
311 | # undef uintptr_t | 313 | # undef uintptr_t |
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h index 46608bed..63ebf7c6 100644 --- a/gl/stdio-impl.h +++ b/gl/stdio-impl.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Implementation details of FILE streams. | 1 | /* Implementation details of FILE streams. |
2 | Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/stdio-read.c b/gl/stdio-read.c index 6e2984c5..253b8aa4 100644 --- a/gl/stdio-read.c +++ b/gl/stdio-read.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* POSIX compatible FILE stream read function. | 1 | /* POSIX compatible FILE stream read function. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2011. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/stdio-write.c b/gl/stdio-write.c index 9cf36cca..ca6aa00c 100644 --- a/gl/stdio-write.c +++ b/gl/stdio-write.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* POSIX compatible FILE stream write function. | 1 | /* POSIX compatible FILE stream write function. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/stdio.in.h b/gl/stdio.in.h index 59cbea3d..35b9f748 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <stdio.h>. | 1 | /* A GNU-like <stdio.h>. |
2 | 2 | ||
3 | Copyright (C) 2004, 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -36,6 +36,18 @@ | |||
36 | 36 | ||
37 | #ifndef _@GUARD_PREFIX@_STDIO_H | 37 | #ifndef _@GUARD_PREFIX@_STDIO_H |
38 | 38 | ||
39 | /* Suppress macOS deprecation warnings for sprintf and vsprintf. */ | ||
40 | #if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE | ||
41 | # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ | ||
42 | # include <AvailabilityMacros.h> | ||
43 | # endif | ||
44 | # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \ | ||
45 | && 130000 <= MAC_OS_X_VERSION_MIN_REQUIRED) | ||
46 | # define _POSIX_C_SOURCE 200809L | ||
47 | # define _GL_DEFINED__POSIX_C_SOURCE | ||
48 | # endif | ||
49 | #endif | ||
50 | |||
39 | #define _GL_ALREADY_INCLUDING_STDIO_H | 51 | #define _GL_ALREADY_INCLUDING_STDIO_H |
40 | 52 | ||
41 | /* The include_next requires a split double-inclusion guard. */ | 53 | /* The include_next requires a split double-inclusion guard. */ |
@@ -43,9 +55,21 @@ | |||
43 | 55 | ||
44 | #undef _GL_ALREADY_INCLUDING_STDIO_H | 56 | #undef _GL_ALREADY_INCLUDING_STDIO_H |
45 | 57 | ||
58 | #ifdef _GL_DEFINED__POSIX_C_SOURCE | ||
59 | # undef _GL_DEFINED__POSIX_C_SOURCE | ||
60 | # undef _POSIX_C_SOURCE | ||
61 | #endif | ||
62 | |||
46 | #ifndef _@GUARD_PREFIX@_STDIO_H | 63 | #ifndef _@GUARD_PREFIX@_STDIO_H |
47 | #define _@GUARD_PREFIX@_STDIO_H | 64 | #define _@GUARD_PREFIX@_STDIO_H |
48 | 65 | ||
66 | /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT, | ||
67 | _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, | ||
68 | HAVE_RAW_DECL_*. */ | ||
69 | #if !_GL_CONFIG_H_INCLUDED | ||
70 | #error "Please include config.h first." | ||
71 | #endif | ||
72 | |||
49 | /* Get va_list. Needed on many systems, including glibc 2.8. */ | 73 | /* Get va_list. Needed on many systems, including glibc 2.8. */ |
50 | #include <stdarg.h> | 74 | #include <stdarg.h> |
51 | 75 | ||
@@ -116,6 +140,38 @@ | |||
116 | # endif | 140 | # endif |
117 | #endif | 141 | #endif |
118 | 142 | ||
143 | /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly | ||
144 | allocated memory. */ | ||
145 | #ifndef _GL_ATTRIBUTE_MALLOC | ||
146 | # if __GNUC__ >= 3 || defined __clang__ | ||
147 | # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) | ||
148 | # else | ||
149 | # define _GL_ATTRIBUTE_MALLOC | ||
150 | # endif | ||
151 | #endif | ||
152 | |||
153 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
154 | */ | ||
155 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
156 | # if defined __cplusplus | ||
157 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
158 | # if __cplusplus >= 201103L | ||
159 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
160 | # else | ||
161 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
162 | # endif | ||
163 | # else | ||
164 | # define _GL_ATTRIBUTE_NOTHROW | ||
165 | # endif | ||
166 | # else | ||
167 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
168 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
169 | # else | ||
170 | # define _GL_ATTRIBUTE_NOTHROW | ||
171 | # endif | ||
172 | # endif | ||
173 | #endif | ||
174 | |||
119 | /* An __attribute__ __format__ specifier for a function that takes a format | 175 | /* An __attribute__ __format__ specifier for a function that takes a format |
120 | string and arguments, where the format string directives are the ones | 176 | string and arguments, where the format string directives are the ones |
121 | standardized by ISO C99 and POSIX. | 177 | standardized by ISO C99 and POSIX. |
@@ -193,6 +249,36 @@ | |||
193 | # undef putc_unlocked | 249 | # undef putc_unlocked |
194 | #endif | 250 | #endif |
195 | 251 | ||
252 | |||
253 | /* Maximum number of characters produced by printing a NaN value. */ | ||
254 | #ifndef _PRINTF_NAN_LEN_MAX | ||
255 | # if defined __FreeBSD__ || defined __DragonFly__ \ | ||
256 | || defined __NetBSD__ \ | ||
257 | || (defined __APPLE__ && defined __MACH__) | ||
258 | /* On BSD systems, a NaN value prints as just "nan", without a sign. */ | ||
259 | # define _PRINTF_NAN_LEN_MAX 3 | ||
260 | # elif (__GLIBC__ >= 2) || MUSL_LIBC || defined __OpenBSD__ || defined __sun || defined __CYGWIN__ | ||
261 | /* glibc, musl libc, OpenBSD, Solaris libc, and Cygwin produce "[-]nan". */ | ||
262 | # define _PRINTF_NAN_LEN_MAX 4 | ||
263 | # elif defined _AIX | ||
264 | /* AIX produces "[-]NaNQ". */ | ||
265 | # define _PRINTF_NAN_LEN_MAX 5 | ||
266 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
267 | /* On native Windows, the output can be: | ||
268 | - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)", | ||
269 | - with mingw: "[-]1.#IND" or "[-]1.#QNAN". */ | ||
270 | # define _PRINTF_NAN_LEN_MAX 10 | ||
271 | # elif defined __sgi | ||
272 | /* On IRIX, the output typically is "[-]nan0xNNNNNNNN" with 8 hexadecimal | ||
273 | digits. */ | ||
274 | # define _PRINTF_NAN_LEN_MAX 14 | ||
275 | # else | ||
276 | /* We don't know, but 32 should be a safe maximum. */ | ||
277 | # define _PRINTF_NAN_LEN_MAX 32 | ||
278 | # endif | ||
279 | #endif | ||
280 | |||
281 | |||
196 | #if @GNULIB_DPRINTF@ | 282 | #if @GNULIB_DPRINTF@ |
197 | # if @REPLACE_DPRINTF@ | 283 | # if @REPLACE_DPRINTF@ |
198 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 284 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
@@ -210,7 +296,9 @@ _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) | |||
210 | # endif | 296 | # endif |
211 | _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); | 297 | _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); |
212 | # endif | 298 | # endif |
299 | # if __GLIBC__ >= 2 | ||
213 | _GL_CXXALIASWARN (dprintf); | 300 | _GL_CXXALIASWARN (dprintf); |
301 | # endif | ||
214 | #elif defined GNULIB_POSIXCHECK | 302 | #elif defined GNULIB_POSIXCHECK |
215 | # undef dprintf | 303 | # undef dprintf |
216 | # if HAVE_RAW_DECL_DPRINTF | 304 | # if HAVE_RAW_DECL_DPRINTF |
@@ -273,7 +361,8 @@ _GL_CXXALIASWARN (fcloseall); | |||
273 | # endif | 361 | # endif |
274 | _GL_FUNCDECL_RPL (fdopen, FILE *, | 362 | _GL_FUNCDECL_RPL (fdopen, FILE *, |
275 | (int fd, const char *mode) | 363 | (int fd, const char *mode) |
276 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 364 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
365 | _GL_ATTRIBUTE_MALLOC); | ||
277 | _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); | 366 | _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); |
278 | # elif defined _WIN32 && !defined __CYGWIN__ | 367 | # elif defined _WIN32 && !defined __CYGWIN__ |
279 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 368 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
@@ -284,9 +373,18 @@ _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); | |||
284 | # else | 373 | # else |
285 | # if __GNUC__ >= 11 | 374 | # if __GNUC__ >= 11 |
286 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ | 375 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ |
376 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
287 | _GL_FUNCDECL_SYS (fdopen, FILE *, | 377 | _GL_FUNCDECL_SYS (fdopen, FILE *, |
288 | (int fd, const char *mode) | 378 | (int fd, const char *mode) |
289 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 379 | _GL_ATTRIBUTE_NOTHROW |
380 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) | ||
381 | _GL_ATTRIBUTE_MALLOC); | ||
382 | # else | ||
383 | _GL_FUNCDECL_SYS (fdopen, FILE *, | ||
384 | (int fd, const char *mode) | ||
385 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) | ||
386 | _GL_ATTRIBUTE_MALLOC); | ||
387 | # endif | ||
290 | # endif | 388 | # endif |
291 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); | 389 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); |
292 | # endif | 390 | # endif |
@@ -294,9 +392,18 @@ _GL_CXXALIASWARN (fdopen); | |||
294 | #else | 392 | #else |
295 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen | 393 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen |
296 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ | 394 | /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ |
395 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
396 | _GL_FUNCDECL_SYS (fdopen, FILE *, | ||
397 | (int fd, const char *mode) | ||
398 | _GL_ATTRIBUTE_NOTHROW | ||
399 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) | ||
400 | _GL_ATTRIBUTE_MALLOC); | ||
401 | # else | ||
297 | _GL_FUNCDECL_SYS (fdopen, FILE *, | 402 | _GL_FUNCDECL_SYS (fdopen, FILE *, |
298 | (int fd, const char *mode) | 403 | (int fd, const char *mode) |
299 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 404 | _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
405 | _GL_ATTRIBUTE_MALLOC); | ||
406 | # endif | ||
300 | # endif | 407 | # endif |
301 | # if defined GNULIB_POSIXCHECK | 408 | # if defined GNULIB_POSIXCHECK |
302 | # undef fdopen | 409 | # undef fdopen |
@@ -407,7 +514,8 @@ _GL_CXXALIASWARN (fileno); | |||
407 | # endif | 514 | # endif |
408 | _GL_FUNCDECL_RPL (fopen, FILE *, | 515 | _GL_FUNCDECL_RPL (fopen, FILE *, |
409 | (const char *restrict filename, const char *restrict mode) | 516 | (const char *restrict filename, const char *restrict mode) |
410 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 517 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
518 | _GL_ATTRIBUTE_MALLOC); | ||
411 | _GL_CXXALIAS_RPL (fopen, FILE *, | 519 | _GL_CXXALIAS_RPL (fopen, FILE *, |
412 | (const char *restrict filename, const char *restrict mode)); | 520 | (const char *restrict filename, const char *restrict mode)); |
413 | # else | 521 | # else |
@@ -799,14 +907,14 @@ _GL_CXXALIAS_SYS (fwrite, size_t, | |||
799 | && !defined __cplusplus) | 907 | && !defined __cplusplus) |
800 | # undef fwrite | 908 | # undef fwrite |
801 | # undef fwrite_unlocked | 909 | # undef fwrite_unlocked |
802 | extern size_t __REDIRECT (rpl_fwrite, | 910 | _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite, |
803 | (const void *__restrict, size_t, size_t, | 911 | (const void *__restrict, size_t, size_t, |
804 | FILE *__restrict), | 912 | FILE *__restrict), |
805 | fwrite); | 913 | fwrite); |
806 | extern size_t __REDIRECT (rpl_fwrite_unlocked, | 914 | _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked, |
807 | (const void *__restrict, size_t, size_t, | 915 | (const void *__restrict, size_t, size_t, |
808 | FILE *__restrict), | 916 | FILE *__restrict), |
809 | fwrite_unlocked); | 917 | fwrite_unlocked); |
810 | # define fwrite rpl_fwrite | 918 | # define fwrite rpl_fwrite |
811 | # define fwrite_unlocked rpl_fwrite_unlocked | 919 | # define fwrite_unlocked rpl_fwrite_unlocked |
812 | # endif | 920 | # endif |
@@ -882,7 +990,9 @@ _GL_CXXALIAS_SYS (getdelim, ssize_t, | |||
882 | int delimiter, | 990 | int delimiter, |
883 | FILE *restrict stream)); | 991 | FILE *restrict stream)); |
884 | # endif | 992 | # endif |
993 | # if __GLIBC__ >= 2 | ||
885 | _GL_CXXALIASWARN (getdelim); | 994 | _GL_CXXALIASWARN (getdelim); |
995 | # endif | ||
886 | #elif defined GNULIB_POSIXCHECK | 996 | #elif defined GNULIB_POSIXCHECK |
887 | # undef getdelim | 997 | # undef getdelim |
888 | # if HAVE_RAW_DECL_GETDELIM | 998 | # if HAVE_RAW_DECL_GETDELIM |
@@ -921,7 +1031,7 @@ _GL_CXXALIAS_SYS (getline, ssize_t, | |||
921 | (char **restrict lineptr, size_t *restrict linesize, | 1031 | (char **restrict lineptr, size_t *restrict linesize, |
922 | FILE *restrict stream)); | 1032 | FILE *restrict stream)); |
923 | # endif | 1033 | # endif |
924 | # if @HAVE_DECL_GETLINE@ | 1034 | # if __GLIBC__ >= 2 && @HAVE_DECL_GETLINE@ |
925 | _GL_CXXALIASWARN (getline); | 1035 | _GL_CXXALIASWARN (getline); |
926 | # endif | 1036 | # endif |
927 | #elif defined GNULIB_POSIXCHECK | 1037 | #elif defined GNULIB_POSIXCHECK |
@@ -951,9 +1061,17 @@ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); | |||
951 | # endif | 1061 | # endif |
952 | _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); | 1062 | _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); |
953 | # else | 1063 | # else |
1064 | # if @HAVE_DECL_GETW@ | ||
1065 | # if defined __APPLE__ && defined __MACH__ | ||
1066 | /* The presence of the declaration depends on _POSIX_C_SOURCE. */ | ||
1067 | _GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream)); | ||
1068 | # endif | ||
954 | _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); | 1069 | _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); |
1070 | # endif | ||
955 | # endif | 1071 | # endif |
1072 | # if __GLIBC__ >= 2 | ||
956 | _GL_CXXALIASWARN (getw); | 1073 | _GL_CXXALIASWARN (getw); |
1074 | # endif | ||
957 | #endif | 1075 | #endif |
958 | 1076 | ||
959 | #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ | 1077 | #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ |
@@ -1052,13 +1170,15 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " | |||
1052 | # endif | 1170 | # endif |
1053 | _GL_FUNCDECL_RPL (popen, FILE *, | 1171 | _GL_FUNCDECL_RPL (popen, FILE *, |
1054 | (const char *cmd, const char *mode) | 1172 | (const char *cmd, const char *mode) |
1055 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | 1173 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) |
1174 | _GL_ATTRIBUTE_MALLOC); | ||
1056 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); | 1175 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); |
1057 | # else | 1176 | # else |
1058 | # if !@HAVE_POPEN@ || __GNUC__ >= 11 | 1177 | # if !@HAVE_POPEN@ || __GNUC__ >= 11 |
1059 | _GL_FUNCDECL_SYS (popen, FILE *, | 1178 | _GL_FUNCDECL_SYS (popen, FILE *, |
1060 | (const char *cmd, const char *mode) | 1179 | (const char *cmd, const char *mode) |
1061 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | 1180 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) |
1181 | _GL_ATTRIBUTE_MALLOC); | ||
1062 | # endif | 1182 | # endif |
1063 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); | 1183 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); |
1064 | # endif | 1184 | # endif |
@@ -1068,7 +1188,8 @@ _GL_CXXALIASWARN (popen); | |||
1068 | /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ | 1188 | /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ |
1069 | _GL_FUNCDECL_SYS (popen, FILE *, | 1189 | _GL_FUNCDECL_SYS (popen, FILE *, |
1070 | (const char *cmd, const char *mode) | 1190 | (const char *cmd, const char *mode) |
1071 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); | 1191 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) |
1192 | _GL_ATTRIBUTE_MALLOC); | ||
1072 | # endif | 1193 | # endif |
1073 | # if defined GNULIB_POSIXCHECK | 1194 | # if defined GNULIB_POSIXCHECK |
1074 | # undef popen | 1195 | # undef popen |
@@ -1190,9 +1311,17 @@ _GL_CXXALIASWARN (puts); | |||
1190 | # endif | 1311 | # endif |
1191 | _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); | 1312 | _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); |
1192 | # else | 1313 | # else |
1314 | # if @HAVE_DECL_PUTW@ | ||
1315 | # if defined __APPLE__ && defined __MACH__ | ||
1316 | /* The presence of the declaration depends on _POSIX_C_SOURCE. */ | ||
1317 | _GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream)); | ||
1318 | # endif | ||
1193 | _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); | 1319 | _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); |
1320 | # endif | ||
1194 | # endif | 1321 | # endif |
1322 | # if __GLIBC__ >= 2 | ||
1195 | _GL_CXXALIASWARN (putw); | 1323 | _GL_CXXALIASWARN (putw); |
1324 | # endif | ||
1196 | #endif | 1325 | #endif |
1197 | 1326 | ||
1198 | #if @GNULIB_REMOVE@ | 1327 | #if @GNULIB_REMOVE@ |
@@ -1398,13 +1527,15 @@ _GL_CXXALIASWARN (tempnam); | |||
1398 | # define tmpfile rpl_tmpfile | 1527 | # define tmpfile rpl_tmpfile |
1399 | # endif | 1528 | # endif |
1400 | _GL_FUNCDECL_RPL (tmpfile, FILE *, (void) | 1529 | _GL_FUNCDECL_RPL (tmpfile, FILE *, (void) |
1401 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 1530 | _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
1531 | _GL_ATTRIBUTE_MALLOC); | ||
1402 | _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); | 1532 | _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); |
1403 | # else | 1533 | # else |
1404 | # if __GNUC__ >= 11 | 1534 | # if __GNUC__ >= 11 |
1405 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ | 1535 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ |
1406 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) | 1536 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) |
1407 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 1537 | _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
1538 | _GL_ATTRIBUTE_MALLOC); | ||
1408 | # endif | 1539 | # endif |
1409 | _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); | 1540 | _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); |
1410 | # endif | 1541 | # endif |
@@ -1415,7 +1546,8 @@ _GL_CXXALIASWARN (tmpfile); | |||
1415 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile | 1546 | # if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile |
1416 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ | 1547 | /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ |
1417 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) | 1548 | _GL_FUNCDECL_SYS (tmpfile, FILE *, (void) |
1418 | _GL_ATTRIBUTE_DEALLOC (fclose, 1)); | 1549 | _GL_ATTRIBUTE_DEALLOC (fclose, 1) |
1550 | _GL_ATTRIBUTE_MALLOC); | ||
1419 | # endif | 1551 | # endif |
1420 | # if defined GNULIB_POSIXCHECK | 1552 | # if defined GNULIB_POSIXCHECK |
1421 | # undef tmpfile | 1553 | # undef tmpfile |
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index b79e5f70..e74e7c18 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <stdlib.h>. | 1 | /* A GNU-like <stdlib.h>. |
2 | 2 | ||
3 | Copyright (C) 1995, 2001-2004, 2006-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -37,6 +37,13 @@ | |||
37 | #ifndef _@GUARD_PREFIX@_STDLIB_H | 37 | #ifndef _@GUARD_PREFIX@_STDLIB_H |
38 | #define _@GUARD_PREFIX@_STDLIB_H | 38 | #define _@GUARD_PREFIX@_STDLIB_H |
39 | 39 | ||
40 | /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | ||
41 | _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, | ||
42 | HAVE_RAW_DECL_*. */ | ||
43 | #if !_GL_CONFIG_H_INCLUDED | ||
44 | #error "Please include config.h first." | ||
45 | #endif | ||
46 | |||
40 | /* NetBSD 5.0 mis-defines NULL. */ | 47 | /* NetBSD 5.0 mis-defines NULL. */ |
41 | #include <stddef.h> | 48 | #include <stddef.h> |
42 | 49 | ||
@@ -67,9 +74,7 @@ | |||
67 | # include <random.h> | 74 | # include <random.h> |
68 | # endif | 75 | # endif |
69 | 76 | ||
70 | # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ | 77 | # include <stdint.h> |
71 | # include <stdint.h> | ||
72 | # endif | ||
73 | 78 | ||
74 | # if !@HAVE_STRUCT_RANDOM_DATA@ | 79 | # if !@HAVE_STRUCT_RANDOM_DATA@ |
75 | /* Define 'struct random_data'. | 80 | /* Define 'struct random_data'. |
@@ -128,6 +133,28 @@ struct random_data | |||
128 | # endif | 133 | # endif |
129 | #endif | 134 | #endif |
130 | 135 | ||
136 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
137 | */ | ||
138 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
139 | # if defined __cplusplus | ||
140 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
141 | # if __cplusplus >= 201103L | ||
142 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
143 | # else | ||
144 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
145 | # endif | ||
146 | # else | ||
147 | # define _GL_ATTRIBUTE_NOTHROW | ||
148 | # endif | ||
149 | # else | ||
150 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
151 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
152 | # else | ||
153 | # define _GL_ATTRIBUTE_NOTHROW | ||
154 | # endif | ||
155 | # endif | ||
156 | #endif | ||
157 | |||
131 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | 158 | /* The __attribute__ feature is available in gcc versions 2.5 and later. |
132 | The attribute __pure__ was added in gcc 2.96. */ | 159 | The attribute __pure__ was added in gcc 2.96. */ |
133 | #ifndef _GL_ATTRIBUTE_PURE | 160 | #ifndef _GL_ATTRIBUTE_PURE |
@@ -164,11 +191,22 @@ struct random_data | |||
164 | #if @GNULIB__EXIT@ | 191 | #if @GNULIB__EXIT@ |
165 | /* Terminate the current process with the given return code, without running | 192 | /* Terminate the current process with the given return code, without running |
166 | the 'atexit' handlers. */ | 193 | the 'atexit' handlers. */ |
167 | # if !@HAVE__EXIT@ | 194 | # if @REPLACE__EXIT@ |
195 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
196 | # undef _Exit | ||
197 | # define _Exit rpl__Exit | ||
198 | # endif | ||
199 | _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); | ||
200 | _GL_CXXALIAS_RPL (_Exit, void, (int status)); | ||
201 | # else | ||
202 | # if !@HAVE__EXIT@ | ||
168 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); | 203 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); |
169 | # endif | 204 | # endif |
170 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); | 205 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); |
206 | # endif | ||
207 | # if __GLIBC__ >= 2 | ||
171 | _GL_CXXALIASWARN (_Exit); | 208 | _GL_CXXALIASWARN (_Exit); |
209 | # endif | ||
172 | #elif defined GNULIB_POSIXCHECK | 210 | #elif defined GNULIB_POSIXCHECK |
173 | # undef _Exit | 211 | # undef _Exit |
174 | # if HAVE_RAW_DECL__EXIT | 212 | # if HAVE_RAW_DECL__EXIT |
@@ -185,7 +223,7 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " | |||
185 | # define free rpl_free | 223 | # define free rpl_free |
186 | # endif | 224 | # endif |
187 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 225 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
188 | _GL_FUNCDECL_RPL (free, void, (void *ptr) throw ()); | 226 | _GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); |
189 | # else | 227 | # else |
190 | _GL_FUNCDECL_RPL (free, void, (void *ptr)); | 228 | _GL_FUNCDECL_RPL (free, void, (void *ptr)); |
191 | # endif | 229 | # endif |
@@ -219,9 +257,16 @@ _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); | |||
219 | # if @HAVE_ALIGNED_ALLOC@ | 257 | # if @HAVE_ALIGNED_ALLOC@ |
220 | # if __GNUC__ >= 11 | 258 | # if __GNUC__ >= 11 |
221 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | 259 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ |
260 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | ||
261 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | ||
262 | (size_t alignment, size_t size) | ||
263 | _GL_ATTRIBUTE_NOTHROW | ||
264 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
265 | # else | ||
222 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 266 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
223 | (size_t alignment, size_t size) | 267 | (size_t alignment, size_t size) |
224 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 268 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
269 | # endif | ||
225 | # endif | 270 | # endif |
226 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); | 271 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); |
227 | # endif | 272 | # endif |
@@ -232,9 +277,16 @@ _GL_CXXALIASWARN (aligned_alloc); | |||
232 | #else | 277 | #else |
233 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc | 278 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc |
234 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | 279 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ |
280 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | ||
235 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 281 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
236 | (size_t alignment, size_t size) | 282 | (size_t alignment, size_t size) |
283 | _GL_ATTRIBUTE_NOTHROW | ||
237 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 284 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
285 | # else | ||
286 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | ||
287 | (size_t alignment, size_t size) | ||
288 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
289 | # endif | ||
238 | # endif | 290 | # endif |
239 | # if defined GNULIB_POSIXCHECK | 291 | # if defined GNULIB_POSIXCHECK |
240 | # undef aligned_alloc | 292 | # undef aligned_alloc |
@@ -277,9 +329,16 @@ _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); | |||
277 | # else | 329 | # else |
278 | # if __GNUC__ >= 11 | 330 | # if __GNUC__ >= 11 |
279 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | 331 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ |
332 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | ||
280 | _GL_FUNCDECL_SYS (calloc, void *, | 333 | _GL_FUNCDECL_SYS (calloc, void *, |
281 | (size_t nmemb, size_t size) | 334 | (size_t nmemb, size_t size) |
335 | _GL_ATTRIBUTE_NOTHROW | ||
282 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 336 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
337 | # else | ||
338 | _GL_FUNCDECL_SYS (calloc, void *, | ||
339 | (size_t nmemb, size_t size) | ||
340 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
341 | # endif | ||
283 | # endif | 342 | # endif |
284 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); | 343 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); |
285 | # endif | 344 | # endif |
@@ -289,9 +348,16 @@ _GL_CXXALIASWARN (calloc); | |||
289 | #else | 348 | #else |
290 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc | 349 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc |
291 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | 350 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ |
351 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | ||
352 | _GL_FUNCDECL_SYS (calloc, void *, | ||
353 | (size_t nmemb, size_t size) | ||
354 | _GL_ATTRIBUTE_NOTHROW | ||
355 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
356 | # else | ||
292 | _GL_FUNCDECL_SYS (calloc, void *, | 357 | _GL_FUNCDECL_SYS (calloc, void *, |
293 | (size_t nmemb, size_t size) | 358 | (size_t nmemb, size_t size) |
294 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 359 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
360 | # endif | ||
295 | # endif | 361 | # endif |
296 | # if defined GNULIB_POSIXCHECK | 362 | # if defined GNULIB_POSIXCHECK |
297 | # undef calloc | 363 | # undef calloc |
@@ -313,10 +379,18 @@ _GL_FUNCDECL_RPL (canonicalize_file_name, char *, | |||
313 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); | 379 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); |
314 | # else | 380 | # else |
315 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 | 381 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 |
382 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
316 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 383 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
317 | (const char *name) | 384 | (const char *name) |
385 | _GL_ATTRIBUTE_NOTHROW | ||
318 | _GL_ARG_NONNULL ((1)) | 386 | _GL_ARG_NONNULL ((1)) |
319 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 387 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
388 | # else | ||
389 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | ||
390 | (const char *name) | ||
391 | _GL_ARG_NONNULL ((1)) | ||
392 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
393 | # endif | ||
320 | # endif | 394 | # endif |
321 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); | 395 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); |
322 | # endif | 396 | # endif |
@@ -329,10 +403,18 @@ _GL_CXXALIASWARN (canonicalize_file_name); | |||
329 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name | 403 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name |
330 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or | 404 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or |
331 | rpl_free. */ | 405 | rpl_free. */ |
406 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
332 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 407 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
333 | (const char *name) | 408 | (const char *name) |
409 | _GL_ATTRIBUTE_NOTHROW | ||
334 | _GL_ARG_NONNULL ((1)) | 410 | _GL_ARG_NONNULL ((1)) |
335 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 411 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
412 | # else | ||
413 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | ||
414 | (const char *name) | ||
415 | _GL_ARG_NONNULL ((1)) | ||
416 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
417 | # endif | ||
336 | # endif | 418 | # endif |
337 | # if defined GNULIB_POSIXCHECK | 419 | # if defined GNULIB_POSIXCHECK |
338 | # undef canonicalize_file_name | 420 | # undef canonicalize_file_name |
@@ -416,12 +498,24 @@ _GL_CXXALIASWARN (gcvt); | |||
416 | The three numbers are the load average of the last 1 minute, the last 5 | 498 | The three numbers are the load average of the last 1 minute, the last 5 |
417 | minutes, and the last 15 minutes, respectively. | 499 | minutes, and the last 15 minutes, respectively. |
418 | LOADAVG is an array of NELEM numbers. */ | 500 | LOADAVG is an array of NELEM numbers. */ |
419 | # if !@HAVE_DECL_GETLOADAVG@ | 501 | # if @REPLACE_GETLOADAVG@ |
502 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
503 | # undef getloadavg | ||
504 | # define getloadavg rpl_getloadavg | ||
505 | # endif | ||
506 | _GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) | ||
507 | _GL_ARG_NONNULL ((1))); | ||
508 | _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); | ||
509 | # else | ||
510 | # if !@HAVE_DECL_GETLOADAVG@ | ||
420 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) | 511 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) |
421 | _GL_ARG_NONNULL ((1))); | 512 | _GL_ARG_NONNULL ((1))); |
422 | # endif | 513 | # endif |
423 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); | 514 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); |
515 | # endif | ||
516 | # if __GLIBC__ >= 2 | ||
424 | _GL_CXXALIASWARN (getloadavg); | 517 | _GL_CXXALIASWARN (getloadavg); |
518 | # endif | ||
425 | #elif defined GNULIB_POSIXCHECK | 519 | #elif defined GNULIB_POSIXCHECK |
426 | # undef getloadavg | 520 | # undef getloadavg |
427 | # if HAVE_RAW_DECL_GETLOADAVG | 521 | # if HAVE_RAW_DECL_GETLOADAVG |
@@ -430,6 +524,41 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " | |||
430 | # endif | 524 | # endif |
431 | #endif | 525 | #endif |
432 | 526 | ||
527 | #if @GNULIB_GETPROGNAME@ | ||
528 | /* Return the base name of the executing program. | ||
529 | On native Windows this will usually end in ".exe" or ".EXE". */ | ||
530 | # if @REPLACE_GETPROGNAME@ | ||
531 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
532 | # undef getprogname | ||
533 | # define getprogname rpl_getprogname | ||
534 | # endif | ||
535 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ | ||
536 | _GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); | ||
537 | # else | ||
538 | _GL_FUNCDECL_RPL (getprogname, const char *, (void)); | ||
539 | # endif | ||
540 | _GL_CXXALIAS_RPL (getprogname, const char *, (void)); | ||
541 | # else | ||
542 | # if !@HAVE_GETPROGNAME@ | ||
543 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ | ||
544 | _GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); | ||
545 | # else | ||
546 | _GL_FUNCDECL_SYS (getprogname, const char *, (void)); | ||
547 | # endif | ||
548 | # endif | ||
549 | _GL_CXXALIAS_SYS (getprogname, const char *, (void)); | ||
550 | # endif | ||
551 | # if __GLIBC__ >= 2 | ||
552 | _GL_CXXALIASWARN (getprogname); | ||
553 | # endif | ||
554 | #elif defined GNULIB_POSIXCHECK | ||
555 | # undef getprogname | ||
556 | # if HAVE_RAW_DECL_GETPROGNAME | ||
557 | _GL_WARN_ON_USE (getprogname, "getprogname is unportable - " | ||
558 | "use gnulib module getprogname for portability"); | ||
559 | # endif | ||
560 | #endif | ||
561 | |||
433 | #if @GNULIB_GETSUBOPT@ | 562 | #if @GNULIB_GETSUBOPT@ |
434 | /* Assuming *OPTIONP is a comma separated list of elements of the form | 563 | /* Assuming *OPTIONP is a comma separated list of elements of the form |
435 | "token" or "token=value", getsubopt parses the first of these elements. | 564 | "token" or "token=value", getsubopt parses the first of these elements. |
@@ -442,14 +571,28 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " | |||
442 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. | 571 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. |
443 | For more details see the POSIX specification. | 572 | For more details see the POSIX specification. |
444 | https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ | 573 | https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ |
445 | # if !@HAVE_GETSUBOPT@ | 574 | # if @REPLACE_GETSUBOPT@ |
575 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
576 | # undef getsubopt | ||
577 | # define getsubopt rpl_getsubopt | ||
578 | # endif | ||
579 | _GL_FUNCDECL_RPL (getsubopt, int, | ||
580 | (char **optionp, char *const *tokens, char **valuep) | ||
581 | _GL_ARG_NONNULL ((1, 2, 3))); | ||
582 | _GL_CXXALIAS_RPL (getsubopt, int, | ||
583 | (char **optionp, char *const *tokens, char **valuep)); | ||
584 | # else | ||
585 | # if !@HAVE_GETSUBOPT@ | ||
446 | _GL_FUNCDECL_SYS (getsubopt, int, | 586 | _GL_FUNCDECL_SYS (getsubopt, int, |
447 | (char **optionp, char *const *tokens, char **valuep) | 587 | (char **optionp, char *const *tokens, char **valuep) |
448 | _GL_ARG_NONNULL ((1, 2, 3))); | 588 | _GL_ARG_NONNULL ((1, 2, 3))); |
449 | # endif | 589 | # endif |
450 | _GL_CXXALIAS_SYS (getsubopt, int, | 590 | _GL_CXXALIAS_SYS (getsubopt, int, |
451 | (char **optionp, char *const *tokens, char **valuep)); | 591 | (char **optionp, char *const *tokens, char **valuep)); |
592 | # endif | ||
593 | # if __GLIBC__ >= 2 | ||
452 | _GL_CXXALIASWARN (getsubopt); | 594 | _GL_CXXALIASWARN (getsubopt); |
595 | # endif | ||
453 | #elif defined GNULIB_POSIXCHECK | 596 | #elif defined GNULIB_POSIXCHECK |
454 | # undef getsubopt | 597 | # undef getsubopt |
455 | # if HAVE_RAW_DECL_GETSUBOPT | 598 | # if HAVE_RAW_DECL_GETSUBOPT |
@@ -493,9 +636,16 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); | |||
493 | # else | 636 | # else |
494 | # if __GNUC__ >= 11 | 637 | # if __GNUC__ >= 11 |
495 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | 638 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ |
639 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | ||
496 | _GL_FUNCDECL_SYS (malloc, void *, | 640 | _GL_FUNCDECL_SYS (malloc, void *, |
497 | (size_t size) | 641 | (size_t size) |
642 | _GL_ATTRIBUTE_NOTHROW | ||
498 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 643 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
644 | # else | ||
645 | _GL_FUNCDECL_SYS (malloc, void *, | ||
646 | (size_t size) | ||
647 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
648 | # endif | ||
499 | # endif | 649 | # endif |
500 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); | 650 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); |
501 | # endif | 651 | # endif |
@@ -505,9 +655,16 @@ _GL_CXXALIASWARN (malloc); | |||
505 | #else | 655 | #else |
506 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc | 656 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc |
507 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | 657 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ |
658 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | ||
659 | _GL_FUNCDECL_SYS (malloc, void *, | ||
660 | (size_t size) | ||
661 | _GL_ATTRIBUTE_NOTHROW | ||
662 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
663 | # else | ||
508 | _GL_FUNCDECL_SYS (malloc, void *, | 664 | _GL_FUNCDECL_SYS (malloc, void *, |
509 | (size_t size) | 665 | (size_t size) |
510 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 666 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
667 | # endif | ||
511 | # endif | 668 | # endif |
512 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | 669 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC |
513 | # undef malloc | 670 | # undef malloc |
@@ -517,6 +674,51 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |||
517 | # endif | 674 | # endif |
518 | #endif | 675 | #endif |
519 | 676 | ||
677 | /* Return maximum number of bytes of a multibyte character. */ | ||
678 | #if @REPLACE_MB_CUR_MAX@ | ||
679 | # if !GNULIB_defined_MB_CUR_MAX | ||
680 | static inline | ||
681 | int gl_MB_CUR_MAX (void) | ||
682 | { | ||
683 | /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ | ||
684 | return MB_CUR_MAX + (MB_CUR_MAX == 3); | ||
685 | } | ||
686 | # undef MB_CUR_MAX | ||
687 | # define MB_CUR_MAX gl_MB_CUR_MAX () | ||
688 | # define GNULIB_defined_MB_CUR_MAX 1 | ||
689 | # endif | ||
690 | #endif | ||
691 | |||
692 | /* Convert a string to a wide string. */ | ||
693 | #if @GNULIB_MBSTOWCS@ | ||
694 | # if @REPLACE_MBSTOWCS@ | ||
695 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
696 | # undef mbstowcs | ||
697 | # define mbstowcs rpl_mbstowcs | ||
698 | # endif | ||
699 | _GL_FUNCDECL_RPL (mbstowcs, size_t, | ||
700 | (wchar_t *restrict dest, const char *restrict src, | ||
701 | size_t len) | ||
702 | _GL_ARG_NONNULL ((2))); | ||
703 | _GL_CXXALIAS_RPL (mbstowcs, size_t, | ||
704 | (wchar_t *restrict dest, const char *restrict src, | ||
705 | size_t len)); | ||
706 | # else | ||
707 | _GL_CXXALIAS_SYS (mbstowcs, size_t, | ||
708 | (wchar_t *restrict dest, const char *restrict src, | ||
709 | size_t len)); | ||
710 | # endif | ||
711 | # if __GLIBC__ >= 2 | ||
712 | _GL_CXXALIASWARN (mbstowcs); | ||
713 | # endif | ||
714 | #elif defined GNULIB_POSIXCHECK | ||
715 | # undef mbstowcs | ||
716 | # if HAVE_RAW_DECL_MBSTOWCS | ||
717 | _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " | ||
718 | "use gnulib module mbstowcs for portability"); | ||
719 | # endif | ||
720 | #endif | ||
721 | |||
520 | /* Convert a multibyte character to a wide character. */ | 722 | /* Convert a multibyte character to a wide character. */ |
521 | #if @GNULIB_MBTOWC@ | 723 | #if @GNULIB_MBTOWC@ |
522 | # if @REPLACE_MBTOWC@ | 724 | # if @REPLACE_MBTOWC@ |
@@ -579,12 +781,24 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " | |||
579 | implementation. | 781 | implementation. |
580 | Returns the open file descriptor if successful, otherwise -1 and errno | 782 | Returns the open file descriptor if successful, otherwise -1 and errno |
581 | set. */ | 783 | set. */ |
582 | # if !@HAVE_MKOSTEMP@ | 784 | # if @REPLACE_MKOSTEMP@ |
785 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
786 | # undef mkostemp | ||
787 | # define mkostemp rpl_mkostemp | ||
788 | # endif | ||
789 | _GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) | ||
790 | _GL_ARG_NONNULL ((1))); | ||
791 | _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); | ||
792 | # else | ||
793 | # if !@HAVE_MKOSTEMP@ | ||
583 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) | 794 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) |
584 | _GL_ARG_NONNULL ((1))); | 795 | _GL_ARG_NONNULL ((1))); |
585 | # endif | 796 | # endif |
586 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); | 797 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); |
798 | # endif | ||
799 | # if __GLIBC__ >= 2 | ||
587 | _GL_CXXALIASWARN (mkostemp); | 800 | _GL_CXXALIASWARN (mkostemp); |
801 | # endif | ||
588 | #elif defined GNULIB_POSIXCHECK | 802 | #elif defined GNULIB_POSIXCHECK |
589 | # undef mkostemp | 803 | # undef mkostemp |
590 | # if HAVE_RAW_DECL_MKOSTEMP | 804 | # if HAVE_RAW_DECL_MKOSTEMP |
@@ -607,14 +821,28 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " | |||
607 | implementation. | 821 | implementation. |
608 | Returns the open file descriptor if successful, otherwise -1 and errno | 822 | Returns the open file descriptor if successful, otherwise -1 and errno |
609 | set. */ | 823 | set. */ |
610 | # if !@HAVE_MKOSTEMPS@ | 824 | # if @REPLACE_MKOSTEMPS@ |
825 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
826 | # undef mkostemps | ||
827 | # define mkostemps rpl_mkostemps | ||
828 | # endif | ||
829 | _GL_FUNCDECL_RPL (mkostemps, int, | ||
830 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) | ||
831 | _GL_ARG_NONNULL ((1))); | ||
832 | _GL_CXXALIAS_RPL (mkostemps, int, | ||
833 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); | ||
834 | # else | ||
835 | # if !@HAVE_MKOSTEMPS@ | ||
611 | _GL_FUNCDECL_SYS (mkostemps, int, | 836 | _GL_FUNCDECL_SYS (mkostemps, int, |
612 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) | 837 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) |
613 | _GL_ARG_NONNULL ((1))); | 838 | _GL_ARG_NONNULL ((1))); |
614 | # endif | 839 | # endif |
615 | _GL_CXXALIAS_SYS (mkostemps, int, | 840 | _GL_CXXALIAS_SYS (mkostemps, int, |
616 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); | 841 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); |
842 | # endif | ||
843 | # if __GLIBC__ >= 2 | ||
617 | _GL_CXXALIASWARN (mkostemps); | 844 | _GL_CXXALIASWARN (mkostemps); |
845 | # endif | ||
618 | #elif defined GNULIB_POSIXCHECK | 846 | #elif defined GNULIB_POSIXCHECK |
619 | # undef mkostemps | 847 | # undef mkostemps |
620 | # if HAVE_RAW_DECL_MKOSTEMPS | 848 | # if HAVE_RAW_DECL_MKOSTEMPS |
@@ -713,7 +941,7 @@ _GL_CXXALIAS_SYS (posix_memalign, int, | |||
713 | (void **memptr, size_t alignment, size_t size)); | 941 | (void **memptr, size_t alignment, size_t size)); |
714 | # endif | 942 | # endif |
715 | # endif | 943 | # endif |
716 | # if @HAVE_POSIX_MEMALIGN@ | 944 | # if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@ |
717 | _GL_CXXALIASWARN (posix_memalign); | 945 | _GL_CXXALIASWARN (posix_memalign); |
718 | # endif | 946 | # endif |
719 | #elif defined GNULIB_POSIXCHECK | 947 | #elif defined GNULIB_POSIXCHECK |
@@ -727,11 +955,22 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " | |||
727 | #if @GNULIB_POSIX_OPENPT@ | 955 | #if @GNULIB_POSIX_OPENPT@ |
728 | /* Return an FD open to the master side of a pseudo-terminal. Flags should | 956 | /* Return an FD open to the master side of a pseudo-terminal. Flags should |
729 | include O_RDWR, and may also include O_NOCTTY. */ | 957 | include O_RDWR, and may also include O_NOCTTY. */ |
730 | # if !@HAVE_POSIX_OPENPT@ | 958 | # if @REPLACE_POSIX_OPENPT@ |
959 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
960 | # undef posix_openpt | ||
961 | # define posix_openpt rpl_posix_openpt | ||
962 | # endif | ||
963 | _GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); | ||
964 | _GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); | ||
965 | # else | ||
966 | # if !@HAVE_POSIX_OPENPT@ | ||
731 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); | 967 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); |
732 | # endif | 968 | # endif |
733 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); | 969 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); |
970 | # endif | ||
971 | # if __GLIBC__ >= 2 | ||
734 | _GL_CXXALIASWARN (posix_openpt); | 972 | _GL_CXXALIASWARN (posix_openpt); |
973 | # endif | ||
735 | #elif defined GNULIB_POSIXCHECK | 974 | #elif defined GNULIB_POSIXCHECK |
736 | # undef posix_openpt | 975 | # undef posix_openpt |
737 | # if HAVE_RAW_DECL_POSIX_OPENPT | 976 | # if HAVE_RAW_DECL_POSIX_OPENPT |
@@ -808,6 +1047,10 @@ _GL_CXXALIAS_RPL (putenv, int, (char *string)); | |||
808 | # define putenv _putenv | 1047 | # define putenv _putenv |
809 | # endif | 1048 | # endif |
810 | _GL_CXXALIAS_MDA (putenv, int, (char *string)); | 1049 | _GL_CXXALIAS_MDA (putenv, int, (char *string)); |
1050 | # elif defined __KLIBC__ | ||
1051 | /* Need to cast, because on OS/2 kLIBC, the first parameter is | ||
1052 | const char *string. */ | ||
1053 | _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string)); | ||
811 | # else | 1054 | # else |
812 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); | 1055 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); |
813 | # endif | 1056 | # endif |
@@ -824,6 +1067,10 @@ _GL_CXXALIASWARN (putenv); | |||
824 | /* Need to cast, because on mingw, the parameter is either | 1067 | /* Need to cast, because on mingw, the parameter is either |
825 | 'const char *string' or 'char *string'. */ | 1068 | 'const char *string' or 'char *string'. */ |
826 | _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); | 1069 | _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); |
1070 | # elif defined __KLIBC__ | ||
1071 | /* Need to cast, because on OS/2 kLIBC, the first parameter is | ||
1072 | const char *string. */ | ||
1073 | _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string)); | ||
827 | # else | 1074 | # else |
828 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); | 1075 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); |
829 | # endif | 1076 | # endif |
@@ -865,7 +1112,9 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | |||
865 | _gl_qsort_r_compar_fn compare, | 1112 | _gl_qsort_r_compar_fn compare, |
866 | void *arg)); | 1113 | void *arg)); |
867 | # endif | 1114 | # endif |
1115 | # if __GLIBC__ >= 2 | ||
868 | _GL_CXXALIASWARN (qsort_r); | 1116 | _GL_CXXALIASWARN (qsort_r); |
1117 | # endif | ||
869 | #elif defined GNULIB_POSIXCHECK | 1118 | #elif defined GNULIB_POSIXCHECK |
870 | # undef qsort_r | 1119 | # undef qsort_r |
871 | # if HAVE_RAW_DECL_QSORT_R | 1120 | # if HAVE_RAW_DECL_QSORT_R |
@@ -875,11 +1124,26 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " | |||
875 | #endif | 1124 | #endif |
876 | 1125 | ||
877 | 1126 | ||
878 | #if @GNULIB_RANDOM_R@ | 1127 | #if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) |
879 | # if !@HAVE_RANDOM_R@ | 1128 | # ifndef RAND_MAX |
880 | # ifndef RAND_MAX | 1129 | # define RAND_MAX 2147483647 |
881 | # define RAND_MAX 2147483647 | 1130 | # endif |
1131 | #endif | ||
1132 | |||
1133 | |||
1134 | #if @GNULIB_RAND@ | ||
1135 | # if @REPLACE_RAND@ | ||
1136 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1137 | # undef rand | ||
1138 | # define rand rpl_rand | ||
882 | # endif | 1139 | # endif |
1140 | _GL_FUNCDECL_RPL (rand, int, (void)); | ||
1141 | _GL_CXXALIAS_RPL (rand, int, (void)); | ||
1142 | # else | ||
1143 | _GL_CXXALIAS_SYS (rand, int, (void)); | ||
1144 | # endif | ||
1145 | # if __GLIBC__ >= 2 | ||
1146 | _GL_CXXALIASWARN (rand); | ||
883 | # endif | 1147 | # endif |
884 | #endif | 1148 | #endif |
885 | 1149 | ||
@@ -900,7 +1164,9 @@ _GL_FUNCDECL_SYS (random, long, (void)); | |||
900 | int. */ | 1164 | int. */ |
901 | _GL_CXXALIAS_SYS_CAST (random, long, (void)); | 1165 | _GL_CXXALIAS_SYS_CAST (random, long, (void)); |
902 | # endif | 1166 | # endif |
1167 | # if __GLIBC__ >= 2 | ||
903 | _GL_CXXALIASWARN (random); | 1168 | _GL_CXXALIASWARN (random); |
1169 | # endif | ||
904 | #elif defined GNULIB_POSIXCHECK | 1170 | #elif defined GNULIB_POSIXCHECK |
905 | # undef random | 1171 | # undef random |
906 | # if HAVE_RAW_DECL_RANDOM | 1172 | # if HAVE_RAW_DECL_RANDOM |
@@ -925,7 +1191,9 @@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); | |||
925 | unsigned long seed. */ | 1191 | unsigned long seed. */ |
926 | _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); | 1192 | _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); |
927 | # endif | 1193 | # endif |
1194 | # if __GLIBC__ >= 2 | ||
928 | _GL_CXXALIASWARN (srandom); | 1195 | _GL_CXXALIASWARN (srandom); |
1196 | # endif | ||
929 | #elif defined GNULIB_POSIXCHECK | 1197 | #elif defined GNULIB_POSIXCHECK |
930 | # undef srandom | 1198 | # undef srandom |
931 | # if HAVE_RAW_DECL_SRANDOM | 1199 | # if HAVE_RAW_DECL_SRANDOM |
@@ -956,7 +1224,9 @@ _GL_FUNCDECL_SYS (initstate, char *, | |||
956 | _GL_CXXALIAS_SYS_CAST (initstate, char *, | 1224 | _GL_CXXALIAS_SYS_CAST (initstate, char *, |
957 | (unsigned int seed, char *buf, size_t buf_size)); | 1225 | (unsigned int seed, char *buf, size_t buf_size)); |
958 | # endif | 1226 | # endif |
1227 | # if __GLIBC__ >= 2 | ||
959 | _GL_CXXALIASWARN (initstate); | 1228 | _GL_CXXALIASWARN (initstate); |
1229 | # endif | ||
960 | #elif defined GNULIB_POSIXCHECK | 1230 | #elif defined GNULIB_POSIXCHECK |
961 | # undef initstate | 1231 | # undef initstate |
962 | # if HAVE_RAW_DECL_INITSTATE | 1232 | # if HAVE_RAW_DECL_INITSTATE |
@@ -981,7 +1251,9 @@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | |||
981 | is const char *arg_state. */ | 1251 | is const char *arg_state. */ |
982 | _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); | 1252 | _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); |
983 | # endif | 1253 | # endif |
1254 | # if __GLIBC__ >= 2 | ||
984 | _GL_CXXALIASWARN (setstate); | 1255 | _GL_CXXALIASWARN (setstate); |
1256 | # endif | ||
985 | #elif defined GNULIB_POSIXCHECK | 1257 | #elif defined GNULIB_POSIXCHECK |
986 | # undef setstate | 1258 | # undef setstate |
987 | # if HAVE_RAW_DECL_SETSTATE | 1259 | # if HAVE_RAW_DECL_SETSTATE |
@@ -1126,8 +1398,16 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); | |||
1126 | # else | 1398 | # else |
1127 | # if __GNUC__ >= 11 | 1399 | # if __GNUC__ >= 11 |
1128 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | 1400 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ |
1129 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) | 1401 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
1130 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1402 | _GL_FUNCDECL_SYS (realloc, void *, |
1403 | (void *ptr, size_t size) | ||
1404 | _GL_ATTRIBUTE_NOTHROW | ||
1405 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1406 | # else | ||
1407 | _GL_FUNCDECL_SYS (realloc, void *, | ||
1408 | (void *ptr, size_t size) | ||
1409 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1410 | # endif | ||
1131 | # endif | 1411 | # endif |
1132 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); | 1412 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); |
1133 | # endif | 1413 | # endif |
@@ -1137,8 +1417,16 @@ _GL_CXXALIASWARN (realloc); | |||
1137 | #else | 1417 | #else |
1138 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc | 1418 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc |
1139 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | 1419 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ |
1140 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) | 1420 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
1141 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1421 | _GL_FUNCDECL_SYS (realloc, void *, |
1422 | (void *ptr, size_t size) | ||
1423 | _GL_ATTRIBUTE_NOTHROW | ||
1424 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1425 | # else | ||
1426 | _GL_FUNCDECL_SYS (realloc, void *, | ||
1427 | (void *ptr, size_t size) | ||
1428 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1429 | # endif | ||
1142 | # endif | 1430 | # endif |
1143 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | 1431 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC |
1144 | # undef realloc | 1432 | # undef realloc |
@@ -1167,7 +1455,9 @@ _GL_FUNCDECL_SYS (reallocarray, void *, | |||
1167 | _GL_CXXALIAS_SYS (reallocarray, void *, | 1455 | _GL_CXXALIAS_SYS (reallocarray, void *, |
1168 | (void *ptr, size_t nmemb, size_t size)); | 1456 | (void *ptr, size_t nmemb, size_t size)); |
1169 | # endif | 1457 | # endif |
1458 | # if __GLIBC__ >= 2 | ||
1170 | _GL_CXXALIASWARN (reallocarray); | 1459 | _GL_CXXALIASWARN (reallocarray); |
1460 | # endif | ||
1171 | #elif defined GNULIB_POSIXCHECK | 1461 | #elif defined GNULIB_POSIXCHECK |
1172 | # undef reallocarray | 1462 | # undef reallocarray |
1173 | # if HAVE_RAW_DECL_REALLOCARRAY | 1463 | # if HAVE_RAW_DECL_REALLOCARRAY |
@@ -1301,6 +1591,38 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |||
1301 | # endif | 1591 | # endif |
1302 | #endif | 1592 | #endif |
1303 | 1593 | ||
1594 | #if @GNULIB_STRTOF@ | ||
1595 | /* Parse a float from STRING, updating ENDP if appropriate. */ | ||
1596 | # if @REPLACE_STRTOF@ | ||
1597 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1598 | # define strtof rpl_strtof | ||
1599 | # endif | ||
1600 | # define GNULIB_defined_strtof_function 1 | ||
1601 | _GL_FUNCDECL_RPL (strtof, float, | ||
1602 | (const char *restrict str, char **restrict endp) | ||
1603 | _GL_ARG_NONNULL ((1))); | ||
1604 | _GL_CXXALIAS_RPL (strtof, float, | ||
1605 | (const char *restrict str, char **restrict endp)); | ||
1606 | # else | ||
1607 | # if !@HAVE_STRTOF@ | ||
1608 | _GL_FUNCDECL_SYS (strtof, float, | ||
1609 | (const char *restrict str, char **restrict endp) | ||
1610 | _GL_ARG_NONNULL ((1))); | ||
1611 | # endif | ||
1612 | _GL_CXXALIAS_SYS (strtof, float, | ||
1613 | (const char *restrict str, char **restrict endp)); | ||
1614 | # endif | ||
1615 | # if __GLIBC__ >= 2 | ||
1616 | _GL_CXXALIASWARN (strtof); | ||
1617 | # endif | ||
1618 | #elif defined GNULIB_POSIXCHECK | ||
1619 | # undef strtof | ||
1620 | # if HAVE_RAW_DECL_STRTOF | ||
1621 | _GL_WARN_ON_USE (strtof, "strtof is unportable - " | ||
1622 | "use gnulib module strtof for portability"); | ||
1623 | # endif | ||
1624 | #endif | ||
1625 | |||
1304 | #if @GNULIB_STRTOLD@ | 1626 | #if @GNULIB_STRTOLD@ |
1305 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ | 1627 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ |
1306 | # if @REPLACE_STRTOLD@ | 1628 | # if @REPLACE_STRTOLD@ |
diff --git a/gl/str-two-way.h b/gl/str-two-way.h index dfe70224..cf85e268 100644 --- a/gl/str-two-way.h +++ b/gl/str-two-way.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Byte-wise substring search, using the Two-Way algorithm. | 1 | /* Byte-wise substring search, using the Two-Way algorithm. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Written by Eric Blake <ebb9@byu.net>, 2008. | 4 | Written by Eric Blake <ebb9@byu.net>, 2008. |
5 | 5 | ||
diff --git a/gl/strcasecmp.c b/gl/strcasecmp.c index 3a5ce3e1..7939b404 100644 --- a/gl/strcasecmp.c +++ b/gl/strcasecmp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Case-insensitive string comparison function. | 1 | /* Case-insensitive string comparison function. |
2 | Copyright (C) 1998-1999, 2005-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -22,8 +22,6 @@ | |||
22 | #include <ctype.h> | 22 | #include <ctype.h> |
23 | #include <limits.h> | 23 | #include <limits.h> |
24 | 24 | ||
25 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
26 | |||
27 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | 25 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or |
28 | greater than zero if S1 is lexicographically less than, equal to or greater | 26 | greater than zero if S1 is lexicographically less than, equal to or greater |
29 | than S2. | 27 | than S2. |
@@ -41,8 +39,8 @@ strcasecmp (const char *s1, const char *s2) | |||
41 | 39 | ||
42 | do | 40 | do |
43 | { | 41 | { |
44 | c1 = TOLOWER (*p1); | 42 | c1 = tolower (*p1); |
45 | c2 = TOLOWER (*p2); | 43 | c2 = tolower (*p2); |
46 | 44 | ||
47 | if (c1 == '\0') | 45 | if (c1 == '\0') |
48 | break; | 46 | break; |
diff --git a/gl/strcasestr.c b/gl/strcasestr.c index 8eea435c..b8c0479d 100644 --- a/gl/strcasestr.c +++ b/gl/strcasestr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Case-insensitive searching in a string. | 1 | /* Case-insensitive searching in a string. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2005. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2005. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -23,14 +23,12 @@ | |||
23 | #include <ctype.h> | 23 | #include <ctype.h> |
24 | #include <strings.h> | 24 | #include <strings.h> |
25 | 25 | ||
26 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
27 | |||
28 | /* Two-Way algorithm. */ | 26 | /* Two-Way algorithm. */ |
29 | #define RETURN_TYPE char * | 27 | #define RETURN_TYPE char * |
30 | #define AVAILABLE(h, h_l, j, n_l) \ | 28 | #define AVAILABLE(h, h_l, j, n_l) \ |
31 | (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ | 29 | (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ |
32 | && ((h_l) = (j) + (n_l))) | 30 | && ((h_l) = (j) + (n_l))) |
33 | #define CANON_ELEMENT(c) TOLOWER (c) | 31 | #define CANON_ELEMENT(c) tolower (c) |
34 | #define CMP_FUNC(p1, p2, l) \ | 32 | #define CMP_FUNC(p1, p2, l) \ |
35 | strncasecmp ((const char *) (p1), (const char *) (p2), l) | 33 | strncasecmp ((const char *) (p1), (const char *) (p2), l) |
36 | #include "str-two-way.h" | 34 | #include "str-two-way.h" |
@@ -52,8 +50,8 @@ strcasestr (const char *haystack_start, const char *needle_start) | |||
52 | NEEDLE if HAYSTACK is too short). */ | 50 | NEEDLE if HAYSTACK is too short). */ |
53 | while (*haystack && *needle) | 51 | while (*haystack && *needle) |
54 | { | 52 | { |
55 | ok &= (TOLOWER ((unsigned char) *haystack) | 53 | ok &= (tolower ((unsigned char) *haystack) |
56 | == TOLOWER ((unsigned char) *needle)); | 54 | == tolower ((unsigned char) *needle)); |
57 | haystack++; | 55 | haystack++; |
58 | needle++; | 56 | needle++; |
59 | } | 57 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* Optimized string comparison. | 1 | /* Optimized string comparison. |
2 | Copyright (C) 2001-2002, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2001-2002, 2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -21,6 +21,11 @@ | |||
21 | 21 | ||
22 | #include <string.h> | 22 | #include <string.h> |
23 | 23 | ||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif | ||
27 | |||
28 | |||
24 | /* STREQ_OPT allows to optimize string comparison with a small literal string. | 29 | /* STREQ_OPT allows to optimize string comparison with a small literal string. |
25 | STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) | 30 | STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) |
26 | is semantically equivalent to | 31 | is semantically equivalent to |
@@ -173,4 +178,9 @@ streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, | |||
173 | 178 | ||
174 | #endif | 179 | #endif |
175 | 180 | ||
181 | |||
182 | #ifdef __cplusplus | ||
183 | } | ||
184 | #endif | ||
185 | |||
176 | #endif /* _GL_STREQ_H */ | 186 | #endif /* _GL_STREQ_H */ |
diff --git a/gl/strerror-override.c b/gl/strerror-override.c index cddaa4a9..b9c1c7ab 100644 --- a/gl/strerror-override.c +++ b/gl/strerror-override.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* strerror-override.c --- POSIX compatible system error routine | 1 | /* strerror-override.c --- POSIX compatible system error routine |
2 | 2 | ||
3 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2010-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/strerror-override.h b/gl/strerror-override.h index 388cc282..a1734a24 100644 --- a/gl/strerror-override.h +++ b/gl/strerror-override.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* strerror-override.h --- POSIX compatible system error routine | 1 | /* strerror-override.h --- POSIX compatible system error routine |
2 | 2 | ||
3 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2010-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -16,42 +16,57 @@ | |||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | #ifndef _GL_STRERROR_OVERRIDE_H | 18 | #ifndef _GL_STRERROR_OVERRIDE_H |
19 | # define _GL_STRERROR_OVERRIDE_H | 19 | #define _GL_STRERROR_OVERRIDE_H |
20 | |||
21 | /* This file uses _GL_ATTRIBUTE_CONST. */ | ||
22 | #if !_GL_CONFIG_H_INCLUDED | ||
23 | # error "Please include config.h first." | ||
24 | #endif | ||
25 | |||
26 | #include <errno.h> | ||
27 | #include <stddef.h> | ||
28 | |||
29 | #ifdef __cplusplus | ||
30 | extern "C" { | ||
31 | #endif | ||
20 | 32 | ||
21 | # include <errno.h> | ||
22 | # include <stddef.h> | ||
23 | 33 | ||
24 | /* Reasonable buffer size that should never trigger ERANGE; if this | 34 | /* Reasonable buffer size that should never trigger ERANGE; if this |
25 | proves too small, we intentionally abort(), to remind us to fix | 35 | proves too small, we intentionally abort(), to remind us to fix |
26 | this value. */ | 36 | this value. */ |
27 | # define STACKBUF_LEN 256 | 37 | #define STACKBUF_LEN 256 |
28 | 38 | ||
29 | /* If ERRNUM maps to an errno value defined by gnulib, return a string | 39 | /* If ERRNUM maps to an errno value defined by gnulib, return a string |
30 | describing the error. Otherwise return NULL. */ | 40 | describing the error. Otherwise return NULL. */ |
31 | # if REPLACE_STRERROR_0 \ | 41 | #if REPLACE_STRERROR_0 \ |
32 | || GNULIB_defined_ESOCK \ | 42 | || GNULIB_defined_ESOCK \ |
33 | || GNULIB_defined_ESTREAMS \ | 43 | || GNULIB_defined_ESTREAMS \ |
34 | || GNULIB_defined_EWINSOCK \ | 44 | || GNULIB_defined_EWINSOCK \ |
35 | || GNULIB_defined_ENOMSG \ | 45 | || GNULIB_defined_ENOMSG \ |
36 | || GNULIB_defined_EIDRM \ | 46 | || GNULIB_defined_EIDRM \ |
37 | || GNULIB_defined_ENOLINK \ | 47 | || GNULIB_defined_ENOLINK \ |
38 | || GNULIB_defined_EPROTO \ | 48 | || GNULIB_defined_EPROTO \ |
39 | || GNULIB_defined_EMULTIHOP \ | 49 | || GNULIB_defined_EMULTIHOP \ |
40 | || GNULIB_defined_EBADMSG \ | 50 | || GNULIB_defined_EBADMSG \ |
41 | || GNULIB_defined_EOVERFLOW \ | 51 | || GNULIB_defined_EOVERFLOW \ |
42 | || GNULIB_defined_ENOTSUP \ | 52 | || GNULIB_defined_ENOTSUP \ |
43 | || GNULIB_defined_ENETRESET \ | 53 | || GNULIB_defined_ENETRESET \ |
44 | || GNULIB_defined_ECONNABORTED \ | 54 | || GNULIB_defined_ECONNABORTED \ |
45 | || GNULIB_defined_ESTALE \ | 55 | || GNULIB_defined_ESTALE \ |
46 | || GNULIB_defined_EDQUOT \ | 56 | || GNULIB_defined_EDQUOT \ |
47 | || GNULIB_defined_ECANCELED \ | 57 | || GNULIB_defined_ECANCELED \ |
48 | || GNULIB_defined_EOWNERDEAD \ | 58 | || GNULIB_defined_EOWNERDEAD \ |
49 | || GNULIB_defined_ENOTRECOVERABLE \ | 59 | || GNULIB_defined_ENOTRECOVERABLE \ |
50 | || GNULIB_defined_EILSEQ | 60 | || GNULIB_defined_EILSEQ |
51 | extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; | 61 | extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; |
52 | # else | 62 | #else |
53 | # define strerror_override(ignored) NULL | 63 | # define strerror_override(ignored) NULL |
54 | # define GNULIB_defined_strerror_override_macro 1 | 64 | # define GNULIB_defined_strerror_override_macro 1 |
55 | # endif | 65 | #endif |
66 | |||
67 | |||
68 | #ifdef __cplusplus | ||
69 | } | ||
70 | #endif | ||
56 | 71 | ||
57 | #endif /* _GL_STRERROR_OVERRIDE_H */ | 72 | #endif /* _GL_STRERROR_OVERRIDE_H */ |
diff --git a/gl/strerror.c b/gl/strerror.c index d754f601..6b760ff4 100644 --- a/gl/strerror.c +++ b/gl/strerror.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* strerror.c --- POSIX compatible system error routine | 1 | /* strerror.c --- POSIX compatible system error routine |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/string.in.h b/gl/string.in.h index e993b2fb..44ec2e7e 100644 --- a/gl/string.in.h +++ b/gl/string.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <string.h>. | 1 | /* A GNU-like <string.h>. |
2 | 2 | ||
3 | Copyright (C) 1995-1996, 2001-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1995-1996, 2001-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -44,6 +44,13 @@ | |||
44 | #ifndef _@GUARD_PREFIX@_STRING_H | 44 | #ifndef _@GUARD_PREFIX@_STRING_H |
45 | #define _@GUARD_PREFIX@_STRING_H | 45 | #define _@GUARD_PREFIX@_STRING_H |
46 | 46 | ||
47 | /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | ||
48 | _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, | ||
49 | HAVE_RAW_DECL_*. */ | ||
50 | #if !_GL_CONFIG_H_INCLUDED | ||
51 | #error "Please include config.h first." | ||
52 | #endif | ||
53 | |||
47 | /* NetBSD 5.0 mis-defines NULL. */ | 54 | /* NetBSD 5.0 mis-defines NULL. */ |
48 | #include <stddef.h> | 55 | #include <stddef.h> |
49 | 56 | ||
@@ -59,10 +66,11 @@ | |||
59 | # include <unistd.h> | 66 | # include <unistd.h> |
60 | #endif | 67 | #endif |
61 | 68 | ||
62 | /* AIX 7.2 declares ffsl and ffsll in <strings.h>, not in <string.h>. */ | 69 | /* AIX 7.2 and Android 13 declare ffsl and ffsll in <strings.h>, not in |
70 | <string.h>. */ | ||
63 | /* But in any case avoid namespace pollution on glibc systems. */ | 71 | /* But in any case avoid namespace pollution on glibc systems. */ |
64 | #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ | 72 | #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ |
65 | && defined _AIX) \ | 73 | && (defined _AIX || defined __ANDROID__)) \ |
66 | && ! defined __GLIBC__ | 74 | && ! defined __GLIBC__ |
67 | # include <strings.h> | 75 | # include <strings.h> |
68 | #endif | 76 | #endif |
@@ -103,6 +111,28 @@ | |||
103 | # endif | 111 | # endif |
104 | #endif | 112 | #endif |
105 | 113 | ||
114 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
115 | */ | ||
116 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
117 | # if defined __cplusplus | ||
118 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
119 | # if __cplusplus >= 201103L | ||
120 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
121 | # else | ||
122 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
123 | # endif | ||
124 | # else | ||
125 | # define _GL_ATTRIBUTE_NOTHROW | ||
126 | # endif | ||
127 | # else | ||
128 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
129 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
130 | # else | ||
131 | # define _GL_ATTRIBUTE_NOTHROW | ||
132 | # endif | ||
133 | # endif | ||
134 | #endif | ||
135 | |||
106 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | 136 | /* The __attribute__ feature is available in gcc versions 2.5 and later. |
107 | The attribute __pure__ was added in gcc 2.96. */ | 137 | The attribute __pure__ was added in gcc 2.96. */ |
108 | #ifndef _GL_ATTRIBUTE_PURE | 138 | #ifndef _GL_ATTRIBUTE_PURE |
@@ -125,7 +155,11 @@ | |||
125 | # if (@REPLACE_FREE@ && !defined free \ | 155 | # if (@REPLACE_FREE@ && !defined free \ |
126 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | 156 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) |
127 | /* We can't do '#define free rpl_free' here. */ | 157 | /* We can't do '#define free rpl_free' here. */ |
158 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
159 | _GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW; | ||
160 | # else | ||
128 | _GL_EXTERN_C void rpl_free (void *); | 161 | _GL_EXTERN_C void rpl_free (void *); |
162 | # endif | ||
129 | # undef _GL_ATTRIBUTE_DEALLOC_FREE | 163 | # undef _GL_ATTRIBUTE_DEALLOC_FREE |
130 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) | 164 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) |
131 | # else | 165 | # else |
@@ -137,7 +171,7 @@ _GL_EXTERN_C | |||
137 | void __cdecl free (void *); | 171 | void __cdecl free (void *); |
138 | # else | 172 | # else |
139 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 173 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
140 | _GL_EXTERN_C void free (void *) throw (); | 174 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
141 | # else | 175 | # else |
142 | _GL_EXTERN_C void free (void *); | 176 | _GL_EXTERN_C void free (void *); |
143 | # endif | 177 | # endif |
@@ -152,7 +186,7 @@ _GL_EXTERN_C | |||
152 | void __cdecl free (void *); | 186 | void __cdecl free (void *); |
153 | # else | 187 | # else |
154 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 188 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
155 | _GL_EXTERN_C void free (void *) throw (); | 189 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
156 | # else | 190 | # else |
157 | _GL_EXTERN_C void free (void *); | 191 | _GL_EXTERN_C void free (void *); |
158 | # endif | 192 | # endif |
@@ -255,9 +289,12 @@ _GL_CXXALIAS_SYS_CAST2 (memchr, | |||
255 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 289 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
256 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 290 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
257 | || defined __clang__) | 291 | || defined __clang__) |
258 | _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n) throw ()); | 292 | _GL_CXXALIASWARN1 (memchr, void *, |
293 | (void *__s, int __c, size_t __n) | ||
294 | _GL_ATTRIBUTE_NOTHROW); | ||
259 | _GL_CXXALIASWARN1 (memchr, void const *, | 295 | _GL_CXXALIASWARN1 (memchr, void const *, |
260 | (void const *__s, int __c, size_t __n) throw ()); | 296 | (void const *__s, int __c, size_t __n) |
297 | _GL_ATTRIBUTE_NOTHROW); | ||
261 | # elif __GLIBC__ >= 2 | 298 | # elif __GLIBC__ >= 2 |
262 | _GL_CXXALIASWARN (memchr); | 299 | _GL_CXXALIASWARN (memchr); |
263 | # endif | 300 | # endif |
@@ -307,16 +344,32 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " | |||
307 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the | 344 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the |
308 | last written byte. */ | 345 | last written byte. */ |
309 | #if @GNULIB_MEMPCPY@ | 346 | #if @GNULIB_MEMPCPY@ |
310 | # if ! @HAVE_MEMPCPY@ | 347 | # if @REPLACE_MEMPCPY@ |
348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
349 | # undef mempcpy | ||
350 | # define mempcpy rpl_mempcpy | ||
351 | # endif | ||
352 | _GL_FUNCDECL_RPL (mempcpy, void *, | ||
353 | (void *restrict __dest, void const *restrict __src, | ||
354 | size_t __n) | ||
355 | _GL_ARG_NONNULL ((1, 2))); | ||
356 | _GL_CXXALIAS_RPL (mempcpy, void *, | ||
357 | (void *restrict __dest, void const *restrict __src, | ||
358 | size_t __n)); | ||
359 | # else | ||
360 | # if !@HAVE_MEMPCPY@ | ||
311 | _GL_FUNCDECL_SYS (mempcpy, void *, | 361 | _GL_FUNCDECL_SYS (mempcpy, void *, |
312 | (void *restrict __dest, void const *restrict __src, | 362 | (void *restrict __dest, void const *restrict __src, |
313 | size_t __n) | 363 | size_t __n) |
314 | _GL_ARG_NONNULL ((1, 2))); | 364 | _GL_ARG_NONNULL ((1, 2))); |
315 | # endif | 365 | # endif |
316 | _GL_CXXALIAS_SYS (mempcpy, void *, | 366 | _GL_CXXALIAS_SYS (mempcpy, void *, |
317 | (void *restrict __dest, void const *restrict __src, | 367 | (void *restrict __dest, void const *restrict __src, |
318 | size_t __n)); | 368 | size_t __n)); |
369 | # endif | ||
370 | # if __GLIBC__ >= 2 | ||
319 | _GL_CXXALIASWARN (mempcpy); | 371 | _GL_CXXALIASWARN (mempcpy); |
372 | # endif | ||
320 | #elif defined GNULIB_POSIXCHECK | 373 | #elif defined GNULIB_POSIXCHECK |
321 | # undef mempcpy | 374 | # undef mempcpy |
322 | # if HAVE_RAW_DECL_MEMPCPY | 375 | # if HAVE_RAW_DECL_MEMPCPY |
@@ -341,9 +394,13 @@ _GL_CXXALIAS_SYS_CAST2 (memrchr, | |||
341 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 394 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
342 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 395 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
343 | || defined __clang__) | 396 | || defined __clang__) |
344 | _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t) throw ()); | 397 | _GL_CXXALIASWARN1 (memrchr, void *, |
345 | _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t) throw ()); | 398 | (void *, int, size_t) |
346 | # else | 399 | _GL_ATTRIBUTE_NOTHROW); |
400 | _GL_CXXALIASWARN1 (memrchr, void const *, | ||
401 | (void const *, int, size_t) | ||
402 | _GL_ATTRIBUTE_NOTHROW); | ||
403 | # elif __GLIBC__ >= 2 | ||
347 | _GL_CXXALIASWARN (memrchr); | 404 | _GL_CXXALIASWARN (memrchr); |
348 | # endif | 405 | # endif |
349 | #elif defined GNULIB_POSIXCHECK | 406 | #elif defined GNULIB_POSIXCHECK |
@@ -357,11 +414,21 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " | |||
357 | /* Overwrite a block of memory. The compiler will not optimize | 414 | /* Overwrite a block of memory. The compiler will not optimize |
358 | effects away, even if the block is dead after the call. */ | 415 | effects away, even if the block is dead after the call. */ |
359 | #if @GNULIB_MEMSET_EXPLICIT@ | 416 | #if @GNULIB_MEMSET_EXPLICIT@ |
360 | # if ! @HAVE_MEMSET_EXPLICIT@ | 417 | # if @REPLACE_MEMSET_EXPLICIT@ |
418 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
419 | # undef memset_explicit | ||
420 | # define memset_explicit rpl_memset_explicit | ||
421 | # endif | ||
422 | _GL_FUNCDECL_RPL (memset_explicit, void *, | ||
423 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); | ||
424 | _GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); | ||
425 | # else | ||
426 | # if !@HAVE_MEMSET_EXPLICIT@ | ||
361 | _GL_FUNCDECL_SYS (memset_explicit, void *, | 427 | _GL_FUNCDECL_SYS (memset_explicit, void *, |
362 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); | 428 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); |
363 | # endif | 429 | # endif |
364 | _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); | 430 | _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); |
431 | # endif | ||
365 | _GL_CXXALIASWARN (memset_explicit); | 432 | _GL_CXXALIASWARN (memset_explicit); |
366 | #elif defined GNULIB_POSIXCHECK | 433 | #elif defined GNULIB_POSIXCHECK |
367 | # undef memset_explicit | 434 | # undef memset_explicit |
@@ -389,9 +456,12 @@ _GL_CXXALIAS_SYS_CAST2 (rawmemchr, | |||
389 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 456 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
390 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 457 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
391 | || defined __clang__) | 458 | || defined __clang__) |
392 | _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in) throw ()); | 459 | _GL_CXXALIASWARN1 (rawmemchr, void *, |
460 | (void *__s, int __c_in) | ||
461 | _GL_ATTRIBUTE_NOTHROW); | ||
393 | _GL_CXXALIASWARN1 (rawmemchr, void const *, | 462 | _GL_CXXALIASWARN1 (rawmemchr, void const *, |
394 | (void const *__s, int __c_in) throw ()); | 463 | (void const *__s, int __c_in) |
464 | _GL_ATTRIBUTE_NOTHROW); | ||
395 | # else | 465 | # else |
396 | _GL_CXXALIASWARN (rawmemchr); | 466 | _GL_CXXALIASWARN (rawmemchr); |
397 | # endif | 467 | # endif |
@@ -405,14 +475,28 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " | |||
405 | 475 | ||
406 | /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ | 476 | /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ |
407 | #if @GNULIB_STPCPY@ | 477 | #if @GNULIB_STPCPY@ |
408 | # if ! @HAVE_STPCPY@ | 478 | # if @REPLACE_STPCPY@ |
479 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
480 | # undef stpcpy | ||
481 | # define stpcpy rpl_stpcpy | ||
482 | # endif | ||
483 | _GL_FUNCDECL_RPL (stpcpy, char *, | ||
484 | (char *restrict __dst, char const *restrict __src) | ||
485 | _GL_ARG_NONNULL ((1, 2))); | ||
486 | _GL_CXXALIAS_RPL (stpcpy, char *, | ||
487 | (char *restrict __dst, char const *restrict __src)); | ||
488 | # else | ||
489 | # if !@HAVE_STPCPY@ | ||
409 | _GL_FUNCDECL_SYS (stpcpy, char *, | 490 | _GL_FUNCDECL_SYS (stpcpy, char *, |
410 | (char *restrict __dst, char const *restrict __src) | 491 | (char *restrict __dst, char const *restrict __src) |
411 | _GL_ARG_NONNULL ((1, 2))); | 492 | _GL_ARG_NONNULL ((1, 2))); |
412 | # endif | 493 | # endif |
413 | _GL_CXXALIAS_SYS (stpcpy, char *, | 494 | _GL_CXXALIAS_SYS (stpcpy, char *, |
414 | (char *restrict __dst, char const *restrict __src)); | 495 | (char *restrict __dst, char const *restrict __src)); |
496 | # endif | ||
497 | # if __GLIBC__ >= 2 | ||
415 | _GL_CXXALIASWARN (stpcpy); | 498 | _GL_CXXALIASWARN (stpcpy); |
499 | # endif | ||
416 | #elif defined GNULIB_POSIXCHECK | 500 | #elif defined GNULIB_POSIXCHECK |
417 | # undef stpcpy | 501 | # undef stpcpy |
418 | # if HAVE_RAW_DECL_STPCPY | 502 | # if HAVE_RAW_DECL_STPCPY |
@@ -447,7 +531,9 @@ _GL_CXXALIAS_SYS (stpncpy, char *, | |||
447 | (char *restrict __dst, char const *restrict __src, | 531 | (char *restrict __dst, char const *restrict __src, |
448 | size_t __n)); | 532 | size_t __n)); |
449 | # endif | 533 | # endif |
534 | # if __GLIBC__ >= 2 | ||
450 | _GL_CXXALIASWARN (stpncpy); | 535 | _GL_CXXALIASWARN (stpncpy); |
536 | # endif | ||
451 | #elif defined GNULIB_POSIXCHECK | 537 | #elif defined GNULIB_POSIXCHECK |
452 | # undef stpncpy | 538 | # undef stpncpy |
453 | # if HAVE_RAW_DECL_STPNCPY | 539 | # if HAVE_RAW_DECL_STPNCPY |
@@ -495,10 +581,13 @@ _GL_CXXALIAS_SYS_CAST2 (strchrnul, | |||
495 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 581 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
496 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 582 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
497 | || defined __clang__) | 583 | || defined __clang__) |
498 | _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in) throw ()); | 584 | _GL_CXXALIASWARN1 (strchrnul, char *, |
585 | (char *__s, int __c_in) | ||
586 | _GL_ATTRIBUTE_NOTHROW); | ||
499 | _GL_CXXALIASWARN1 (strchrnul, char const *, | 587 | _GL_CXXALIASWARN1 (strchrnul, char const *, |
500 | (char const *__s, int __c_in) throw ()); | 588 | (char const *__s, int __c_in) |
501 | # else | 589 | _GL_ATTRIBUTE_NOTHROW); |
590 | # elif __GLIBC__ >= 2 | ||
502 | _GL_CXXALIASWARN (strchrnul); | 591 | _GL_CXXALIASWARN (strchrnul); |
503 | # endif | 592 | # endif |
504 | #elif defined GNULIB_POSIXCHECK | 593 | #elif defined GNULIB_POSIXCHECK |
@@ -533,10 +622,18 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); | |||
533 | # undef strdup | 622 | # undef strdup |
534 | # endif | 623 | # endif |
535 | # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup | 624 | # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup |
625 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
626 | _GL_FUNCDECL_SYS (strdup, char *, | ||
627 | (char const *__s) | ||
628 | _GL_ATTRIBUTE_NOTHROW | ||
629 | _GL_ARG_NONNULL ((1)) | ||
630 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
631 | # else | ||
536 | _GL_FUNCDECL_SYS (strdup, char *, | 632 | _GL_FUNCDECL_SYS (strdup, char *, |
537 | (char const *__s) | 633 | (char const *__s) |
538 | _GL_ARG_NONNULL ((1)) | 634 | _GL_ARG_NONNULL ((1)) |
539 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 635 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
636 | # endif | ||
540 | # endif | 637 | # endif |
541 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); | 638 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); |
542 | # endif | 639 | # endif |
@@ -544,10 +641,18 @@ _GL_CXXALIASWARN (strdup); | |||
544 | #else | 641 | #else |
545 | # if __GNUC__ >= 11 && !defined strdup | 642 | # if __GNUC__ >= 11 && !defined strdup |
546 | /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ | 643 | /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ |
644 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
547 | _GL_FUNCDECL_SYS (strdup, char *, | 645 | _GL_FUNCDECL_SYS (strdup, char *, |
548 | (char const *__s) | 646 | (char const *__s) |
647 | _GL_ATTRIBUTE_NOTHROW | ||
549 | _GL_ARG_NONNULL ((1)) | 648 | _GL_ARG_NONNULL ((1)) |
550 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 649 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
650 | # else | ||
651 | _GL_FUNCDECL_SYS (strdup, char *, | ||
652 | (char const *__s) | ||
653 | _GL_ARG_NONNULL ((1)) | ||
654 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
655 | # endif | ||
551 | # endif | 656 | # endif |
552 | # if defined GNULIB_POSIXCHECK | 657 | # if defined GNULIB_POSIXCHECK |
553 | # undef strdup | 658 | # undef strdup |
@@ -616,10 +721,18 @@ _GL_FUNCDECL_RPL (strndup, char *, | |||
616 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); | 721 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); |
617 | # else | 722 | # else |
618 | # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) | 723 | # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) |
724 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
619 | _GL_FUNCDECL_SYS (strndup, char *, | 725 | _GL_FUNCDECL_SYS (strndup, char *, |
620 | (char const *__s, size_t __n) | 726 | (char const *__s, size_t __n) |
727 | _GL_ATTRIBUTE_NOTHROW | ||
621 | _GL_ARG_NONNULL ((1)) | 728 | _GL_ARG_NONNULL ((1)) |
622 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 729 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
730 | # else | ||
731 | _GL_FUNCDECL_SYS (strndup, char *, | ||
732 | (char const *__s, size_t __n) | ||
733 | _GL_ARG_NONNULL ((1)) | ||
734 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
735 | # endif | ||
623 | # endif | 736 | # endif |
624 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); | 737 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); |
625 | # endif | 738 | # endif |
@@ -627,10 +740,18 @@ _GL_CXXALIASWARN (strndup); | |||
627 | #else | 740 | #else |
628 | # if __GNUC__ >= 11 && !defined strndup | 741 | # if __GNUC__ >= 11 && !defined strndup |
629 | /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ | 742 | /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ |
743 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
630 | _GL_FUNCDECL_SYS (strndup, char *, | 744 | _GL_FUNCDECL_SYS (strndup, char *, |
631 | (char const *__s, size_t __n) | 745 | (char const *__s, size_t __n) |
746 | _GL_ATTRIBUTE_NOTHROW | ||
632 | _GL_ARG_NONNULL ((1)) | 747 | _GL_ARG_NONNULL ((1)) |
633 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 748 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
749 | # else | ||
750 | _GL_FUNCDECL_SYS (strndup, char *, | ||
751 | (char const *__s, size_t __n) | ||
752 | _GL_ARG_NONNULL ((1)) | ||
753 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
754 | # endif | ||
634 | # endif | 755 | # endif |
635 | # if defined GNULIB_POSIXCHECK | 756 | # if defined GNULIB_POSIXCHECK |
636 | # undef strndup | 757 | # undef strndup |
@@ -699,9 +820,12 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk, | |||
699 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 820 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
700 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 821 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
701 | || defined __clang__) | 822 | || defined __clang__) |
702 | _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept) throw ()); | 823 | _GL_CXXALIASWARN1 (strpbrk, char *, |
824 | (char *__s, char const *__accept) | ||
825 | _GL_ATTRIBUTE_NOTHROW); | ||
703 | _GL_CXXALIASWARN1 (strpbrk, char const *, | 826 | _GL_CXXALIASWARN1 (strpbrk, char const *, |
704 | (char const *__s, char const *__accept) throw ()); | 827 | (char const *__s, char const *__accept) |
828 | _GL_ATTRIBUTE_NOTHROW); | ||
705 | # elif __GLIBC__ >= 2 | 829 | # elif __GLIBC__ >= 2 |
706 | _GL_CXXALIASWARN (strpbrk); | 830 | _GL_CXXALIASWARN (strpbrk); |
707 | # endif | 831 | # endif |
@@ -809,9 +933,11 @@ _GL_CXXALIAS_SYS_CAST2 (strstr, | |||
809 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 933 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
810 | || defined __clang__) | 934 | || defined __clang__) |
811 | _GL_CXXALIASWARN1 (strstr, char *, | 935 | _GL_CXXALIASWARN1 (strstr, char *, |
812 | (char *haystack, const char *needle) throw ()); | 936 | (char *haystack, const char *needle) |
937 | _GL_ATTRIBUTE_NOTHROW); | ||
813 | _GL_CXXALIASWARN1 (strstr, const char *, | 938 | _GL_CXXALIASWARN1 (strstr, const char *, |
814 | (const char *haystack, const char *needle) throw ()); | 939 | (const char *haystack, const char *needle) |
940 | _GL_ATTRIBUTE_NOTHROW); | ||
815 | # elif __GLIBC__ >= 2 | 941 | # elif __GLIBC__ >= 2 |
816 | _GL_CXXALIASWARN (strstr); | 942 | _GL_CXXALIASWARN (strstr); |
817 | # endif | 943 | # endif |
@@ -860,10 +986,12 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr, | |||
860 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 986 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
861 | || defined __clang__) | 987 | || defined __clang__) |
862 | _GL_CXXALIASWARN1 (strcasestr, char *, | 988 | _GL_CXXALIASWARN1 (strcasestr, char *, |
863 | (char *haystack, const char *needle) throw ()); | 989 | (char *haystack, const char *needle) |
990 | _GL_ATTRIBUTE_NOTHROW); | ||
864 | _GL_CXXALIASWARN1 (strcasestr, const char *, | 991 | _GL_CXXALIASWARN1 (strcasestr, const char *, |
865 | (const char *haystack, const char *needle) throw ()); | 992 | (const char *haystack, const char *needle) |
866 | # else | 993 | _GL_ATTRIBUTE_NOTHROW); |
994 | # elif __GLIBC__ >= 2 | ||
867 | _GL_CXXALIASWARN (strcasestr); | 995 | _GL_CXXALIASWARN (strcasestr); |
868 | # endif | 996 | # endif |
869 | #elif defined GNULIB_POSIXCHECK | 997 | #elif defined GNULIB_POSIXCHECK |
@@ -1211,7 +1339,7 @@ _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) | |||
1211 | # endif | 1339 | # endif |
1212 | _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); | 1340 | _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); |
1213 | # endif | 1341 | # endif |
1214 | # if @HAVE_DECL_STRERROR_R@ | 1342 | # if __GLIBC__ >= 2 && @HAVE_DECL_STRERROR_R@ |
1215 | _GL_CXXALIASWARN (strerror_r); | 1343 | _GL_CXXALIASWARN (strerror_r); |
1216 | # endif | 1344 | # endif |
1217 | #elif defined GNULIB_POSIXCHECK | 1345 | #elif defined GNULIB_POSIXCHECK |
@@ -1301,12 +1429,22 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " | |||
1301 | #endif | 1429 | #endif |
1302 | 1430 | ||
1303 | #if @GNULIB_STRVERSCMP@ | 1431 | #if @GNULIB_STRVERSCMP@ |
1304 | # if !@HAVE_STRVERSCMP@ | 1432 | # if @REPLACE_STRVERSCMP@ |
1433 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1434 | # define strverscmp rpl_strverscmp | ||
1435 | # endif | ||
1436 | _GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) | ||
1437 | _GL_ATTRIBUTE_PURE | ||
1438 | _GL_ARG_NONNULL ((1, 2))); | ||
1439 | _GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); | ||
1440 | # else | ||
1441 | # if !@HAVE_STRVERSCMP@ | ||
1305 | _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) | 1442 | _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) |
1306 | _GL_ATTRIBUTE_PURE | 1443 | _GL_ATTRIBUTE_PURE |
1307 | _GL_ARG_NONNULL ((1, 2))); | 1444 | _GL_ARG_NONNULL ((1, 2))); |
1308 | # endif | 1445 | # endif |
1309 | _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); | 1446 | _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); |
1447 | # endif | ||
1310 | _GL_CXXALIASWARN (strverscmp); | 1448 | _GL_CXXALIASWARN (strverscmp); |
1311 | #elif defined GNULIB_POSIXCHECK | 1449 | #elif defined GNULIB_POSIXCHECK |
1312 | # undef strverscmp | 1450 | # undef strverscmp |
diff --git a/gl/strings.in.h b/gl/strings.in.h index 2cfe8b16..2b3e062a 100644 --- a/gl/strings.in.h +++ b/gl/strings.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute <strings.h>. | 1 | /* A substitute <strings.h>. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -36,6 +36,11 @@ | |||
36 | #ifndef _@GUARD_PREFIX@_STRINGS_H | 36 | #ifndef _@GUARD_PREFIX@_STRINGS_H |
37 | #define _@GUARD_PREFIX@_STRINGS_H | 37 | #define _@GUARD_PREFIX@_STRINGS_H |
38 | 38 | ||
39 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
40 | #if !_GL_CONFIG_H_INCLUDED | ||
41 | #error "Please include config.h first." | ||
42 | #endif | ||
43 | |||
39 | #if ! @HAVE_DECL_STRNCASECMP@ | 44 | #if ! @HAVE_DECL_STRNCASECMP@ |
40 | /* Get size_t. */ | 45 | /* Get size_t. */ |
41 | # include <stddef.h> | 46 | # include <stddef.h> |
diff --git a/gl/stripslash.c b/gl/stripslash.c index fe46a9c1..c127ce7e 100644 --- a/gl/stripslash.c +++ b/gl/stripslash.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* stripslash.c -- remove redundant trailing slashes from a file name | 1 | /* stripslash.c -- remove redundant trailing slashes from a file name |
2 | 2 | ||
3 | Copyright (C) 1990, 2001, 2003-2006, 2009-2023 Free Software Foundation, | 3 | Copyright (C) 1990, 2001, 2003-2006, 2009-2024 Free Software Foundation, |
4 | Inc. | 4 | Inc. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/strncasecmp.c b/gl/strncasecmp.c index c5c2cd35..c79161f3 100644 --- a/gl/strncasecmp.c +++ b/gl/strncasecmp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* strncasecmp.c -- case insensitive string comparator | 1 | /* strncasecmp.c -- case insensitive string comparator |
2 | Copyright (C) 1998-1999, 2005-2007, 2009-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -22,8 +22,6 @@ | |||
22 | #include <ctype.h> | 22 | #include <ctype.h> |
23 | #include <limits.h> | 23 | #include <limits.h> |
24 | 24 | ||
25 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
26 | |||
27 | /* Compare no more than N bytes of strings S1 and S2, ignoring case, | 25 | /* Compare no more than N bytes of strings S1 and S2, ignoring case, |
28 | returning less than, equal to or greater than zero if S1 is | 26 | returning less than, equal to or greater than zero if S1 is |
29 | lexicographically less than, equal to or greater than S2. | 27 | lexicographically less than, equal to or greater than S2. |
@@ -41,8 +39,8 @@ strncasecmp (const char *s1, const char *s2, size_t n) | |||
41 | 39 | ||
42 | do | 40 | do |
43 | { | 41 | { |
44 | c1 = TOLOWER (*p1); | 42 | c1 = tolower (*p1); |
45 | c2 = TOLOWER (*p2); | 43 | c2 = tolower (*p2); |
46 | 44 | ||
47 | if (--n == 0 || c1 == '\0') | 45 | if (--n == 0 || c1 == '\0') |
48 | break; | 46 | break; |
diff --git a/gl/strsep.c b/gl/strsep.c index 8e9708a3..eefd85e2 100644 --- a/gl/strsep.c +++ b/gl/strsep.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2004, 2007, 2009-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2004, 2007, 2009-2024 Free Software Foundation, Inc. |
2 | 2 | ||
3 | Written by Yoann Vandoorselaere <yoann@prelude-ids.org>. | 3 | Written by Yoann Vandoorselaere <yoann@prelude-ids.org>. |
4 | 4 | ||
diff --git a/gl/strstr.c b/gl/strstr.c index 574f4d50..7ea28603 100644 --- a/gl/strstr.c +++ b/gl/strstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2023 Free Software | 1 | /* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2024 Free Software |
2 | Foundation, Inc. | 2 | Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
diff --git a/gl/sys-limits.h b/gl/sys-limits.h index 0e9556d6..d2f29d80 100644 --- a/gl/sys-limits.h +++ b/gl/sys-limits.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* System call limits | 1 | /* System call limits |
2 | 2 | ||
3 | Copyright 2018-2023 Free Software Foundation, Inc. | 3 | Copyright 2018-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/sys_socket.c b/gl/sys_socket.c index b7388cec..672d3aac 100644 --- a/gl/sys_socket.c +++ b/gl/sys_socket.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Inline functions for <sys/socket.h>. | 1 | /* Inline functions for <sys/socket.h>. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,5 +18,5 @@ | |||
18 | #include <config.h> | 18 | #include <config.h> |
19 | 19 | ||
20 | #define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE | 20 | #define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE |
21 | #include "sys/socket.h" | 21 | #include <sys/socket.h> |
22 | typedef int dummy; | 22 | typedef int dummy; |
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h index 6705593f..13833c0f 100644 --- a/gl/sys_socket.in.h +++ b/gl/sys_socket.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) | 1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) |
2 | and for systems where it is incomplete. | 2 | and for systems where it is incomplete. |
3 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
4 | Written by Simon Josefsson. | 4 | Written by Simon Josefsson. |
5 | 5 | ||
6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
@@ -63,9 +63,12 @@ | |||
63 | #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H | 63 | #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H |
64 | #define _@GUARD_PREFIX@_SYS_SOCKET_H | 64 | #define _@GUARD_PREFIX@_SYS_SOCKET_H |
65 | 65 | ||
66 | #ifndef _GL_INLINE_HEADER_BEGIN | 66 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, |
67 | HAVE_RAW_DECL_*, alignof. */ | ||
68 | #if !_GL_CONFIG_H_INCLUDED | ||
67 | #error "Please include config.h first." | 69 | #error "Please include config.h first." |
68 | #endif | 70 | #endif |
71 | |||
69 | _GL_INLINE_HEADER_BEGIN | 72 | _GL_INLINE_HEADER_BEGIN |
70 | #ifndef _GL_SYS_SOCKET_INLINE | 73 | #ifndef _GL_SYS_SOCKET_INLINE |
71 | # define _GL_SYS_SOCKET_INLINE _GL_INLINE | 74 | # define _GL_SYS_SOCKET_INLINE _GL_INLINE |
@@ -355,7 +358,9 @@ _GL_CXXALIAS_SYS_CAST (accept, int, | |||
355 | struct sockaddr *restrict addr, | 358 | struct sockaddr *restrict addr, |
356 | socklen_t *restrict addrlen)); | 359 | socklen_t *restrict addrlen)); |
357 | # endif | 360 | # endif |
361 | # if __GLIBC__ >= 2 | ||
358 | _GL_CXXALIASWARN (accept); | 362 | _GL_CXXALIASWARN (accept); |
363 | # endif | ||
359 | #elif @HAVE_WINSOCK2_H@ | 364 | #elif @HAVE_WINSOCK2_H@ |
360 | # undef accept | 365 | # undef accept |
361 | # define accept accept_used_without_requesting_gnulib_module_accept | 366 | # define accept accept_used_without_requesting_gnulib_module_accept |
@@ -417,7 +422,9 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int, | |||
417 | (int fd, struct sockaddr *restrict addr, | 422 | (int fd, struct sockaddr *restrict addr, |
418 | socklen_t *restrict addrlen)); | 423 | socklen_t *restrict addrlen)); |
419 | # endif | 424 | # endif |
425 | # if __GLIBC__ >= 2 | ||
420 | _GL_CXXALIASWARN (getpeername); | 426 | _GL_CXXALIASWARN (getpeername); |
427 | # endif | ||
421 | #elif @HAVE_WINSOCK2_H@ | 428 | #elif @HAVE_WINSOCK2_H@ |
422 | # undef getpeername | 429 | # undef getpeername |
423 | # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername | 430 | # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername |
@@ -449,7 +456,9 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int, | |||
449 | (int fd, struct sockaddr *restrict addr, | 456 | (int fd, struct sockaddr *restrict addr, |
450 | socklen_t *restrict addrlen)); | 457 | socklen_t *restrict addrlen)); |
451 | # endif | 458 | # endif |
459 | # if __GLIBC__ >= 2 | ||
452 | _GL_CXXALIASWARN (getsockname); | 460 | _GL_CXXALIASWARN (getsockname); |
461 | # endif | ||
453 | #elif @HAVE_WINSOCK2_H@ | 462 | #elif @HAVE_WINSOCK2_H@ |
454 | # undef getsockname | 463 | # undef getsockname |
455 | # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname | 464 | # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname |
@@ -596,7 +605,9 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, | |||
596 | struct sockaddr *restrict from, | 605 | struct sockaddr *restrict from, |
597 | socklen_t *restrict fromlen)); | 606 | socklen_t *restrict fromlen)); |
598 | # endif | 607 | # endif |
608 | # if __GLIBC__ >= 2 | ||
599 | _GL_CXXALIASWARN (recvfrom); | 609 | _GL_CXXALIASWARN (recvfrom); |
610 | # endif | ||
600 | #elif @HAVE_WINSOCK2_H@ | 611 | #elif @HAVE_WINSOCK2_H@ |
601 | # undef recvfrom | 612 | # undef recvfrom |
602 | # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom | 613 | # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom |
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h index 096887c0..bf08f335 100644 --- a/gl/sys_stat.in.h +++ b/gl/sys_stat.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Provide a more complete sys/stat.h header file. | 1 | /* Provide a more complete sys/stat.h header file. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -25,6 +25,13 @@ | |||
25 | #endif | 25 | #endif |
26 | @PRAGMA_COLUMNS@ | 26 | @PRAGMA_COLUMNS@ |
27 | 27 | ||
28 | /* This file uses #include_next of a system file that defines time_t. | ||
29 | For the 'year2038' module to work right, <config.h> needs to have been | ||
30 | included before. */ | ||
31 | #if !_GL_CONFIG_H_INCLUDED | ||
32 | #error "Please include config.h first." | ||
33 | #endif | ||
34 | |||
28 | #if defined __need_system_sys_stat_h | 35 | #if defined __need_system_sys_stat_h |
29 | /* Special invocation convention. */ | 36 | /* Special invocation convention. */ |
30 | 37 | ||
@@ -48,12 +55,41 @@ | |||
48 | #ifndef _@GUARD_PREFIX@_SYS_STAT_H | 55 | #ifndef _@GUARD_PREFIX@_SYS_STAT_H |
49 | #define _@GUARD_PREFIX@_SYS_STAT_H | 56 | #define _@GUARD_PREFIX@_SYS_STAT_H |
50 | 57 | ||
58 | /* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
59 | #if !_GL_CONFIG_H_INCLUDED | ||
60 | #error "Please include config.h first." | ||
61 | #endif | ||
62 | |||
63 | |||
64 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
65 | */ | ||
66 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
67 | # if defined __cplusplus | ||
68 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
69 | # if __cplusplus >= 201103L | ||
70 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
71 | # else | ||
72 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
73 | # endif | ||
74 | # else | ||
75 | # define _GL_ATTRIBUTE_NOTHROW | ||
76 | # endif | ||
77 | # else | ||
78 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
79 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
80 | # else | ||
81 | # define _GL_ATTRIBUTE_NOTHROW | ||
82 | # endif | ||
83 | # endif | ||
84 | #endif | ||
85 | |||
51 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 86 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
52 | 87 | ||
53 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 88 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
54 | 89 | ||
55 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 90 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
56 | 91 | ||
92 | |||
57 | /* Before doing "#define mknod rpl_mknod" below, we need to include all | 93 | /* Before doing "#define mknod rpl_mknod" below, we need to include all |
58 | headers that may declare mknod(). OS/2 kLIBC declares mknod() in | 94 | headers that may declare mknod(). OS/2 kLIBC declares mknod() in |
59 | <unistd.h>, not in <sys/stat.h>. */ | 95 | <unistd.h>, not in <sys/stat.h>. */ |
@@ -549,7 +585,7 @@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); | |||
549 | # endif | 585 | # endif |
550 | _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); | 586 | _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); |
551 | # endif | 587 | # endif |
552 | # if @HAVE_FUTIMENS@ | 588 | # if __GLIBC__ >= 2 && @HAVE_FUTIMENS@ |
553 | _GL_CXXALIASWARN (futimens); | 589 | _GL_CXXALIASWARN (futimens); |
554 | # endif | 590 | # endif |
555 | #elif defined GNULIB_POSIXCHECK | 591 | #elif defined GNULIB_POSIXCHECK |
@@ -563,7 +599,11 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - " | |||
563 | 599 | ||
564 | #if @GNULIB_GETUMASK@ | 600 | #if @GNULIB_GETUMASK@ |
565 | # if !@HAVE_GETUMASK@ | 601 | # if !@HAVE_GETUMASK@ |
602 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
603 | _GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW); | ||
604 | # else | ||
566 | _GL_FUNCDECL_SYS (getumask, mode_t, (void)); | 605 | _GL_FUNCDECL_SYS (getumask, mode_t, (void)); |
606 | # endif | ||
567 | # endif | 607 | # endif |
568 | _GL_CXXALIAS_SYS (getumask, mode_t, (void)); | 608 | _GL_CXXALIAS_SYS (getumask, mode_t, (void)); |
569 | # if @HAVE_GETUMASK@ | 609 | # if @HAVE_GETUMASK@ |
@@ -716,7 +756,9 @@ _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) | |||
716 | # endif | 756 | # endif |
717 | _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); | 757 | _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); |
718 | # endif | 758 | # endif |
759 | # if __GLIBC__ >= 2 | ||
719 | _GL_CXXALIASWARN (mkfifoat); | 760 | _GL_CXXALIASWARN (mkfifoat); |
761 | # endif | ||
720 | #elif defined GNULIB_POSIXCHECK | 762 | #elif defined GNULIB_POSIXCHECK |
721 | # undef mkfifoat | 763 | # undef mkfifoat |
722 | # if HAVE_RAW_DECL_MKFIFOAT | 764 | # if HAVE_RAW_DECL_MKFIFOAT |
@@ -773,7 +815,9 @@ _GL_FUNCDECL_SYS (mknodat, int, | |||
773 | _GL_CXXALIAS_SYS (mknodat, int, | 815 | _GL_CXXALIAS_SYS (mknodat, int, |
774 | (int fd, char const *file, mode_t mode, dev_t dev)); | 816 | (int fd, char const *file, mode_t mode, dev_t dev)); |
775 | # endif | 817 | # endif |
818 | # if __GLIBC__ >= 2 | ||
776 | _GL_CXXALIASWARN (mknodat); | 819 | _GL_CXXALIASWARN (mknodat); |
820 | # endif | ||
777 | #elif defined GNULIB_POSIXCHECK | 821 | #elif defined GNULIB_POSIXCHECK |
778 | # undef mknodat | 822 | # undef mknodat |
779 | # if HAVE_RAW_DECL_MKNODAT | 823 | # if HAVE_RAW_DECL_MKNODAT |
@@ -937,7 +981,7 @@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, | |||
937 | _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, | 981 | _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, |
938 | struct timespec const times[2], int flag)); | 982 | struct timespec const times[2], int flag)); |
939 | # endif | 983 | # endif |
940 | # if @HAVE_UTIMENSAT@ | 984 | # if __GLIBC__ >= 2 && @HAVE_UTIMENSAT@ |
941 | _GL_CXXALIASWARN (utimensat); | 985 | _GL_CXXALIASWARN (utimensat); |
942 | # endif | 986 | # endif |
943 | #elif defined GNULIB_POSIXCHECK | 987 | #elif defined GNULIB_POSIXCHECK |
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h index 082a6c67..0a0ccc3c 100644 --- a/gl/sys_types.in.h +++ b/gl/sys_types.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Provide a more complete sys/types.h. | 1 | /* Provide a more complete sys/types.h. |
2 | 2 | ||
3 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -20,6 +20,13 @@ | |||
20 | #endif | 20 | #endif |
21 | @PRAGMA_COLUMNS@ | 21 | @PRAGMA_COLUMNS@ |
22 | 22 | ||
23 | /* This file uses #include_next of a system file that defines time_t. | ||
24 | For the 'year2038' module to work right, <config.h> needs to have been | ||
25 | included before. */ | ||
26 | #if !_GL_CONFIG_H_INCLUDED | ||
27 | #error "Please include config.h first." | ||
28 | #endif | ||
29 | |||
23 | #if defined _WIN32 && !defined __CYGWIN__ \ | 30 | #if defined _WIN32 && !defined __CYGWIN__ \ |
24 | && (defined __need_off_t || defined __need___off64_t \ | 31 | && (defined __need_off_t || defined __need___off64_t \ |
25 | || defined __need_ssize_t || defined __need_time_t) | 32 | || defined __need_ssize_t || defined __need_time_t) |
diff --git a/gl/sys_uio.in.h b/gl/sys_uio.in.h index 64c4fb6d..5e71859d 100644 --- a/gl/sys_uio.in.h +++ b/gl/sys_uio.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for <sys/uio.h>. | 1 | /* Substitute for <sys/uio.h>. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/time.in.h b/gl/time.in.h index 50c9b30b..df99c8ab 100644 --- a/gl/time.in.h +++ b/gl/time.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A more-standard <time.h>. | 1 | /* A more-standard <time.h>. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -20,6 +20,13 @@ | |||
20 | #endif | 20 | #endif |
21 | @PRAGMA_COLUMNS@ | 21 | @PRAGMA_COLUMNS@ |
22 | 22 | ||
23 | /* This file uses #include_next of a system file that defines time_t. | ||
24 | For the 'year2038' module to work right, <config.h> needs to have been | ||
25 | included before. */ | ||
26 | #if !_GL_CONFIG_H_INCLUDED | ||
27 | #error "Please include config.h first." | ||
28 | #endif | ||
29 | |||
23 | /* Don't get in the way of glibc when it includes time.h merely to | 30 | /* Don't get in the way of glibc when it includes time.h merely to |
24 | declare a few standard symbols, rather than to declare all the | 31 | declare a few standard symbols, rather than to declare all the |
25 | symbols. (However, skip this for MinGW as it treats __need_time_t | 32 | symbols. (However, skip this for MinGW as it treats __need_time_t |
@@ -45,6 +52,12 @@ | |||
45 | 52 | ||
46 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ | 53 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ |
47 | 54 | ||
55 | /* This file uses _GL_ATTRIBUTE_DEPRECATED, GNULIB_POSIXCHECK, | ||
56 | HAVE_RAW_DECL_*. */ | ||
57 | # if !_GL_CONFIG_H_INCLUDED | ||
58 | # error "Please include config.h first." | ||
59 | # endif | ||
60 | |||
48 | /* NetBSD 5.0 mis-defines NULL. */ | 61 | /* NetBSD 5.0 mis-defines NULL. */ |
49 | # include <stddef.h> | 62 | # include <stddef.h> |
50 | 63 | ||
@@ -112,23 +125,79 @@ struct __time_t_must_be_integral { | |||
112 | /* Set *TS to the current time, and return BASE. | 125 | /* Set *TS to the current time, and return BASE. |
113 | Upon failure, return 0. */ | 126 | Upon failure, return 0. */ |
114 | # if @GNULIB_TIMESPEC_GET@ | 127 | # if @GNULIB_TIMESPEC_GET@ |
115 | # if ! @HAVE_TIMESPEC_GET@ | 128 | # if @REPLACE_TIMESPEC_GET@ |
129 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
130 | # undef timespec_get | ||
131 | # define timespec_get rpl_timespec_get | ||
132 | # endif | ||
133 | _GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base) | ||
134 | _GL_ARG_NONNULL ((1))); | ||
135 | _GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); | ||
136 | # else | ||
137 | # if !@HAVE_TIMESPEC_GET@ | ||
116 | _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) | 138 | _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) |
117 | _GL_ARG_NONNULL ((1))); | 139 | _GL_ARG_NONNULL ((1))); |
118 | # endif | 140 | # endif |
119 | _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); | 141 | _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); |
142 | # endif | ||
143 | # if __GLIBC__ >= 2 | ||
120 | _GL_CXXALIASWARN (timespec_get); | 144 | _GL_CXXALIASWARN (timespec_get); |
145 | # endif | ||
146 | # elif defined GNULIB_POSIXCHECK | ||
147 | # undef timespec_get | ||
148 | # if HAVE_RAW_DECL_TIMESPEC_GET | ||
149 | _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " | ||
150 | "use gnulib module timespec_get for portability"); | ||
151 | # endif | ||
121 | # endif | 152 | # endif |
122 | 153 | ||
123 | /* Set *TS to the current time resolution, and return BASE. | 154 | /* Set *TS to the current time resolution, and return BASE. |
124 | Upon failure, return 0. */ | 155 | Upon failure, return 0. */ |
125 | # if @GNULIB_TIMESPEC_GETRES@ | 156 | # if @GNULIB_TIMESPEC_GETRES@ |
126 | # if ! @HAVE_TIMESPEC_GETRES@ | 157 | # if @REPLACE_TIMESPEC_GETRES@ |
158 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
159 | # undef timespec_getres | ||
160 | # define timespec_getres rpl_timespec_getres | ||
161 | # endif | ||
162 | _GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) | ||
163 | _GL_ARG_NONNULL ((1))); | ||
164 | _GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); | ||
165 | # else | ||
166 | # if !@HAVE_TIMESPEC_GETRES@ | ||
127 | _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) | 167 | _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) |
128 | _GL_ARG_NONNULL ((1))); | 168 | _GL_ARG_NONNULL ((1))); |
129 | # endif | 169 | # endif |
130 | _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); | 170 | _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); |
171 | # endif | ||
131 | _GL_CXXALIASWARN (timespec_getres); | 172 | _GL_CXXALIASWARN (timespec_getres); |
173 | # elif defined GNULIB_POSIXCHECK | ||
174 | # undef timespec_getres | ||
175 | # if HAVE_RAW_DECL_TIMESPEC_GETRES | ||
176 | _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " | ||
177 | "use gnulib module timespec_getres for portability"); | ||
178 | # endif | ||
179 | # endif | ||
180 | |||
181 | /* Return the number of seconds that have elapsed since the Epoch. */ | ||
182 | # if @GNULIB_TIME@ | ||
183 | # if @REPLACE_TIME@ | ||
184 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
185 | # define time rpl_time | ||
186 | # endif | ||
187 | _GL_FUNCDECL_RPL (time, time_t, (time_t *__tp)); | ||
188 | _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); | ||
189 | # else | ||
190 | _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); | ||
191 | # endif | ||
192 | # if __GLIBC__ >= 2 | ||
193 | _GL_CXXALIASWARN (time); | ||
194 | # endif | ||
195 | # elif defined GNULIB_POSIXCHECK | ||
196 | # undef time | ||
197 | # if HAVE_RAW_DECL_TIME | ||
198 | _GL_WARN_ON_USE (time, "time has consistency problems - " | ||
199 | "use gnulib module time for portability"); | ||
200 | # endif | ||
132 | # endif | 201 | # endif |
133 | 202 | ||
134 | /* Sleep for at least RQTP seconds unless interrupted, If interrupted, | 203 | /* Sleep for at least RQTP seconds unless interrupted, If interrupted, |
@@ -154,6 +223,12 @@ _GL_CXXALIAS_SYS (nanosleep, int, | |||
154 | (struct timespec const *__rqtp, struct timespec *__rmtp)); | 223 | (struct timespec const *__rqtp, struct timespec *__rmtp)); |
155 | # endif | 224 | # endif |
156 | _GL_CXXALIASWARN (nanosleep); | 225 | _GL_CXXALIASWARN (nanosleep); |
226 | # elif defined GNULIB_POSIXCHECK | ||
227 | # undef nanosleep | ||
228 | # if HAVE_RAW_DECL_NANOSLEEP | ||
229 | _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " | ||
230 | "use gnulib module nanosleep for portability"); | ||
231 | # endif | ||
157 | # endif | 232 | # endif |
158 | 233 | ||
159 | /* Initialize time conversion information. */ | 234 | /* Initialize time conversion information. */ |
@@ -189,6 +264,12 @@ _GL_CXXALIAS_MDA (tzset, void, (void)); | |||
189 | _GL_CXXALIAS_SYS (tzset, void, (void)); | 264 | _GL_CXXALIAS_SYS (tzset, void, (void)); |
190 | # endif | 265 | # endif |
191 | _GL_CXXALIASWARN (tzset); | 266 | _GL_CXXALIASWARN (tzset); |
267 | # elif defined GNULIB_POSIXCHECK | ||
268 | # undef tzset | ||
269 | # if HAVE_RAW_DECL_TZSET | ||
270 | _GL_WARN_ON_USE (tzset, "tzset has portability problems - " | ||
271 | "use gnulib module tzset for portability"); | ||
272 | # endif | ||
192 | # endif | 273 | # endif |
193 | 274 | ||
194 | /* Return the 'time_t' representation of TP and normalize TP. */ | 275 | /* Return the 'time_t' representation of TP and normalize TP. */ |
@@ -205,6 +286,12 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); | |||
205 | # if __GLIBC__ >= 2 | 286 | # if __GLIBC__ >= 2 |
206 | _GL_CXXALIASWARN (mktime); | 287 | _GL_CXXALIASWARN (mktime); |
207 | # endif | 288 | # endif |
289 | # elif defined GNULIB_POSIXCHECK | ||
290 | # undef mktime | ||
291 | # if HAVE_RAW_DECL_MKTIME | ||
292 | _GL_WARN_ON_USE (mktime, "mktime has portability problems - " | ||
293 | "use gnulib module mktime for portability"); | ||
294 | # endif | ||
208 | # endif | 295 | # endif |
209 | 296 | ||
210 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See | 297 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See |
@@ -255,6 +342,17 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, | |||
255 | # if @HAVE_DECL_LOCALTIME_R@ | 342 | # if @HAVE_DECL_LOCALTIME_R@ |
256 | _GL_CXXALIASWARN (gmtime_r); | 343 | _GL_CXXALIASWARN (gmtime_r); |
257 | # endif | 344 | # endif |
345 | # elif defined GNULIB_POSIXCHECK | ||
346 | # undef localtime_r | ||
347 | # if HAVE_RAW_DECL_LOCALTIME_R | ||
348 | _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " | ||
349 | "use gnulib module time_r for portability"); | ||
350 | # endif | ||
351 | # undef gmtime_r | ||
352 | # if HAVE_RAW_DECL_GMTIME_R | ||
353 | _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " | ||
354 | "use gnulib module time_r for portability"); | ||
355 | # endif | ||
258 | # endif | 356 | # endif |
259 | 357 | ||
260 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See | 358 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See |
@@ -275,6 +373,12 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); | |||
275 | # if __GLIBC__ >= 2 | 373 | # if __GLIBC__ >= 2 |
276 | _GL_CXXALIASWARN (localtime); | 374 | _GL_CXXALIASWARN (localtime); |
277 | # endif | 375 | # endif |
376 | # elif defined GNULIB_POSIXCHECK | ||
377 | # undef localtime | ||
378 | # if HAVE_RAW_DECL_LOCALTIME | ||
379 | _GL_WARN_ON_USE (localtime, "localtime has portability problems - " | ||
380 | "use gnulib module localtime for portability"); | ||
381 | # endif | ||
278 | # endif | 382 | # endif |
279 | 383 | ||
280 | # if 0 || @REPLACE_GMTIME@ | 384 | # if 0 || @REPLACE_GMTIME@ |
@@ -306,6 +410,12 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, | |||
306 | char const *restrict __format, | 410 | char const *restrict __format, |
307 | struct tm *restrict __tm)); | 411 | struct tm *restrict __tm)); |
308 | _GL_CXXALIASWARN (strptime); | 412 | _GL_CXXALIASWARN (strptime); |
413 | # elif defined GNULIB_POSIXCHECK | ||
414 | # undef strptime | ||
415 | # if HAVE_RAW_DECL_STRPTIME | ||
416 | _GL_WARN_ON_USE (strptime, "strptime is unportable - " | ||
417 | "use gnulib module strptime for portability"); | ||
418 | # endif | ||
309 | # endif | 419 | # endif |
310 | 420 | ||
311 | /* Convert *TP to a date and time string. See | 421 | /* Convert *TP to a date and time string. See |
@@ -315,7 +425,9 @@ _GL_CXXALIASWARN (strptime); | |||
315 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 425 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
316 | # define ctime rpl_ctime | 426 | # define ctime rpl_ctime |
317 | # endif | 427 | # endif |
428 | # ifndef __cplusplus | ||
318 | _GL_ATTRIBUTE_DEPRECATED | 429 | _GL_ATTRIBUTE_DEPRECATED |
430 | # endif | ||
319 | _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) | 431 | _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) |
320 | _GL_ARG_NONNULL ((1))); | 432 | _GL_ARG_NONNULL ((1))); |
321 | _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); | 433 | _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); |
@@ -325,6 +437,8 @@ _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); | |||
325 | # if __GLIBC__ >= 2 | 437 | # if __GLIBC__ >= 2 |
326 | _GL_CXXALIASWARN (ctime); | 438 | _GL_CXXALIASWARN (ctime); |
327 | # endif | 439 | # endif |
440 | # elif defined GNULIB_POSIXCHECK | ||
441 | /* No need to warn about portability, as a more serious warning is below. */ | ||
328 | # endif | 442 | # endif |
329 | 443 | ||
330 | /* Convert *TP to a date and time string. See | 444 | /* Convert *TP to a date and time string. See |
@@ -349,6 +463,12 @@ _GL_CXXALIAS_SYS (strftime, size_t, | |||
349 | # if __GLIBC__ >= 2 | 463 | # if __GLIBC__ >= 2 |
350 | _GL_CXXALIASWARN (strftime); | 464 | _GL_CXXALIASWARN (strftime); |
351 | # endif | 465 | # endif |
466 | # elif defined GNULIB_POSIXCHECK | ||
467 | # undef strftime | ||
468 | # if HAVE_RAW_DECL_STRFTIME | ||
469 | _GL_WARN_ON_USE (strftime, "strftime has portability problems - " | ||
470 | "use gnulib module strftime-fixes for portability"); | ||
471 | # endif | ||
352 | # endif | 472 | # endif |
353 | 473 | ||
354 | # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ | 474 | # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ |
@@ -423,7 +543,15 @@ _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); | |||
423 | # endif | 543 | # endif |
424 | _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); | 544 | _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); |
425 | # endif | 545 | # endif |
546 | # if __GLIBC__ >= 2 | ||
426 | _GL_CXXALIASWARN (timegm); | 547 | _GL_CXXALIASWARN (timegm); |
548 | # endif | ||
549 | # elif defined GNULIB_POSIXCHECK | ||
550 | # undef timegm | ||
551 | # if HAVE_RAW_DECL_TIMEGM | ||
552 | _GL_WARN_ON_USE (timegm, "timegm is unportable - " | ||
553 | "use gnulib module timegm for portability"); | ||
554 | # endif | ||
427 | # endif | 555 | # endif |
428 | 556 | ||
429 | /* Encourage applications to avoid unsafe functions that can overrun | 557 | /* Encourage applications to avoid unsafe functions that can overrun |
@@ -431,8 +559,10 @@ _GL_CXXALIASWARN (timegm); | |||
431 | applications should use strftime (or even sprintf) instead. */ | 559 | applications should use strftime (or even sprintf) instead. */ |
432 | # if defined GNULIB_POSIXCHECK | 560 | # if defined GNULIB_POSIXCHECK |
433 | # undef asctime | 561 | # undef asctime |
562 | # if HAVE_RAW_DECL_ASCTIME | ||
434 | _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " | 563 | _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " |
435 | "better use strftime (or even sprintf) instead"); | 564 | "better use strftime (or even sprintf) instead"); |
565 | # endif | ||
436 | # endif | 566 | # endif |
437 | # if defined GNULIB_POSIXCHECK | 567 | # if defined GNULIB_POSIXCHECK |
438 | # undef asctime_r | 568 | # undef asctime_r |
@@ -443,8 +573,10 @@ _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " | |||
443 | # endif | 573 | # endif |
444 | # if defined GNULIB_POSIXCHECK | 574 | # if defined GNULIB_POSIXCHECK |
445 | # undef ctime | 575 | # undef ctime |
576 | # if HAVE_RAW_DECL_CTIME | ||
446 | _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " | 577 | _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " |
447 | "better use strftime (or even sprintf) instead"); | 578 | "better use strftime (or even sprintf) instead"); |
579 | # endif | ||
448 | # endif | 580 | # endif |
449 | # if defined GNULIB_POSIXCHECK | 581 | # if defined GNULIB_POSIXCHECK |
450 | # undef ctime_r | 582 | # undef ctime_r |
diff --git a/gl/time_r.c b/gl/time_r.c index 97be4fd0..b724f3b3 100644 --- a/gl/time_r.c +++ b/gl/time_r.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Reentrant time functions like localtime_r. | 1 | /* Reentrant time functions like localtime_r. |
2 | 2 | ||
3 | Copyright (C) 2003, 2006-2007, 2010-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2006-2007, 2010-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -21,6 +21,11 @@ | |||
21 | 21 | ||
22 | #include <time.h> | 22 | #include <time.h> |
23 | 23 | ||
24 | /* The replacement functions in this file are only used on native Windows. | ||
25 | They are multithread-safe, because the gmtime() and localtime() functions | ||
26 | on native Windows — both in the ucrt and in the older MSVCRT — return a | ||
27 | pointer to a 'struct tm' in thread-local memory. */ | ||
28 | |||
24 | static struct tm * | 29 | static struct tm * |
25 | copy_tm_result (struct tm *dest, struct tm const *src) | 30 | copy_tm_result (struct tm *dest, struct tm const *src) |
26 | { | 31 | { |
diff --git a/gl/timegm.c b/gl/timegm.c index b47025a0..e5cf30c0 100644 --- a/gl/timegm.c +++ b/gl/timegm.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. | 1 | /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. |
2 | 2 | ||
3 | Copyright (C) 1994-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1994-2024 Free Software Foundation, Inc. |
4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
5 | 5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | 6 | The GNU C Library is free software; you can redistribute it and/or |
diff --git a/gl/unistd.c b/gl/unistd.c index be7a8255..f3b3f7bd 100644 --- a/gl/unistd.c +++ b/gl/unistd.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Inline functions for <unistd.h>. | 1 | /* Inline functions for <unistd.h>. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,5 +18,5 @@ | |||
18 | #include <config.h> | 18 | #include <config.h> |
19 | 19 | ||
20 | #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE | 20 | #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE |
21 | #include "unistd.h" | 21 | #include <unistd.h> |
22 | typedef int dummy; | 22 | typedef int dummy; |
diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 4812fdb1..b4129663 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for and wrapper around <unistd.h>. | 1 | /* Substitute for and wrapper around <unistd.h>. |
2 | Copyright (C) 2003-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2003-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -40,6 +40,24 @@ | |||
40 | # undef _GL_INCLUDING_UNISTD_H | 40 | # undef _GL_INCLUDING_UNISTD_H |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /* Avoid lseek bugs in FreeBSD, macOS <https://bugs.gnu.org/61386>. | ||
44 | This bug is fixed after FreeBSD 13; see <https://bugs.freebsd.org/256205>. | ||
45 | Use macOS "9999" to stand for a future fixed macOS version. */ | ||
46 | #if defined __FreeBSD__ && __FreeBSD__ < 14 | ||
47 | # undef SEEK_DATA | ||
48 | # undef SEEK_HOLE | ||
49 | #elif defined __APPLE__ && defined __MACH__ && defined SEEK_DATA | ||
50 | # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ | ||
51 | # include <AvailabilityMacros.h> | ||
52 | # endif | ||
53 | # if (!defined MAC_OS_X_VERSION_MIN_REQUIRED \ | ||
54 | || MAC_OS_X_VERSION_MIN_REQUIRED < 99990000) | ||
55 | # include <sys/fcntl.h> /* It also defines the two macros. */ | ||
56 | # undef SEEK_DATA | ||
57 | # undef SEEK_HOLE | ||
58 | # endif | ||
59 | #endif | ||
60 | |||
43 | /* Get all possible declarations of gethostname(). */ | 61 | /* Get all possible declarations of gethostname(). */ |
44 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ | 62 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ |
45 | && !defined _GL_INCLUDING_WINSOCK2_H | 63 | && !defined _GL_INCLUDING_WINSOCK2_H |
@@ -51,6 +69,12 @@ | |||
51 | #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H | 69 | #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H |
52 | #define _@GUARD_PREFIX@_UNISTD_H | 70 | #define _@GUARD_PREFIX@_UNISTD_H |
53 | 71 | ||
72 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, | ||
73 | HAVE_RAW_DECL_*. */ | ||
74 | #if !_GL_CONFIG_H_INCLUDED | ||
75 | #error "Please include config.h first." | ||
76 | #endif | ||
77 | |||
54 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ | 78 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ |
55 | /* But avoid namespace pollution on glibc systems. */ | 79 | /* But avoid namespace pollution on glibc systems. */ |
56 | #ifndef __GLIBC__ | 80 | #ifndef __GLIBC__ |
@@ -152,9 +176,6 @@ | |||
152 | # include <getopt-pfx-core.h> | 176 | # include <getopt-pfx-core.h> |
153 | #endif | 177 | #endif |
154 | 178 | ||
155 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
156 | #error "Please include config.h first." | ||
157 | #endif | ||
158 | _GL_INLINE_HEADER_BEGIN | 179 | _GL_INLINE_HEADER_BEGIN |
159 | #ifndef _GL_UNISTD_INLINE | 180 | #ifndef _GL_UNISTD_INLINE |
160 | # define _GL_UNISTD_INLINE _GL_INLINE | 181 | # define _GL_UNISTD_INLINE _GL_INLINE |
@@ -541,17 +562,22 @@ _GL_CXXALIASWARN (dup2); | |||
541 | Return newfd if successful, otherwise -1 and errno set. | 562 | Return newfd if successful, otherwise -1 and errno set. |
542 | See the Linux man page at | 563 | See the Linux man page at |
543 | <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ | 564 | <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ |
544 | # if @HAVE_DUP3@ | 565 | # if @REPLACE_DUP3@ |
545 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 566 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
567 | # undef dup3 | ||
546 | # define dup3 rpl_dup3 | 568 | # define dup3 rpl_dup3 |
547 | # endif | 569 | # endif |
548 | _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); | 570 | _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); |
549 | _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); | 571 | _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); |
550 | # else | 572 | # else |
573 | # if !@HAVE_DUP3@ | ||
551 | _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); | 574 | _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); |
575 | # endif | ||
552 | _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); | 576 | _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); |
553 | # endif | 577 | # endif |
578 | # if __GLIBC__ >= 2 | ||
554 | _GL_CXXALIASWARN (dup3); | 579 | _GL_CXXALIASWARN (dup3); |
580 | # endif | ||
555 | #elif defined GNULIB_POSIXCHECK | 581 | #elif defined GNULIB_POSIXCHECK |
556 | # undef dup3 | 582 | # undef dup3 |
557 | # if HAVE_RAW_DECL_DUP3 | 583 | # if HAVE_RAW_DECL_DUP3 |
@@ -870,7 +896,9 @@ _GL_FUNCDECL_SYS (execvpe, int, | |||
870 | _GL_CXXALIAS_SYS (execvpe, int, | 896 | _GL_CXXALIAS_SYS (execvpe, int, |
871 | (const char *program, char * const *argv, char * const *env)); | 897 | (const char *program, char * const *argv, char * const *env)); |
872 | # endif | 898 | # endif |
899 | # if __GLIBC__ >= 2 | ||
873 | _GL_CXXALIASWARN (execvpe); | 900 | _GL_CXXALIASWARN (execvpe); |
901 | # endif | ||
874 | #elif defined GNULIB_POSIXCHECK | 902 | #elif defined GNULIB_POSIXCHECK |
875 | # undef execvpe | 903 | # undef execvpe |
876 | # if HAVE_RAW_DECL_EXECVPE | 904 | # if HAVE_RAW_DECL_EXECVPE |
@@ -925,7 +953,9 @@ _GL_FUNCDECL_SYS (faccessat, int, | |||
925 | _GL_CXXALIAS_SYS (faccessat, int, | 953 | _GL_CXXALIAS_SYS (faccessat, int, |
926 | (int fd, char const *file, int mode, int flag)); | 954 | (int fd, char const *file, int mode, int flag)); |
927 | # endif | 955 | # endif |
956 | # if __GLIBC__ >= 2 | ||
928 | _GL_CXXALIASWARN (faccessat); | 957 | _GL_CXXALIASWARN (faccessat); |
958 | # endif | ||
929 | #elif defined GNULIB_POSIXCHECK | 959 | #elif defined GNULIB_POSIXCHECK |
930 | # undef faccessat | 960 | # undef faccessat |
931 | # if HAVE_RAW_DECL_FACCESSAT | 961 | # if HAVE_RAW_DECL_FACCESSAT |
@@ -941,23 +971,28 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " | |||
941 | Return 0 if successful, otherwise -1 and errno set. | 971 | Return 0 if successful, otherwise -1 and errno set. |
942 | See the POSIX:2008 specification | 972 | See the POSIX:2008 specification |
943 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ | 973 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ |
944 | # if ! @HAVE_FCHDIR@ | 974 | # if @REPLACE_FCHDIR@ |
975 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
976 | # undef fchdir | ||
977 | # define fchdir rpl_fchdir | ||
978 | # endif | ||
979 | _GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); | ||
980 | _GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); | ||
981 | # else | ||
982 | # if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ | ||
945 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | 983 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); |
946 | 984 | # endif | |
985 | _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); | ||
986 | # endif | ||
987 | _GL_CXXALIASWARN (fchdir); | ||
988 | # if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@ | ||
947 | /* Gnulib internal hooks needed to maintain the fchdir metadata. */ | 989 | /* Gnulib internal hooks needed to maintain the fchdir metadata. */ |
948 | _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) | 990 | _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) |
949 | _GL_ARG_NONNULL ((2)); | 991 | _GL_ARG_NONNULL ((2)); |
950 | _GL_EXTERN_C void _gl_unregister_fd (int fd); | 992 | _GL_EXTERN_C void _gl_unregister_fd (int fd); |
951 | _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); | 993 | _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); |
952 | _GL_EXTERN_C const char *_gl_directory_name (int fd); | 994 | _GL_EXTERN_C const char *_gl_directory_name (int fd); |
953 | |||
954 | # else | ||
955 | # if !@HAVE_DECL_FCHDIR@ | ||
956 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | ||
957 | # endif | ||
958 | # endif | 995 | # endif |
959 | _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); | ||
960 | _GL_CXXALIASWARN (fchdir); | ||
961 | #elif defined GNULIB_POSIXCHECK | 996 | #elif defined GNULIB_POSIXCHECK |
962 | # undef fchdir | 997 | # undef fchdir |
963 | # if HAVE_RAW_DECL_FCHDIR | 998 | # if HAVE_RAW_DECL_FCHDIR |
@@ -1002,11 +1037,22 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " | |||
1002 | Return 0 if successful, otherwise -1 and errno set. | 1037 | Return 0 if successful, otherwise -1 and errno set. |
1003 | See POSIX:2008 specification | 1038 | See POSIX:2008 specification |
1004 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ | 1039 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ |
1005 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ | 1040 | # if @REPLACE_FDATASYNC@ |
1041 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1042 | # undef fdatasync | ||
1043 | # define fdatasync rpl_fdatasync | ||
1044 | # endif | ||
1045 | _GL_FUNCDECL_RPL (fdatasync, int, (int fd)); | ||
1046 | _GL_CXXALIAS_RPL (fdatasync, int, (int fd)); | ||
1047 | # else | ||
1048 | # if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@ | ||
1006 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); | 1049 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); |
1007 | # endif | 1050 | # endif |
1008 | _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); | 1051 | _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); |
1052 | # endif | ||
1053 | # if __GLIBC__ >= 2 | ||
1009 | _GL_CXXALIASWARN (fdatasync); | 1054 | _GL_CXXALIASWARN (fdatasync); |
1055 | # endif | ||
1010 | #elif defined GNULIB_POSIXCHECK | 1056 | #elif defined GNULIB_POSIXCHECK |
1011 | # undef fdatasync | 1057 | # undef fdatasync |
1012 | # if HAVE_RAW_DECL_FDATASYNC | 1058 | # if HAVE_RAW_DECL_FDATASYNC |
@@ -1053,7 +1099,9 @@ _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); | |||
1053 | # endif | 1099 | # endif |
1054 | _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); | 1100 | _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); |
1055 | # endif | 1101 | # endif |
1102 | # if __GLIBC__ >= 2 | ||
1056 | _GL_CXXALIASWARN (ftruncate); | 1103 | _GL_CXXALIASWARN (ftruncate); |
1104 | # endif | ||
1057 | #elif defined GNULIB_POSIXCHECK | 1105 | #elif defined GNULIB_POSIXCHECK |
1058 | # undef ftruncate | 1106 | # undef ftruncate |
1059 | # if HAVE_RAW_DECL_FTRUNCATE | 1107 | # if HAVE_RAW_DECL_FTRUNCATE |
@@ -1070,10 +1118,10 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " | |||
1070 | or SIZE was too small. | 1118 | or SIZE was too small. |
1071 | See the POSIX:2008 specification | 1119 | See the POSIX:2008 specification |
1072 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. | 1120 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. |
1073 | Additionally, the gnulib module 'getcwd' guarantees the following GNU | 1121 | Additionally, the gnulib module 'getcwd' or 'getcwd-lgpl' guarantees the |
1074 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array | 1122 | following GNU extension: If BUF is NULL, an array is allocated with |
1075 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as | 1123 | 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case |
1076 | necessary. */ | 1124 | it is as big as necessary. */ |
1077 | # if @REPLACE_GETCWD@ | 1125 | # if @REPLACE_GETCWD@ |
1078 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1126 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1079 | # define getcwd rpl_getcwd | 1127 | # define getcwd rpl_getcwd |
@@ -1185,11 +1233,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " | |||
1185 | 1233 | ||
1186 | #if @GNULIB_GETENTROPY@ | 1234 | #if @GNULIB_GETENTROPY@ |
1187 | /* Fill a buffer with random bytes. */ | 1235 | /* Fill a buffer with random bytes. */ |
1188 | # if !@HAVE_GETENTROPY@ | 1236 | # if @REPLACE_GETENTROPY@ |
1237 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1238 | # undef getentropy | ||
1239 | # define getentropy rpl_getentropy | ||
1240 | # endif | ||
1241 | _GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); | ||
1242 | _GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); | ||
1243 | # else | ||
1244 | # if !@HAVE_GETENTROPY@ | ||
1189 | _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); | 1245 | _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); |
1190 | # endif | 1246 | # endif |
1191 | _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); | 1247 | _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); |
1248 | # endif | ||
1249 | # if __GLIBC__ >= 2 | ||
1192 | _GL_CXXALIASWARN (getentropy); | 1250 | _GL_CXXALIASWARN (getentropy); |
1251 | # endif | ||
1193 | #elif defined GNULIB_POSIXCHECK | 1252 | #elif defined GNULIB_POSIXCHECK |
1194 | # undef getentropy | 1253 | # undef getentropy |
1195 | # if HAVE_RAW_DECL_GETENTROPY | 1254 | # if HAVE_RAW_DECL_GETENTROPY |
@@ -1323,7 +1382,9 @@ _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) | |||
1323 | int size. */ | 1382 | int size. */ |
1324 | _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); | 1383 | _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); |
1325 | # endif | 1384 | # endif |
1385 | # if __GLIBC__ >= 2 | ||
1326 | _GL_CXXALIASWARN (getlogin_r); | 1386 | _GL_CXXALIASWARN (getlogin_r); |
1387 | # endif | ||
1327 | #elif defined GNULIB_POSIXCHECK | 1388 | #elif defined GNULIB_POSIXCHECK |
1328 | # undef getlogin_r | 1389 | # undef getlogin_r |
1329 | # if HAVE_RAW_DECL_GETLOGIN_R | 1390 | # if HAVE_RAW_DECL_GETLOGIN_R |
@@ -1661,7 +1722,9 @@ _GL_CXXALIAS_SYS (linkat, int, | |||
1661 | (int fd1, const char *path1, int fd2, const char *path2, | 1722 | (int fd1, const char *path1, int fd2, const char *path2, |
1662 | int flag)); | 1723 | int flag)); |
1663 | # endif | 1724 | # endif |
1725 | # if __GLIBC__ >= 2 | ||
1664 | _GL_CXXALIASWARN (linkat); | 1726 | _GL_CXXALIASWARN (linkat); |
1727 | # endif | ||
1665 | #elif defined GNULIB_POSIXCHECK | 1728 | #elif defined GNULIB_POSIXCHECK |
1666 | # undef linkat | 1729 | # undef linkat |
1667 | # if HAVE_RAW_DECL_LINKAT | 1730 | # if HAVE_RAW_DECL_LINKAT |
@@ -1742,8 +1805,9 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " | |||
1742 | Return 0 upon success, or -1 with errno set upon failure. | 1805 | Return 0 upon success, or -1 with errno set upon failure. |
1743 | See also the Linux man page at | 1806 | See also the Linux man page at |
1744 | <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ | 1807 | <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ |
1745 | # if @HAVE_PIPE2@ | 1808 | # if @REPLACE_PIPE2@ |
1746 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1809 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1810 | # undef pipe2 | ||
1747 | # define pipe2 rpl_pipe2 | 1811 | # define pipe2 rpl_pipe2 |
1748 | # endif | 1812 | # endif |
1749 | _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); | 1813 | _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); |
@@ -1752,7 +1816,9 @@ _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); | |||
1752 | _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); | 1816 | _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); |
1753 | _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); | 1817 | _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); |
1754 | # endif | 1818 | # endif |
1819 | # if __GLIBC__ >= 2 | ||
1755 | _GL_CXXALIASWARN (pipe2); | 1820 | _GL_CXXALIASWARN (pipe2); |
1821 | # endif | ||
1756 | #elif defined GNULIB_POSIXCHECK | 1822 | #elif defined GNULIB_POSIXCHECK |
1757 | # undef pipe2 | 1823 | # undef pipe2 |
1758 | # if HAVE_RAW_DECL_PIPE2 | 1824 | # if HAVE_RAW_DECL_PIPE2 |
@@ -1787,7 +1853,9 @@ _GL_FUNCDECL_SYS (pread, ssize_t, | |||
1787 | _GL_CXXALIAS_SYS (pread, ssize_t, | 1853 | _GL_CXXALIAS_SYS (pread, ssize_t, |
1788 | (int fd, void *buf, size_t bufsize, off_t offset)); | 1854 | (int fd, void *buf, size_t bufsize, off_t offset)); |
1789 | # endif | 1855 | # endif |
1856 | # if __GLIBC__ >= 2 | ||
1790 | _GL_CXXALIASWARN (pread); | 1857 | _GL_CXXALIASWARN (pread); |
1858 | # endif | ||
1791 | #elif defined GNULIB_POSIXCHECK | 1859 | #elif defined GNULIB_POSIXCHECK |
1792 | # undef pread | 1860 | # undef pread |
1793 | # if HAVE_RAW_DECL_PREAD | 1861 | # if HAVE_RAW_DECL_PREAD |
@@ -1822,7 +1890,9 @@ _GL_FUNCDECL_SYS (pwrite, ssize_t, | |||
1822 | _GL_CXXALIAS_SYS (pwrite, ssize_t, | 1890 | _GL_CXXALIAS_SYS (pwrite, ssize_t, |
1823 | (int fd, const void *buf, size_t bufsize, off_t offset)); | 1891 | (int fd, const void *buf, size_t bufsize, off_t offset)); |
1824 | # endif | 1892 | # endif |
1893 | # if __GLIBC__ >= 2 | ||
1825 | _GL_CXXALIASWARN (pwrite); | 1894 | _GL_CXXALIASWARN (pwrite); |
1895 | # endif | ||
1826 | #elif defined GNULIB_POSIXCHECK | 1896 | #elif defined GNULIB_POSIXCHECK |
1827 | # undef pwrite | 1897 | # undef pwrite |
1828 | # if HAVE_RAW_DECL_PWRITE | 1898 | # if HAVE_RAW_DECL_PWRITE |
@@ -1936,7 +2006,9 @@ _GL_CXXALIAS_SYS (readlinkat, ssize_t, | |||
1936 | (int fd, char const *restrict file, | 2006 | (int fd, char const *restrict file, |
1937 | char *restrict buf, size_t len)); | 2007 | char *restrict buf, size_t len)); |
1938 | # endif | 2008 | # endif |
2009 | # if __GLIBC__ >= 2 | ||
1939 | _GL_CXXALIASWARN (readlinkat); | 2010 | _GL_CXXALIASWARN (readlinkat); |
2011 | # endif | ||
1940 | #elif defined GNULIB_POSIXCHECK | 2012 | #elif defined GNULIB_POSIXCHECK |
1941 | # undef readlinkat | 2013 | # undef readlinkat |
1942 | # if HAVE_RAW_DECL_READLINKAT | 2014 | # if HAVE_RAW_DECL_READLINKAT |
@@ -1996,15 +2068,27 @@ _GL_CXXALIASWARN (rmdir); | |||
1996 | 2068 | ||
1997 | Platforms with no ability to set the hostname return -1 and set | 2069 | Platforms with no ability to set the hostname return -1 and set |
1998 | errno = ENOSYS. */ | 2070 | errno = ENOSYS. */ |
1999 | # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ | 2071 | # if @REPLACE_SETHOSTNAME@ |
2072 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2073 | # undef sethostname | ||
2074 | # define sethostname rpl_sethostname | ||
2075 | # endif | ||
2076 | _GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) | ||
2077 | _GL_ARG_NONNULL ((1))); | ||
2078 | _GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len)); | ||
2079 | # else | ||
2080 | # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ | ||
2000 | _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) | 2081 | _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) |
2001 | _GL_ARG_NONNULL ((1))); | 2082 | _GL_ARG_NONNULL ((1))); |
2002 | # endif | 2083 | # endif |
2003 | /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 | 2084 | /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 |
2004 | and FreeBSD 6.4 the second parameter is int. On Solaris 11 | 2085 | and FreeBSD 6.4 the second parameter is int. On Solaris 11 |
2005 | 2011-10, the first parameter is not const. */ | 2086 | 2011-10, the first parameter is not const. */ |
2006 | _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); | 2087 | _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); |
2088 | # endif | ||
2089 | # if __GLIBC__ >= 2 | ||
2007 | _GL_CXXALIASWARN (sethostname); | 2090 | _GL_CXXALIASWARN (sethostname); |
2091 | # endif | ||
2008 | #elif defined GNULIB_POSIXCHECK | 2092 | #elif defined GNULIB_POSIXCHECK |
2009 | # undef sethostname | 2093 | # undef sethostname |
2010 | # if HAVE_RAW_DECL_SETHOSTNAME | 2094 | # if HAVE_RAW_DECL_SETHOSTNAME |
@@ -2113,7 +2197,9 @@ _GL_FUNCDECL_SYS (symlinkat, int, | |||
2113 | _GL_CXXALIAS_SYS (symlinkat, int, | 2197 | _GL_CXXALIAS_SYS (symlinkat, int, |
2114 | (char const *contents, int fd, char const *file)); | 2198 | (char const *contents, int fd, char const *file)); |
2115 | # endif | 2199 | # endif |
2200 | # if __GLIBC__ >= 2 | ||
2116 | _GL_CXXALIASWARN (symlinkat); | 2201 | _GL_CXXALIASWARN (symlinkat); |
2202 | # endif | ||
2117 | #elif defined GNULIB_POSIXCHECK | 2203 | #elif defined GNULIB_POSIXCHECK |
2118 | # undef symlinkat | 2204 | # undef symlinkat |
2119 | # if HAVE_RAW_DECL_SYMLINKAT | 2205 | # if HAVE_RAW_DECL_SYMLINKAT |
@@ -2143,7 +2229,9 @@ _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) | |||
2143 | # endif | 2229 | # endif |
2144 | _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); | 2230 | _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); |
2145 | # endif | 2231 | # endif |
2232 | # if __GLIBC__ >= 2 | ||
2146 | _GL_CXXALIASWARN (truncate); | 2233 | _GL_CXXALIASWARN (truncate); |
2234 | # endif | ||
2147 | #elif defined GNULIB_POSIXCHECK | 2235 | #elif defined GNULIB_POSIXCHECK |
2148 | # undef truncate | 2236 | # undef truncate |
2149 | # if HAVE_RAW_DECL_TRUNCATE | 2237 | # if HAVE_RAW_DECL_TRUNCATE |
@@ -2173,7 +2261,9 @@ _GL_FUNCDECL_SYS (ttyname_r, int, | |||
2173 | _GL_CXXALIAS_SYS (ttyname_r, int, | 2261 | _GL_CXXALIAS_SYS (ttyname_r, int, |
2174 | (int fd, char *buf, size_t buflen)); | 2262 | (int fd, char *buf, size_t buflen)); |
2175 | # endif | 2263 | # endif |
2264 | # if __GLIBC__ >= 2 | ||
2176 | _GL_CXXALIASWARN (ttyname_r); | 2265 | _GL_CXXALIASWARN (ttyname_r); |
2266 | # endif | ||
2177 | #elif defined GNULIB_POSIXCHECK | 2267 | #elif defined GNULIB_POSIXCHECK |
2178 | # undef ttyname_r | 2268 | # undef ttyname_r |
2179 | # if HAVE_RAW_DECL_TTYNAME_R | 2269 | # if HAVE_RAW_DECL_TTYNAME_R |
diff --git a/gl/unlocked-io.h b/gl/unlocked-io.h index fdef624a..0cd9bbf3 100644 --- a/gl/unlocked-io.h +++ b/gl/unlocked-io.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Prefer faster, non-thread-safe stdio functions if available. | 1 | /* Prefer faster, non-thread-safe stdio functions if available. |
2 | 2 | ||
3 | Copyright (C) 2001-2004, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2001-2004, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
@@ -31,6 +31,11 @@ | |||
31 | the *_unlocked functions directly. On hosts that lack those | 31 | the *_unlocked functions directly. On hosts that lack those |
32 | functions, invoke the non-thread-safe versions instead. */ | 32 | functions, invoke the non-thread-safe versions instead. */ |
33 | 33 | ||
34 | /* This file uses HAVE_DECL_*_UNLOCKED. */ | ||
35 | # if !_GL_CONFIG_H_INCLUDED | ||
36 | # error "Please include config.h first." | ||
37 | # endif | ||
38 | |||
34 | # include <stdio.h> | 39 | # include <stdio.h> |
35 | 40 | ||
36 | # if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked | 41 | # if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked |
@@ -96,7 +101,7 @@ | |||
96 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) | 101 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) |
97 | # endif | 102 | # endif |
98 | 103 | ||
99 | # if HAVE_DECL_GETC_UNLOCKED || defined get_unlocked | 104 | # if HAVE_DECL_GETC_UNLOCKED || defined getc_unlocked |
100 | # undef getc | 105 | # undef getc |
101 | # define getc(x) getc_unlocked (x) | 106 | # define getc(x) getc_unlocked (x) |
102 | # else | 107 | # else |
diff --git a/gl/unsetenv.c b/gl/unsetenv.c index e5489490..d8ada2aa 100644 --- a/gl/unsetenv.c +++ b/gl/unsetenv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1992, 1995-2002, 2005-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992, 1995-2002, 2005-2024 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c index 277c39e3..de204458 100644 --- a/gl/vasnprintf.c +++ b/gl/vasnprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* vsprintf with automatic memory allocation. | 1 | /* vsprintf with automatic memory allocation. |
2 | Copyright (C) 1999, 2002-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -83,9 +83,9 @@ | |||
83 | #include <stdio.h> /* snprintf(), sprintf() */ | 83 | #include <stdio.h> /* snprintf(), sprintf() */ |
84 | #include <stdlib.h> /* abort(), malloc(), realloc(), free() */ | 84 | #include <stdlib.h> /* abort(), malloc(), realloc(), free() */ |
85 | #include <string.h> /* memcpy(), strlen() */ | 85 | #include <string.h> /* memcpy(), strlen() */ |
86 | #include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb() */ | 86 | #include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(), mbszero() */ |
87 | #include <errno.h> /* errno */ | 87 | #include <errno.h> /* errno */ |
88 | #include <limits.h> /* CHAR_BIT */ | 88 | #include <limits.h> /* CHAR_BIT, INT_WIDTH, LONG_WIDTH */ |
89 | #include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ | 89 | #include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ |
90 | #if HAVE_NL_LANGINFO | 90 | #if HAVE_NL_LANGINFO |
91 | # include <langinfo.h> | 91 | # include <langinfo.h> |
@@ -103,29 +103,29 @@ | |||
103 | 103 | ||
104 | #include "attribute.h" | 104 | #include "attribute.h" |
105 | 105 | ||
106 | #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL | 106 | #if NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
107 | # include <math.h> | 107 | # include <math.h> |
108 | # include "float+.h" | 108 | # include "float+.h" |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL | 111 | #if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE |
112 | # include <math.h> | 112 | # include <math.h> |
113 | # include "isnand-nolibm.h" | 113 | # include "isnand-nolibm.h" |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL | 116 | #if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
117 | # include <math.h> | 117 | # include <math.h> |
118 | # include "isnanl-nolibm.h" | 118 | # include "isnanl-nolibm.h" |
119 | # include "fpucw.h" | 119 | # include "fpucw.h" |
120 | #endif | 120 | #endif |
121 | 121 | ||
122 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL | 122 | #if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE |
123 | # include <math.h> | 123 | # include <math.h> |
124 | # include "isnand-nolibm.h" | 124 | # include "isnand-nolibm.h" |
125 | # include "printf-frexp.h" | 125 | # include "printf-frexp.h" |
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL | 128 | #if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
129 | # include <math.h> | 129 | # include <math.h> |
130 | # include "isnanl-nolibm.h" | 130 | # include "isnanl-nolibm.h" |
131 | # include "printf-frexpl.h" | 131 | # include "printf-frexpl.h" |
@@ -138,8 +138,6 @@ | |||
138 | # define VASNPRINTF vasnwprintf | 138 | # define VASNPRINTF vasnwprintf |
139 | # define FCHAR_T wchar_t | 139 | # define FCHAR_T wchar_t |
140 | # define DCHAR_T wchar_t | 140 | # define DCHAR_T wchar_t |
141 | # define TCHAR_T wchar_t | ||
142 | # define DCHAR_IS_TCHAR 1 | ||
143 | # define DIRECTIVE wchar_t_directive | 141 | # define DIRECTIVE wchar_t_directive |
144 | # define DIRECTIVES wchar_t_directives | 142 | # define DIRECTIVES wchar_t_directives |
145 | # define PRINTF_PARSE wprintf_parse | 143 | # define PRINTF_PARSE wprintf_parse |
@@ -159,24 +157,32 @@ | |||
159 | # endif | 157 | # endif |
160 | #endif | 158 | #endif |
161 | #if WIDE_CHAR_VERSION | 159 | #if WIDE_CHAR_VERSION |
162 | /* TCHAR_T is wchar_t. */ | 160 | /* DCHAR_T is wchar_t. */ |
163 | # define USE_SNPRINTF 1 | 161 | # if HAVE_DECL__SNWPRINTF || (HAVE_SWPRINTF && HAVE_WORKING_SWPRINTF) |
164 | # if HAVE_DECL__SNWPRINTF | 162 | # define TCHAR_T wchar_t |
165 | /* On Windows, the function swprintf() has a different signature than | 163 | # define DCHAR_IS_TCHAR 1 |
166 | on Unix; we use the function _snwprintf() or - on mingw - snwprintf() | 164 | # define USE_SNPRINTF 1 |
167 | instead. The mingw function snwprintf() has fewer bugs than the | 165 | # if HAVE_DECL__SNWPRINTF |
168 | MSVCRT function _snwprintf(), so prefer that. */ | 166 | /* On Windows, the function swprintf() has a different signature than |
169 | # if defined __MINGW32__ | 167 | on Unix; we use the function _snwprintf() or - on mingw - snwprintf() |
170 | # define SNPRINTF snwprintf | 168 | instead. The mingw function snwprintf() has fewer bugs than the |
169 | MSVCRT function _snwprintf(), so prefer that. */ | ||
170 | # if defined __MINGW32__ | ||
171 | # define SNPRINTF snwprintf | ||
172 | # else | ||
173 | # define SNPRINTF _snwprintf | ||
174 | # define USE_MSVC__SNPRINTF 1 | ||
175 | # endif | ||
171 | # else | 176 | # else |
172 | # define SNPRINTF _snwprintf | 177 | /* Unix. */ |
173 | # define USE_MSVC__SNPRINTF 1 | 178 | # define SNPRINTF swprintf |
174 | # endif | 179 | # endif |
175 | # else | 180 | # else |
176 | /* Unix. */ | 181 | /* Old platforms such as NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00, IRIX 6.5. */ |
177 | # define SNPRINTF swprintf | 182 | # define TCHAR_T char |
178 | # endif | 183 | # endif |
179 | #else | 184 | #endif |
185 | #if !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR | ||
180 | /* TCHAR_T is char. */ | 186 | /* TCHAR_T is char. */ |
181 | /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. | 187 | /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. |
182 | But don't use it on BeOS, since BeOS snprintf produces no output if the | 188 | But don't use it on BeOS, since BeOS snprintf produces no output if the |
@@ -241,7 +247,7 @@ local_strnlen (const char *string, size_t maxlen) | |||
241 | # endif | 247 | # endif |
242 | #endif | 248 | #endif |
243 | 249 | ||
244 | #if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T | 250 | #if (((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T |
245 | # if HAVE_WCSLEN | 251 | # if HAVE_WCSLEN |
246 | # define local_wcslen wcslen | 252 | # define local_wcslen wcslen |
247 | # else | 253 | # else |
@@ -264,8 +270,8 @@ local_wcslen (const wchar_t *s) | |||
264 | # endif | 270 | # endif |
265 | #endif | 271 | #endif |
266 | 272 | ||
267 | #if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION | 273 | #if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION |
268 | # if HAVE_WCSNLEN | 274 | # if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN |
269 | # define local_wcsnlen wcsnlen | 275 | # define local_wcsnlen wcsnlen |
270 | # else | 276 | # else |
271 | # ifndef local_wcsnlen_defined | 277 | # ifndef local_wcsnlen_defined |
@@ -283,12 +289,12 @@ local_wcsnlen (const wchar_t *s, size_t maxlen) | |||
283 | # endif | 289 | # endif |
284 | #endif | 290 | #endif |
285 | 291 | ||
286 | #if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL) || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || (ENABLE_WCHAR_FALLBACK && HAVE_WINT_T)) && !WIDE_CHAR_VERSION | 292 | #if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) && !WIDE_CHAR_VERSION |
287 | # if ENABLE_WCHAR_FALLBACK | 293 | # if ENABLE_WCHAR_FALLBACK |
288 | static size_t | 294 | static size_t |
289 | wctomb_fallback (char *s, wchar_t wc) | 295 | wctomb_fallback (char *s, wchar_t wc) |
290 | { | 296 | { |
291 | static char hex[16] = "0123456789ABCDEF"; | 297 | static char const hex[16] = "0123456789ABCDEF"; |
292 | 298 | ||
293 | s[0] = '\\'; | 299 | s[0] = '\\'; |
294 | if (sizeof (wchar_t) > 2 && wc > 0xffff) | 300 | if (sizeof (wchar_t) > 2 && wc > 0xffff) |
@@ -351,7 +357,7 @@ local_wctomb (char *s, wchar_t wc) | |||
351 | # endif | 357 | # endif |
352 | #endif | 358 | #endif |
353 | 359 | ||
354 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL | 360 | #if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
355 | /* Determine the decimal-point character according to the current locale. */ | 361 | /* Determine the decimal-point character according to the current locale. */ |
356 | # ifndef decimal_point_char_defined | 362 | # ifndef decimal_point_char_defined |
357 | # define decimal_point_char_defined 1 | 363 | # define decimal_point_char_defined 1 |
@@ -378,7 +384,7 @@ decimal_point_char (void) | |||
378 | # endif | 384 | # endif |
379 | #endif | 385 | #endif |
380 | 386 | ||
381 | #if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL | 387 | #if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE |
382 | 388 | ||
383 | /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ | 389 | /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ |
384 | static int | 390 | static int |
@@ -389,7 +395,7 @@ is_infinite_or_zero (double x) | |||
389 | 395 | ||
390 | #endif | 396 | #endif |
391 | 397 | ||
392 | #if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL | 398 | #if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE |
393 | 399 | ||
394 | /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ | 400 | /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ |
395 | static int | 401 | static int |
@@ -400,7 +406,7 @@ is_infinite_or_zerol (long double x) | |||
400 | 406 | ||
401 | #endif | 407 | #endif |
402 | 408 | ||
403 | #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL | 409 | #if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE |
404 | 410 | ||
405 | /* Converting 'long double' to decimal without rare rounding bugs requires | 411 | /* Converting 'long double' to decimal without rare rounding bugs requires |
406 | real bignums. We use the naming conventions of GNU gmp, but vastly simpler | 412 | real bignums. We use the naming conventions of GNU gmp, but vastly simpler |
@@ -921,6 +927,14 @@ divide (mpn_t a, mpn_t b, mpn_t *q) | |||
921 | return roomptr; | 927 | return roomptr; |
922 | } | 928 | } |
923 | 929 | ||
930 | /* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds | ||
931 | maximum object size 9223372036854775807", triggered by the use of xsum as | ||
932 | argument of malloc. */ | ||
933 | # if __GNUC__ >= 7 | ||
934 | # pragma GCC diagnostic push | ||
935 | # pragma GCC diagnostic ignored "-Walloc-size-larger-than=" | ||
936 | # endif | ||
937 | |||
924 | /* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal | 938 | /* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal |
925 | representation. | 939 | representation. |
926 | Destroys the contents of a. | 940 | Destroys the contents of a. |
@@ -977,6 +991,10 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes) | |||
977 | return c_ptr; | 991 | return c_ptr; |
978 | } | 992 | } |
979 | 993 | ||
994 | # if __GNUC__ >= 7 | ||
995 | # pragma GCC diagnostic pop | ||
996 | # endif | ||
997 | |||
980 | # if NEED_PRINTF_LONG_DOUBLE | 998 | # if NEED_PRINTF_LONG_DOUBLE |
981 | 999 | ||
982 | /* Assuming x is finite and >= 0: | 1000 | /* Assuming x is finite and >= 0: |
@@ -1171,8 +1189,6 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) | |||
1171 | void *z_memory; | 1189 | void *z_memory; |
1172 | char *digits; | 1190 | char *digits; |
1173 | 1191 | ||
1174 | if (memory == NULL) | ||
1175 | return NULL; | ||
1176 | /* x = 2^e * m, hence | 1192 | /* x = 2^e * m, hence |
1177 | y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) | 1193 | y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) |
1178 | = round (2^s * 5^n * m). */ | 1194 | = round (2^s * 5^n * m). */ |
@@ -1380,10 +1396,13 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) | |||
1380 | static char * | 1396 | static char * |
1381 | scale10_round_decimal_long_double (long double x, int n) | 1397 | scale10_round_decimal_long_double (long double x, int n) |
1382 | { | 1398 | { |
1383 | int e IF_LINT(= 0); | 1399 | int e; |
1384 | mpn_t m; | 1400 | mpn_t m; |
1385 | void *memory = decode_long_double (x, &e, &m); | 1401 | void *memory = decode_long_double (x, &e, &m); |
1386 | return scale10_round_decimal_decoded (e, m, memory, n); | 1402 | if (memory != NULL) |
1403 | return scale10_round_decimal_decoded (e, m, memory, n); | ||
1404 | else | ||
1405 | return NULL; | ||
1387 | } | 1406 | } |
1388 | 1407 | ||
1389 | # endif | 1408 | # endif |
@@ -1398,10 +1417,13 @@ scale10_round_decimal_long_double (long double x, int n) | |||
1398 | static char * | 1417 | static char * |
1399 | scale10_round_decimal_double (double x, int n) | 1418 | scale10_round_decimal_double (double x, int n) |
1400 | { | 1419 | { |
1401 | int e IF_LINT(= 0); | 1420 | int e; |
1402 | mpn_t m; | 1421 | mpn_t m; |
1403 | void *memory = decode_double (x, &e, &m); | 1422 | void *memory = decode_double (x, &e, &m); |
1404 | return scale10_round_decimal_decoded (e, m, memory, n); | 1423 | if (memory != NULL) |
1424 | return scale10_round_decimal_decoded (e, m, memory, n); | ||
1425 | else | ||
1426 | return NULL; | ||
1405 | } | 1427 | } |
1406 | 1428 | ||
1407 | # endif | 1429 | # endif |
@@ -1604,7 +1626,7 @@ is_borderline (const char *digits, size_t precision) | |||
1604 | 1626 | ||
1605 | #endif | 1627 | #endif |
1606 | 1628 | ||
1607 | #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF | 1629 | #if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF |
1608 | 1630 | ||
1609 | /* Use a different function name, to make it possible that the 'wchar_t' | 1631 | /* Use a different function name, to make it possible that the 'wchar_t' |
1610 | parametrization and the 'char' parametrization get compiled in the same | 1632 | parametrization and the 'char' parametrization get compiled in the same |
@@ -1627,24 +1649,156 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, | |||
1627 | switch (conversion) | 1649 | switch (conversion) |
1628 | { | 1650 | { |
1629 | case 'd': case 'i': case 'u': | 1651 | case 'd': case 'i': case 'u': |
1630 | if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) | 1652 | switch (type) |
1631 | tmp_length = | 1653 | { |
1632 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 1654 | default: |
1633 | * 0.30103 /* binary -> decimal */ | 1655 | tmp_length = |
1634 | ) | 1656 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
1635 | + 1; /* turn floor into ceil */ | 1657 | * 0.30103 /* binary -> decimal */ |
1636 | else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 1658 | ) |
1637 | tmp_length = | 1659 | + 1; /* turn floor into ceil */ |
1638 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 1660 | break; |
1639 | * 0.30103 /* binary -> decimal */ | 1661 | case TYPE_LONGINT: |
1640 | ) | 1662 | tmp_length = |
1641 | + 1; /* turn floor into ceil */ | 1663 | (unsigned int) (sizeof (long int) * CHAR_BIT |
1642 | else | 1664 | * 0.30103 /* binary -> decimal */ |
1643 | tmp_length = | 1665 | ) |
1644 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 1666 | + 1; /* turn floor into ceil */ |
1645 | * 0.30103 /* binary -> decimal */ | 1667 | break; |
1646 | ) | 1668 | case TYPE_ULONGINT: |
1647 | + 1; /* turn floor into ceil */ | 1669 | tmp_length = |
1670 | (unsigned int) (sizeof (unsigned long int) * CHAR_BIT | ||
1671 | * 0.30103 /* binary -> decimal */ | ||
1672 | ) | ||
1673 | + 1; /* turn floor into ceil */ | ||
1674 | break; | ||
1675 | case TYPE_LONGLONGINT: | ||
1676 | tmp_length = | ||
1677 | (unsigned int) (sizeof (long long int) * CHAR_BIT | ||
1678 | * 0.30103 /* binary -> decimal */ | ||
1679 | ) | ||
1680 | + 1; /* turn floor into ceil */ | ||
1681 | break; | ||
1682 | case TYPE_ULONGLONGINT: | ||
1683 | tmp_length = | ||
1684 | (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT | ||
1685 | * 0.30103 /* binary -> decimal */ | ||
1686 | ) | ||
1687 | + 1; /* turn floor into ceil */ | ||
1688 | break; | ||
1689 | case TYPE_INT8_T: | ||
1690 | tmp_length = | ||
1691 | (unsigned int) (sizeof (int8_t) * CHAR_BIT | ||
1692 | * 0.30103 /* binary -> decimal */ | ||
1693 | ) | ||
1694 | + 1; /* turn floor into ceil */ | ||
1695 | break; | ||
1696 | case TYPE_UINT8_T: | ||
1697 | tmp_length = | ||
1698 | (unsigned int) (sizeof (uint8_t) * CHAR_BIT | ||
1699 | * 0.30103 /* binary -> decimal */ | ||
1700 | ) | ||
1701 | + 1; /* turn floor into ceil */ | ||
1702 | break; | ||
1703 | case TYPE_INT16_T: | ||
1704 | tmp_length = | ||
1705 | (unsigned int) (sizeof (int16_t) * CHAR_BIT | ||
1706 | * 0.30103 /* binary -> decimal */ | ||
1707 | ) | ||
1708 | + 1; /* turn floor into ceil */ | ||
1709 | break; | ||
1710 | case TYPE_UINT16_T: | ||
1711 | tmp_length = | ||
1712 | (unsigned int) (sizeof (uint16_t) * CHAR_BIT | ||
1713 | * 0.30103 /* binary -> decimal */ | ||
1714 | ) | ||
1715 | + 1; /* turn floor into ceil */ | ||
1716 | break; | ||
1717 | case TYPE_INT32_T: | ||
1718 | tmp_length = | ||
1719 | (unsigned int) (sizeof (int32_t) * CHAR_BIT | ||
1720 | * 0.30103 /* binary -> decimal */ | ||
1721 | ) | ||
1722 | + 1; /* turn floor into ceil */ | ||
1723 | break; | ||
1724 | case TYPE_UINT32_T: | ||
1725 | tmp_length = | ||
1726 | (unsigned int) (sizeof (uint32_t) * CHAR_BIT | ||
1727 | * 0.30103 /* binary -> decimal */ | ||
1728 | ) | ||
1729 | + 1; /* turn floor into ceil */ | ||
1730 | break; | ||
1731 | case TYPE_INT64_T: | ||
1732 | tmp_length = | ||
1733 | (unsigned int) (sizeof (int64_t) * CHAR_BIT | ||
1734 | * 0.30103 /* binary -> decimal */ | ||
1735 | ) | ||
1736 | + 1; /* turn floor into ceil */ | ||
1737 | break; | ||
1738 | case TYPE_UINT64_T: | ||
1739 | tmp_length = | ||
1740 | (unsigned int) (sizeof (uint64_t) * CHAR_BIT | ||
1741 | * 0.30103 /* binary -> decimal */ | ||
1742 | ) | ||
1743 | + 1; /* turn floor into ceil */ | ||
1744 | break; | ||
1745 | case TYPE_INT_FAST8_T: | ||
1746 | tmp_length = | ||
1747 | (unsigned int) (sizeof (int_fast8_t) * CHAR_BIT | ||
1748 | * 0.30103 /* binary -> decimal */ | ||
1749 | ) | ||
1750 | + 1; /* turn floor into ceil */ | ||
1751 | break; | ||
1752 | case TYPE_UINT_FAST8_T: | ||
1753 | tmp_length = | ||
1754 | (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT | ||
1755 | * 0.30103 /* binary -> decimal */ | ||
1756 | ) | ||
1757 | + 1; /* turn floor into ceil */ | ||
1758 | break; | ||
1759 | case TYPE_INT_FAST16_T: | ||
1760 | tmp_length = | ||
1761 | (unsigned int) (sizeof (int_fast16_t) * CHAR_BIT | ||
1762 | * 0.30103 /* binary -> decimal */ | ||
1763 | ) | ||
1764 | + 1; /* turn floor into ceil */ | ||
1765 | break; | ||
1766 | case TYPE_UINT_FAST16_T: | ||
1767 | tmp_length = | ||
1768 | (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT | ||
1769 | * 0.30103 /* binary -> decimal */ | ||
1770 | ) | ||
1771 | + 1; /* turn floor into ceil */ | ||
1772 | break; | ||
1773 | case TYPE_INT_FAST32_T: | ||
1774 | tmp_length = | ||
1775 | (unsigned int) (sizeof (int_fast32_t) * CHAR_BIT | ||
1776 | * 0.30103 /* binary -> decimal */ | ||
1777 | ) | ||
1778 | + 1; /* turn floor into ceil */ | ||
1779 | break; | ||
1780 | case TYPE_UINT_FAST32_T: | ||
1781 | tmp_length = | ||
1782 | (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT | ||
1783 | * 0.30103 /* binary -> decimal */ | ||
1784 | ) | ||
1785 | + 1; /* turn floor into ceil */ | ||
1786 | break; | ||
1787 | case TYPE_INT_FAST64_T: | ||
1788 | tmp_length = | ||
1789 | (unsigned int) (sizeof (int_fast64_t) * CHAR_BIT | ||
1790 | * 0.30103 /* binary -> decimal */ | ||
1791 | ) | ||
1792 | + 1; /* turn floor into ceil */ | ||
1793 | break; | ||
1794 | case TYPE_UINT_FAST64_T: | ||
1795 | tmp_length = | ||
1796 | (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT | ||
1797 | * 0.30103 /* binary -> decimal */ | ||
1798 | ) | ||
1799 | + 1; /* turn floor into ceil */ | ||
1800 | break; | ||
1801 | } | ||
1648 | if (tmp_length < precision) | 1802 | if (tmp_length < precision) |
1649 | tmp_length = precision; | 1803 | tmp_length = precision; |
1650 | /* Multiply by 2, as an estimate for FLAG_GROUP. */ | 1804 | /* Multiply by 2, as an estimate for FLAG_GROUP. */ |
@@ -1653,25 +1807,156 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, | |||
1653 | tmp_length = xsum (tmp_length, 1); | 1807 | tmp_length = xsum (tmp_length, 1); |
1654 | break; | 1808 | break; |
1655 | 1809 | ||
1810 | case 'b': | ||
1811 | #if SUPPORT_GNU_PRINTF_DIRECTIVES \ | ||
1812 | || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2) | ||
1813 | case 'B': | ||
1814 | #endif | ||
1815 | switch (type) | ||
1816 | { | ||
1817 | default: | ||
1818 | tmp_length = | ||
1819 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT) | ||
1820 | + 1; /* turn floor into ceil */ | ||
1821 | break; | ||
1822 | case TYPE_ULONGINT: | ||
1823 | tmp_length = | ||
1824 | (unsigned int) (sizeof (unsigned long int) * CHAR_BIT) | ||
1825 | + 1; /* turn floor into ceil */ | ||
1826 | break; | ||
1827 | case TYPE_ULONGLONGINT: | ||
1828 | tmp_length = | ||
1829 | (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT) | ||
1830 | + 1; /* turn floor into ceil */ | ||
1831 | break; | ||
1832 | case TYPE_UINT8_T: | ||
1833 | tmp_length = | ||
1834 | (unsigned int) (sizeof (uint8_t) * CHAR_BIT) | ||
1835 | + 1; /* turn floor into ceil */ | ||
1836 | break; | ||
1837 | case TYPE_UINT16_T: | ||
1838 | tmp_length = | ||
1839 | (unsigned int) (sizeof (uint16_t) * CHAR_BIT) | ||
1840 | + 1; /* turn floor into ceil */ | ||
1841 | break; | ||
1842 | case TYPE_UINT32_T: | ||
1843 | tmp_length = | ||
1844 | (unsigned int) (sizeof (uint32_t) * CHAR_BIT) | ||
1845 | + 1; /* turn floor into ceil */ | ||
1846 | break; | ||
1847 | case TYPE_UINT64_T: | ||
1848 | tmp_length = | ||
1849 | (unsigned int) (sizeof (uint64_t) * CHAR_BIT) | ||
1850 | + 1; /* turn floor into ceil */ | ||
1851 | break; | ||
1852 | case TYPE_UINT_FAST8_T: | ||
1853 | tmp_length = | ||
1854 | (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT) | ||
1855 | + 1; /* turn floor into ceil */ | ||
1856 | break; | ||
1857 | case TYPE_UINT_FAST16_T: | ||
1858 | tmp_length = | ||
1859 | (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT) | ||
1860 | + 1; /* turn floor into ceil */ | ||
1861 | break; | ||
1862 | case TYPE_UINT_FAST32_T: | ||
1863 | tmp_length = | ||
1864 | (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT) | ||
1865 | + 1; /* turn floor into ceil */ | ||
1866 | break; | ||
1867 | case TYPE_UINT_FAST64_T: | ||
1868 | tmp_length = | ||
1869 | (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT) | ||
1870 | + 1; /* turn floor into ceil */ | ||
1871 | break; | ||
1872 | } | ||
1873 | if (tmp_length < precision) | ||
1874 | tmp_length = precision; | ||
1875 | /* Add 2, to account for a prefix from the alternate form. */ | ||
1876 | tmp_length = xsum (tmp_length, 2); | ||
1877 | break; | ||
1878 | |||
1656 | case 'o': | 1879 | case 'o': |
1657 | if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) | 1880 | switch (type) |
1658 | tmp_length = | 1881 | { |
1659 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 1882 | default: |
1660 | * 0.333334 /* binary -> octal */ | 1883 | tmp_length = |
1661 | ) | 1884 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
1662 | + 1; /* turn floor into ceil */ | 1885 | * 0.333334 /* binary -> octal */ |
1663 | else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 1886 | ) |
1664 | tmp_length = | 1887 | + 1; /* turn floor into ceil */ |
1665 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 1888 | break; |
1666 | * 0.333334 /* binary -> octal */ | 1889 | case TYPE_ULONGINT: |
1667 | ) | 1890 | tmp_length = |
1668 | + 1; /* turn floor into ceil */ | 1891 | (unsigned int) (sizeof (unsigned long int) * CHAR_BIT |
1669 | else | 1892 | * 0.333334 /* binary -> octal */ |
1670 | tmp_length = | 1893 | ) |
1671 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 1894 | + 1; /* turn floor into ceil */ |
1672 | * 0.333334 /* binary -> octal */ | 1895 | break; |
1673 | ) | 1896 | case TYPE_ULONGLONGINT: |
1674 | + 1; /* turn floor into ceil */ | 1897 | tmp_length = |
1898 | (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT | ||
1899 | * 0.333334 /* binary -> octal */ | ||
1900 | ) | ||
1901 | + 1; /* turn floor into ceil */ | ||
1902 | break; | ||
1903 | case TYPE_UINT8_T: | ||
1904 | tmp_length = | ||
1905 | (unsigned int) (sizeof (uint8_t) * CHAR_BIT | ||
1906 | * 0.333334 /* binary -> octal */ | ||
1907 | ) | ||
1908 | + 1; /* turn floor into ceil */ | ||
1909 | break; | ||
1910 | case TYPE_UINT16_T: | ||
1911 | tmp_length = | ||
1912 | (unsigned int) (sizeof (uint16_t) * CHAR_BIT | ||
1913 | * 0.333334 /* binary -> octal */ | ||
1914 | ) | ||
1915 | + 1; /* turn floor into ceil */ | ||
1916 | break; | ||
1917 | case TYPE_UINT32_T: | ||
1918 | tmp_length = | ||
1919 | (unsigned int) (sizeof (uint32_t) * CHAR_BIT | ||
1920 | * 0.333334 /* binary -> octal */ | ||
1921 | ) | ||
1922 | + 1; /* turn floor into ceil */ | ||
1923 | break; | ||
1924 | case TYPE_UINT64_T: | ||
1925 | tmp_length = | ||
1926 | (unsigned int) (sizeof (uint64_t) * CHAR_BIT | ||
1927 | * 0.333334 /* binary -> octal */ | ||
1928 | ) | ||
1929 | + 1; /* turn floor into ceil */ | ||
1930 | break; | ||
1931 | case TYPE_UINT_FAST8_T: | ||
1932 | tmp_length = | ||
1933 | (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT | ||
1934 | * 0.333334 /* binary -> octal */ | ||
1935 | ) | ||
1936 | + 1; /* turn floor into ceil */ | ||
1937 | break; | ||
1938 | case TYPE_UINT_FAST16_T: | ||
1939 | tmp_length = | ||
1940 | (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT | ||
1941 | * 0.333334 /* binary -> octal */ | ||
1942 | ) | ||
1943 | + 1; /* turn floor into ceil */ | ||
1944 | break; | ||
1945 | case TYPE_UINT_FAST32_T: | ||
1946 | tmp_length = | ||
1947 | (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT | ||
1948 | * 0.333334 /* binary -> octal */ | ||
1949 | ) | ||
1950 | + 1; /* turn floor into ceil */ | ||
1951 | break; | ||
1952 | case TYPE_UINT_FAST64_T: | ||
1953 | tmp_length = | ||
1954 | (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT | ||
1955 | * 0.333334 /* binary -> octal */ | ||
1956 | ) | ||
1957 | + 1; /* turn floor into ceil */ | ||
1958 | break; | ||
1959 | } | ||
1675 | if (tmp_length < precision) | 1960 | if (tmp_length < precision) |
1676 | tmp_length = precision; | 1961 | tmp_length = precision; |
1677 | /* Add 1, to account for a leading sign. */ | 1962 | /* Add 1, to account for a leading sign. */ |
@@ -1679,27 +1964,89 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, | |||
1679 | break; | 1964 | break; |
1680 | 1965 | ||
1681 | case 'x': case 'X': | 1966 | case 'x': case 'X': |
1682 | if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) | 1967 | switch (type) |
1683 | tmp_length = | 1968 | { |
1684 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 1969 | default: |
1685 | * 0.25 /* binary -> hexadecimal */ | 1970 | tmp_length = |
1686 | ) | 1971 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
1687 | + 1; /* turn floor into ceil */ | 1972 | * 0.25 /* binary -> hexadecimal */ |
1688 | else if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 1973 | ) |
1689 | tmp_length = | 1974 | + 1; /* turn floor into ceil */ |
1690 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 1975 | break; |
1691 | * 0.25 /* binary -> hexadecimal */ | 1976 | case TYPE_ULONGINT: |
1692 | ) | 1977 | tmp_length = |
1693 | + 1; /* turn floor into ceil */ | 1978 | (unsigned int) (sizeof (unsigned long int) * CHAR_BIT |
1694 | else | 1979 | * 0.25 /* binary -> hexadecimal */ |
1695 | tmp_length = | 1980 | ) |
1696 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 1981 | + 1; /* turn floor into ceil */ |
1697 | * 0.25 /* binary -> hexadecimal */ | 1982 | break; |
1698 | ) | 1983 | case TYPE_ULONGLONGINT: |
1699 | + 1; /* turn floor into ceil */ | 1984 | tmp_length = |
1985 | (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT | ||
1986 | * 0.25 /* binary -> hexadecimal */ | ||
1987 | ) | ||
1988 | + 1; /* turn floor into ceil */ | ||
1989 | break; | ||
1990 | case TYPE_UINT8_T: | ||
1991 | tmp_length = | ||
1992 | (unsigned int) (sizeof (uint8_t) * CHAR_BIT | ||
1993 | * 0.25 /* binary -> hexadecimal */ | ||
1994 | ) | ||
1995 | + 1; /* turn floor into ceil */ | ||
1996 | break; | ||
1997 | case TYPE_UINT16_T: | ||
1998 | tmp_length = | ||
1999 | (unsigned int) (sizeof (uint16_t) * CHAR_BIT | ||
2000 | * 0.25 /* binary -> hexadecimal */ | ||
2001 | ) | ||
2002 | + 1; /* turn floor into ceil */ | ||
2003 | break; | ||
2004 | case TYPE_UINT32_T: | ||
2005 | tmp_length = | ||
2006 | (unsigned int) (sizeof (uint32_t) * CHAR_BIT | ||
2007 | * 0.25 /* binary -> hexadecimal */ | ||
2008 | ) | ||
2009 | + 1; /* turn floor into ceil */ | ||
2010 | break; | ||
2011 | case TYPE_UINT64_T: | ||
2012 | tmp_length = | ||
2013 | (unsigned int) (sizeof (uint64_t) * CHAR_BIT | ||
2014 | * 0.25 /* binary -> hexadecimal */ | ||
2015 | ) | ||
2016 | + 1; /* turn floor into ceil */ | ||
2017 | break; | ||
2018 | case TYPE_UINT_FAST8_T: | ||
2019 | tmp_length = | ||
2020 | (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT | ||
2021 | * 0.25 /* binary -> hexadecimal */ | ||
2022 | ) | ||
2023 | + 1; /* turn floor into ceil */ | ||
2024 | break; | ||
2025 | case TYPE_UINT_FAST16_T: | ||
2026 | tmp_length = | ||
2027 | (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT | ||
2028 | * 0.25 /* binary -> hexadecimal */ | ||
2029 | ) | ||
2030 | + 1; /* turn floor into ceil */ | ||
2031 | break; | ||
2032 | case TYPE_UINT_FAST32_T: | ||
2033 | tmp_length = | ||
2034 | (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT | ||
2035 | * 0.25 /* binary -> hexadecimal */ | ||
2036 | ) | ||
2037 | + 1; /* turn floor into ceil */ | ||
2038 | break; | ||
2039 | case TYPE_UINT_FAST64_T: | ||
2040 | tmp_length = | ||
2041 | (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT | ||
2042 | * 0.25 /* binary -> hexadecimal */ | ||
2043 | ) | ||
2044 | + 1; /* turn floor into ceil */ | ||
2045 | break; | ||
2046 | } | ||
1700 | if (tmp_length < precision) | 2047 | if (tmp_length < precision) |
1701 | tmp_length = precision; | 2048 | tmp_length = precision; |
1702 | /* Add 2, to account for a leading sign or alternate form. */ | 2049 | /* Add 2, to account for a prefix from the alternate form. */ |
1703 | tmp_length = xsum (tmp_length, 2); | 2050 | tmp_length = xsum (tmp_length, 2); |
1704 | break; | 2051 | break; |
1705 | 2052 | ||
@@ -1988,6 +2335,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
1988 | 2335 | ||
1989 | if (dp->conversion == 'n') | 2336 | if (dp->conversion == 'n') |
1990 | { | 2337 | { |
2338 | #if NEED_PRINTF_WITH_N_DIRECTIVE | ||
1991 | switch (a.arg[dp->arg_index].type) | 2339 | switch (a.arg[dp->arg_index].type) |
1992 | { | 2340 | { |
1993 | case TYPE_COUNT_SCHAR_POINTER: | 2341 | case TYPE_COUNT_SCHAR_POINTER: |
@@ -2005,9 +2353,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2005 | case TYPE_COUNT_LONGLONGINT_POINTER: | 2353 | case TYPE_COUNT_LONGLONGINT_POINTER: |
2006 | *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; | 2354 | *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; |
2007 | break; | 2355 | break; |
2356 | case TYPE_COUNT_INT8_T_POINTER: | ||
2357 | *a.arg[dp->arg_index].a.a_count_int8_t_pointer = length; | ||
2358 | break; | ||
2359 | case TYPE_COUNT_INT16_T_POINTER: | ||
2360 | *a.arg[dp->arg_index].a.a_count_int16_t_pointer = length; | ||
2361 | break; | ||
2362 | case TYPE_COUNT_INT32_T_POINTER: | ||
2363 | *a.arg[dp->arg_index].a.a_count_int32_t_pointer = length; | ||
2364 | break; | ||
2365 | case TYPE_COUNT_INT64_T_POINTER: | ||
2366 | *a.arg[dp->arg_index].a.a_count_int64_t_pointer = length; | ||
2367 | break; | ||
2368 | case TYPE_COUNT_INT_FAST8_T_POINTER: | ||
2369 | *a.arg[dp->arg_index].a.a_count_int_fast8_t_pointer = length; | ||
2370 | break; | ||
2371 | case TYPE_COUNT_INT_FAST16_T_POINTER: | ||
2372 | *a.arg[dp->arg_index].a.a_count_int_fast16_t_pointer = length; | ||
2373 | break; | ||
2374 | case TYPE_COUNT_INT_FAST32_T_POINTER: | ||
2375 | *a.arg[dp->arg_index].a.a_count_int_fast32_t_pointer = length; | ||
2376 | break; | ||
2377 | case TYPE_COUNT_INT_FAST64_T_POINTER: | ||
2378 | *a.arg[dp->arg_index].a.a_count_int_fast64_t_pointer = length; | ||
2379 | break; | ||
2008 | default: | 2380 | default: |
2009 | abort (); | 2381 | abort (); |
2010 | } | 2382 | } |
2383 | #else | ||
2384 | abort (); | ||
2385 | #endif | ||
2011 | } | 2386 | } |
2012 | #if ENABLE_UNISTDIO | 2387 | #if ENABLE_UNISTDIO |
2013 | /* The unistdio extensions. */ | 2388 | /* The unistdio extensions. */ |
@@ -2130,7 +2505,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2130 | characters = 0; | 2505 | characters = 0; |
2131 | } | 2506 | } |
2132 | 2507 | ||
2133 | if (characters < width && !(dp->flags & FLAG_LEFT)) | 2508 | if (characters < width && !(flags & FLAG_LEFT)) |
2134 | { | 2509 | { |
2135 | size_t n = width - characters; | 2510 | size_t n = width - characters; |
2136 | ENSURE_ALLOCATION (xsum (length, n)); | 2511 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2175,7 +2550,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2175 | } | 2550 | } |
2176 | # endif | 2551 | # endif |
2177 | 2552 | ||
2178 | if (characters < width && (dp->flags & FLAG_LEFT)) | 2553 | if (characters < width && (flags & FLAG_LEFT)) |
2179 | { | 2554 | { |
2180 | size_t n = width - characters; | 2555 | size_t n = width - characters; |
2181 | ENSURE_ALLOCATION (xsum (length, n)); | 2556 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2232,7 +2607,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2232 | characters = 0; | 2607 | characters = 0; |
2233 | } | 2608 | } |
2234 | 2609 | ||
2235 | if (characters < width && !(dp->flags & FLAG_LEFT)) | 2610 | if (characters < width && !(flags & FLAG_LEFT)) |
2236 | { | 2611 | { |
2237 | size_t n = width - characters; | 2612 | size_t n = width - characters; |
2238 | ENSURE_ALLOCATION (xsum (length, n)); | 2613 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2277,7 +2652,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2277 | } | 2652 | } |
2278 | # endif | 2653 | # endif |
2279 | 2654 | ||
2280 | if (characters < width && (dp->flags & FLAG_LEFT)) | 2655 | if (characters < width && (flags & FLAG_LEFT)) |
2281 | { | 2656 | { |
2282 | size_t n = width - characters; | 2657 | size_t n = width - characters; |
2283 | ENSURE_ALLOCATION (xsum (length, n)); | 2658 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2334,7 +2709,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2334 | characters = 0; | 2709 | characters = 0; |
2335 | } | 2710 | } |
2336 | 2711 | ||
2337 | if (characters < width && !(dp->flags & FLAG_LEFT)) | 2712 | if (characters < width && !(flags & FLAG_LEFT)) |
2338 | { | 2713 | { |
2339 | size_t n = width - characters; | 2714 | size_t n = width - characters; |
2340 | ENSURE_ALLOCATION (xsum (length, n)); | 2715 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2379,7 +2754,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2379 | } | 2754 | } |
2380 | # endif | 2755 | # endif |
2381 | 2756 | ||
2382 | if (characters < width && (dp->flags & FLAG_LEFT)) | 2757 | if (characters < width && (flags & FLAG_LEFT)) |
2383 | { | 2758 | { |
2384 | size_t n = width - characters; | 2759 | size_t n = width - characters; |
2385 | ENSURE_ALLOCATION (xsum (length, n)); | 2760 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2394,7 +2769,150 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2394 | } | 2769 | } |
2395 | } | 2770 | } |
2396 | #endif | 2771 | #endif |
2397 | #if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL) || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T | 2772 | #if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) |
2773 | else if ((dp->conversion == 's' | ||
2774 | && a.arg[dp->arg_index].type == TYPE_WIDE_STRING) | ||
2775 | || (dp->conversion == 'c' | ||
2776 | && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR)) | ||
2777 | { | ||
2778 | /* %ls or %lc in vasnwprintf. See the specification of | ||
2779 | fwprintf. */ | ||
2780 | /* It would be silly to use snprintf ("%ls", ...) and then | ||
2781 | convert back the result from a char[] to a wchar_t[]. | ||
2782 | Instead, just copy the argument wchar_t[] to the result. */ | ||
2783 | int flags = dp->flags; | ||
2784 | size_t width; | ||
2785 | |||
2786 | width = 0; | ||
2787 | if (dp->width_start != dp->width_end) | ||
2788 | { | ||
2789 | if (dp->width_arg_index != ARG_NONE) | ||
2790 | { | ||
2791 | int arg; | ||
2792 | |||
2793 | if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) | ||
2794 | abort (); | ||
2795 | arg = a.arg[dp->width_arg_index].a.a_int; | ||
2796 | width = arg; | ||
2797 | if (arg < 0) | ||
2798 | { | ||
2799 | /* "A negative field width is taken as a '-' flag | ||
2800 | followed by a positive field width." */ | ||
2801 | flags |= FLAG_LEFT; | ||
2802 | width = -width; | ||
2803 | } | ||
2804 | } | ||
2805 | else | ||
2806 | { | ||
2807 | const FCHAR_T *digitp = dp->width_start; | ||
2808 | |||
2809 | do | ||
2810 | width = xsum (xtimes (width, 10), *digitp++ - '0'); | ||
2811 | while (digitp != dp->width_end); | ||
2812 | } | ||
2813 | } | ||
2814 | |||
2815 | { | ||
2816 | const wchar_t *ls_arg; | ||
2817 | wchar_t lc_arg[1]; | ||
2818 | size_t characters; | ||
2819 | |||
2820 | if (dp->conversion == 's') | ||
2821 | { | ||
2822 | int has_precision; | ||
2823 | size_t precision; | ||
2824 | |||
2825 | has_precision = 0; | ||
2826 | precision = 6; | ||
2827 | if (dp->precision_start != dp->precision_end) | ||
2828 | { | ||
2829 | if (dp->precision_arg_index != ARG_NONE) | ||
2830 | { | ||
2831 | int arg; | ||
2832 | |||
2833 | if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) | ||
2834 | abort (); | ||
2835 | arg = a.arg[dp->precision_arg_index].a.a_int; | ||
2836 | /* "A negative precision is taken as if the precision | ||
2837 | were omitted." */ | ||
2838 | if (arg >= 0) | ||
2839 | { | ||
2840 | precision = arg; | ||
2841 | has_precision = 1; | ||
2842 | } | ||
2843 | } | ||
2844 | else | ||
2845 | { | ||
2846 | const FCHAR_T *digitp = dp->precision_start + 1; | ||
2847 | |||
2848 | precision = 0; | ||
2849 | while (digitp != dp->precision_end) | ||
2850 | precision = xsum (xtimes (precision, 10), *digitp++ - '0'); | ||
2851 | has_precision = 1; | ||
2852 | } | ||
2853 | } | ||
2854 | |||
2855 | ls_arg = a.arg[dp->arg_index].a.a_wide_string; | ||
2856 | |||
2857 | if (has_precision) | ||
2858 | { | ||
2859 | /* Use only at most PRECISION wide characters, from | ||
2860 | the left. */ | ||
2861 | const wchar_t *ls_arg_end; | ||
2862 | |||
2863 | ls_arg_end = ls_arg; | ||
2864 | characters = 0; | ||
2865 | for (; precision > 0; precision--) | ||
2866 | { | ||
2867 | if (*ls_arg_end == 0) | ||
2868 | /* Found the terminating null wide character. */ | ||
2869 | break; | ||
2870 | ls_arg_end++; | ||
2871 | characters++; | ||
2872 | } | ||
2873 | } | ||
2874 | else | ||
2875 | { | ||
2876 | /* Use the entire string, and count the number of wide | ||
2877 | characters. */ | ||
2878 | characters = local_wcslen (ls_arg); | ||
2879 | } | ||
2880 | } | ||
2881 | else /* dp->conversion == 'c' */ | ||
2882 | { | ||
2883 | lc_arg[0] = (wchar_t) a.arg[dp->arg_index].a.a_wide_char; | ||
2884 | ls_arg = lc_arg; | ||
2885 | characters = 1; | ||
2886 | } | ||
2887 | |||
2888 | { | ||
2889 | size_t total = (characters < width ? width : characters); | ||
2890 | ENSURE_ALLOCATION (xsum (length, total)); | ||
2891 | |||
2892 | if (characters < width && !(flags & FLAG_LEFT)) | ||
2893 | { | ||
2894 | size_t n = width - characters; | ||
2895 | DCHAR_SET (result + length, ' ', n); | ||
2896 | length += n; | ||
2897 | } | ||
2898 | |||
2899 | if (characters > 0) | ||
2900 | { | ||
2901 | DCHAR_CPY (result + length, ls_arg, characters); | ||
2902 | length += characters; | ||
2903 | } | ||
2904 | |||
2905 | if (characters < width && (flags & FLAG_LEFT)) | ||
2906 | { | ||
2907 | size_t n = width - characters; | ||
2908 | DCHAR_SET (result + length, ' ', n); | ||
2909 | length += n; | ||
2910 | } | ||
2911 | } | ||
2912 | } | ||
2913 | } | ||
2914 | #endif | ||
2915 | #if (!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T | ||
2398 | else if (dp->conversion == 's' | 2916 | else if (dp->conversion == 's' |
2399 | # if WIDE_CHAR_VERSION | 2917 | # if WIDE_CHAR_VERSION |
2400 | && a.arg[dp->arg_index].type != TYPE_WIDE_STRING | 2918 | && a.arg[dp->arg_index].type != TYPE_WIDE_STRING |
@@ -2493,7 +3011,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2493 | wide characters, from the left. */ | 3011 | wide characters, from the left. */ |
2494 | # if HAVE_MBRTOWC | 3012 | # if HAVE_MBRTOWC |
2495 | mbstate_t state; | 3013 | mbstate_t state; |
2496 | memset (&state, '\0', sizeof (mbstate_t)); | 3014 | mbszero (&state); |
2497 | # endif | 3015 | # endif |
2498 | arg_end = arg; | 3016 | arg_end = arg; |
2499 | characters = 0; | 3017 | characters = 0; |
@@ -2521,7 +3039,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2521 | characters. */ | 3039 | characters. */ |
2522 | # if HAVE_MBRTOWC | 3040 | # if HAVE_MBRTOWC |
2523 | mbstate_t state; | 3041 | mbstate_t state; |
2524 | memset (&state, '\0', sizeof (mbstate_t)); | 3042 | mbszero (&state); |
2525 | # endif | 3043 | # endif |
2526 | arg_end = arg; | 3044 | arg_end = arg; |
2527 | characters = 0; | 3045 | characters = 0; |
@@ -2551,7 +3069,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2551 | characters = 0; | 3069 | characters = 0; |
2552 | } | 3070 | } |
2553 | 3071 | ||
2554 | if (characters < width && !(dp->flags & FLAG_LEFT)) | 3072 | if (characters < width && !(flags & FLAG_LEFT)) |
2555 | { | 3073 | { |
2556 | size_t n = width - characters; | 3074 | size_t n = width - characters; |
2557 | ENSURE_ALLOCATION (xsum (length, n)); | 3075 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2565,7 +3083,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2565 | size_t remaining; | 3083 | size_t remaining; |
2566 | # if HAVE_MBRTOWC | 3084 | # if HAVE_MBRTOWC |
2567 | mbstate_t state; | 3085 | mbstate_t state; |
2568 | memset (&state, '\0', sizeof (mbstate_t)); | 3086 | mbszero (&state); |
2569 | # endif | 3087 | # endif |
2570 | ENSURE_ALLOCATION (xsum (length, characters)); | 3088 | ENSURE_ALLOCATION (xsum (length, characters)); |
2571 | for (remaining = characters; remaining > 0; remaining--) | 3089 | for (remaining = characters; remaining > 0; remaining--) |
@@ -2591,7 +3109,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2591 | { | 3109 | { |
2592 | # if HAVE_MBRTOWC | 3110 | # if HAVE_MBRTOWC |
2593 | mbstate_t state; | 3111 | mbstate_t state; |
2594 | memset (&state, '\0', sizeof (mbstate_t)); | 3112 | mbszero (&state); |
2595 | # endif | 3113 | # endif |
2596 | while (arg < arg_end) | 3114 | while (arg < arg_end) |
2597 | { | 3115 | { |
@@ -2602,17 +3120,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2602 | # else | 3120 | # else |
2603 | count = mbtowc (&wc, arg, arg_end - arg); | 3121 | count = mbtowc (&wc, arg, arg_end - arg); |
2604 | # endif | 3122 | # endif |
2605 | if (count <= 0) | 3123 | if (count == 0) |
2606 | /* mbrtowc not consistent with mbrlen, or mbtowc | 3124 | /* mbrtowc not consistent with strlen. */ |
2607 | not consistent with mblen. */ | ||
2608 | abort (); | 3125 | abort (); |
3126 | if (count < 0) | ||
3127 | /* Invalid or incomplete multibyte character. */ | ||
3128 | goto fail_with_EILSEQ; | ||
2609 | ENSURE_ALLOCATION (xsum (length, 1)); | 3129 | ENSURE_ALLOCATION (xsum (length, 1)); |
2610 | result[length++] = wc; | 3130 | result[length++] = wc; |
2611 | arg += count; | 3131 | arg += count; |
2612 | } | 3132 | } |
2613 | } | 3133 | } |
2614 | 3134 | ||
2615 | if (characters < width && (dp->flags & FLAG_LEFT)) | 3135 | if (characters < width && (flags & FLAG_LEFT)) |
2616 | { | 3136 | { |
2617 | size_t n = width - characters; | 3137 | size_t n = width - characters; |
2618 | ENSURE_ALLOCATION (xsum (length, n)); | 3138 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2641,7 +3161,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2641 | at most PRECISION bytes, from the left. */ | 3161 | at most PRECISION bytes, from the left. */ |
2642 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3162 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2643 | mbstate_t state; | 3163 | mbstate_t state; |
2644 | memset (&state, '\0', sizeof (mbstate_t)); | 3164 | mbszero (&state); |
2645 | # endif | 3165 | # endif |
2646 | arg_end = arg; | 3166 | arg_end = arg; |
2647 | characters = 0; | 3167 | characters = 0; |
@@ -2674,7 +3194,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2674 | bytes. */ | 3194 | bytes. */ |
2675 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3195 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2676 | mbstate_t state; | 3196 | mbstate_t state; |
2677 | memset (&state, '\0', sizeof (mbstate_t)); | 3197 | mbszero (&state); |
2678 | # endif | 3198 | # endif |
2679 | arg_end = arg; | 3199 | arg_end = arg; |
2680 | characters = 0; | 3200 | characters = 0; |
@@ -2714,7 +3234,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2714 | size_t remaining; | 3234 | size_t remaining; |
2715 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3235 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2716 | mbstate_t state; | 3236 | mbstate_t state; |
2717 | memset (&state, '\0', sizeof (mbstate_t)); | 3237 | mbszero (&state); |
2718 | # endif | 3238 | # endif |
2719 | for (remaining = characters; remaining > 0; ) | 3239 | for (remaining = characters; remaining > 0; ) |
2720 | { | 3240 | { |
@@ -2768,7 +3288,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2768 | /* w doesn't matter. */ | 3288 | /* w doesn't matter. */ |
2769 | w = 0; | 3289 | w = 0; |
2770 | 3290 | ||
2771 | if (w < width && !(dp->flags & FLAG_LEFT)) | 3291 | if (w < width && !(flags & FLAG_LEFT)) |
2772 | { | 3292 | { |
2773 | size_t n = width - w; | 3293 | size_t n = width - w; |
2774 | ENSURE_ALLOCATION (xsum (length, n)); | 3294 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2783,7 +3303,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2783 | size_t remaining; | 3303 | size_t remaining; |
2784 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3304 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2785 | mbstate_t state; | 3305 | mbstate_t state; |
2786 | memset (&state, '\0', sizeof (mbstate_t)); | 3306 | mbszero (&state); |
2787 | # endif | 3307 | # endif |
2788 | ENSURE_ALLOCATION (xsum (length, characters)); | 3308 | ENSURE_ALLOCATION (xsum (length, characters)); |
2789 | for (remaining = characters; remaining > 0; ) | 3309 | for (remaining = characters; remaining > 0; ) |
@@ -2809,7 +3329,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2809 | { | 3329 | { |
2810 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3330 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2811 | mbstate_t state; | 3331 | mbstate_t state; |
2812 | memset (&state, '\0', sizeof (mbstate_t)); | 3332 | mbszero (&state); |
2813 | # endif | 3333 | # endif |
2814 | while (arg < arg_end) | 3334 | while (arg < arg_end) |
2815 | { | 3335 | { |
@@ -2836,7 +3356,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2836 | length += tmpdst_len; | 3356 | length += tmpdst_len; |
2837 | # endif | 3357 | # endif |
2838 | 3358 | ||
2839 | if (w < width && (dp->flags & FLAG_LEFT)) | 3359 | if (w < width && (flags & FLAG_LEFT)) |
2840 | { | 3360 | { |
2841 | size_t n = width - w; | 3361 | size_t n = width - w; |
2842 | ENSURE_ALLOCATION (xsum (length, n)); | 3362 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2847,12 +3367,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2847 | # endif | 3367 | # endif |
2848 | } | 3368 | } |
2849 | #endif | 3369 | #endif |
2850 | #if ENABLE_WCHAR_FALLBACK && HAVE_WINT_T && !WIDE_CHAR_VERSION | 3370 | #if (NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION |
2851 | else if (dp->conversion == 'c' | 3371 | else if (dp->conversion == 'c' |
2852 | && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR) | 3372 | && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR) |
2853 | { | 3373 | { |
2854 | /* Implement the 'lc' directive ourselves, in order to provide | 3374 | /* Implement the 'lc' directive ourselves, in order to provide |
2855 | the fallback that avoids EILSEQ. */ | 3375 | a correct behaviour for the null wint_t argument and/or the |
3376 | fallback that avoids EILSEQ. */ | ||
2856 | int flags = dp->flags; | 3377 | int flags = dp->flags; |
2857 | int has_width; | 3378 | int has_width; |
2858 | size_t width; | 3379 | size_t width; |
@@ -2907,21 +3428,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2907 | { | 3428 | { |
2908 | /* Count the number of bytes. */ | 3429 | /* Count the number of bytes. */ |
2909 | characters = 0; | 3430 | characters = 0; |
2910 | if (arg != 0) | 3431 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2911 | { | 3432 | int count; |
2912 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2913 | int count; | ||
2914 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3433 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2915 | mbstate_t state; | 3434 | mbstate_t state; |
2916 | memset (&state, '\0', sizeof (mbstate_t)); | 3435 | mbszero (&state); |
2917 | # endif | 3436 | # endif |
2918 | 3437 | ||
2919 | count = local_wcrtomb (cbuf, arg, &state); | 3438 | count = local_wcrtomb (cbuf, arg, &state); |
2920 | if (count < 0) | 3439 | if (count < 0) |
2921 | /* Inconsistency. */ | 3440 | /* Cannot convert. */ |
2922 | abort (); | 3441 | goto fail_with_EILSEQ; |
2923 | characters = count; | 3442 | characters = count; |
2924 | } | ||
2925 | } | 3443 | } |
2926 | # if DCHAR_IS_TCHAR | 3444 | # if DCHAR_IS_TCHAR |
2927 | else | 3445 | else |
@@ -2933,13 +3451,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2933 | 3451 | ||
2934 | # if !DCHAR_IS_TCHAR | 3452 | # if !DCHAR_IS_TCHAR |
2935 | /* Convert the string into a piece of temporary memory. */ | 3453 | /* Convert the string into a piece of temporary memory. */ |
2936 | if (characters > 0) /* implies arg != 0 */ | 3454 | if (characters > 0) |
2937 | { | 3455 | { |
2938 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ | 3456 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2939 | int count; | 3457 | int count; |
2940 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3458 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2941 | mbstate_t state; | 3459 | mbstate_t state; |
2942 | memset (&state, '\0', sizeof (mbstate_t)); | 3460 | mbszero (&state); |
2943 | # endif | 3461 | # endif |
2944 | 3462 | ||
2945 | count = local_wcrtomb (cbuf, arg, &state); | 3463 | count = local_wcrtomb (cbuf, arg, &state); |
@@ -2977,7 +3495,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2977 | /* w doesn't matter. */ | 3495 | /* w doesn't matter. */ |
2978 | w = 0; | 3496 | w = 0; |
2979 | 3497 | ||
2980 | if (w < width && !(dp->flags & FLAG_LEFT)) | 3498 | if (w < width && !(flags & FLAG_LEFT)) |
2981 | { | 3499 | { |
2982 | size_t n = width - w; | 3500 | size_t n = width - w; |
2983 | ENSURE_ALLOCATION (xsum (length, n)); | 3501 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -2990,12 +3508,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2990 | { | 3508 | { |
2991 | /* We know the number of bytes in advance. */ | 3509 | /* We know the number of bytes in advance. */ |
2992 | ENSURE_ALLOCATION (xsum (length, characters)); | 3510 | ENSURE_ALLOCATION (xsum (length, characters)); |
2993 | if (characters > 0) /* implies arg != 0 */ | 3511 | if (characters > 0) |
2994 | { | 3512 | { |
2995 | int count; | 3513 | int count; |
2996 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3514 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
2997 | mbstate_t state; | 3515 | mbstate_t state; |
2998 | memset (&state, '\0', sizeof (mbstate_t)); | 3516 | mbszero (&state); |
2999 | # endif | 3517 | # endif |
3000 | 3518 | ||
3001 | count = local_wcrtomb (result + length, arg, &state); | 3519 | count = local_wcrtomb (result + length, arg, &state); |
@@ -3007,23 +3525,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3007 | } | 3525 | } |
3008 | else | 3526 | else |
3009 | { | 3527 | { |
3010 | if (arg != 0) | 3528 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
3011 | { | 3529 | int count; |
3012 | char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
3013 | int count; | ||
3014 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t | 3530 | # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t |
3015 | mbstate_t state; | 3531 | mbstate_t state; |
3016 | memset (&state, '\0', sizeof (mbstate_t)); | 3532 | mbszero (&state); |
3017 | # endif | 3533 | # endif |
3018 | 3534 | ||
3019 | count = local_wcrtomb (cbuf, arg, &state); | 3535 | count = local_wcrtomb (cbuf, arg, &state); |
3020 | if (count <= 0) | 3536 | if (count < 0) |
3021 | /* Inconsistency. */ | 3537 | /* Cannot convert. */ |
3022 | abort (); | 3538 | goto fail_with_EILSEQ; |
3023 | ENSURE_ALLOCATION (xsum (length, count)); | 3539 | ENSURE_ALLOCATION (xsum (length, count)); |
3024 | memcpy (result + length, cbuf, count); | 3540 | memcpy (result + length, cbuf, count); |
3025 | length += count; | 3541 | length += count; |
3026 | } | ||
3027 | } | 3542 | } |
3028 | # else | 3543 | # else |
3029 | ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), | 3544 | ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), |
@@ -3033,7 +3548,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3033 | length += tmpdst_len; | 3548 | length += tmpdst_len; |
3034 | # endif | 3549 | # endif |
3035 | 3550 | ||
3036 | if (w < width && (dp->flags & FLAG_LEFT)) | 3551 | if (w < width && (flags & FLAG_LEFT)) |
3037 | { | 3552 | { |
3038 | size_t n = width - w; | 3553 | size_t n = width - w; |
3039 | ENSURE_ALLOCATION (xsum (length, n)); | 3554 | ENSURE_ALLOCATION (xsum (length, n)); |
@@ -3043,14 +3558,399 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3043 | } | 3558 | } |
3044 | } | 3559 | } |
3045 | #endif | 3560 | #endif |
3046 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL | 3561 | #if NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION |
3562 | else if (dp->conversion == 'c' | ||
3563 | && a.arg[dp->arg_index].type != TYPE_WIDE_CHAR) | ||
3564 | { | ||
3565 | /* Implement the 'c' directive ourselves, in order to avoid | ||
3566 | EILSEQ in the "C" locale. */ | ||
3567 | int flags = dp->flags; | ||
3568 | size_t width; | ||
3569 | |||
3570 | width = 0; | ||
3571 | if (dp->width_start != dp->width_end) | ||
3572 | { | ||
3573 | if (dp->width_arg_index != ARG_NONE) | ||
3574 | { | ||
3575 | int arg; | ||
3576 | |||
3577 | if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) | ||
3578 | abort (); | ||
3579 | arg = a.arg[dp->width_arg_index].a.a_int; | ||
3580 | width = arg; | ||
3581 | if (arg < 0) | ||
3582 | { | ||
3583 | /* "A negative field width is taken as a '-' flag | ||
3584 | followed by a positive field width." */ | ||
3585 | flags |= FLAG_LEFT; | ||
3586 | width = -width; | ||
3587 | } | ||
3588 | } | ||
3589 | else | ||
3590 | { | ||
3591 | const FCHAR_T *digitp = dp->width_start; | ||
3592 | |||
3593 | do | ||
3594 | width = xsum (xtimes (width, 10), *digitp++ - '0'); | ||
3595 | while (digitp != dp->width_end); | ||
3596 | } | ||
3597 | } | ||
3598 | |||
3599 | /* %c in vasnwprintf. See the specification of fwprintf. */ | ||
3600 | { | ||
3601 | char arg = (char) a.arg[dp->arg_index].a.a_char; | ||
3602 | mbstate_t state; | ||
3603 | wchar_t wc; | ||
3604 | |||
3605 | mbszero (&state); | ||
3606 | int count = mbrtowc (&wc, &arg, 1, &state); | ||
3607 | if (count < 0) | ||
3608 | /* Invalid or incomplete multibyte character. */ | ||
3609 | goto fail_with_EILSEQ; | ||
3610 | |||
3611 | if (1 < width && !(flags & FLAG_LEFT)) | ||
3612 | { | ||
3613 | size_t n = width - 1; | ||
3614 | ENSURE_ALLOCATION (xsum (length, n)); | ||
3615 | DCHAR_SET (result + length, ' ', n); | ||
3616 | length += n; | ||
3617 | } | ||
3618 | |||
3619 | ENSURE_ALLOCATION (xsum (length, 1)); | ||
3620 | result[length++] = wc; | ||
3621 | |||
3622 | if (1 < width && (flags & FLAG_LEFT)) | ||
3623 | { | ||
3624 | size_t n = width - 1; | ||
3625 | ENSURE_ALLOCATION (xsum (length, n)); | ||
3626 | DCHAR_SET (result + length, ' ', n); | ||
3627 | length += n; | ||
3628 | } | ||
3629 | } | ||
3630 | } | ||
3631 | #endif | ||
3632 | #if NEED_PRINTF_DIRECTIVE_B || NEED_PRINTF_DIRECTIVE_UPPERCASE_B | ||
3633 | else if (0 | ||
3634 | # if NEED_PRINTF_DIRECTIVE_B | ||
3635 | || (dp->conversion == 'b') | ||
3636 | # endif | ||
3637 | # if NEED_PRINTF_DIRECTIVE_UPPERCASE_B | ||
3638 | || (dp->conversion == 'B') | ||
3639 | # endif | ||
3640 | ) | ||
3641 | { | ||
3642 | arg_type type = a.arg[dp->arg_index].type; | ||
3643 | int flags = dp->flags; | ||
3644 | int has_width; | ||
3645 | size_t width; | ||
3646 | int has_precision; | ||
3647 | size_t precision; | ||
3648 | size_t tmp_length; | ||
3649 | size_t count; | ||
3650 | DCHAR_T tmpbuf[700]; | ||
3651 | DCHAR_T *tmp; | ||
3652 | DCHAR_T *tmp_end; | ||
3653 | DCHAR_T *tmp_start; | ||
3654 | DCHAR_T *pad_ptr; | ||
3655 | DCHAR_T *p; | ||
3656 | |||
3657 | has_width = 0; | ||
3658 | width = 0; | ||
3659 | if (dp->width_start != dp->width_end) | ||
3660 | { | ||
3661 | if (dp->width_arg_index != ARG_NONE) | ||
3662 | { | ||
3663 | int arg; | ||
3664 | |||
3665 | if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) | ||
3666 | abort (); | ||
3667 | arg = a.arg[dp->width_arg_index].a.a_int; | ||
3668 | width = arg; | ||
3669 | if (arg < 0) | ||
3670 | { | ||
3671 | /* "A negative field width is taken as a '-' flag | ||
3672 | followed by a positive field width." */ | ||
3673 | flags |= FLAG_LEFT; | ||
3674 | width = -width; | ||
3675 | } | ||
3676 | } | ||
3677 | else | ||
3678 | { | ||
3679 | const FCHAR_T *digitp = dp->width_start; | ||
3680 | |||
3681 | do | ||
3682 | width = xsum (xtimes (width, 10), *digitp++ - '0'); | ||
3683 | while (digitp != dp->width_end); | ||
3684 | } | ||
3685 | has_width = 1; | ||
3686 | } | ||
3687 | |||
3688 | has_precision = 0; | ||
3689 | precision = 1; | ||
3690 | if (dp->precision_start != dp->precision_end) | ||
3691 | { | ||
3692 | if (dp->precision_arg_index != ARG_NONE) | ||
3693 | { | ||
3694 | int arg; | ||
3695 | |||
3696 | if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) | ||
3697 | abort (); | ||
3698 | arg = a.arg[dp->precision_arg_index].a.a_int; | ||
3699 | /* "A negative precision is taken as if the precision | ||
3700 | were omitted." */ | ||
3701 | if (arg >= 0) | ||
3702 | { | ||
3703 | precision = arg; | ||
3704 | has_precision = 1; | ||
3705 | } | ||
3706 | } | ||
3707 | else | ||
3708 | { | ||
3709 | const FCHAR_T *digitp = dp->precision_start + 1; | ||
3710 | |||
3711 | precision = 0; | ||
3712 | while (digitp != dp->precision_end) | ||
3713 | precision = xsum (xtimes (precision, 10), *digitp++ - '0'); | ||
3714 | has_precision = 1; | ||
3715 | } | ||
3716 | } | ||
3717 | |||
3718 | /* Allocate a temporary buffer of sufficient size. */ | ||
3719 | switch (type) | ||
3720 | { | ||
3721 | default: | ||
3722 | tmp_length = | ||
3723 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT) | ||
3724 | + 1; /* turn floor into ceil */ | ||
3725 | break; | ||
3726 | case TYPE_ULONGINT: | ||
3727 | tmp_length = | ||
3728 | (unsigned int) (sizeof (unsigned long int) * CHAR_BIT) | ||
3729 | + 1; /* turn floor into ceil */ | ||
3730 | break; | ||
3731 | case TYPE_ULONGLONGINT: | ||
3732 | tmp_length = | ||
3733 | (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT) | ||
3734 | + 1; /* turn floor into ceil */ | ||
3735 | break; | ||
3736 | case TYPE_UINT8_T: | ||
3737 | tmp_length = | ||
3738 | (unsigned int) (sizeof (uint8_t) * CHAR_BIT) | ||
3739 | + 1; /* turn floor into ceil */ | ||
3740 | break; | ||
3741 | case TYPE_UINT16_T: | ||
3742 | tmp_length = | ||
3743 | (unsigned int) (sizeof (uint16_t) * CHAR_BIT) | ||
3744 | + 1; /* turn floor into ceil */ | ||
3745 | break; | ||
3746 | case TYPE_UINT32_T: | ||
3747 | tmp_length = | ||
3748 | (unsigned int) (sizeof (uint32_t) * CHAR_BIT) | ||
3749 | + 1; /* turn floor into ceil */ | ||
3750 | break; | ||
3751 | case TYPE_UINT64_T: | ||
3752 | tmp_length = | ||
3753 | (unsigned int) (sizeof (uint64_t) * CHAR_BIT) | ||
3754 | + 1; /* turn floor into ceil */ | ||
3755 | break; | ||
3756 | case TYPE_UINT_FAST8_T: | ||
3757 | tmp_length = | ||
3758 | (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT) | ||
3759 | + 1; /* turn floor into ceil */ | ||
3760 | break; | ||
3761 | case TYPE_UINT_FAST16_T: | ||
3762 | tmp_length = | ||
3763 | (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT) | ||
3764 | + 1; /* turn floor into ceil */ | ||
3765 | break; | ||
3766 | case TYPE_UINT_FAST32_T: | ||
3767 | tmp_length = | ||
3768 | (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT) | ||
3769 | + 1; /* turn floor into ceil */ | ||
3770 | break; | ||
3771 | case TYPE_UINT_FAST64_T: | ||
3772 | tmp_length = | ||
3773 | (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT) | ||
3774 | + 1; /* turn floor into ceil */ | ||
3775 | break; | ||
3776 | } | ||
3777 | if (tmp_length < precision) | ||
3778 | tmp_length = precision; | ||
3779 | /* Add 2, to account for a prefix from the alternate form. */ | ||
3780 | tmp_length = xsum (tmp_length, 2); | ||
3781 | |||
3782 | if (tmp_length < width) | ||
3783 | tmp_length = width; | ||
3784 | |||
3785 | if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) | ||
3786 | tmp = tmpbuf; | ||
3787 | else | ||
3788 | { | ||
3789 | size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); | ||
3790 | |||
3791 | if (size_overflow_p (tmp_memsize)) | ||
3792 | /* Overflow, would lead to out of memory. */ | ||
3793 | goto out_of_memory; | ||
3794 | tmp = (DCHAR_T *) malloc (tmp_memsize); | ||
3795 | if (tmp == NULL) | ||
3796 | /* Out of memory. */ | ||
3797 | goto out_of_memory; | ||
3798 | } | ||
3799 | |||
3800 | tmp_end = tmp + tmp_length; | ||
3801 | |||
3802 | unsigned long long arg; | ||
3803 | switch (type) | ||
3804 | { | ||
3805 | case TYPE_UCHAR: | ||
3806 | arg = a.arg[dp->arg_index].a.a_uchar; | ||
3807 | break; | ||
3808 | case TYPE_USHORT: | ||
3809 | arg = a.arg[dp->arg_index].a.a_ushort; | ||
3810 | break; | ||
3811 | case TYPE_UINT: | ||
3812 | arg = a.arg[dp->arg_index].a.a_uint; | ||
3813 | break; | ||
3814 | case TYPE_ULONGINT: | ||
3815 | arg = a.arg[dp->arg_index].a.a_ulongint; | ||
3816 | break; | ||
3817 | case TYPE_ULONGLONGINT: | ||
3818 | arg = a.arg[dp->arg_index].a.a_ulonglongint; | ||
3819 | break; | ||
3820 | case TYPE_UINT8_T: | ||
3821 | arg = a.arg[dp->arg_index].a.a_uint8_t; | ||
3822 | break; | ||
3823 | case TYPE_UINT16_T: | ||
3824 | arg = a.arg[dp->arg_index].a.a_uint16_t; | ||
3825 | break; | ||
3826 | case TYPE_UINT32_T: | ||
3827 | arg = a.arg[dp->arg_index].a.a_uint32_t; | ||
3828 | break; | ||
3829 | case TYPE_UINT64_T: | ||
3830 | arg = a.arg[dp->arg_index].a.a_uint64_t; | ||
3831 | break; | ||
3832 | case TYPE_UINT_FAST8_T: | ||
3833 | arg = a.arg[dp->arg_index].a.a_uint_fast8_t; | ||
3834 | break; | ||
3835 | case TYPE_UINT_FAST16_T: | ||
3836 | arg = a.arg[dp->arg_index].a.a_uint_fast16_t; | ||
3837 | break; | ||
3838 | case TYPE_UINT_FAST32_T: | ||
3839 | arg = a.arg[dp->arg_index].a.a_uint_fast32_t; | ||
3840 | break; | ||
3841 | case TYPE_UINT_FAST64_T: | ||
3842 | arg = a.arg[dp->arg_index].a.a_uint_fast64_t; | ||
3843 | break; | ||
3844 | default: | ||
3845 | abort (); | ||
3846 | } | ||
3847 | int need_prefix = ((flags & FLAG_ALT) && arg != 0); | ||
3848 | |||
3849 | p = tmp_end; | ||
3850 | /* "The result of converting a zero value with a precision | ||
3851 | of zero is no characters." */ | ||
3852 | if (!(has_precision && precision == 0 && arg == 0)) | ||
3853 | { | ||
3854 | do | ||
3855 | { | ||
3856 | *--p = '0' + (arg & 1); | ||
3857 | arg = arg >> 1; | ||
3858 | } | ||
3859 | while (arg != 0); | ||
3860 | } | ||
3861 | |||
3862 | if (has_precision) | ||
3863 | { | ||
3864 | DCHAR_T *digits_start = tmp_end - precision; | ||
3865 | while (p > digits_start) | ||
3866 | *--p = '0'; | ||
3867 | } | ||
3868 | |||
3869 | pad_ptr = p; | ||
3870 | |||
3871 | if (need_prefix) | ||
3872 | { | ||
3873 | # if NEED_PRINTF_DIRECTIVE_B && !NEED_PRINTF_DIRECTIVE_UPPERCASE_B | ||
3874 | *--p = 'b'; | ||
3875 | # elif NEED_PRINTF_DIRECTIVE_UPPERCASE_B && !NEED_PRINTF_DIRECTIVE_B | ||
3876 | *--p = 'B'; | ||
3877 | # else | ||
3878 | *--p = dp->conversion; | ||
3879 | # endif | ||
3880 | *--p = '0'; | ||
3881 | } | ||
3882 | tmp_start = p; | ||
3883 | |||
3884 | /* The generated string now extends from tmp_start to tmp_end, | ||
3885 | with the zero padding insertion point being at pad_ptr, | ||
3886 | tmp_start <= pad_ptr <= tmp_end. */ | ||
3887 | count = tmp_end - tmp_start; | ||
3888 | |||
3889 | if (count < width) | ||
3890 | { | ||
3891 | size_t pad = width - count; | ||
3892 | |||
3893 | if (flags & FLAG_LEFT) | ||
3894 | { | ||
3895 | /* Pad with spaces on the right. */ | ||
3896 | for (p = tmp_start; p < tmp_end; p++) | ||
3897 | *(p - pad) = *p; | ||
3898 | for (p = tmp_end - pad; p < tmp_end; p++) | ||
3899 | *p = ' '; | ||
3900 | } | ||
3901 | else if ((flags & FLAG_ZERO) | ||
3902 | /* Neither ISO C nor POSIX specify that the '0' | ||
3903 | flag is ignored when a width and a precision | ||
3904 | are both present. But most implementations | ||
3905 | do so. */ | ||
3906 | && !(has_width && has_precision)) | ||
3907 | { | ||
3908 | /* Pad with zeroes. */ | ||
3909 | for (p = tmp_start; p < pad_ptr; p++) | ||
3910 | *(p - pad) = *p; | ||
3911 | for (p = pad_ptr - pad; p < pad_ptr; p++) | ||
3912 | *p = '0'; | ||
3913 | } | ||
3914 | else | ||
3915 | { | ||
3916 | /* Pad with spaces on the left. */ | ||
3917 | for (p = tmp_start - pad; p < tmp_start; p++) | ||
3918 | *p = ' '; | ||
3919 | } | ||
3920 | |||
3921 | tmp_start = tmp_start - pad; | ||
3922 | } | ||
3923 | |||
3924 | count = tmp_end - tmp_start; | ||
3925 | |||
3926 | if (count > tmp_length) | ||
3927 | /* tmp_length was incorrectly calculated - fix the | ||
3928 | code above! */ | ||
3929 | abort (); | ||
3930 | |||
3931 | /* Make room for the result. */ | ||
3932 | if (count >= allocated - length) | ||
3933 | { | ||
3934 | size_t n = xsum (length, count); | ||
3935 | |||
3936 | ENSURE_ALLOCATION (n); | ||
3937 | } | ||
3938 | |||
3939 | /* Append the result. */ | ||
3940 | memcpy (result + length, tmp_start, count * sizeof (DCHAR_T)); | ||
3941 | if (tmp != tmpbuf) | ||
3942 | free (tmp); | ||
3943 | length += count; | ||
3944 | } | ||
3945 | #endif | ||
3946 | #if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) | ||
3047 | else if ((dp->conversion == 'a' || dp->conversion == 'A') | 3947 | else if ((dp->conversion == 'a' || dp->conversion == 'A') |
3048 | # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) | 3948 | # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) |
3049 | && (0 | 3949 | && (0 |
3050 | # if NEED_PRINTF_DOUBLE | 3950 | # if NEED_PRINTF_DOUBLE |
3051 | || a.arg[dp->arg_index].type == TYPE_DOUBLE | 3951 | || a.arg[dp->arg_index].type == TYPE_DOUBLE |
3052 | # endif | 3952 | # endif |
3053 | # if NEED_PRINTF_LONG_DOUBLE | 3953 | # if NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
3054 | || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE | 3954 | || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE |
3055 | # endif | 3955 | # endif |
3056 | ) | 3956 | ) |
@@ -3170,7 +4070,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3170 | p = tmp; | 4070 | p = tmp; |
3171 | if (type == TYPE_LONGDOUBLE) | 4071 | if (type == TYPE_LONGDOUBLE) |
3172 | { | 4072 | { |
3173 | # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE | 4073 | # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) |
3174 | long double arg = a.arg[dp->arg_index].a.a_longdouble; | 4074 | long double arg = a.arg[dp->arg_index].a.a_longdouble; |
3175 | 4075 | ||
3176 | if (isnanl (arg)) | 4076 | if (isnanl (arg)) |
@@ -3290,7 +4190,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3290 | } | 4190 | } |
3291 | } | 4191 | } |
3292 | *p++ = dp->conversion - 'A' + 'P'; | 4192 | *p++ = dp->conversion - 'A' + 'P'; |
3293 | # if WIDE_CHAR_VERSION | 4193 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
3294 | { | 4194 | { |
3295 | static const wchar_t decimal_format[] = | 4195 | static const wchar_t decimal_format[] = |
3296 | { '%', '+', 'd', '\0' }; | 4196 | { '%', '+', 'd', '\0' }; |
@@ -3441,7 +4341,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3441 | } | 4341 | } |
3442 | } | 4342 | } |
3443 | *p++ = dp->conversion - 'A' + 'P'; | 4343 | *p++ = dp->conversion - 'A' + 'P'; |
3444 | # if WIDE_CHAR_VERSION | 4344 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
3445 | { | 4345 | { |
3446 | static const wchar_t decimal_format[] = | 4346 | static const wchar_t decimal_format[] = |
3447 | { '%', '+', 'd', '\0' }; | 4347 | { '%', '+', 'd', '\0' }; |
@@ -3533,7 +4433,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3533 | length += count; | 4433 | length += count; |
3534 | } | 4434 | } |
3535 | #endif | 4435 | #endif |
3536 | #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL | 4436 | #if NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE |
3537 | else if ((dp->conversion == 'f' || dp->conversion == 'F' | 4437 | else if ((dp->conversion == 'f' || dp->conversion == 'F' |
3538 | || dp->conversion == 'e' || dp->conversion == 'E' | 4438 | || dp->conversion == 'e' || dp->conversion == 'E' |
3539 | || dp->conversion == 'g' || dp->conversion == 'G' | 4439 | || dp->conversion == 'g' || dp->conversion == 'G' |
@@ -3901,7 +4801,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
3901 | } | 4801 | } |
3902 | 4802 | ||
3903 | *p++ = dp->conversion; /* 'e' or 'E' */ | 4803 | *p++ = dp->conversion; /* 'e' or 'E' */ |
3904 | # if WIDE_CHAR_VERSION | 4804 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
3905 | { | 4805 | { |
3906 | static const wchar_t decimal_format[] = | 4806 | static const wchar_t decimal_format[] = |
3907 | { '%', '+', '.', '2', 'd', '\0' }; | 4807 | { '%', '+', '.', '2', 'd', '\0' }; |
@@ -4082,7 +4982,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4082 | } | 4982 | } |
4083 | } | 4983 | } |
4084 | *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ | 4984 | *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ |
4085 | # if WIDE_CHAR_VERSION | 4985 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
4086 | { | 4986 | { |
4087 | static const wchar_t decimal_format[] = | 4987 | static const wchar_t decimal_format[] = |
4088 | { '%', '+', '.', '2', 'd', '\0' }; | 4988 | { '%', '+', '.', '2', 'd', '\0' }; |
@@ -4359,7 +5259,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4359 | } | 5259 | } |
4360 | 5260 | ||
4361 | *p++ = dp->conversion; /* 'e' or 'E' */ | 5261 | *p++ = dp->conversion; /* 'e' or 'E' */ |
4362 | # if WIDE_CHAR_VERSION | 5262 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
4363 | { | 5263 | { |
4364 | static const wchar_t decimal_format[] = | 5264 | static const wchar_t decimal_format[] = |
4365 | /* Produce the same number of exponent digits | 5265 | /* Produce the same number of exponent digits |
@@ -4552,7 +5452,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4552 | } | 5452 | } |
4553 | } | 5453 | } |
4554 | *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ | 5454 | *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ |
4555 | # if WIDE_CHAR_VERSION | 5455 | # if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR |
4556 | { | 5456 | { |
4557 | static const wchar_t decimal_format[] = | 5457 | static const wchar_t decimal_format[] = |
4558 | /* Produce the same number of exponent digits | 5458 | /* Produce the same number of exponent digits |
@@ -4720,24 +5620,24 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4720 | { | 5620 | { |
4721 | arg_type type = a.arg[dp->arg_index].type; | 5621 | arg_type type = a.arg[dp->arg_index].type; |
4722 | int flags = dp->flags; | 5622 | int flags = dp->flags; |
4723 | #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5623 | #if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4724 | int has_width; | 5624 | int has_width; |
4725 | #endif | 5625 | #endif |
4726 | #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5626 | #if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4727 | size_t width; | 5627 | size_t width; |
4728 | #endif | 5628 | #endif |
4729 | #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION | 5629 | #if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4730 | int has_precision; | 5630 | int has_precision; |
4731 | size_t precision; | 5631 | size_t precision; |
4732 | #endif | 5632 | #endif |
4733 | #if NEED_PRINTF_UNBOUNDED_PRECISION | 5633 | #if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4734 | int prec_ourselves; | 5634 | int prec_ourselves; |
4735 | #else | 5635 | #else |
4736 | # define prec_ourselves 0 | 5636 | # define prec_ourselves 0 |
4737 | #endif | 5637 | #endif |
4738 | #if NEED_PRINTF_FLAG_LEFTADJUST | 5638 | #if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST |
4739 | # define pad_ourselves 1 | 5639 | # define pad_ourselves 1 |
4740 | #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5640 | #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4741 | int pad_ourselves; | 5641 | int pad_ourselves; |
4742 | #else | 5642 | #else |
4743 | # define pad_ourselves 0 | 5643 | # define pad_ourselves 0 |
@@ -4752,10 +5652,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4752 | TCHAR_T *tmp; | 5652 | TCHAR_T *tmp; |
4753 | #endif | 5653 | #endif |
4754 | 5654 | ||
4755 | #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5655 | #if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4756 | has_width = 0; | 5656 | has_width = 0; |
4757 | #endif | 5657 | #endif |
4758 | #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5658 | #if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4759 | width = 0; | 5659 | width = 0; |
4760 | if (dp->width_start != dp->width_end) | 5660 | if (dp->width_start != dp->width_end) |
4761 | { | 5661 | { |
@@ -4783,13 +5683,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4783 | width = xsum (xtimes (width, 10), *digitp++ - '0'); | 5683 | width = xsum (xtimes (width, 10), *digitp++ - '0'); |
4784 | while (digitp != dp->width_end); | 5684 | while (digitp != dp->width_end); |
4785 | } | 5685 | } |
4786 | #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 5686 | # if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4787 | has_width = 1; | 5687 | has_width = 1; |
4788 | #endif | 5688 | # endif |
4789 | } | 5689 | } |
4790 | #endif | 5690 | #endif |
4791 | 5691 | ||
4792 | #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION | 5692 | #if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4793 | has_precision = 0; | 5693 | has_precision = 0; |
4794 | precision = 6; | 5694 | precision = 6; |
4795 | if (dp->precision_start != dp->precision_end) | 5695 | if (dp->precision_start != dp->precision_end) |
@@ -4822,14 +5722,32 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4822 | #endif | 5722 | #endif |
4823 | 5723 | ||
4824 | /* Decide whether to handle the precision ourselves. */ | 5724 | /* Decide whether to handle the precision ourselves. */ |
4825 | #if NEED_PRINTF_UNBOUNDED_PRECISION | 5725 | #if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
4826 | switch (dp->conversion) | 5726 | switch (dp->conversion) |
4827 | { | 5727 | { |
5728 | # if NEED_PRINTF_UNBOUNDED_PRECISION | ||
4828 | case 'd': case 'i': case 'u': | 5729 | case 'd': case 'i': case 'u': |
5730 | case 'b': | ||
5731 | #if SUPPORT_GNU_PRINTF_DIRECTIVES \ | ||
5732 | || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2) | ||
5733 | case 'B': | ||
5734 | #endif | ||
4829 | case 'o': | 5735 | case 'o': |
4830 | case 'x': case 'X': case 'p': | ||
4831 | prec_ourselves = has_precision && (precision > 0); | 5736 | prec_ourselves = has_precision && (precision > 0); |
4832 | break; | 5737 | break; |
5738 | # endif | ||
5739 | case 'x': case 'X': case 'p': | ||
5740 | prec_ourselves = | ||
5741 | has_precision | ||
5742 | && (0 | ||
5743 | # if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO | ||
5744 | || (precision == 0) | ||
5745 | # endif | ||
5746 | # if NEED_PRINTF_UNBOUNDED_PRECISION | ||
5747 | || (precision > 0) | ||
5748 | # endif | ||
5749 | ); | ||
5750 | break; | ||
4833 | default: | 5751 | default: |
4834 | prec_ourselves = 0; | 5752 | prec_ourselves = 0; |
4835 | break; | 5753 | break; |
@@ -4837,7 +5755,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4837 | #endif | 5755 | #endif |
4838 | 5756 | ||
4839 | /* Decide whether to perform the padding ourselves. */ | 5757 | /* Decide whether to perform the padding ourselves. */ |
4840 | #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) | 5758 | #if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) |
4841 | switch (dp->conversion) | 5759 | switch (dp->conversion) |
4842 | { | 5760 | { |
4843 | # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO | 5761 | # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO |
@@ -4956,6 +5874,54 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4956 | { | 5874 | { |
4957 | case TYPE_LONGLONGINT: | 5875 | case TYPE_LONGLONGINT: |
4958 | case TYPE_ULONGLONGINT: | 5876 | case TYPE_ULONGLONGINT: |
5877 | #if INT8_WIDTH > LONG_WIDTH | ||
5878 | case TYPE_INT8_T: | ||
5879 | #endif | ||
5880 | #if UINT8_WIDTH > LONG_WIDTH | ||
5881 | case TYPE_UINT8_T: | ||
5882 | #endif | ||
5883 | #if INT16_WIDTH > LONG_WIDTH | ||
5884 | case TYPE_INT16_T: | ||
5885 | #endif | ||
5886 | #if UINT16_WIDTH > LONG_WIDTH | ||
5887 | case TYPE_UINT16_T: | ||
5888 | #endif | ||
5889 | #if INT32_WIDTH > LONG_WIDTH | ||
5890 | case TYPE_INT32_T: | ||
5891 | #endif | ||
5892 | #if UINT32_WIDTH > LONG_WIDTH | ||
5893 | case TYPE_UINT32_T: | ||
5894 | #endif | ||
5895 | #if INT64_WIDTH > LONG_WIDTH | ||
5896 | case TYPE_INT64_T: | ||
5897 | #endif | ||
5898 | #if UINT64_WIDTH > LONG_WIDTH | ||
5899 | case TYPE_UINT64_T: | ||
5900 | #endif | ||
5901 | #if INT_FAST8_WIDTH > LONG_WIDTH | ||
5902 | case TYPE_INT_FAST8_T: | ||
5903 | #endif | ||
5904 | #if UINT_FAST8_WIDTH > LONG_WIDTH | ||
5905 | case TYPE_UINT_FAST8_T: | ||
5906 | #endif | ||
5907 | #if INT_FAST16_WIDTH > LONG_WIDTH | ||
5908 | case TYPE_INT_FAST16_T: | ||
5909 | #endif | ||
5910 | #if UINT_FAST16_WIDTH > LONG_WIDTH | ||
5911 | case TYPE_UINT_FAST16_T: | ||
5912 | #endif | ||
5913 | #if INT_FAST32_WIDTH > LONG_WIDTH | ||
5914 | case TYPE_INT3_FAST2_T: | ||
5915 | #endif | ||
5916 | #if UINT_FAST32_WIDTH > LONG_WIDTH | ||
5917 | case TYPE_UINT_FAST32_T: | ||
5918 | #endif | ||
5919 | #if INT_FAST64_WIDTH > LONG_WIDTH | ||
5920 | case TYPE_INT_FAST64_T: | ||
5921 | #endif | ||
5922 | #if UINT_FAST64_WIDTH > LONG_WIDTH | ||
5923 | case TYPE_UINT_FAST64_T: | ||
5924 | #endif | ||
4959 | #if defined _WIN32 && ! defined __CYGWIN__ | 5925 | #if defined _WIN32 && ! defined __CYGWIN__ |
4960 | *fbp++ = 'I'; | 5926 | *fbp++ = 'I'; |
4961 | *fbp++ = '6'; | 5927 | *fbp++ = '6'; |
@@ -4967,12 +5933,60 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4967 | FALLTHROUGH; | 5933 | FALLTHROUGH; |
4968 | case TYPE_LONGINT: | 5934 | case TYPE_LONGINT: |
4969 | case TYPE_ULONGINT: | 5935 | case TYPE_ULONGINT: |
4970 | #if HAVE_WINT_T | 5936 | #if INT8_WIDTH > INT_WIDTH && INT8_WIDTH <= LONG_WIDTH |
5937 | case TYPE_INT8_T: | ||
5938 | #endif | ||
5939 | #if UINT8_WIDTH > INT_WIDTH && UINT8_WIDTH <= LONG_WIDTH | ||
5940 | case TYPE_UINT8_T: | ||
5941 | #endif | ||
5942 | #if INT16_WIDTH > INT_WIDTH && INT16_WIDTH <= LONG_WIDTH | ||
5943 | case TYPE_INT16_T: | ||
5944 | #endif | ||
5945 | #if UINT16_WIDTH > INT_WIDTH && UINT16_WIDTH <= LONG_WIDTH | ||
5946 | case TYPE_UINT16_T: | ||
5947 | #endif | ||
5948 | #if INT32_WIDTH > INT_WIDTH && INT32_WIDTH <= LONG_WIDTH | ||
5949 | case TYPE_INT32_T: | ||
5950 | #endif | ||
5951 | #if UINT32_WIDTH > INT_WIDTH && UINT32_WIDTH <= LONG_WIDTH | ||
5952 | case TYPE_UINT32_T: | ||
5953 | #endif | ||
5954 | #if INT64_WIDTH > INT_WIDTH && INT64_WIDTH <= LONG_WIDTH | ||
5955 | case TYPE_INT64_T: | ||
5956 | #endif | ||
5957 | #if UINT64_WIDTH > INT_WIDTH && UINT64_WIDTH <= LONG_WIDTH | ||
5958 | case TYPE_UINT64_T: | ||
5959 | #endif | ||
5960 | #if INT_FAST8_WIDTH > INT_WIDTH && INT_FAST8_WIDTH <= LONG_WIDTH | ||
5961 | case TYPE_INT_FAST8_T: | ||
5962 | #endif | ||
5963 | #if UINT_FAST8_WIDTH > INT_WIDTH && UINT_FAST8_WIDTH <= LONG_WIDTH | ||
5964 | case TYPE_UINT_FAST8_T: | ||
5965 | #endif | ||
5966 | #if INT_FAST16_WIDTH > INT_WIDTH && INT_FAST16_WIDTH <= LONG_WIDTH | ||
5967 | case TYPE_INT_FAST16_T: | ||
5968 | #endif | ||
5969 | #if UINT_FAST16_WIDTH > INT_WIDTH && UINT_FAST16_WIDTH <= LONG_WIDTH | ||
5970 | case TYPE_UINT_FAST16_T: | ||
5971 | #endif | ||
5972 | #if INT_FAST32_WIDTH > INT_WIDTH && INT_FAST32_WIDTH <= LONG_WIDTH | ||
5973 | case TYPE_INT_FAST32_T: | ||
5974 | #endif | ||
5975 | #if UINT_FAST32_WIDTH > INT_WIDTH && UINT_FAST32_WIDTH <= LONG_WIDTH | ||
5976 | case TYPE_UINT_FAST32_T: | ||
5977 | #endif | ||
5978 | #if INT_FAST64_WIDTH > INT_WIDTH && INT_FAST64_WIDTH <= LONG_WIDTH | ||
5979 | case TYPE_INT_FAST64_T: | ||
5980 | #endif | ||
5981 | #if UINT_FAST64_WIDTH > INT_WIDTH && UINT_FAST64_WIDTH <= LONG_WIDTH | ||
5982 | case TYPE_UINT_FAST64_T: | ||
5983 | #endif | ||
5984 | #if HAVE_WINT_T | ||
4971 | case TYPE_WIDE_CHAR: | 5985 | case TYPE_WIDE_CHAR: |
4972 | #endif | 5986 | #endif |
4973 | #if HAVE_WCHAR_T | 5987 | #if HAVE_WCHAR_T |
4974 | case TYPE_WIDE_STRING: | 5988 | case TYPE_WIDE_STRING: |
4975 | #endif | 5989 | #endif |
4976 | *fbp++ = 'l'; | 5990 | *fbp++ = 'l'; |
4977 | break; | 5991 | break; |
4978 | case TYPE_LONGDOUBLE: | 5992 | case TYPE_LONGDOUBLE: |
@@ -4988,47 +6002,74 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4988 | #endif | 6002 | #endif |
4989 | *fbp = dp->conversion; | 6003 | *fbp = dp->conversion; |
4990 | #if USE_SNPRINTF | 6004 | #if USE_SNPRINTF |
4991 | # if ((HAVE_SNPRINTF_RETVAL_C99 && HAVE_SNPRINTF_TRUNCATION_C99) \ | 6005 | /* Decide whether to pass %n in the format string |
6006 | to SNPRINTF. */ | ||
6007 | # if (((!WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR) \ | ||
6008 | && (HAVE_SNPRINTF_RETVAL_C99 && HAVE_SNPRINTF_TRUNCATION_C99)) \ | ||
4992 | || ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ | 6009 | || ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ |
4993 | && !defined __UCLIBC__) \ | 6010 | && !defined __UCLIBC__) \ |
4994 | || (defined __APPLE__ && defined __MACH__) \ | 6011 | || (defined __APPLE__ && defined __MACH__) \ |
6012 | || defined __OpenBSD__ \ | ||
4995 | || defined __ANDROID__ \ | 6013 | || defined __ANDROID__ \ |
4996 | || (defined _WIN32 && ! defined __CYGWIN__)) | 6014 | || (defined _WIN32 && ! defined __CYGWIN__)) \ |
4997 | /* On systems where we know that snprintf's return value | 6015 | || (WIDE_CHAR_VERSION && MUSL_LIBC) |
4998 | conforms to ISO C 99 (HAVE_SNPRINTF_RETVAL_C99) and that | 6016 | /* We can avoid passing %n and instead rely on SNPRINTF's |
4999 | snprintf always produces NUL-terminated strings | 6017 | return value if |
5000 | (HAVE_SNPRINTF_TRUNCATION_C99), it is possible to avoid | 6018 | - !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR, because otherwise, |
5001 | using %n. And it is desirable to do so, because more and | 6019 | when WIDE_CHAR_VERSION && DCHAR_IS_TCHAR, |
5002 | more platforms no longer support %n, for "security reasons". | 6020 | snwprintf()/_snwprintf() (Windows) and swprintf() (Unix) |
5003 | In particular, the following platforms: | 6021 | don't return the needed buffer size, |
6022 | and | ||
6023 | - we're compiling for a system where we know | ||
6024 | - that snprintf's return value conforms to ISO C 99 | ||
6025 | (HAVE_SNPRINTF_RETVAL_C99) and | ||
6026 | - that snprintf always produces NUL-terminated strings | ||
6027 | (HAVE_SNPRINTF_TRUNCATION_C99). | ||
6028 | And it is desirable to do so, because more and more platforms | ||
6029 | no longer support %n, for "security reasons". */ | ||
6030 | /* On specific platforms, listed below, we *must* avoid %n. | ||
6031 | In the case | ||
6032 | !WIDE_CHAR_VERSION && HAVE_SNPRINTF_RETVAL_C99 && !USE_MSVC__SNPRINTF | ||
6033 | we can rely on the return value of snprintf instead. Whereas | ||
6034 | in the opposite case | ||
6035 | WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF | ||
6036 | we need to make room based on an estimation, computed by | ||
6037 | MAX_ROOM_NEEDED. */ | ||
6038 | /* The following platforms forbid %n: | ||
5004 | - On glibc2 systems from 2004-10-18 or newer, the use of | 6039 | - On glibc2 systems from 2004-10-18 or newer, the use of |
5005 | %n in format strings in writable memory may crash the | 6040 | %n in format strings in writable memory may crash the |
5006 | program (if compiled with _FORTIFY_SOURCE=2). | 6041 | program (if compiled with _FORTIFY_SOURCE=2). |
5007 | - On Mac OS X 10.13 or newer, the use of %n in format | 6042 | - On macOS 10.13 or newer, the use of %n in format |
5008 | strings in writable memory by default crashes the | 6043 | strings in writable memory by default crashes the |
5009 | program. | 6044 | program. |
6045 | - On OpenBSD, since 2021-08-30, the use of %n in format | ||
6046 | strings produces an abort (see | ||
6047 | <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfprintf.c.diff?r1=1.79&r2=1.80&f=h>, | ||
6048 | <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfwprintf.c.diff?r1=1.20&r2=1.21&f=h>). | ||
5010 | - On Android, starting on 2018-03-07, the use of %n in | 6049 | - On Android, starting on 2018-03-07, the use of %n in |
5011 | format strings produces a fatal error (see | 6050 | format strings produces a fatal error (see |
5012 | <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>). | 6051 | <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>). |
5013 | On these platforms, HAVE_SNPRINTF_RETVAL_C99 and | 6052 | - On native Windows systems (such as mingw) where the OS is |
5014 | HAVE_SNPRINTF_TRUNCATION_C99 are 1. We have listed them | 6053 | Windows Vista, the use of %n in format strings by default |
5015 | explicitly in the condition above, in case of cross- | 6054 | crashes the program. See |
5016 | compilation (just to be sure). */ | 6055 | <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and |
5017 | /* On native Windows systems (such as mingw), we can avoid using | 6056 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output> |
5018 | %n because: | 6057 | On the first four of these platforms, if !WIDE_CHAR_VERSION, |
6058 | it is not a big deal to avoid %n, because on these platforms, | ||
6059 | HAVE_SNPRINTF_RETVAL_C99 and HAVE_SNPRINTF_TRUNCATION_C99 are | ||
6060 | 1. | ||
6061 | On native Windows, if !WIDE_CHAR_VERSION, it's not a big deal | ||
6062 | either because: | ||
5019 | - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, | 6063 | - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, |
5020 | snprintf does not write more than the specified number | 6064 | snprintf does not write more than the specified number |
5021 | of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes | 6065 | of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes |
5022 | '4', '5', '6' into buf, not '4', '5', '\0'.) | 6066 | '4', '5', '6' into buf, not '4', '5', '\0'.) |
5023 | - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf | 6067 | - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf |
5024 | allows us to recognize the case of an insufficient | 6068 | allows us to recognize the case of an insufficient |
5025 | buffer size: it returns -1 in this case. | 6069 | buffer size: it returns -1 in this case. */ |
5026 | On native Windows systems (such as mingw) where the OS is | 6070 | /* Additionally, in the WIDE_CHAR_VERSION case, we cannot use %n |
5027 | Windows Vista, the use of %n in format strings by default | 6071 | on musl libc because we would run into an swprintf() bug. |
5028 | crashes the program. See | 6072 | See <https://www.openwall.com/lists/musl/2023/03/19/1>. */ |
5029 | <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and | ||
5030 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output> | ||
5031 | So we should avoid %n in this situation. */ | ||
5032 | fbp[1] = '\0'; | 6073 | fbp[1] = '\0'; |
5033 | # else /* AIX <= 5.1, HP-UX, IRIX, OSF/1, Solaris <= 9, BeOS */ | 6074 | # else /* AIX <= 5.1, HP-UX, IRIX, OSF/1, Solaris <= 9, BeOS */ |
5034 | fbp[1] = '%'; | 6075 | fbp[1] = '%'; |
@@ -5189,6 +6230,102 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5189 | SNPRINTF_BUF (arg); | 6230 | SNPRINTF_BUF (arg); |
5190 | } | 6231 | } |
5191 | break; | 6232 | break; |
6233 | case TYPE_INT8_T: | ||
6234 | { | ||
6235 | int8_t arg = a.arg[dp->arg_index].a.a_int8_t; | ||
6236 | SNPRINTF_BUF (arg); | ||
6237 | } | ||
6238 | break; | ||
6239 | case TYPE_UINT8_T: | ||
6240 | { | ||
6241 | uint8_t arg = a.arg[dp->arg_index].a.a_uint8_t; | ||
6242 | SNPRINTF_BUF (arg); | ||
6243 | } | ||
6244 | break; | ||
6245 | case TYPE_INT16_T: | ||
6246 | { | ||
6247 | int16_t arg = a.arg[dp->arg_index].a.a_int16_t; | ||
6248 | SNPRINTF_BUF (arg); | ||
6249 | } | ||
6250 | break; | ||
6251 | case TYPE_UINT16_T: | ||
6252 | { | ||
6253 | uint16_t arg = a.arg[dp->arg_index].a.a_uint16_t; | ||
6254 | SNPRINTF_BUF (arg); | ||
6255 | } | ||
6256 | break; | ||
6257 | case TYPE_INT32_T: | ||
6258 | { | ||
6259 | int32_t arg = a.arg[dp->arg_index].a.a_int32_t; | ||
6260 | SNPRINTF_BUF (arg); | ||
6261 | } | ||
6262 | break; | ||
6263 | case TYPE_UINT32_T: | ||
6264 | { | ||
6265 | uint32_t arg = a.arg[dp->arg_index].a.a_uint32_t; | ||
6266 | SNPRINTF_BUF (arg); | ||
6267 | } | ||
6268 | break; | ||
6269 | case TYPE_INT64_T: | ||
6270 | { | ||
6271 | int64_t arg = a.arg[dp->arg_index].a.a_int64_t; | ||
6272 | SNPRINTF_BUF (arg); | ||
6273 | } | ||
6274 | break; | ||
6275 | case TYPE_UINT64_T: | ||
6276 | { | ||
6277 | uint64_t arg = a.arg[dp->arg_index].a.a_uint64_t; | ||
6278 | SNPRINTF_BUF (arg); | ||
6279 | } | ||
6280 | break; | ||
6281 | case TYPE_INT_FAST8_T: | ||
6282 | { | ||
6283 | int_fast8_t arg = a.arg[dp->arg_index].a.a_int_fast8_t; | ||
6284 | SNPRINTF_BUF (arg); | ||
6285 | } | ||
6286 | break; | ||
6287 | case TYPE_UINT_FAST8_T: | ||
6288 | { | ||
6289 | uint_fast8_t arg = a.arg[dp->arg_index].a.a_uint_fast8_t; | ||
6290 | SNPRINTF_BUF (arg); | ||
6291 | } | ||
6292 | break; | ||
6293 | case TYPE_INT_FAST16_T: | ||
6294 | { | ||
6295 | int_fast16_t arg = a.arg[dp->arg_index].a.a_int_fast16_t; | ||
6296 | SNPRINTF_BUF (arg); | ||
6297 | } | ||
6298 | break; | ||
6299 | case TYPE_UINT_FAST16_T: | ||
6300 | { | ||
6301 | uint_fast16_t arg = a.arg[dp->arg_index].a.a_uint_fast16_t; | ||
6302 | SNPRINTF_BUF (arg); | ||
6303 | } | ||
6304 | break; | ||
6305 | case TYPE_INT_FAST32_T: | ||
6306 | { | ||
6307 | int_fast32_t arg = a.arg[dp->arg_index].a.a_int_fast32_t; | ||
6308 | SNPRINTF_BUF (arg); | ||
6309 | } | ||
6310 | break; | ||
6311 | case TYPE_UINT_FAST32_T: | ||
6312 | { | ||
6313 | uint_fast32_t arg = a.arg[dp->arg_index].a.a_uint_fast32_t; | ||
6314 | SNPRINTF_BUF (arg); | ||
6315 | } | ||
6316 | break; | ||
6317 | case TYPE_INT_FAST64_T: | ||
6318 | { | ||
6319 | int_fast64_t arg = a.arg[dp->arg_index].a.a_int_fast64_t; | ||
6320 | SNPRINTF_BUF (arg); | ||
6321 | } | ||
6322 | break; | ||
6323 | case TYPE_UINT_FAST64_T: | ||
6324 | { | ||
6325 | uint_fast64_t arg = a.arg[dp->arg_index].a.a_uint_fast64_t; | ||
6326 | SNPRINTF_BUF (arg); | ||
6327 | } | ||
6328 | break; | ||
5192 | case TYPE_DOUBLE: | 6329 | case TYPE_DOUBLE: |
5193 | { | 6330 | { |
5194 | double arg = a.arg[dp->arg_index].a.a_double; | 6331 | double arg = a.arg[dp->arg_index].a.a_double; |
@@ -5271,12 +6408,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5271 | /* Look at the snprintf() return value. */ | 6408 | /* Look at the snprintf() return value. */ |
5272 | if (retcount < 0) | 6409 | if (retcount < 0) |
5273 | { | 6410 | { |
5274 | # if !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF | 6411 | # if (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF |
5275 | /* HP-UX 10.20 snprintf() is doubly deficient: | 6412 | /* HP-UX 10.20 snprintf() is doubly deficient: |
5276 | It doesn't understand the '%n' directive, | 6413 | It doesn't understand the '%n' directive, |
5277 | *and* it returns -1 (rather than the length | 6414 | *and* it returns -1 (rather than the length |
5278 | that would have been required) when the | 6415 | that would have been required) when the |
5279 | buffer is too small. | 6416 | buffer is too small. |
6417 | Likewise, in case of | ||
6418 | WIDE_CHAR_VERSION && DCHAR_IS_TCHAR, the | ||
6419 | functions snwprintf()/_snwprintf() (Windows) | ||
6420 | or swprintf() (Unix). | ||
5280 | But a failure at this point can also come | 6421 | But a failure at this point can also come |
5281 | from other reasons than a too small buffer, | 6422 | from other reasons than a too small buffer, |
5282 | such as an invalid wide string argument to | 6423 | such as an invalid wide string argument to |
@@ -5312,7 +6453,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5312 | # endif | 6453 | # endif |
5313 | } | 6454 | } |
5314 | else | 6455 | else |
5315 | count = retcount; | 6456 | { |
6457 | count = retcount; | ||
6458 | # if WIDE_CHAR_VERSION && defined __MINGW32__ | ||
6459 | if (count == 0 && dp->conversion == 'c') | ||
6460 | /* snwprintf returned 0 instead of 1. But it | ||
6461 | wrote a null wide character. */ | ||
6462 | count = 1; | ||
6463 | # endif | ||
6464 | } | ||
5316 | } | 6465 | } |
5317 | } | 6466 | } |
5318 | #endif | 6467 | #endif |
@@ -5370,7 +6519,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5370 | } | 6519 | } |
5371 | #endif | 6520 | #endif |
5372 | 6521 | ||
5373 | #if NEED_PRINTF_UNBOUNDED_PRECISION | 6522 | #if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
5374 | if (prec_ourselves) | 6523 | if (prec_ourselves) |
5375 | { | 6524 | { |
5376 | /* Handle the precision. */ | 6525 | /* Handle the precision. */ |
@@ -5430,6 +6579,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5430 | 6579 | ||
5431 | count += insert; | 6580 | count += insert; |
5432 | } | 6581 | } |
6582 | # if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO | ||
6583 | else if (precision == 0 | ||
6584 | && move == 1 | ||
6585 | && prec_ptr[prefix_count] == '0') | ||
6586 | { | ||
6587 | /* Replace the "0" result with an empty string. */ | ||
6588 | count = prefix_count; | ||
6589 | } | ||
6590 | # endif | ||
5433 | } | 6591 | } |
5434 | #endif | 6592 | #endif |
5435 | 6593 | ||
@@ -5442,11 +6600,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5442 | 6600 | ||
5443 | #if !DCHAR_IS_TCHAR | 6601 | #if !DCHAR_IS_TCHAR |
5444 | /* Convert from TCHAR_T[] to DCHAR_T[]. */ | 6602 | /* Convert from TCHAR_T[] to DCHAR_T[]. */ |
5445 | if (dp->conversion == 'c' || dp->conversion == 's') | 6603 | if (dp->conversion == 'c' || dp->conversion == 's' |
6604 | # if __GLIBC__ >= 2 && !defined __UCLIBC__ | ||
6605 | || (flags & FLAG_LOCALIZED) | ||
6606 | # endif | ||
6607 | ) | ||
5446 | { | 6608 | { |
5447 | /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING | 6609 | /* The result string is not guaranteed to be ASCII. */ |
5448 | TYPE_WIDE_STRING. | ||
5449 | The result string is not certainly ASCII. */ | ||
5450 | const TCHAR_T *tmpsrc; | 6610 | const TCHAR_T *tmpsrc; |
5451 | DCHAR_T *tmpdst; | 6611 | DCHAR_T *tmpdst; |
5452 | size_t tmpdst_len; | 6612 | size_t tmpdst_len; |
@@ -5457,6 +6617,56 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5457 | # else | 6617 | # else |
5458 | tmpsrc = tmp; | 6618 | tmpsrc = tmp; |
5459 | # endif | 6619 | # endif |
6620 | # if WIDE_CHAR_VERSION | ||
6621 | /* Convert tmpsrc[0..count-1] to a freshly allocated | ||
6622 | wide character array. */ | ||
6623 | mbstate_t state; | ||
6624 | |||
6625 | mbszero (&state); | ||
6626 | tmpdst_len = 0; | ||
6627 | { | ||
6628 | const TCHAR_T *src = tmpsrc; | ||
6629 | size_t srclen = count; | ||
6630 | |||
6631 | for (; srclen > 0; tmpdst_len++) | ||
6632 | { | ||
6633 | /* Parse the next multibyte character. */ | ||
6634 | size_t ret = mbrtowc (NULL, src, srclen, &state); | ||
6635 | if (ret == (size_t)(-2) || ret == (size_t)(-1)) | ||
6636 | goto fail_with_EILSEQ; | ||
6637 | if (ret == 0) | ||
6638 | ret = 1; | ||
6639 | src += ret; | ||
6640 | srclen -= ret; | ||
6641 | } | ||
6642 | } | ||
6643 | |||
6644 | tmpdst = | ||
6645 | (wchar_t *) malloc ((tmpdst_len + 1) * sizeof (wchar_t)); | ||
6646 | if (tmpdst == NULL) | ||
6647 | goto out_of_memory; | ||
6648 | |||
6649 | mbszero (&state); | ||
6650 | { | ||
6651 | DCHAR_T *destptr = tmpdst; | ||
6652 | const TCHAR_T *src = tmpsrc; | ||
6653 | size_t srclen = count; | ||
6654 | |||
6655 | for (; srclen > 0; destptr++) | ||
6656 | { | ||
6657 | /* Parse the next multibyte character. */ | ||
6658 | size_t ret = mbrtowc (destptr, src, srclen, &state); | ||
6659 | if (ret == (size_t)(-2) || ret == (size_t)(-1)) | ||
6660 | /* Should already have been caught in the first | ||
6661 | loop, above. */ | ||
6662 | abort (); | ||
6663 | if (ret == 0) | ||
6664 | ret = 1; | ||
6665 | src += ret; | ||
6666 | srclen -= ret; | ||
6667 | } | ||
6668 | } | ||
6669 | # else | ||
5460 | tmpdst = | 6670 | tmpdst = |
5461 | DCHAR_CONV_FROM_ENCODING (locale_charset (), | 6671 | DCHAR_CONV_FROM_ENCODING (locale_charset (), |
5462 | iconveh_question_mark, | 6672 | iconveh_question_mark, |
@@ -5465,6 +6675,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5465 | NULL, &tmpdst_len); | 6675 | NULL, &tmpdst_len); |
5466 | if (tmpdst == NULL) | 6676 | if (tmpdst == NULL) |
5467 | goto fail_with_errno; | 6677 | goto fail_with_errno; |
6678 | # endif | ||
5468 | ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), | 6679 | ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), |
5469 | { free (tmpdst); goto out_of_memory; }); | 6680 | { free (tmpdst); goto out_of_memory; }); |
5470 | DCHAR_CPY (result + length, tmpdst, tmpdst_len); | 6681 | DCHAR_CPY (result + length, tmpdst, tmpdst_len); |
@@ -5531,7 +6742,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5531 | /* Here count <= allocated - length. */ | 6742 | /* Here count <= allocated - length. */ |
5532 | 6743 | ||
5533 | /* Perform padding. */ | 6744 | /* Perform padding. */ |
5534 | #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION | 6745 | #if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION |
5535 | if (pad_ourselves && has_width) | 6746 | if (pad_ourselves && has_width) |
5536 | { | 6747 | { |
5537 | size_t w; | 6748 | size_t w; |
@@ -5590,6 +6801,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5590 | if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') | 6801 | if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') |
5591 | || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) | 6802 | || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) |
5592 | pad_ptr = NULL; | 6803 | pad_ptr = NULL; |
6804 | else | ||
6805 | /* Do the zero-padding after the "0x" or | ||
6806 | "0b" prefix, not before. */ | ||
6807 | if (p - rp >= 2 | ||
6808 | && *rp == '0' | ||
6809 | && (((dp->conversion == 'a' | ||
6810 | || dp->conversion == 'x') | ||
6811 | && rp[1] == 'x') | ||
6812 | || ((dp->conversion == 'A' | ||
6813 | || dp->conversion == 'X') | ||
6814 | && rp[1] == 'X') | ||
6815 | || (dp->conversion == 'b' | ||
6816 | && rp[1] == 'b') | ||
6817 | || (dp->conversion == 'B' | ||
6818 | && rp[1] == 'B'))) | ||
6819 | pad_ptr += 2; | ||
5593 | } | 6820 | } |
5594 | /* The generated string now extends from rp to p, | 6821 | /* The generated string now extends from rp to p, |
5595 | with the zero padding insertion point being at | 6822 | with the zero padding insertion point being at |
@@ -5603,7 +6830,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5603 | for (; pad > 0; pad--) | 6830 | for (; pad > 0; pad--) |
5604 | *p++ = ' '; | 6831 | *p++ = ' '; |
5605 | } | 6832 | } |
5606 | else if ((flags & FLAG_ZERO) && pad_ptr != NULL) | 6833 | else if ((flags & FLAG_ZERO) && pad_ptr != NULL |
6834 | /* ISO C says: "For d, i, o, u, x, and X | ||
6835 | conversions, if a precision is | ||
6836 | specified, the 0 flag is ignored. */ | ||
6837 | && !(has_precision | ||
6838 | && (dp->conversion == 'd' | ||
6839 | || dp->conversion == 'i' | ||
6840 | || dp->conversion == 'o' | ||
6841 | || dp->conversion == 'u' | ||
6842 | || dp->conversion == 'x' | ||
6843 | || dp->conversion == 'X' | ||
6844 | /* Although ISO C does not | ||
6845 | require it, treat 'b' and 'B' | ||
6846 | like 'x' and 'X'. */ | ||
6847 | || dp->conversion == 'b' | ||
6848 | || dp->conversion == 'B'))) | ||
5607 | { | 6849 | { |
5608 | /* Pad with zeroes. */ | 6850 | /* Pad with zeroes. */ |
5609 | DCHAR_T *q = end; | 6851 | DCHAR_T *q = end; |
@@ -5697,7 +6939,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
5697 | errno = ENOMEM; | 6939 | errno = ENOMEM; |
5698 | goto fail_with_errno; | 6940 | goto fail_with_errno; |
5699 | 6941 | ||
5700 | #if ENABLE_UNISTDIO || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL) || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) | 6942 | #if ENABLE_UNISTDIO || ((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION) || (NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION) |
5701 | fail_with_EILSEQ: | 6943 | fail_with_EILSEQ: |
5702 | errno = EILSEQ; | 6944 | errno = EILSEQ; |
5703 | goto fail_with_errno; | 6945 | goto fail_with_errno; |
diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h index f69649fb..7ed9145c 100644 --- a/gl/vasnprintf.h +++ b/gl/vasnprintf.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* vsprintf with automatic memory allocation. | 1 | /* vsprintf with automatic memory allocation. |
2 | Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
@@ -17,6 +17,11 @@ | |||
17 | #ifndef _VASNPRINTF_H | 17 | #ifndef _VASNPRINTF_H |
18 | #define _VASNPRINTF_H | 18 | #define _VASNPRINTF_H |
19 | 19 | ||
20 | /* This file uses _GL_ATTRIBUTE_FORMAT. */ | ||
21 | #if !_GL_CONFIG_H_INCLUDED | ||
22 | #error "Please include config.h first." | ||
23 | #endif | ||
24 | |||
20 | /* Get va_list. */ | 25 | /* Get va_list. */ |
21 | #include <stdarg.h> | 26 | #include <stdarg.h> |
22 | 27 | ||
diff --git a/gl/vasprintf.c b/gl/vasprintf.c index d2878cd9..e52aaca5 100644 --- a/gl/vasprintf.c +++ b/gl/vasprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999, 2002, 2006-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002, 2006-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/verify.h b/gl/verify.h index b63cb264..08268c24 100644 --- a/gl/verify.h +++ b/gl/verify.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Compile-time assert-like macros. | 1 | /* Compile-time assert-like macros. |
2 | 2 | ||
3 | Copyright (C) 2005-2006, 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -188,9 +188,9 @@ template <int w> | |||
188 | _gl_verify_type<(R) ? 1 : -1> | 188 | _gl_verify_type<(R) ? 1 : -1> |
189 | #elif defined _GL_HAVE__STATIC_ASSERT | 189 | #elif defined _GL_HAVE__STATIC_ASSERT |
190 | # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ | 190 | # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ |
191 | struct { \ | 191 | struct { \ |
192 | _Static_assert (R, DIAGNOSTIC); \ | 192 | _Static_assert (R, DIAGNOSTIC); \ |
193 | int _gl_dummy; \ | 193 | int _gl_dummy; \ |
194 | } | 194 | } |
195 | #else | 195 | #else |
196 | # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ | 196 | # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ |
@@ -212,8 +212,8 @@ template <int w> | |||
212 | #elif defined _GL_HAVE__STATIC_ASSERT | 212 | #elif defined _GL_HAVE__STATIC_ASSERT |
213 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) | 213 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) |
214 | #else | 214 | #else |
215 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ | 215 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ |
216 | extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ | 216 | extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ |
217 | [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] | 217 | [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] |
218 | # if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | 218 | # if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) |
219 | # pragma GCC diagnostic ignored "-Wnested-externs" | 219 | # pragma GCC diagnostic ignored "-Wnested-externs" |
@@ -222,22 +222,43 @@ template <int w> | |||
222 | 222 | ||
223 | /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ | 223 | /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ |
224 | #ifdef _GL_STATIC_ASSERT_H | 224 | #ifdef _GL_STATIC_ASSERT_H |
225 | # if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert | 225 | /* Define _Static_assert if needed. */ |
226 | /* With clang ≥ 3.8.0 in C++ mode, _Static_assert already works and accepts | ||
227 | 1 or 2 arguments. We better don't override it, because clang's standard | ||
228 | C++ library uses static_assert inside classes in several places, and our | ||
229 | replacement via _GL_VERIFY does not work in these contexts. */ | ||
230 | # if (defined __cplusplus && defined __clang__ \ | ||
231 | && (4 <= __clang_major__ + (8 <= __clang_minor__))) | ||
232 | # if 5 <= __clang_major__ | ||
233 | /* Avoid "warning: 'static_assert' with no message is a C++17 extension". */ | ||
234 | # pragma clang diagnostic ignored "-Wc++17-extensions" | ||
235 | # else | ||
236 | /* Avoid "warning: static_assert with no message is a C++1z extension". */ | ||
237 | # pragma clang diagnostic ignored "-Wc++1z-extensions" | ||
238 | # endif | ||
239 | # elif !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert | ||
226 | # if !defined _MSC_VER || defined __clang__ | 240 | # if !defined _MSC_VER || defined __clang__ |
227 | # define _Static_assert(...) \ | 241 | # define _Static_assert(...) \ |
228 | _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) | 242 | _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) |
229 | # else | 243 | # else |
230 | /* Work around MSVC preprocessor incompatibility with ISO C; see | 244 | # if defined __cplusplus && _MSC_VER >= 1910 |
231 | <https://stackoverflow.com/questions/5134523/>. */ | 245 | /* In MSVC 14.1 or newer, static_assert accepts one or two arguments, |
232 | # define _Static_assert(R, ...) \ | 246 | but _Static_assert is not defined. */ |
233 | _GL_VERIFY ((R), "static assertion failed", -) | 247 | # define _Static_assert static_assert |
248 | # else | ||
249 | /* Work around MSVC preprocessor incompatibility with ISO C; see | ||
250 | <https://stackoverflow.com/questions/5134523/>. */ | ||
251 | # define _Static_assert(R, ...) \ | ||
252 | _GL_VERIFY ((R), "static assertion failed", -) | ||
253 | # endif | ||
234 | # endif | 254 | # endif |
235 | # endif | 255 | # endif |
256 | /* Define static_assert if needed. */ | ||
236 | # if (!defined static_assert \ | 257 | # if (!defined static_assert \ |
237 | && __STDC_VERSION__ < 202311 \ | 258 | && __STDC_VERSION__ < 202311 \ |
238 | && (!defined __cplusplus \ | 259 | && (!defined __cplusplus \ |
239 | || (__cpp_static_assert < 201411 \ | 260 | || (__cpp_static_assert < 201411 \ |
240 | && __GNUG__ < 6 && __clang_major__ < 6))) | 261 | && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910))) |
241 | # if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ | 262 | # if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ |
242 | /* MSVC 14 in C++ mode supports the two-arguments static_assert but not | 263 | /* MSVC 14 in C++ mode supports the two-arguments static_assert but not |
243 | the one-argument static_assert, and it does not support _Static_assert. | 264 | the one-argument static_assert, and it does not support _Static_assert. |
@@ -250,6 +271,8 @@ template <int w> | |||
250 | # define _GL_SA3 static_assert | 271 | # define _GL_SA3 static_assert |
251 | # define _GL_SA_PICK(x1,x2,x3,x4,...) x4 | 272 | # define _GL_SA_PICK(x1,x2,x3,x4,...) x4 |
252 | # define static_assert(...) _GL_EXPAND(_GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1)) (__VA_ARGS__) | 273 | # define static_assert(...) _GL_EXPAND(_GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1)) (__VA_ARGS__) |
274 | /* Avoid "fatal error C1189: #error: The C++ Standard Library forbids macroizing keywords." */ | ||
275 | # define _ALLOW_KEYWORD_MACROS 1 | ||
253 | # else | 276 | # else |
254 | # define static_assert _Static_assert /* C11 requires this #define. */ | 277 | # define static_assert _Static_assert /* C11 requires this #define. */ |
255 | # endif | 278 | # endif |
@@ -268,14 +291,16 @@ template <int w> | |||
268 | # define _GL_HAS_BUILTIN_TRAP 0 | 291 | # define _GL_HAS_BUILTIN_TRAP 0 |
269 | #endif | 292 | #endif |
270 | 293 | ||
271 | #if defined __clang_major__ && __clang_major__ < 5 | 294 | #ifndef _GL_HAS_BUILTIN_UNREACHABLE |
272 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | 295 | # if defined __clang_major__ && __clang_major__ < 5 |
273 | #elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) | 296 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 |
274 | # define _GL_HAS_BUILTIN_UNREACHABLE 1 | 297 | # elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) |
275 | #elif defined __has_builtin | 298 | # define _GL_HAS_BUILTIN_UNREACHABLE 1 |
276 | # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) | 299 | # elif defined __has_builtin |
277 | #else | 300 | # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) |
278 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | 301 | # else |
302 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | ||
303 | # endif | ||
279 | #endif | 304 | #endif |
280 | 305 | ||
281 | /* Each of these macros verifies that its argument R is nonzero. To | 306 | /* Each of these macros verifies that its argument R is nonzero. To |
diff --git a/gl/vsnprintf.c b/gl/vsnprintf.c index acd4e2d4..e6676a1f 100644 --- a/gl/vsnprintf.c +++ b/gl/vsnprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 2004, 2006-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. | 3 | Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
diff --git a/gl/w32sock.h b/gl/w32sock.h index 84e46e33..166a5f77 100644 --- a/gl/w32sock.h +++ b/gl/w32sock.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* w32sock.h --- internal auxiliary functions for Windows socket functions | 1 | /* w32sock.h --- internal auxiliary functions for Windows socket functions |
2 | 2 | ||
3 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/warn-on-use.h b/gl/warn-on-use.h index 30756034..701013a0 100644 --- a/gl/warn-on-use.h +++ b/gl/warn-on-use.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* A C macro for emitting warnings if a function is used. | 1 | /* A C macro for emitting warnings if a function is used. |
2 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2010-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify it | 4 | This program is free software: you can redistribute it and/or modify it |
5 | under the terms of the GNU Lesser General Public License as published | 5 | under the terms of the GNU Lesser General Public License as published |
@@ -32,6 +32,10 @@ | |||
32 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' | 32 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' |
33 | linkage. | 33 | linkage. |
34 | 34 | ||
35 | _GL_WARN_ON_USE should not be used more than once for a given function | ||
36 | in a given compilation unit (because this may generate a warning even | ||
37 | if the function is never called). | ||
38 | |||
35 | However, one of the reasons that a function is a portability trap is | 39 | However, one of the reasons that a function is a portability trap is |
36 | if it has the wrong signature. Declaring FUNCTION with a different | 40 | if it has the wrong signature. Declaring FUNCTION with a different |
37 | signature in C is a compilation error, so this macro must use the | 41 | signature in C is a compilation error, so this macro must use the |
diff --git a/gl/wchar.in.h b/gl/wchar.in.h index 09c9185f..a33a10f7 100644 --- a/gl/wchar.in.h +++ b/gl/wchar.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. | 1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -84,6 +84,13 @@ | |||
84 | #ifndef _@GUARD_PREFIX@_WCHAR_H | 84 | #ifndef _@GUARD_PREFIX@_WCHAR_H |
85 | #define _@GUARD_PREFIX@_WCHAR_H | 85 | #define _@GUARD_PREFIX@_WCHAR_H |
86 | 86 | ||
87 | /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | ||
88 | _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, | ||
89 | HAVE_RAW_DECL_*. */ | ||
90 | #if !_GL_CONFIG_H_INCLUDED | ||
91 | #error "Please include config.h first." | ||
92 | #endif | ||
93 | |||
87 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | 94 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers |
88 | that can be freed by passing them as the Ith argument to the | 95 | that can be freed by passing them as the Ith argument to the |
89 | function F. */ | 96 | function F. */ |
@@ -130,6 +137,28 @@ | |||
130 | # endif | 137 | # endif |
131 | #endif | 138 | #endif |
132 | 139 | ||
140 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
141 | */ | ||
142 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
143 | # if defined __cplusplus | ||
144 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
145 | # if __cplusplus >= 201103L | ||
146 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
147 | # else | ||
148 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
149 | # endif | ||
150 | # else | ||
151 | # define _GL_ATTRIBUTE_NOTHROW | ||
152 | # endif | ||
153 | # else | ||
154 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
155 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
156 | # else | ||
157 | # define _GL_ATTRIBUTE_NOTHROW | ||
158 | # endif | ||
159 | # endif | ||
160 | #endif | ||
161 | |||
133 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 162 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
134 | 163 | ||
135 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 164 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
@@ -188,7 +217,11 @@ typedef int rpl_mbstate_t; | |||
188 | # if (@REPLACE_FREE@ && !defined free \ | 217 | # if (@REPLACE_FREE@ && !defined free \ |
189 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | 218 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) |
190 | /* We can't do '#define free rpl_free' here. */ | 219 | /* We can't do '#define free rpl_free' here. */ |
220 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
221 | _GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW; | ||
222 | # else | ||
191 | _GL_EXTERN_C void rpl_free (void *); | 223 | _GL_EXTERN_C void rpl_free (void *); |
224 | # endif | ||
192 | # undef _GL_ATTRIBUTE_DEALLOC_FREE | 225 | # undef _GL_ATTRIBUTE_DEALLOC_FREE |
193 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) | 226 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) |
194 | # else | 227 | # else |
@@ -200,7 +233,7 @@ _GL_EXTERN_C | |||
200 | void __cdecl free (void *); | 233 | void __cdecl free (void *); |
201 | # else | 234 | # else |
202 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 235 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
203 | _GL_EXTERN_C void free (void *) throw (); | 236 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
204 | # else | 237 | # else |
205 | _GL_EXTERN_C void free (void *); | 238 | _GL_EXTERN_C void free (void *); |
206 | # endif | 239 | # endif |
@@ -215,13 +248,20 @@ _GL_EXTERN_C | |||
215 | void __cdecl free (void *); | 248 | void __cdecl free (void *); |
216 | # else | 249 | # else |
217 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 250 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
218 | _GL_EXTERN_C void free (void *) throw (); | 251 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
219 | # else | 252 | # else |
220 | _GL_EXTERN_C void free (void *); | 253 | _GL_EXTERN_C void free (void *); |
221 | # endif | 254 | # endif |
222 | # endif | 255 | # endif |
223 | #endif | 256 | #endif |
224 | 257 | ||
258 | |||
259 | #if @GNULIB_MBSZERO@ | ||
260 | /* Get memset(). */ | ||
261 | # include <string.h> | ||
262 | #endif | ||
263 | |||
264 | |||
225 | /* Convert a single-byte character to a wide character. */ | 265 | /* Convert a single-byte character to a wide character. */ |
226 | #if @GNULIB_BTOWC@ | 266 | #if @GNULIB_BTOWC@ |
227 | # if @REPLACE_BTOWC@ | 267 | # if @REPLACE_BTOWC@ |
@@ -278,7 +318,7 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - " | |||
278 | #endif | 318 | #endif |
279 | 319 | ||
280 | 320 | ||
281 | /* Test whether *PS is in the initial state. */ | 321 | /* Test whether *PS is in an initial state. */ |
282 | #if @GNULIB_MBSINIT@ | 322 | #if @GNULIB_MBSINIT@ |
283 | # if @REPLACE_MBSINIT@ | 323 | # if @REPLACE_MBSINIT@ |
284 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 324 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
@@ -305,6 +345,208 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " | |||
305 | #endif | 345 | #endif |
306 | 346 | ||
307 | 347 | ||
348 | /* Put *PS into an initial state. */ | ||
349 | #if @GNULIB_MBSZERO@ | ||
350 | /* ISO C 23 § 7.31.6.(3) says that zeroing an mbstate_t is a way to put the | ||
351 | mbstate_t into an initial state. However, on many platforms an mbstate_t | ||
352 | is large, and it is possible - as an optimization - to get away with zeroing | ||
353 | only part of it. So, instead of | ||
354 | |||
355 | mbstate_t state = { 0 }; | ||
356 | |||
357 | or | ||
358 | |||
359 | mbstate_t state; | ||
360 | memset (&state, 0, sizeof (mbstate_t)); | ||
361 | |||
362 | we can write this faster code: | ||
363 | |||
364 | mbstate_t state; | ||
365 | mbszero (&state); | ||
366 | */ | ||
367 | /* _GL_MBSTATE_INIT_SIZE describes how mbsinit() behaves: It is the number of | ||
368 | bytes at the beginning of an mbstate_t that need to be zero, for mbsinit() | ||
369 | to return true. | ||
370 | _GL_MBSTATE_ZERO_SIZE is the number of bytes at the beginning of an mbstate_t | ||
371 | that need to be zero, | ||
372 | - for mbsinit() to return true, and | ||
373 | - for all other multibyte-aware functions to operate properly. | ||
374 | 0 < _GL_MBSTATE_INIT_SIZE <= _GL_MBSTATE_ZERO_SIZE <= sizeof (mbstate_t). | ||
375 | These values are determined by source code inspection, where possible, and | ||
376 | by running the gnulib unit tests. | ||
377 | We need _GL_MBSTATE_INIT_SIZE because if we define _GL_MBSTATE_ZERO_SIZE | ||
378 | without considering what mbsinit() does, we get test failures such as | ||
379 | assertion "mbsinit (&iter->state)" failed | ||
380 | */ | ||
381 | # if GNULIB_defined_mbstate_t /* AIX, IRIX */ | ||
382 | /* mbstate_t has at least 4 bytes. They are used as coded in | ||
383 | gnulib/lib/mbrtowc.c. */ | ||
384 | # define _GL_MBSTATE_INIT_SIZE 1 | ||
385 | /* define _GL_MBSTATE_ZERO_SIZE 4 | ||
386 | does not work: it causes test failures. | ||
387 | So, use the safe fallback value, below. */ | ||
388 | # elif __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 /* glibc */ | ||
389 | /* mbstate_t is defined in <bits/types/__mbstate_t.h>. | ||
390 | For more details, see glibc/iconv/skeleton.c. */ | ||
391 | # define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (((mbstate_t) {0}).__count) */ | ||
392 | # define _GL_MBSTATE_ZERO_SIZE /* 8 */ sizeof (mbstate_t) | ||
393 | # elif defined MUSL_LIBC /* musl libc */ | ||
394 | /* mbstate_t is defined in <bits/alltypes.h>. | ||
395 | It is an opaque aligned 8-byte struct, of which at most the first | ||
396 | 4 bytes are used. | ||
397 | For more details, see src/multibyte/mbrtowc.c. */ | ||
398 | # define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (unsigned) */ | ||
399 | # define _GL_MBSTATE_ZERO_SIZE 4 | ||
400 | # elif defined __APPLE__ && defined __MACH__ /* macOS */ | ||
401 | /* On macOS, mbstate_t is defined in <machine/_types.h>. | ||
402 | It is an opaque aligned 128-byte struct, of which at most the first | ||
403 | 12 bytes are used. | ||
404 | For more details, see the __mbsinit implementations in | ||
405 | Libc-<version>/locale/FreeBSD/ | ||
406 | {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8,utf2}.c. */ | ||
407 | /* File INIT_SIZE ZERO_SIZE | ||
408 | ascii.c 0 0 | ||
409 | none.c 0 0 | ||
410 | euc.c 12 12 | ||
411 | mskanji.c 4 4 | ||
412 | big5.c 4 4 | ||
413 | gb2312.c 4 6 | ||
414 | gbk.c 4 4 | ||
415 | gb18030.c 4 8 | ||
416 | utf8.c 8 10 | ||
417 | utf2.c 8 12 */ | ||
418 | # define _GL_MBSTATE_INIT_SIZE 12 | ||
419 | # define _GL_MBSTATE_ZERO_SIZE 12 | ||
420 | # elif defined __FreeBSD__ /* FreeBSD */ | ||
421 | /* On FreeBSD, mbstate_t is defined in src/sys/sys/_types.h. | ||
422 | It is an opaque aligned 128-byte struct, of which at most the first | ||
423 | 12 bytes are used. | ||
424 | For more details, see the __mbsinit implementations in | ||
425 | src/lib/libc/locale/ | ||
426 | {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c. */ | ||
427 | /* File INIT_SIZE ZERO_SIZE | ||
428 | ascii.c 0 0 | ||
429 | none.c 0 0 | ||
430 | euc.c 12 12 | ||
431 | mskanji.c 4 4 | ||
432 | big5.c 4 4 | ||
433 | gb2312.c 4 6 | ||
434 | gbk.c 4 4 | ||
435 | gb18030.c 4 8 | ||
436 | utf8.c 8 12 */ | ||
437 | # define _GL_MBSTATE_INIT_SIZE 12 | ||
438 | # define _GL_MBSTATE_ZERO_SIZE 12 | ||
439 | # elif defined __NetBSD__ /* NetBSD */ | ||
440 | /* On NetBSD, mbstate_t is defined in src/sys/sys/ansi.h. | ||
441 | It is an opaque aligned 128-byte struct, of which at most the first | ||
442 | 28 bytes are used. | ||
443 | For more details, see the *State types in | ||
444 | src/lib/libc/citrus/modules/citrus_*.c | ||
445 | (ignoring citrus_{hz,iso2022,utf7,viqr,zw}.c, since these implement | ||
446 | stateful encodings, not usable as locale encodings). */ | ||
447 | /* File ZERO_SIZE | ||
448 | citrus/citrus_none.c 0 | ||
449 | citrus/modules/citrus_euc.c 8 | ||
450 | citrus/modules/citrus_euctw.c 8 | ||
451 | citrus/modules/citrus_mskanji.c 8 | ||
452 | citrus/modules/citrus_big5.c 8 | ||
453 | citrus/modules/citrus_gbk2k.c 8 | ||
454 | citrus/modules/citrus_dechanyu.c 8 | ||
455 | citrus/modules/citrus_johab.c 6 | ||
456 | citrus/modules/citrus_utf8.c 12 */ | ||
457 | /* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test | ||
458 | failures for values < 28. */ | ||
459 | # define _GL_MBSTATE_ZERO_SIZE 28 | ||
460 | # elif defined __OpenBSD__ /* OpenBSD */ | ||
461 | /* On OpenBSD, mbstate_t is defined in src/sys/sys/_types.h. | ||
462 | It is an opaque aligned 128-byte struct, of which at most the first | ||
463 | 12 bytes are used. | ||
464 | For more details, see src/lib/libc/citrus/citrus_*.c. */ | ||
465 | /* File INIT_SIZE ZERO_SIZE | ||
466 | citrus_none.c 0 0 | ||
467 | citrus_utf8.c 12 12 */ | ||
468 | # define _GL_MBSTATE_INIT_SIZE 12 | ||
469 | # define _GL_MBSTATE_ZERO_SIZE 12 | ||
470 | # elif defined __minix /* Minix */ | ||
471 | /* On Minix, mbstate_t is defined in sys/sys/ansi.h. | ||
472 | It is an opaque aligned 128-byte struct. | ||
473 | For more details, see the *State types in | ||
474 | lib/libc/citrus/citrus_*.c. */ | ||
475 | /* File INIT_SIZE ZERO_SIZE | ||
476 | citrus_none.c 0 0 */ | ||
477 | /* But 1 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test | ||
478 | failures for values < 4. */ | ||
479 | # define _GL_MBSTATE_ZERO_SIZE 4 | ||
480 | # elif defined __sun /* Solaris */ | ||
481 | /* On Solaris, mbstate_t is defined in <wchar_impl.h>. | ||
482 | It is an opaque aligned 24-byte or 32-byte struct, of which at most the first | ||
483 | 20 or 28 bytes are used. | ||
484 | For more details on OpenSolaris derivatives, see the *State types in | ||
485 | illumos-gate/usr/src/lib/libc/port/locale/ | ||
486 | {none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c. */ | ||
487 | /* File INIT_SIZE ZERO_SIZE | ||
488 | none.c 0 0 | ||
489 | euc.c 12 12 | ||
490 | mskanji.c 4 4 | ||
491 | big5.c 4 4 | ||
492 | gb2312.c 4 6 | ||
493 | gbk.c 4 4 | ||
494 | gb18030.c 4 8 | ||
495 | utf8.c 12 12 */ | ||
496 | /* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test | ||
497 | failures | ||
498 | - in OpenIndiana and OmniOS: for values < 16, | ||
499 | - in Solaris 10 and 11: for values < 20 (in 32-bit mode) | ||
500 | or < 28 (in 64-bit mode). | ||
501 | Since we don't have a good way to distinguish the OpenSolaris derivatives | ||
502 | from the proprietary Solaris versions, and can't inspect the Solaris source | ||
503 | code, use the safe fallback values, below. */ | ||
504 | # elif defined __CYGWIN__ /* Cygwin */ | ||
505 | /* On Cygwin, mbstate_t is defined in <sys/_types.h>. | ||
506 | For more details, see newlib/libc/stdlib/mbtowc_r.c and | ||
507 | winsup/cygwin/strfuncs.cc. */ | ||
508 | # define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (int) */ | ||
509 | # define _GL_MBSTATE_ZERO_SIZE 8 | ||
510 | # elif defined _WIN32 && !defined __CYGWIN__ /* Native Windows. */ | ||
511 | /* MSVC defines 'mbstate_t' as an aligned 8-byte struct. | ||
512 | On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined | ||
513 | as an aligned 8-byte struct, of which the first 4 bytes matter. | ||
514 | Use the safe values, below. */ | ||
515 | # elif defined __ANDROID__ /* Android */ | ||
516 | /* Android defines 'mbstate_t' in <bits/mbstate_t.h>. | ||
517 | It is an opaque 4-byte or 8-byte struct. | ||
518 | For more details, see | ||
519 | bionic/libc/private/bionic_mbstate.h | ||
520 | bionic/libc/bionic/mbrtoc32.cpp | ||
521 | bionic/libc/bionic/mbrtoc16.cpp | ||
522 | */ | ||
523 | # define _GL_MBSTATE_INIT_SIZE 4 | ||
524 | # define _GL_MBSTATE_ZERO_SIZE 4 | ||
525 | # endif | ||
526 | /* Use safe values as defaults. */ | ||
527 | # ifndef _GL_MBSTATE_INIT_SIZE | ||
528 | # define _GL_MBSTATE_INIT_SIZE sizeof (mbstate_t) | ||
529 | # endif | ||
530 | # ifndef _GL_MBSTATE_ZERO_SIZE | ||
531 | # define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t) | ||
532 | # endif | ||
533 | _GL_BEGIN_C_LINKAGE | ||
534 | # if defined IN_MBSZERO | ||
535 | _GL_EXTERN_INLINE | ||
536 | # else | ||
537 | _GL_INLINE | ||
538 | # endif | ||
539 | _GL_ARG_NONNULL ((1)) void | ||
540 | mbszero (mbstate_t *ps) | ||
541 | { | ||
542 | memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); | ||
543 | } | ||
544 | _GL_END_C_LINKAGE | ||
545 | _GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps)); | ||
546 | _GL_CXXALIASWARN (mbszero); | ||
547 | #endif | ||
548 | |||
549 | |||
308 | /* Convert a multibyte character to a wide character. */ | 550 | /* Convert a multibyte character to a wide character. */ |
309 | #if @GNULIB_MBRTOWC@ | 551 | #if @GNULIB_MBRTOWC@ |
310 | # if @REPLACE_MBRTOWC@ | 552 | # if @REPLACE_MBRTOWC@ |
@@ -441,7 +683,9 @@ _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, | |||
441 | const char **restrict srcp, size_t srclen, size_t len, | 683 | const char **restrict srcp, size_t srclen, size_t len, |
442 | mbstate_t *restrict ps)); | 684 | mbstate_t *restrict ps)); |
443 | # endif | 685 | # endif |
686 | # if __GLIBC__ >= 2 | ||
444 | _GL_CXXALIASWARN (mbsnrtowcs); | 687 | _GL_CXXALIASWARN (mbsnrtowcs); |
688 | # endif | ||
445 | #elif defined GNULIB_POSIXCHECK | 689 | #elif defined GNULIB_POSIXCHECK |
446 | # undef mbsnrtowcs | 690 | # undef mbsnrtowcs |
447 | # if HAVE_RAW_DECL_MBSNRTOWCS | 691 | # if HAVE_RAW_DECL_MBSNRTOWCS |
@@ -629,13 +873,25 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " | |||
629 | 873 | ||
630 | /* Compare N wide characters of S1 and S2. */ | 874 | /* Compare N wide characters of S1 and S2. */ |
631 | #if @GNULIB_WMEMCMP@ | 875 | #if @GNULIB_WMEMCMP@ |
632 | # if !@HAVE_WMEMCMP@ | 876 | # if @REPLACE_WMEMCMP@ |
877 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
878 | # undef wmemcmp | ||
879 | # define wmemcmp rpl_wmemcmp | ||
880 | # endif | ||
881 | _GL_FUNCDECL_RPL (wmemcmp, int, | ||
882 | (const wchar_t *s1, const wchar_t *s2, size_t n) | ||
883 | _GL_ATTRIBUTE_PURE); | ||
884 | _GL_CXXALIAS_RPL (wmemcmp, int, | ||
885 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | ||
886 | # else | ||
887 | # if !@HAVE_WMEMCMP@ | ||
633 | _GL_FUNCDECL_SYS (wmemcmp, int, | 888 | _GL_FUNCDECL_SYS (wmemcmp, int, |
634 | (const wchar_t *s1, const wchar_t *s2, size_t n) | 889 | (const wchar_t *s1, const wchar_t *s2, size_t n) |
635 | _GL_ATTRIBUTE_PURE); | 890 | _GL_ATTRIBUTE_PURE); |
636 | # endif | 891 | # endif |
637 | _GL_CXXALIAS_SYS (wmemcmp, int, | 892 | _GL_CXXALIAS_SYS (wmemcmp, int, |
638 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | 893 | (const wchar_t *s1, const wchar_t *s2, size_t n)); |
894 | # endif | ||
639 | # if __GLIBC__ >= 2 | 895 | # if __GLIBC__ >= 2 |
640 | _GL_CXXALIASWARN (wmemcmp); | 896 | _GL_CXXALIASWARN (wmemcmp); |
641 | # endif | 897 | # endif |
@@ -694,14 +950,27 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " | |||
694 | /* Copy N wide characters of SRC to DEST. | 950 | /* Copy N wide characters of SRC to DEST. |
695 | Return pointer to wide characters after the last written wide character. */ | 951 | Return pointer to wide characters after the last written wide character. */ |
696 | #if @GNULIB_WMEMPCPY@ | 952 | #if @GNULIB_WMEMPCPY@ |
697 | # if !@HAVE_WMEMPCPY@ | 953 | # if @REPLACE_WMEMPCPY@ |
954 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
955 | # undef wmempcpy | ||
956 | # define wmempcpy rpl_wmempcpy | ||
957 | # endif | ||
958 | _GL_FUNCDECL_RPL (wmempcpy, wchar_t *, | ||
959 | (wchar_t *restrict dest, | ||
960 | const wchar_t *restrict src, size_t n)); | ||
961 | _GL_CXXALIAS_RPL (wmempcpy, wchar_t *, | ||
962 | (wchar_t *restrict dest, | ||
963 | const wchar_t *restrict src, size_t n)); | ||
964 | # else | ||
965 | # if !@HAVE_WMEMPCPY@ | ||
698 | _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, | 966 | _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, |
699 | (wchar_t *restrict dest, | 967 | (wchar_t *restrict dest, |
700 | const wchar_t *restrict src, size_t n)); | 968 | const wchar_t *restrict src, size_t n)); |
701 | # endif | 969 | # endif |
702 | _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, | 970 | _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, |
703 | (wchar_t *restrict dest, | 971 | (wchar_t *restrict dest, |
704 | const wchar_t *restrict src, size_t n)); | 972 | const wchar_t *restrict src, size_t n)); |
973 | # endif | ||
705 | # if __GLIBC__ >= 2 | 974 | # if __GLIBC__ >= 2 |
706 | _GL_CXXALIASWARN (wmempcpy); | 975 | _GL_CXXALIASWARN (wmempcpy); |
707 | # endif | 976 | # endif |
@@ -901,11 +1170,21 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " | |||
901 | 1170 | ||
902 | /* Compare S1 and S2. */ | 1171 | /* Compare S1 and S2. */ |
903 | #if @GNULIB_WCSCMP@ | 1172 | #if @GNULIB_WCSCMP@ |
904 | # if !@HAVE_WCSCMP@ | 1173 | # if @REPLACE_WCSCMP@ |
1174 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1175 | # undef wcscmp | ||
1176 | # define wcscmp rpl_wcscmp | ||
1177 | # endif | ||
1178 | _GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) | ||
1179 | _GL_ATTRIBUTE_PURE); | ||
1180 | _GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); | ||
1181 | # else | ||
1182 | # if !@HAVE_WCSCMP@ | ||
905 | _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) | 1183 | _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) |
906 | _GL_ATTRIBUTE_PURE); | 1184 | _GL_ATTRIBUTE_PURE); |
907 | # endif | 1185 | # endif |
908 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); | 1186 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); |
1187 | # endif | ||
909 | # if __GLIBC__ >= 2 | 1188 | # if __GLIBC__ >= 2 |
910 | _GL_CXXALIASWARN (wcscmp); | 1189 | _GL_CXXALIASWARN (wcscmp); |
911 | # endif | 1190 | # endif |
@@ -920,13 +1199,25 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " | |||
920 | 1199 | ||
921 | /* Compare no more than N wide characters of S1 and S2. */ | 1200 | /* Compare no more than N wide characters of S1 and S2. */ |
922 | #if @GNULIB_WCSNCMP@ | 1201 | #if @GNULIB_WCSNCMP@ |
923 | # if !@HAVE_WCSNCMP@ | 1202 | # if @REPLACE_WCSNCMP@ |
1203 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1204 | # undef wcsncmp | ||
1205 | # define wcsncmp rpl_wcsncmp | ||
1206 | # endif | ||
1207 | _GL_FUNCDECL_RPL (wcsncmp, int, | ||
1208 | (const wchar_t *s1, const wchar_t *s2, size_t n) | ||
1209 | _GL_ATTRIBUTE_PURE); | ||
1210 | _GL_CXXALIAS_RPL (wcsncmp, int, | ||
1211 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | ||
1212 | # else | ||
1213 | # if !@HAVE_WCSNCMP@ | ||
924 | _GL_FUNCDECL_SYS (wcsncmp, int, | 1214 | _GL_FUNCDECL_SYS (wcsncmp, int, |
925 | (const wchar_t *s1, const wchar_t *s2, size_t n) | 1215 | (const wchar_t *s1, const wchar_t *s2, size_t n) |
926 | _GL_ATTRIBUTE_PURE); | 1216 | _GL_ATTRIBUTE_PURE); |
927 | # endif | 1217 | # endif |
928 | _GL_CXXALIAS_SYS (wcsncmp, int, | 1218 | _GL_CXXALIAS_SYS (wcsncmp, int, |
929 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | 1219 | (const wchar_t *s1, const wchar_t *s2, size_t n)); |
1220 | # endif | ||
930 | # if __GLIBC__ >= 2 | 1221 | # if __GLIBC__ >= 2 |
931 | _GL_CXXALIASWARN (wcsncmp); | 1222 | _GL_CXXALIASWARN (wcsncmp); |
932 | # endif | 1223 | # endif |
@@ -1035,9 +1326,16 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); | |||
1035 | namespace, not in the global namespace. So, force a declaration in | 1326 | namespace, not in the global namespace. So, force a declaration in |
1036 | the global namespace. */ | 1327 | the global namespace. */ |
1037 | # if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 | 1328 | # if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 |
1329 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
1330 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1331 | (const wchar_t *s) | ||
1332 | _GL_ATTRIBUTE_NOTHROW | ||
1333 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1334 | # else | ||
1038 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | 1335 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, |
1039 | (const wchar_t *s) | 1336 | (const wchar_t *s) |
1040 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 1337 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
1338 | # endif | ||
1041 | # endif | 1339 | # endif |
1042 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | 1340 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); |
1043 | # endif | 1341 | # endif |
@@ -1045,9 +1343,16 @@ _GL_CXXALIASWARN (wcsdup); | |||
1045 | #else | 1343 | #else |
1046 | # if __GNUC__ >= 11 && !defined wcsdup | 1344 | # if __GNUC__ >= 11 && !defined wcsdup |
1047 | /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ | 1345 | /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ |
1346 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
1048 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | 1347 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, |
1049 | (const wchar_t *s) | 1348 | (const wchar_t *s) |
1349 | _GL_ATTRIBUTE_NOTHROW | ||
1050 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 1350 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
1351 | # else | ||
1352 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1353 | (const wchar_t *s) | ||
1354 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1355 | # endif | ||
1051 | # endif | 1356 | # endif |
1052 | # if defined GNULIB_POSIXCHECK | 1357 | # if defined GNULIB_POSIXCHECK |
1053 | # undef wcsdup | 1358 | # undef wcsdup |
@@ -1066,9 +1371,16 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " | |||
1066 | # endif | 1371 | # endif |
1067 | _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); | 1372 | _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); |
1068 | # else | 1373 | # else |
1374 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
1069 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | 1375 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, |
1070 | (const wchar_t *s) | 1376 | (const wchar_t *s) |
1377 | _GL_ATTRIBUTE_NOTHROW | ||
1071 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 1378 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
1379 | # else | ||
1380 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1381 | (const wchar_t *s) | ||
1382 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1383 | # endif | ||
1072 | # if @HAVE_DECL_WCSDUP@ | 1384 | # if @HAVE_DECL_WCSDUP@ |
1073 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | 1385 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); |
1074 | # endif | 1386 | # endif |
@@ -1140,7 +1452,7 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " | |||
1140 | #endif | 1452 | #endif |
1141 | 1453 | ||
1142 | 1454 | ||
1143 | /* Return the length of the initial segmet of WCS which consists entirely | 1455 | /* Return the length of the initial segment of WCS which consists entirely |
1144 | of wide characters not in REJECT. */ | 1456 | of wide characters not in REJECT. */ |
1145 | #if @GNULIB_WCSCSPN@ | 1457 | #if @GNULIB_WCSCSPN@ |
1146 | # if !@HAVE_WCSCSPN@ | 1458 | # if !@HAVE_WCSCSPN@ |
@@ -1160,7 +1472,7 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " | |||
1160 | #endif | 1472 | #endif |
1161 | 1473 | ||
1162 | 1474 | ||
1163 | /* Return the length of the initial segmet of WCS which consists entirely | 1475 | /* Return the length of the initial segment of WCS which consists entirely |
1164 | of wide characters in ACCEPT. */ | 1476 | of wide characters in ACCEPT. */ |
1165 | #if @GNULIB_WCSSPN@ | 1477 | #if @GNULIB_WCSSPN@ |
1166 | # if !@HAVE_WCSSPN@ | 1478 | # if !@HAVE_WCSSPN@ |
@@ -1215,12 +1527,25 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " | |||
1215 | 1527 | ||
1216 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ | 1528 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ |
1217 | #if @GNULIB_WCSSTR@ | 1529 | #if @GNULIB_WCSSTR@ |
1218 | # if !@HAVE_WCSSTR@ | 1530 | # if @REPLACE_WCSSTR@ |
1531 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1532 | # undef wcsstr | ||
1533 | # define wcsstr rpl_wcsstr | ||
1534 | # endif | ||
1535 | _GL_FUNCDECL_RPL (wcsstr, wchar_t *, | ||
1536 | (const wchar_t *restrict haystack, | ||
1537 | const wchar_t *restrict needle) | ||
1538 | _GL_ATTRIBUTE_PURE); | ||
1539 | _GL_CXXALIAS_RPL (wcsstr, wchar_t *, | ||
1540 | (const wchar_t *restrict haystack, | ||
1541 | const wchar_t *restrict needle)); | ||
1542 | # else | ||
1543 | # if !@HAVE_WCSSTR@ | ||
1219 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, | 1544 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, |
1220 | (const wchar_t *restrict haystack, | 1545 | (const wchar_t *restrict haystack, |
1221 | const wchar_t *restrict needle) | 1546 | const wchar_t *restrict needle) |
1222 | _GL_ATTRIBUTE_PURE); | 1547 | _GL_ATTRIBUTE_PURE); |
1223 | # endif | 1548 | # endif |
1224 | /* On some systems, this function is defined as an overloaded function: | 1549 | /* On some systems, this function is defined as an overloaded function: |
1225 | extern "C++" { | 1550 | extern "C++" { |
1226 | const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); | 1551 | const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); |
@@ -1231,6 +1556,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcsstr, | |||
1231 | (const wchar_t *restrict, const wchar_t *restrict), | 1556 | (const wchar_t *restrict, const wchar_t *restrict), |
1232 | const wchar_t *, | 1557 | const wchar_t *, |
1233 | (const wchar_t *restrict, const wchar_t *restrict)); | 1558 | (const wchar_t *restrict, const wchar_t *restrict)); |
1559 | # endif | ||
1234 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 1560 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
1235 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 1561 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) |
1236 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, | 1562 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, |
@@ -1358,6 +1684,24 @@ _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " | |||
1358 | #endif | 1684 | #endif |
1359 | 1685 | ||
1360 | 1686 | ||
1687 | #if @GNULIB_WGETCWD@ && (defined _WIN32 && !defined __CYGWIN__) | ||
1688 | /* Gets the name of the current working directory. | ||
1689 | (a) If BUF is non-NULL, it is assumed to have room for SIZE wide characters. | ||
1690 | This function stores the working directory (NUL-terminated) in BUF and | ||
1691 | returns BUF. | ||
1692 | (b) If BUF is NULL, an array is allocated with 'malloc'. The array is SIZE | ||
1693 | wide characters long, unless SIZE == 0, in which case it is as big as | ||
1694 | necessary. | ||
1695 | If the directory couldn't be determined or SIZE was too small, this function | ||
1696 | returns NULL and sets errno. For a directory of length LEN, SIZE should be | ||
1697 | >= LEN + 3 in case (a) or >= LEN + 1 in case (b). | ||
1698 | Possible errno values include: | ||
1699 | - ERANGE if SIZE is too small. | ||
1700 | - ENOMEM if the memory could no be allocated. */ | ||
1701 | _GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size)); | ||
1702 | #endif | ||
1703 | |||
1704 | |||
1361 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | 1705 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ |
1362 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | 1706 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ |
1363 | #endif | 1707 | #endif |
diff --git a/gl/wcrtomb.c b/gl/wcrtomb.c index 48a6c8eb..197b020e 100644 --- a/gl/wcrtomb.c +++ b/gl/wcrtomb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert wide character to multibyte character. | 1 | /* Convert wide character to multibyte character. |
2 | Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -29,7 +29,7 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps) | |||
29 | #undef wcrtomb | 29 | #undef wcrtomb |
30 | { | 30 | { |
31 | /* This implementation of wcrtomb supports only stateless encodings. | 31 | /* This implementation of wcrtomb supports only stateless encodings. |
32 | ps must be in the initial state. */ | 32 | ps must be in an initial state. */ |
33 | if (ps != NULL && !mbsinit (ps)) | 33 | if (ps != NULL && !mbsinit (ps)) |
34 | { | 34 | { |
35 | errno = EINVAL; | 35 | errno = EINVAL; |
diff --git a/gl/wctype-h.c b/gl/wctype-h.c index 7d3e14a6..7e4ff13a 100644 --- a/gl/wctype-h.c +++ b/gl/wctype-h.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Inline functions for <wctype.h>. | 1 | /* Inline functions for <wctype.h>. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -20,4 +20,4 @@ | |||
20 | #include <config.h> | 20 | #include <config.h> |
21 | 21 | ||
22 | #define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE | 22 | #define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE |
23 | #include "wctype.h" | 23 | #include <wctype.h> |
diff --git a/gl/wctype-impl.h b/gl/wctype-impl.h new file mode 100644 index 00000000..26d68b41 --- /dev/null +++ b/gl/wctype-impl.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* Get descriptor for a wide character property. | ||
2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | wctype_t | ||
19 | wctype (const char* name) | ||
20 | { | ||
21 | switch (name[0]) | ||
22 | { | ||
23 | case 'a': | ||
24 | switch (name[1]) | ||
25 | { | ||
26 | case 'l': | ||
27 | switch (name[2]) | ||
28 | { | ||
29 | case 'n': | ||
30 | if (strcmp (name + 3, "um") == 0) | ||
31 | return (wctype_t) iswalnum; | ||
32 | break; | ||
33 | case 'p': | ||
34 | if (strcmp (name + 3, "ha") == 0) | ||
35 | return (wctype_t) iswalpha; | ||
36 | break; | ||
37 | default: | ||
38 | break; | ||
39 | } | ||
40 | break; | ||
41 | default: | ||
42 | break; | ||
43 | } | ||
44 | break; | ||
45 | case 'b': | ||
46 | if (strcmp (name + 1, "lank") == 0) | ||
47 | return (wctype_t) iswblank; | ||
48 | break; | ||
49 | case 'c': | ||
50 | if (strcmp (name + 1, "ntrl") == 0) | ||
51 | return (wctype_t) iswcntrl; | ||
52 | break; | ||
53 | case 'd': | ||
54 | if (strcmp (name + 1, "igit") == 0) | ||
55 | return (wctype_t) iswdigit; | ||
56 | break; | ||
57 | case 'g': | ||
58 | if (strcmp (name + 1, "raph") == 0) | ||
59 | return (wctype_t) iswgraph; | ||
60 | break; | ||
61 | case 'l': | ||
62 | if (strcmp (name + 1, "ower") == 0) | ||
63 | return (wctype_t) iswlower; | ||
64 | break; | ||
65 | case 'p': | ||
66 | switch (name[1]) | ||
67 | { | ||
68 | case 'r': | ||
69 | if (strcmp (name + 2, "int") == 0) | ||
70 | return (wctype_t) iswprint; | ||
71 | break; | ||
72 | case 'u': | ||
73 | if (strcmp (name + 2, "nct") == 0) | ||
74 | return (wctype_t) iswpunct; | ||
75 | break; | ||
76 | default: | ||
77 | break; | ||
78 | } | ||
79 | break; | ||
80 | case 's': | ||
81 | if (strcmp (name + 1, "pace") == 0) | ||
82 | return (wctype_t) iswspace; | ||
83 | break; | ||
84 | case 'u': | ||
85 | if (strcmp (name + 1, "pper") == 0) | ||
86 | return (wctype_t) iswupper; | ||
87 | break; | ||
88 | case 'x': | ||
89 | if (strcmp (name + 1, "digit") == 0) | ||
90 | return (wctype_t) iswxdigit; | ||
91 | break; | ||
92 | default: | ||
93 | break; | ||
94 | } | ||
95 | return NULL; | ||
96 | } | ||
diff --git a/gl/wctype.c b/gl/wctype.c new file mode 100644 index 00000000..914f6847 --- /dev/null +++ b/gl/wctype.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /* Get descriptor for a wide character property. | ||
2 | Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
3 | Written by Bruno Haible <bruno@clisp.org>, 2011. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #include <config.h> | ||
19 | |||
20 | /* Specification. */ | ||
21 | #include <wctype.h> | ||
22 | |||
23 | #include <string.h> | ||
24 | |||
25 | #include "wctype-impl.h" | ||
diff --git a/gl/wctype.in.h b/gl/wctype.in.h index f6e474d3..851c4f4e 100644 --- a/gl/wctype.in.h +++ b/gl/wctype.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. | 1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. |
2 | 2 | ||
3 | Copyright (C) 2006-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2006-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -44,6 +44,12 @@ | |||
44 | 44 | ||
45 | #ifndef _@GUARD_PREFIX@_WCTYPE_H | 45 | #ifndef _@GUARD_PREFIX@_WCTYPE_H |
46 | 46 | ||
47 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, | ||
48 | HAVE_RAW_DECL_*. */ | ||
49 | #if !_GL_CONFIG_H_INCLUDED | ||
50 | #error "Please include config.h first." | ||
51 | #endif | ||
52 | |||
47 | #if @HAVE_WINT_T@ | 53 | #if @HAVE_WINT_T@ |
48 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ | 54 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ |
49 | # include <wchar.h> | 55 | # include <wchar.h> |
@@ -68,9 +74,6 @@ | |||
68 | #ifndef _@GUARD_PREFIX@_WCTYPE_H | 74 | #ifndef _@GUARD_PREFIX@_WCTYPE_H |
69 | #define _@GUARD_PREFIX@_WCTYPE_H | 75 | #define _@GUARD_PREFIX@_WCTYPE_H |
70 | 76 | ||
71 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
72 | #error "Please include config.h first." | ||
73 | #endif | ||
74 | _GL_INLINE_HEADER_BEGIN | 77 | _GL_INLINE_HEADER_BEGIN |
75 | #ifndef _GL_WCTYPE_INLINE | 78 | #ifndef _GL_WCTYPE_INLINE |
76 | # define _GL_WCTYPE_INLINE _GL_INLINE | 79 | # define _GL_WCTYPE_INLINE _GL_INLINE |
@@ -78,6 +81,8 @@ _GL_INLINE_HEADER_BEGIN | |||
78 | 81 | ||
79 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 82 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
80 | 83 | ||
84 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
85 | |||
81 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 86 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
82 | 87 | ||
83 | /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which | 88 | /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which |
@@ -127,7 +132,8 @@ typedef unsigned int rpl_wint_t; | |||
127 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. | 132 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. |
128 | Linux libc5 has <wctype.h> and the functions but they are broken. | 133 | Linux libc5 has <wctype.h> and the functions but they are broken. |
129 | mingw and MSVC have <wctype.h> and the functions but they take a wchar_t | 134 | mingw and MSVC have <wctype.h> and the functions but they take a wchar_t |
130 | as argument, not an rpl_wint_t. | 135 | as argument, not an rpl_wint_t. Additionally, the mingw iswprint function |
136 | and the Android iswpunct function are broken. | ||
131 | Assume all 11 functions (all isw* except iswblank) are implemented the | 137 | Assume all 11 functions (all isw* except iswblank) are implemented the |
132 | same way, or not at all. */ | 138 | same way, or not at all. */ |
133 | # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ | 139 | # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ |
@@ -179,7 +185,11 @@ rpl_iswlower (wint_t wc) | |||
179 | _GL_WCTYPE_INLINE int | 185 | _GL_WCTYPE_INLINE int |
180 | rpl_iswprint (wint_t wc) | 186 | rpl_iswprint (wint_t wc) |
181 | { | 187 | { |
188 | # ifdef __MINGW32__ | ||
189 | return ((wchar_t) wc == wc ? wc == ' ' || iswgraph ((wchar_t) wc) : 0); | ||
190 | # else | ||
182 | return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); | 191 | return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); |
192 | # endif | ||
183 | } | 193 | } |
184 | 194 | ||
185 | _GL_WCTYPE_INLINE int | 195 | _GL_WCTYPE_INLINE int |
@@ -484,6 +494,16 @@ _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); | |||
484 | # endif | 494 | # endif |
485 | # endif | 495 | # endif |
486 | 496 | ||
497 | # if @GNULIB_ISWPUNCT@ | ||
498 | # if @REPLACE_ISWPUNCT@ | ||
499 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
500 | # undef iswpunct | ||
501 | # define iswpunct rpl_iswpunct | ||
502 | # endif | ||
503 | _GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc)); | ||
504 | # endif | ||
505 | # endif | ||
506 | |||
487 | # if @GNULIB_ISWXDIGIT@ | 507 | # if @GNULIB_ISWXDIGIT@ |
488 | # if @REPLACE_ISWXDIGIT@ | 508 | # if @REPLACE_ISWXDIGIT@ |
489 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 509 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
@@ -623,14 +643,32 @@ _GL_CXXALIASWARN (iswblank); | |||
623 | typedef void * wctype_t; | 643 | typedef void * wctype_t; |
624 | # define GNULIB_defined_wctype_t 1 | 644 | # define GNULIB_defined_wctype_t 1 |
625 | # endif | 645 | # endif |
646 | #elif @REPLACE_WCTYPE@ | ||
647 | # if !GNULIB_defined_wctype_t | ||
648 | typedef void *rpl_wctype_t; | ||
649 | # undef wctype_t | ||
650 | # define wctype_t rpl_wctype_t | ||
651 | # define GNULIB_defined_wctype_t 1 | ||
652 | # endif | ||
626 | #endif | 653 | #endif |
627 | 654 | ||
628 | /* Get a descriptor for a wide character property. */ | 655 | /* Get a descriptor for a wide character property. */ |
629 | #if @GNULIB_WCTYPE@ | 656 | #if @GNULIB_WCTYPE@ |
630 | # if !@HAVE_WCTYPE_T@ | 657 | # if @REPLACE_WCTYPE@ |
631 | _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); | 658 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
632 | # endif | 659 | # undef wctype |
660 | # define wctype rpl_wctype | ||
661 | # endif | ||
662 | _GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name) | ||
663 | _GL_ARG_NONNULL ((1))); | ||
664 | _GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name)); | ||
665 | # else | ||
666 | # if !@HAVE_WCTYPE_T@ | ||
667 | _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name) | ||
668 | _GL_ARG_NONNULL ((1))); | ||
669 | # endif | ||
633 | _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); | 670 | _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); |
671 | # endif | ||
634 | # if __GLIBC__ >= 2 | 672 | # if __GLIBC__ >= 2 |
635 | _GL_CXXALIASWARN (wctype); | 673 | _GL_CXXALIASWARN (wctype); |
636 | # endif | 674 | # endif |
@@ -646,7 +684,7 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - " | |||
646 | The argument WC must be either a wchar_t value or WEOF. | 684 | The argument WC must be either a wchar_t value or WEOF. |
647 | The argument DESC must have been returned by the wctype() function. */ | 685 | The argument DESC must have been returned by the wctype() function. */ |
648 | #if @GNULIB_ISWCTYPE@ | 686 | #if @GNULIB_ISWCTYPE@ |
649 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ | 687 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ || @REPLACE_WCTYPE@ |
650 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 688 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
651 | # undef iswctype | 689 | # undef iswctype |
652 | # define iswctype rpl_iswctype | 690 | # define iswctype rpl_iswctype |
@@ -687,14 +725,32 @@ _GL_CXXALIASWARN (towupper); | |||
687 | typedef void * wctrans_t; | 725 | typedef void * wctrans_t; |
688 | # define GNULIB_defined_wctrans_t 1 | 726 | # define GNULIB_defined_wctrans_t 1 |
689 | # endif | 727 | # endif |
728 | #elif @REPLACE_WCTRANS@ | ||
729 | # if !GNULIB_defined_wctrans_t | ||
730 | typedef void *rpl_wctrans_t; | ||
731 | # undef wctrans_t | ||
732 | # define wctrans_t rpl_wctrans_t | ||
733 | # define GNULIB_defined_wctrans_t 1 | ||
734 | # endif | ||
690 | #endif | 735 | #endif |
691 | 736 | ||
692 | /* Get a descriptor for a wide character case conversion. */ | 737 | /* Get a descriptor for a wide character case conversion. */ |
693 | #if @GNULIB_WCTRANS@ | 738 | #if @GNULIB_WCTRANS@ |
694 | # if !@HAVE_WCTRANS_T@ | 739 | # if @REPLACE_WCTRANS@ |
695 | _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); | 740 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
696 | # endif | 741 | # undef wctrans |
742 | # define wctrans rpl_wctrans | ||
743 | # endif | ||
744 | _GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name) | ||
745 | _GL_ARG_NONNULL ((1))); | ||
746 | _GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name)); | ||
747 | # else | ||
748 | # if !@HAVE_WCTRANS_T@ | ||
749 | _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name) | ||
750 | _GL_ARG_NONNULL ((1))); | ||
751 | # endif | ||
697 | _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); | 752 | _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); |
753 | # endif | ||
698 | # if __GLIBC__ >= 2 | 754 | # if __GLIBC__ >= 2 |
699 | _GL_CXXALIASWARN (wctrans); | 755 | _GL_CXXALIASWARN (wctrans); |
700 | # endif | 756 | # endif |
@@ -710,10 +766,19 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " | |||
710 | The argument WC must be either a wchar_t value or WEOF. | 766 | The argument WC must be either a wchar_t value or WEOF. |
711 | The argument DESC must have been returned by the wctrans() function. */ | 767 | The argument DESC must have been returned by the wctrans() function. */ |
712 | #if @GNULIB_TOWCTRANS@ | 768 | #if @GNULIB_TOWCTRANS@ |
713 | # if !@HAVE_WCTRANS_T@ | 769 | # if @REPLACE_WCTRANS@ |
770 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
771 | # undef towctrans | ||
772 | # define towctrans rpl_towctrans | ||
773 | # endif | ||
774 | _GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | ||
775 | _GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | ||
776 | # else | ||
777 | # if !@HAVE_WCTRANS_T@ | ||
714 | _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | 778 | _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); |
715 | # endif | 779 | # endif |
716 | _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | 780 | _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); |
781 | # endif | ||
717 | # if __GLIBC__ >= 2 | 782 | # if __GLIBC__ >= 2 |
718 | _GL_CXXALIASWARN (towctrans); | 783 | _GL_CXXALIASWARN (towctrans); |
719 | # endif | 784 | # endif |
diff --git a/gl/windows-initguard.h b/gl/windows-initguard.h index 9d36f53c..6bace3f0 100644 --- a/gl/windows-initguard.h +++ b/gl/windows-initguard.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Init guards, somewhat like spinlocks (native Windows implementation). | 1 | /* Init guards, somewhat like spinlocks (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-mutex.c b/gl/windows-mutex.c index ab7258c9..b112e13b 100644 --- a/gl/windows-mutex.c +++ b/gl/windows-mutex.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Plain mutexes (native Windows implementation). | 1 | /* Plain mutexes (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-mutex.h b/gl/windows-mutex.h index 039eb707..88de4bdc 100644 --- a/gl/windows-mutex.h +++ b/gl/windows-mutex.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Plain mutexes (native Windows implementation). | 1 | /* Plain mutexes (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-once.c b/gl/windows-once.c index 0d28281f..17854f5c 100644 --- a/gl/windows-once.c +++ b/gl/windows-once.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Once-only control (native Windows implementation). | 1 | /* Once-only control (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-once.h b/gl/windows-once.h index 54885680..c5bbcd57 100644 --- a/gl/windows-once.h +++ b/gl/windows-once.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Once-only control (native Windows implementation). | 1 | /* Once-only control (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-recmutex.c b/gl/windows-recmutex.c index a8ce9a04..e5672baf 100644 --- a/gl/windows-recmutex.c +++ b/gl/windows-recmutex.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Plain recursive mutexes (native Windows implementation). | 1 | /* Plain recursive mutexes (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-recmutex.h b/gl/windows-recmutex.h index 08ff4597..9fa445b3 100644 --- a/gl/windows-recmutex.h +++ b/gl/windows-recmutex.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Plain recursive mutexes (native Windows implementation). | 1 | /* Plain recursive mutexes (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-rwlock.c b/gl/windows-rwlock.c index 7cbd7bb1..e60c4efc 100644 --- a/gl/windows-rwlock.c +++ b/gl/windows-rwlock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Read-write locks (native Windows implementation). | 1 | /* Read-write locks (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/windows-rwlock.h b/gl/windows-rwlock.h index fe8381e8..08d67750 100644 --- a/gl/windows-rwlock.h +++ b/gl/windows-rwlock.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Read-write locks (native Windows implementation). | 1 | /* Read-write locks (native Windows implementation). |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
diff --git a/gl/xalloc-die.c b/gl/xalloc-die.c index 7605eee1..c053c7a8 100644 --- a/gl/xalloc-die.c +++ b/gl/xalloc-die.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Report a memory allocation failure and exit. | 1 | /* Report a memory allocation failure and exit. |
2 | 2 | ||
3 | Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2023 Free Software | 3 | Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2024 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | 24 | ||
25 | #include "error.h" | 25 | #include <error.h> |
26 | #include "exitfail.h" | 26 | #include "exitfail.h" |
27 | 27 | ||
28 | #include "gettext.h" | 28 | #include "gettext.h" |
diff --git a/gl/xalloc-oversized.h b/gl/xalloc-oversized.h index 5dbdfb55..7f30f83e 100644 --- a/gl/xalloc-oversized.h +++ b/gl/xalloc-oversized.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* xalloc-oversized.h -- memory allocation size checking | 1 | /* xalloc-oversized.h -- memory allocation size checking |
2 | 2 | ||
3 | Copyright (C) 1990-2000, 2003-2004, 2006-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -29,8 +29,7 @@ | |||
29 | is SIZE_MAX - 1. */ | 29 | is SIZE_MAX - 1. */ |
30 | #define __xalloc_oversized(n, s) \ | 30 | #define __xalloc_oversized(n, s) \ |
31 | ((s) != 0 \ | 31 | ((s) != 0 \ |
32 | && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ | 32 | && (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) |
33 | < (n))) | ||
34 | 33 | ||
35 | /* Return 1 if and only if an array of N objects, each of size S, | 34 | /* Return 1 if and only if an array of N objects, each of size S, |
36 | cannot exist reliably because its total size in bytes would exceed | 35 | cannot exist reliably because its total size in bytes would exceed |
@@ -48,13 +47,13 @@ | |||
48 | #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX | 47 | #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX |
49 | # define xalloc_oversized(n, s) \ | 48 | # define xalloc_oversized(n, s) \ |
50 | __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) | 49 | __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) |
51 | #elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ | 50 | #elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX |
52 | && PTRDIFF_MAX < SIZE_MAX) | ||
53 | # define xalloc_oversized(n, s) \ | 51 | # define xalloc_oversized(n, s) \ |
54 | (__builtin_constant_p (n) && __builtin_constant_p (s) \ | 52 | (__builtin_constant_p (n) && __builtin_constant_p (s) \ |
55 | ? __xalloc_oversized (n, s) \ | 53 | ? __xalloc_oversized (n, s) \ |
56 | : ({ ptrdiff_t __xalloc_count; \ | 54 | : __extension__ \ |
57 | __builtin_mul_overflow (n, s, &__xalloc_count); })) | 55 | ({ ptrdiff_t __xalloc_count; \ |
56 | __builtin_mul_overflow (n, s, &__xalloc_count); })) | ||
58 | 57 | ||
59 | /* Other compilers use integer division; this may be slower but is | 58 | /* Other compilers use integer division; this may be slower but is |
60 | more portable. */ | 59 | more portable. */ |
diff --git a/gl/xalloc.h b/gl/xalloc.h index f373c2fe..75a5db30 100644 --- a/gl/xalloc.h +++ b/gl/xalloc.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* xalloc.h -- malloc with out-of-memory checking | 1 | /* xalloc.h -- malloc with out-of-memory checking |
2 | 2 | ||
3 | Copyright (C) 1990-2000, 2003-2004, 2006-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
@@ -18,6 +18,13 @@ | |||
18 | #ifndef XALLOC_H_ | 18 | #ifndef XALLOC_H_ |
19 | #define XALLOC_H_ | 19 | #define XALLOC_H_ |
20 | 20 | ||
21 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _Noreturn, | ||
22 | _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_MALLOC, | ||
23 | _GL_ATTRIBUTE_RETURNS_NONNULL. */ | ||
24 | #if !_GL_CONFIG_H_INCLUDED | ||
25 | #error "Please include config.h first." | ||
26 | #endif | ||
27 | |||
21 | #include <stddef.h> | 28 | #include <stddef.h> |
22 | #include <stdlib.h> | 29 | #include <stdlib.h> |
23 | 30 | ||
@@ -25,9 +32,6 @@ | |||
25 | # include "idx.h" | 32 | # include "idx.h" |
26 | #endif | 33 | #endif |
27 | 34 | ||
28 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
29 | #error "Please include config.h first." | ||
30 | #endif | ||
31 | _GL_INLINE_HEADER_BEGIN | 35 | _GL_INLINE_HEADER_BEGIN |
32 | #ifndef XALLOC_INLINE | 36 | #ifndef XALLOC_INLINE |
33 | # define XALLOC_INLINE _GL_INLINE | 37 | # define XALLOC_INLINE _GL_INLINE |
@@ -46,7 +50,7 @@ extern "C" { | |||
46 | or by using gnulib's xalloc-die module. This is the | 50 | or by using gnulib's xalloc-die module. This is the |
47 | function to call when one wants the program to die because of a | 51 | function to call when one wants the program to die because of a |
48 | memory allocation failure. */ | 52 | memory allocation failure. */ |
49 | /*extern*/ _Noreturn void xalloc_die (void); | 53 | _Noreturn void xalloc_die (void); |
50 | 54 | ||
51 | #endif /* GNULIB_XALLOC_DIE */ | 55 | #endif /* GNULIB_XALLOC_DIE */ |
52 | 56 | ||
diff --git a/gl/xmalloc.c b/gl/xmalloc.c index 289cbd05..5befdab7 100644 --- a/gl/xmalloc.c +++ b/gl/xmalloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* xmalloc.c -- malloc with out of memory checking | 1 | /* xmalloc.c -- malloc with out of memory checking |
2 | 2 | ||
3 | Copyright (C) 1990-2000, 2002-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1990-2000, 2002-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
@@ -30,7 +30,7 @@ | |||
30 | #include <string.h> | 30 | #include <string.h> |
31 | 31 | ||
32 | static void * _GL_ATTRIBUTE_PURE | 32 | static void * _GL_ATTRIBUTE_PURE |
33 | nonnull (void *p) | 33 | check_nonnull (void *p) |
34 | { | 34 | { |
35 | if (!p) | 35 | if (!p) |
36 | xalloc_die (); | 36 | xalloc_die (); |
@@ -42,13 +42,13 @@ nonnull (void *p) | |||
42 | void * | 42 | void * |
43 | xmalloc (size_t s) | 43 | xmalloc (size_t s) |
44 | { | 44 | { |
45 | return nonnull (malloc (s)); | 45 | return check_nonnull (malloc (s)); |
46 | } | 46 | } |
47 | 47 | ||
48 | void * | 48 | void * |
49 | ximalloc (idx_t s) | 49 | ximalloc (idx_t s) |
50 | { | 50 | { |
51 | return nonnull (imalloc (s)); | 51 | return check_nonnull (imalloc (s)); |
52 | } | 52 | } |
53 | 53 | ||
54 | char * | 54 | char * |
@@ -72,7 +72,7 @@ xrealloc (void *p, size_t s) | |||
72 | void * | 72 | void * |
73 | xirealloc (void *p, idx_t s) | 73 | xirealloc (void *p, idx_t s) |
74 | { | 74 | { |
75 | return nonnull (irealloc (p, s)); | 75 | return check_nonnull (irealloc (p, s)); |
76 | } | 76 | } |
77 | 77 | ||
78 | /* Change the size of an allocated block of memory P to an array of N | 78 | /* Change the size of an allocated block of memory P to an array of N |
@@ -90,7 +90,7 @@ xreallocarray (void *p, size_t n, size_t s) | |||
90 | void * | 90 | void * |
91 | xireallocarray (void *p, idx_t n, idx_t s) | 91 | xireallocarray (void *p, idx_t n, idx_t s) |
92 | { | 92 | { |
93 | return nonnull (ireallocarray (p, n, s)); | 93 | return check_nonnull (ireallocarray (p, n, s)); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* Allocate an array of N objects, each with S bytes of memory, | 96 | /* Allocate an array of N objects, each with S bytes of memory, |
@@ -295,13 +295,13 @@ xizalloc (idx_t s) | |||
295 | void * | 295 | void * |
296 | xcalloc (size_t n, size_t s) | 296 | xcalloc (size_t n, size_t s) |
297 | { | 297 | { |
298 | return nonnull (calloc (n, s)); | 298 | return check_nonnull (calloc (n, s)); |
299 | } | 299 | } |
300 | 300 | ||
301 | void * | 301 | void * |
302 | xicalloc (idx_t n, idx_t s) | 302 | xicalloc (idx_t n, idx_t s) |
303 | { | 303 | { |
304 | return nonnull (icalloc (n, s)); | 304 | return check_nonnull (icalloc (n, s)); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* Clone an object P of size S, with error checking. There's no need | 307 | /* Clone an object P of size S, with error checking. There's no need |
@@ -1,6 +1,6 @@ | |||
1 | /* Checked size_t computations. | 1 | /* Checked size_t computations. |
2 | 2 | ||
3 | Copyright (C) 2012-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -1,6 +1,6 @@ | |||
1 | /* xsize.h -- Checked size_t computations. | 1 | /* xsize.h -- Checked size_t computations. |
2 | 2 | ||
3 | Copyright (C) 2003, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,6 +18,11 @@ | |||
18 | #ifndef _XSIZE_H | 18 | #ifndef _XSIZE_H |
19 | #define _XSIZE_H | 19 | #define _XSIZE_H |
20 | 20 | ||
21 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_STDINT_H. */ | ||
22 | #if !_GL_CONFIG_H_INCLUDED | ||
23 | #error "Please include config.h first." | ||
24 | #endif | ||
25 | |||
21 | /* Get size_t. */ | 26 | /* Get size_t. */ |
22 | #include <stddef.h> | 27 | #include <stddef.h> |
23 | 28 | ||
@@ -30,14 +35,16 @@ | |||
30 | /* Get ATTRIBUTE_PURE. */ | 35 | /* Get ATTRIBUTE_PURE. */ |
31 | #include "attribute.h" | 36 | #include "attribute.h" |
32 | 37 | ||
33 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
34 | #error "Please include config.h first." | ||
35 | #endif | ||
36 | _GL_INLINE_HEADER_BEGIN | 38 | _GL_INLINE_HEADER_BEGIN |
37 | #ifndef XSIZE_INLINE | 39 | #ifndef XSIZE_INLINE |
38 | # define XSIZE_INLINE _GL_INLINE | 40 | # define XSIZE_INLINE _GL_INLINE |
39 | #endif | 41 | #endif |
40 | 42 | ||
43 | #ifdef __cplusplus | ||
44 | extern "C" { | ||
45 | #endif | ||
46 | |||
47 | |||
41 | /* The size of memory objects is often computed through expressions of | 48 | /* The size of memory objects is often computed through expressions of |
42 | type size_t. Example: | 49 | type size_t. Example: |
43 | void* p = malloc (header_size + n * element_size). | 50 | void* p = malloc (header_size + n * element_size). |
@@ -103,6 +110,11 @@ xmax (size_t size1, size_t size2) | |||
103 | #define size_in_bounds_p(SIZE) \ | 110 | #define size_in_bounds_p(SIZE) \ |
104 | ((SIZE) != SIZE_MAX) | 111 | ((SIZE) != SIZE_MAX) |
105 | 112 | ||
113 | |||
114 | #ifdef __cplusplus | ||
115 | } | ||
116 | #endif | ||
117 | |||
106 | _GL_INLINE_HEADER_END | 118 | _GL_INLINE_HEADER_END |
107 | 119 | ||
108 | #endif /* _XSIZE_H */ | 120 | #endif /* _XSIZE_H */ |