commit 4e7e340ee50ab179d4c965fd3d9fab4df82a9d3a (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Tue Nov 25 22:19:31 2025 -0800 Port to glibc 2.43+ with GCC 15+ Port to planned glibc 2.43 (scheduled for February 2026), which will support qualifier-generic standard functions; see: https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690 For example, strchr (P, C) will return pointer to const if P is pointer to const. The idea is to catch dumb programming errors when a program mistakenly uses strchr to convert a pointer to const to an unrestricted pointer. This feature is required by C23, and will be enabled by default in GCC 15. * src/callint.c (Fcall_interactively): Respect constness of pointer when calling memchr. * src/gtkutil.c (xg_get_font): 2nd arg is char *, not const char *. * src/xfaces.c (parse_float_color_comp): Return bool, not double. New arg DST. All callers changed. This makes it easier for callers to use char const *. (parse_color_spec): Respect constness of pointer when calling strchr. diff --git a/src/callint.c b/src/callint.c index e0246e5d594..ee06e6973f2 100644 --- a/src/callint.c +++ b/src/callint.c @@ -450,7 +450,7 @@ invoke it (via an `interactive' spec that contains, for instance, an char const *tem = string; for (ptrdiff_t i = 2; tem < string_end; i++) { - char *pnl = memchr (tem + 1, '\n', string_len - (tem + 1 - string)); + char const *pnl = memchr (tem + 1, '\n', string_len - (tem + 1 - string)); ptrdiff_t sz = pnl ? pnl - (tem + 1) : string_end - (tem + 1); visargs[1] = make_string (tem + 1, sz); diff --git a/src/gtkutil.c b/src/gtkutil.c index a8e65f7cb0f..7ad6c7ce8c4 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2894,10 +2894,11 @@ xg_font_filter (const PangoFontFamily *family, `FAMILY [VALUE1 VALUE2] SIZE' This can be parsed using font_parse_fcname in font.c. - DEFAULT_NAME, if non-zero, is the default font name. */ + DEFAULT_NAME, if non-null, is the default font name; + it might be updated in place. */ Lisp_Object -xg_get_font (struct frame *f, const char *default_name) +xg_get_font (struct frame *f, char *default_name) { GtkWidget *w; int done = 0; diff --git a/src/gtkutil.h b/src/gtkutil.h index cabf88da73f..e6c1e19c765 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -91,7 +91,7 @@ extern char *xg_get_file_name (struct frame *f, bool mustmatch_p, bool only_dir_p); -extern Lisp_Object xg_get_font (struct frame *f, const char *); +extern Lisp_Object xg_get_font (struct frame *f, char *); extern GtkWidget *xg_create_widget (const char *type, const char *name, diff --git a/src/xfaces.c b/src/xfaces.c index 83d4c3f1f2c..b0052cdd455 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -950,19 +950,25 @@ parse_hex_color_comp (const char *s, const char *e, unsigned short *dst) } /* Parse floating-point color component specification that starts at S - and ends right before E. Return the parsed number if in the range - [0,1]; otherwise return -1. */ -static double -parse_float_color_comp (const char *s, const char *e) + and ends right before E. Put the integer near-equivalent of that + into *DST. Return true if successful, false otherwise. */ +static bool +parse_float_color_comp (const char *s, const char *e, unsigned short *dst) { /* Only allow decimal float literals without whitespace. */ for (const char *p = s; p < e; p++) if (!((*p >= '0' && *p <= '9') || *p == '.' || *p == '+' || *p == '-' || *p == 'e' || *p == 'E')) - return -1; + return false; char *end; double x = strtod (s, &end); - return (end == e && x >= 0 && x <= 1) ? x : -1; + if (end == e && 0 <= x && x <= 1) + { + *dst = lrint (x * 65535); + return true; + } + else + return false; } /* Parse SPEC as a numeric color specification and set *R, *G and *B. @@ -997,28 +1003,25 @@ parse_color_spec (const char *spec, } else if (strncmp (spec, "rgb:", 4) == 0) { - char *sep1, *sep2; - return ((sep1 = strchr (spec + 4, '/')) != NULL - && (sep2 = strchr (sep1 + 1, '/')) != NULL + char const *sep1 = strchr (spec + 4, '/'); + if (!sep1) + return false; + char const *sep2 = strchr (sep1 + 1, '/'); + return (sep2 && parse_hex_color_comp (spec + 4, sep1, r) && parse_hex_color_comp (sep1 + 1, sep2, g) && parse_hex_color_comp (sep2 + 1, spec + len, b)); } else if (strncmp (spec, "rgbi:", 5) == 0) { - char *sep1, *sep2; - double red, green, blue; - if ((sep1 = strchr (spec + 5, '/')) != NULL - && (sep2 = strchr (sep1 + 1, '/')) != NULL - && (red = parse_float_color_comp (spec + 5, sep1)) >= 0 - && (green = parse_float_color_comp (sep1 + 1, sep2)) >= 0 - && (blue = parse_float_color_comp (sep2 + 1, spec + len)) >= 0) - { - *r = lrint (red * 65535); - *g = lrint (green * 65535); - *b = lrint (blue * 65535); - return true; - } + char const *sep1 = strchr (spec + 5, '/'); + if (!sep1) + return false; + char const *sep2 = strchr (sep1 + 1, '/'); + return (sep2 + && parse_float_color_comp (spec + 5, sep1, r) + && parse_float_color_comp (sep1 + 1, sep2, g) + && parse_float_color_comp (sep2 + 1, spec + len, b)); } return false; } commit 8cdc8a51efdcaefe3632370e7c3ce9c0cfe77e9d Author: Paul Eggert Date: Tue Nov 25 22:13:37 2025 -0800 Update from Gnulib by running admin/merge-gnulib diff --git a/lib/c++defs.h b/lib/c++defs.h index b77979a3259..b887cc3fb80 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -127,6 +127,16 @@ #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. @@ -139,7 +149,7 @@ _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ - _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func diff --git a/lib/dirent.in.h b/lib/dirent.in.h index e6c59e5a41d..2fa347f1d16 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -173,7 +173,6 @@ _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); # endif _GL_CXXALIASWARN (closedir); #elif defined GNULIB_POSIXCHECK -# undef closedir # if HAVE_RAW_DECL_CLOSEDIR _GL_WARN_ON_USE (closedir, "closedir is not portable - " "use gnulib module closedir for portability"); @@ -213,7 +212,6 @@ _GL_FUNCDECL_SYS (opendir, DIR *, _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef opendir # if HAVE_RAW_DECL_OPENDIR _GL_WARN_ON_USE (opendir, "opendir is not portable - " "use gnulib module opendir for portability"); @@ -237,7 +235,6 @@ _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); # endif _GL_CXXALIASWARN (readdir); #elif defined GNULIB_POSIXCHECK -# undef readdir # if HAVE_RAW_DECL_READDIR _GL_WARN_ON_USE (readdir, "readdir is not portable - " "use gnulib module readdir for portability"); @@ -260,7 +257,6 @@ _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); # endif _GL_CXXALIASWARN (rewinddir); #elif defined GNULIB_POSIXCHECK -# undef rewinddir # if HAVE_RAW_DECL_REWINDDIR _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " "use gnulib module rewinddir for portability"); @@ -293,7 +289,6 @@ _GL_CXXALIAS_SYS (dirfd, int, (DIR *)); # endif _GL_CXXALIASWARN (dirfd); #elif defined GNULIB_POSIXCHECK -# undef dirfd # if HAVE_RAW_DECL_DIRFD _GL_WARN_ON_USE (dirfd, "dirfd is unportable - " "use gnulib module dirfd for portability"); @@ -335,7 +330,6 @@ _GL_FUNCDECL_SYS (fdopendir, DIR *, _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef fdopendir # if HAVE_RAW_DECL_FDOPENDIR _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " "use gnulib module fdopendir for portability"); @@ -363,7 +357,6 @@ _GL_CXXALIAS_SYS_CAST (scandir, int, int (*cmp) (const struct dirent **, const struct dirent **))); _GL_CXXALIASWARN (scandir); #elif defined GNULIB_POSIXCHECK -# undef scandir # if HAVE_RAW_DECL_SCANDIR _GL_WARN_ON_USE (scandir, "scandir is unportable - " "use gnulib module scandir for portability"); @@ -384,7 +377,6 @@ _GL_CXXALIAS_SYS_CAST (alphasort, int, (const struct dirent **, const struct dirent **)); _GL_CXXALIASWARN (alphasort); #elif defined GNULIB_POSIXCHECK -# undef alphasort # if HAVE_RAW_DECL_ALPHASORT _GL_WARN_ON_USE (alphasort, "alphasort is unportable - " "use gnulib module alphasort for portability"); diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index bcb5606b13e..a27cc4620e0 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -122,7 +122,6 @@ _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (creat); #elif defined GNULIB_POSIXCHECK -# undef creat /* Assume creat is always declared. */ _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " "use gnulib module creat for portability"); @@ -165,7 +164,6 @@ _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); # endif _GL_CXXALIASWARN (fcntl); #elif defined GNULIB_POSIXCHECK -# undef fcntl # if HAVE_RAW_DECL_FCNTL _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " "use gnulib module fcntl for portability"); @@ -196,7 +194,6 @@ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); _GL_CXXALIASWARN (open); # endif #elif defined GNULIB_POSIXCHECK -# undef open /* Assume open is always declared. */ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " "use gnulib module open for portability"); @@ -242,7 +239,6 @@ _GL_CXXALIAS_SYS (openat, int, # endif _GL_CXXALIASWARN (openat); #elif defined GNULIB_POSIXCHECK -# undef openat # if HAVE_RAW_DECL_OPENAT _GL_WARN_ON_USE (openat, "openat is not portable - " "use gnulib module openat for portability"); @@ -283,7 +279,6 @@ _GL_CXXALIAS_SYS (openat2, int, size_t size)); _GL_CXXALIASWARN (openat2); #elif defined GNULIB_POSIXCHECK -# undef openat2 # if HAVE_RAW_DECL_OPENAT2 _GL_WARN_ON_USE (openat2, "openat2 is not portable - " "use gnulib module openat2 for portability"); diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 5520ebc5699..26d4b27b834 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -925,7 +925,6 @@ _GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x)); _GL_CXXALIASWARN (imaxabs); # endif #elif defined GNULIB_POSIXCHECK -# undef imaxabs # if HAVE_RAW_DECL_IMAXABS _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " "use gnulib module imaxabs for portability"); @@ -956,7 +955,6 @@ _GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); _GL_CXXALIASWARN (imaxdiv); # endif #elif defined GNULIB_POSIXCHECK -# undef imaxdiv # if HAVE_RAW_DECL_IMAXDIV _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " "use gnulib module imaxdiv for portability"); @@ -986,7 +984,6 @@ _GL_CXXALIAS_SYS (strtoimax, intmax_t, # endif _GL_CXXALIASWARN (strtoimax); #elif defined GNULIB_POSIXCHECK -# undef strtoimax # if HAVE_RAW_DECL_STRTOIMAX _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " "use gnulib module strtoimax for portability"); @@ -1016,7 +1013,6 @@ _GL_CXXALIAS_SYS (strtoumax, uintmax_t, # endif _GL_CXXALIASWARN (strtoumax); #elif defined GNULIB_POSIXCHECK -# undef strtoumax # if HAVE_RAW_DECL_STRTOUMAX _GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " "use gnulib module strtoumax for portability"); diff --git a/lib/signal.in.h b/lib/signal.in.h index 66e0c310ef8..45556dbbc4f 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -156,7 +156,6 @@ _GL_CXXALIAS_SYS (sig2str, int, (int signo, char *str)); _GL_CXXALIASWARN (sig2str); # endif #elif defined GNULIB_POSIXCHECK -# undef sig2str # if HAVE_RAW_DECL_SIG2STR _GL_WARN_ON_USE (sig2str, "sig2str is not portable - " "use gnulib module sig2str for portability"); @@ -172,7 +171,6 @@ _GL_CXXALIAS_SYS (str2sig, int, (char const *str, int *signo_p)); _GL_CXXALIASWARN (str2sig); # endif #elif defined GNULIB_POSIXCHECK -# undef str2sig # if HAVE_RAW_DECL_STR2SIG _GL_WARN_ON_USE (str2sig, "str2sig is not portable - " "use gnulib module sig2str for portability"); @@ -210,7 +208,6 @@ _GL_CXXALIAS_SYS (pthread_sigmask, int, _GL_CXXALIASWARN (pthread_sigmask); # endif #elif defined GNULIB_POSIXCHECK -# undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " "use gnulib module pthread_sigmask for portability"); @@ -236,7 +233,6 @@ _GL_CXXALIAS_SYS (raise, int, (int sig)); _GL_CXXALIASWARN (raise); # endif #elif defined GNULIB_POSIXCHECK -# undef raise /* Assume raise is always declared. */ _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " "use gnulib module raise for portability"); @@ -407,37 +403,30 @@ _GL_EXTERN_C int _gl_raise_SIGPIPE (void); # endif #elif defined GNULIB_POSIXCHECK -# undef sigaddset # if HAVE_RAW_DECL_SIGADDSET _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigdelset # if HAVE_RAW_DECL_SIGDELSET _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigemptyset # if HAVE_RAW_DECL_SIGEMPTYSET _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigfillset # if HAVE_RAW_DECL_SIGFILLSET _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigismember # if HAVE_RAW_DECL_SIGISMEMBER _GL_WARN_ON_USE (sigismember, "sigismember is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigpending # if HAVE_RAW_DECL_SIGPENDING _GL_WARN_ON_USE (sigpending, "sigpending is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigprocmask # if HAVE_RAW_DECL_SIGPROCMASK _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " "use the gnulib module sigprocmask for portability"); @@ -523,7 +512,6 @@ _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, _GL_CXXALIASWARN (sigaction); #elif defined GNULIB_POSIXCHECK -# undef sigaction # if HAVE_RAW_DECL_SIGACTION _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " "use the gnulib module sigaction for portability"); diff --git a/lib/stdio.in.h b/lib/stdio.in.h index cc6010119d0..c2af4f6dffc 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -338,7 +338,7 @@ _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); _GL_CXXALIASWARN (dprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef dprintf +# undef dprintf /* https://lists.gnu.org/r/bug-gnulib/2025-11/msg00254.html */ # if HAVE_RAW_DECL_DPRINTF _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " "use gnulib module dprintf for portability"); @@ -360,7 +360,6 @@ _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); _GL_CXXALIASWARN (fclose); # endif #elif defined GNULIB_POSIXCHECK -# undef fclose /* Assume fclose is always declared. */ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); @@ -447,7 +446,6 @@ _GL_FUNCDECL_SYS (fdopen, FILE *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); @@ -488,7 +486,6 @@ _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fflush); # endif #elif defined GNULIB_POSIXCHECK -# undef fflush /* Assume fflush is always declared. */ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); @@ -581,7 +578,6 @@ _GL_FUNCDECL_SYS (fopen, FILE *, _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); @@ -641,9 +637,6 @@ _GL_CXXALIASWARN (fprintf); # endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_fprintf -# undef fprintf -# endif /* Assume fprintf is always declared. */ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " "use gnulib module fprintf-posix for portable " @@ -673,7 +666,6 @@ _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fpurge); # endif #elif defined GNULIB_POSIXCHECK -# undef fpurge # if HAVE_RAW_DECL_FPURGE _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " "use gnulib module fpurge for portability"); @@ -761,7 +753,6 @@ _GL_CXXALIAS_SYS (freopen, FILE *, _GL_CXXALIASWARN (freopen); # endif #elif defined GNULIB_POSIXCHECK -# undef freopen /* Assume freopen is always declared. */ _GL_WARN_ON_USE (freopen, "freopen on native Windows platforms is not POSIX compliant - " @@ -868,7 +859,6 @@ _GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek -# undef fseeko # if HAVE_RAW_DECL_FSEEKO _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " "use gnulib module fseeko for portability"); @@ -932,7 +922,6 @@ _GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell -# undef ftello # if HAVE_RAW_DECL_FTELLO _GL_WARN_ON_USE (ftello, "ftello is unportable - " "use gnulib module ftello for portability"); @@ -1081,7 +1070,6 @@ _GL_CXXALIAS_SYS (getdelim, ssize_t, _GL_CXXALIASWARN (getdelim); # endif #elif defined GNULIB_POSIXCHECK -# undef getdelim # if HAVE_RAW_DECL_GETDELIM _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " "use gnulib module getdelim for portability"); @@ -1135,7 +1123,6 @@ _GL_CXXALIAS_SYS (getline, ssize_t, _GL_CXXALIASWARN (getline); # endif #elif defined GNULIB_POSIXCHECK -# undef getline # if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is unportable - " "use gnulib module getline for portability"); @@ -1145,7 +1132,6 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " /* It is very rare that the developer ever has full control of stdin, so any use of gets warrants an unconditional warning; besides, C11 removed it. */ -#undef gets #if HAVE_RAW_DECL_GETS && !defined __cplusplus _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif @@ -1258,7 +1244,6 @@ _GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); #elif defined GNULIB_POSIXCHECK -# undef pclose # if HAVE_RAW_DECL_PCLOSE _GL_WARN_ON_USE (pclose, "pclose is unportable - " "use gnulib module pclose for more portability"); @@ -1282,7 +1267,6 @@ _GL_CXXALIAS_SYS (perror, void, (const char *string)); _GL_CXXALIASWARN (perror); # endif #elif defined GNULIB_POSIXCHECK -# undef perror /* Assume perror is always declared. */ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " "use gnulib module perror for portability"); @@ -1319,7 +1303,6 @@ _GL_FUNCDECL_SYS (popen, FILE *, _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef popen # if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); @@ -1392,9 +1375,6 @@ _GL_CXXALIASWARN (printf); # endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_printf -# undef printf -# endif /* Assume printf is always declared. */ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " "use gnulib module printf-posix for portable " @@ -1488,7 +1468,6 @@ _GL_CXXALIAS_SYS (remove, int, (const char *name)); _GL_CXXALIASWARN (remove); # endif #elif defined GNULIB_POSIXCHECK -# undef remove /* Assume remove is always declared. */ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " "use gnulib module remove for more portability"); @@ -1513,7 +1492,6 @@ _GL_CXXALIAS_SYS (rename, int, _GL_CXXALIASWARN (rename); # endif #elif defined GNULIB_POSIXCHECK -# undef rename /* Assume rename is always declared. */ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " "use gnulib module rename for more portability"); @@ -1541,7 +1519,6 @@ _GL_CXXALIAS_SYS (renameat, int, # endif _GL_CXXALIASWARN (renameat); #elif defined GNULIB_POSIXCHECK -# undef renameat # if HAVE_RAW_DECL_RENAMEAT _GL_WARN_ON_USE (renameat, "renameat is not portable - " "use gnulib module renameat for portability"); @@ -1635,7 +1612,6 @@ _GL_CXXALIAS_SYS (snprintf, int, _GL_CXXALIASWARN (snprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef snprintf # if HAVE_RAW_DECL_SNPRINTF _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " "use gnulib module snprintf for portability"); @@ -1691,7 +1667,6 @@ _GL_CXXALIAS_SYS (sprintf, int, _GL_CXXALIASWARN (sprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef sprintf /* Assume sprintf is always declared. */ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " "use gnulib module sprintf-posix for portable " @@ -1746,7 +1721,6 @@ _GL_FUNCDECL_SYS (tmpfile, FILE *, (void), _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef tmpfile # if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); @@ -1880,7 +1854,6 @@ _GL_CXXALIAS_SYS_CAST (vdprintf, int, _GL_CXXALIASWARN (vdprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vdprintf # if HAVE_RAW_DECL_VDPRINTF _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " "use gnulib module vdprintf for portability"); @@ -1949,9 +1922,6 @@ _GL_CXXALIASWARN (vfprintf); # endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vfprintf -# undef vfprintf -# endif /* Assume vfprintf is always declared. */ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "use gnulib module vfprintf-posix for portable " @@ -2035,9 +2005,6 @@ _GL_CXXALIASWARN (vprintf); # endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vprintf -# undef vprintf -# endif /* Assume vprintf is always declared. */ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "use gnulib module vprintf-posix for portable " @@ -2116,7 +2083,6 @@ _GL_CXXALIAS_SYS (vsnprintf, int, _GL_CXXALIASWARN (vsnprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsnprintf # if HAVE_RAW_DECL_VSNPRINTF _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " "use gnulib module vsnprintf for portability"); @@ -2169,7 +2135,6 @@ _GL_CXXALIAS_SYS_CAST (vsprintf, int, _GL_CXXALIASWARN (vsprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsprintf /* Assume vsprintf is always declared. */ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "use gnulib module vsprintf-posix for portable " diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index bef0aaaf92e..b5ad275e5d6 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -224,9 +224,9 @@ _GL_INLINE_HEADER_BEGIN /* Declarations for ISO C N3322. */ #if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ -_GL_EXTERN_C void *bsearch (const void *__key, - const void *__base, size_t __nmemb, size_t __size, - int (*__compare) (const void *, const void *)) +_GL_EXTERN_C void *_GL_FUNCDECL_SYS_NAME (bsearch) + (const void *__key, const void *__base, size_t __nmemb, size_t __size, + int (*__compare) (const void *, const void *)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5)); _GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size, int (*__compare) (const void *, const void *)) @@ -254,7 +254,6 @@ _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); # endif #elif defined GNULIB_POSIXCHECK -# undef _Exit # if HAVE_RAW_DECL__EXIT _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " "use gnulib module _Exit for portability"); @@ -301,7 +300,6 @@ _GL_CXXALIAS_SYS (free, void, (void *ptr)); _GL_CXXALIASWARN (free); # endif #elif defined GNULIB_POSIXCHECK -# undef free /* Assume free is always declared. */ _GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - " "use gnulib module free-posix for portability"); @@ -359,7 +357,6 @@ _GL_FUNCDECL_SYS (aligned_alloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef aligned_alloc # if HAVE_RAW_DECL_ALIGNED_ALLOC _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " "use gnulib module aligned_alloc for portability"); @@ -379,7 +376,6 @@ _GL_FUNCDECL_SYS (atoll, long long, _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); #elif defined GNULIB_POSIXCHECK -# undef atoll # if HAVE_RAW_DECL_ATOLL _GL_WARN_ON_USE (atoll, "atoll is unportable - " "use gnulib module atoll for portability"); @@ -436,7 +432,6 @@ _GL_FUNCDECL_SYS (calloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef calloc /* Assume calloc is always declared. */ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " "use gnulib module calloc-posix for portability"); @@ -497,7 +492,6 @@ _GL_FUNCDECL_SYS (canonicalize_file_name, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef canonicalize_file_name # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME _GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " @@ -597,7 +591,6 @@ _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); _GL_CXXALIASWARN (getloadavg); # endif #elif defined GNULIB_POSIXCHECK -# undef getloadavg # if HAVE_RAW_DECL_GETLOADAVG _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " "use gnulib module getloadavg for portability"); @@ -632,7 +625,6 @@ _GL_CXXALIAS_SYS (getprogname, const char *, (void)); _GL_CXXALIASWARN (getprogname); # endif #elif defined GNULIB_POSIXCHECK -# undef getprogname # if HAVE_RAW_DECL_GETPROGNAME _GL_WARN_ON_USE (getprogname, "getprogname is unportable - " "use gnulib module getprogname for portability"); @@ -674,7 +666,6 @@ _GL_CXXALIAS_SYS (getsubopt, int, _GL_CXXALIASWARN (getsubopt); # endif #elif defined GNULIB_POSIXCHECK -# undef getsubopt # if HAVE_RAW_DECL_GETSUBOPT _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " "use gnulib module getsubopt for portability"); @@ -690,7 +681,6 @@ _GL_FUNCDECL_SYS (grantpt, int, (int fd), ); _GL_CXXALIAS_SYS (grantpt, int, (int fd)); _GL_CXXALIASWARN (grantpt); #elif defined GNULIB_POSIXCHECK -# undef grantpt # if HAVE_RAW_DECL_GRANTPT _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " "use gnulib module grantpt for portability"); @@ -751,7 +741,6 @@ _GL_FUNCDECL_SYS (malloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); @@ -802,7 +791,6 @@ _GL_CXXALIAS_SYS (mbstowcs, size_t, _GL_CXXALIASWARN (mbstowcs); # endif #elif defined GNULIB_POSIXCHECK -# undef mbstowcs # if HAVE_RAW_DECL_MBSTOWCS _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " "use gnulib module mbstowcs for portability"); @@ -832,7 +820,6 @@ _GL_CXXALIAS_SYS (mbtowc, int, _GL_CXXALIASWARN (mbtowc); # endif #elif defined GNULIB_POSIXCHECK -# undef mbtowc # if HAVE_RAW_DECL_MBTOWC _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " "use gnulib module mbtowc for portability"); @@ -853,7 +840,6 @@ _GL_FUNCDECL_SYS (mkdtemp, char *, _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); _GL_CXXALIASWARN (mkdtemp); #elif defined GNULIB_POSIXCHECK -# undef mkdtemp # if HAVE_RAW_DECL_MKDTEMP _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " "use gnulib module mkdtemp for portability"); @@ -892,7 +878,6 @@ _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); _GL_CXXALIASWARN (mkostemp); # endif #elif defined GNULIB_POSIXCHECK -# undef mkostemp # if HAVE_RAW_DECL_MKOSTEMP _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " "use gnulib module mkostemp for portability"); @@ -936,7 +921,6 @@ _GL_CXXALIAS_SYS (mkostemps, int, _GL_CXXALIASWARN (mkostemps); # endif #elif defined GNULIB_POSIXCHECK -# undef mkostemps # if HAVE_RAW_DECL_MKOSTEMPS _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " "use gnulib module mkostemps for portability"); @@ -969,7 +953,6 @@ _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif _GL_CXXALIASWARN (mkstemp); #elif defined GNULIB_POSIXCHECK -# undef mkstemp # if HAVE_RAW_DECL_MKSTEMP _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " "use gnulib module mkstemp for portability"); @@ -994,7 +977,6 @@ _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/), _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); _GL_CXXALIASWARN (mkstemps); #elif defined GNULIB_POSIXCHECK -# undef mkstemps # if HAVE_RAW_DECL_MKSTEMPS _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " "use gnulib module mkstemps for portability"); @@ -1039,7 +1021,6 @@ _GL_CXXALIAS_SYS (posix_memalign, int, _GL_CXXALIASWARN (posix_memalign); # endif #elif defined GNULIB_POSIXCHECK -# undef posix_memalign # if HAVE_RAW_DECL_POSIX_MEMALIGN _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " "use gnulib module posix_memalign for portability"); @@ -1066,7 +1047,6 @@ _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); _GL_CXXALIASWARN (posix_openpt); # endif #elif defined GNULIB_POSIXCHECK -# undef posix_openpt # if HAVE_RAW_DECL_POSIX_OPENPT _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " "use gnulib module posix_openpt for portability"); @@ -1091,7 +1071,6 @@ _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); # endif _GL_CXXALIASWARN (ptsname); #elif defined GNULIB_POSIXCHECK -# undef ptsname # if HAVE_RAW_DECL_PTSNAME _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " "use gnulib module ptsname for portability"); @@ -1120,7 +1099,6 @@ _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); # endif _GL_CXXALIASWARN (ptsname_r); #elif defined GNULIB_POSIXCHECK -# undef ptsname_r # if HAVE_RAW_DECL_PTSNAME_R _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " "use gnulib module ptsname_r for portability"); @@ -1214,7 +1192,6 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, _GL_CXXALIASWARN (qsort_r); # endif #elif defined GNULIB_POSIXCHECK -# undef qsort_r # if HAVE_RAW_DECL_QSORT_R _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " "use gnulib module qsort_r for portability"); @@ -1266,7 +1243,6 @@ _GL_CXXALIAS_SYS_CAST (random, long, (void)); _GL_CXXALIASWARN (random); # endif #elif defined GNULIB_POSIXCHECK -# undef random # if HAVE_RAW_DECL_RANDOM _GL_WARN_ON_USE (random, "random is unportable - " "use gnulib module random for portability"); @@ -1293,7 +1269,6 @@ _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); _GL_CXXALIASWARN (srandom); # endif #elif defined GNULIB_POSIXCHECK -# undef srandom # if HAVE_RAW_DECL_SRANDOM _GL_WARN_ON_USE (srandom, "srandom is unportable - " "use gnulib module random for portability"); @@ -1326,7 +1301,6 @@ _GL_CXXALIAS_SYS_CAST (initstate, char *, _GL_CXXALIASWARN (initstate); # endif #elif defined GNULIB_POSIXCHECK -# undef initstate # if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); @@ -1353,7 +1327,6 @@ _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); _GL_CXXALIASWARN (setstate); # endif #elif defined GNULIB_POSIXCHECK -# undef setstate # if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); @@ -1379,7 +1352,6 @@ _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); # endif _GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK -# undef random_r # if HAVE_RAW_DECL_RANDOM_R _GL_WARN_ON_USE (random_r, "random_r is unportable - " "use gnulib module random_r for portability"); @@ -1408,7 +1380,6 @@ _GL_CXXALIAS_SYS (srandom_r, int, # endif _GL_CXXALIASWARN (srandom_r); #elif defined GNULIB_POSIXCHECK -# undef srandom_r # if HAVE_RAW_DECL_SRANDOM_R _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " "use gnulib module random_r for portability"); @@ -1443,7 +1414,6 @@ _GL_CXXALIAS_SYS_CAST (initstate_r, int, # endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK -# undef initstate_r # if HAVE_RAW_DECL_INITSTATE_R _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " "use gnulib module random_r for portability"); @@ -1474,7 +1444,6 @@ _GL_CXXALIAS_SYS_CAST (setstate_r, int, # endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK -# undef setstate_r # if HAVE_RAW_DECL_SETSTATE_R _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " "use gnulib module random_r for portability"); @@ -1544,7 +1513,6 @@ _GL_FUNCDECL_SYS (realloc, void *, # endif # endif # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); @@ -1576,7 +1544,6 @@ _GL_CXXALIAS_SYS (reallocarray, void *, _GL_CXXALIASWARN (reallocarray); # endif #elif defined GNULIB_POSIXCHECK -# undef reallocarray # if HAVE_RAW_DECL_REALLOCARRAY _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " "use gnulib module reallocarray for portability"); @@ -1604,7 +1571,6 @@ _GL_CXXALIAS_SYS (realpath, char *, # endif _GL_CXXALIASWARN (realpath); #elif defined GNULIB_POSIXCHECK -# undef realpath # if HAVE_RAW_DECL_REALPATH _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " "canonicalize or canonicalize-lgpl for portability"); @@ -1621,7 +1587,6 @@ _GL_FUNCDECL_SYS (rpmatch, int, (const char *response), _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); _GL_CXXALIASWARN (rpmatch); #elif defined GNULIB_POSIXCHECK -# undef rpmatch # if HAVE_RAW_DECL_RPMATCH _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " "use gnulib module rpmatch for portability"); @@ -1638,7 +1603,6 @@ _GL_FUNCDECL_SYS (secure_getenv, char *, _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); _GL_CXXALIASWARN (secure_getenv); #elif defined GNULIB_POSIXCHECK -# undef secure_getenv # if HAVE_RAW_DECL_SECURE_GETENV _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " "use gnulib module secure_getenv for portability"); @@ -1671,7 +1635,6 @@ _GL_CXXALIAS_SYS (setenv, int, _GL_CXXALIASWARN (setenv); # endif #elif defined GNULIB_POSIXCHECK -# undef setenv # if HAVE_RAW_DECL_SETENV _GL_WARN_ON_USE (setenv, "setenv is unportable - " "use gnulib module setenv for portability"); @@ -1716,7 +1679,6 @@ _GL_CXXALIAS_SYS (strtod, double, _GL_CXXALIASWARN (strtod); # endif #elif defined GNULIB_POSIXCHECK -# undef strtod # if HAVE_RAW_DECL_STRTOD _GL_WARN_ON_USE (strtod, "strtod is unportable - " "use gnulib module strtod for portability"); @@ -1748,7 +1710,6 @@ _GL_CXXALIAS_SYS (strtof, float, _GL_CXXALIASWARN (strtof); # endif #elif defined GNULIB_POSIXCHECK -# undef strtof # if HAVE_RAW_DECL_STRTOF _GL_WARN_ON_USE (strtof, "strtof is unportable - " "use gnulib module strtof for portability"); @@ -1778,7 +1739,6 @@ _GL_CXXALIAS_SYS (strtold, long double, # endif _GL_CXXALIASWARN (strtold); #elif defined GNULIB_POSIXCHECK -# undef strtold # if HAVE_RAW_DECL_STRTOLD _GL_WARN_ON_USE (strtold, "strtold is unportable - " "use gnulib module strtold for portability"); @@ -1821,7 +1781,6 @@ _GL_CXXALIAS_SYS (strtol, long, _GL_CXXALIASWARN (strtol); # endif #elif defined GNULIB_POSIXCHECK -# undef strtol # if HAVE_RAW_DECL_STRTOL _GL_WARN_ON_USE (strtol, "strtol is unportable - " "use gnulib module strtol for portability"); @@ -1862,7 +1821,6 @@ _GL_CXXALIAS_SYS (strtoll, long long, # endif _GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK -# undef strtoll # if HAVE_RAW_DECL_STRTOLL _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " "use gnulib module strtoll for portability"); @@ -1904,7 +1862,6 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long, _GL_CXXALIASWARN (strtoul); # endif #elif defined GNULIB_POSIXCHECK -# undef strtoul # if HAVE_RAW_DECL_STRTOUL _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " "use gnulib module strtoul for portability"); @@ -1945,7 +1902,6 @@ _GL_CXXALIAS_SYS (strtoull, unsigned long long, # endif _GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK -# undef strtoull # if HAVE_RAW_DECL_STRTOULL _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " "use gnulib module strtoull for portability"); @@ -1961,7 +1917,6 @@ _GL_FUNCDECL_SYS (unlockpt, int, (int fd), ); _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); _GL_CXXALIASWARN (unlockpt); #elif defined GNULIB_POSIXCHECK -# undef unlockpt # if HAVE_RAW_DECL_UNLOCKPT _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " "use gnulib module unlockpt for portability"); @@ -1987,7 +1942,6 @@ _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); _GL_CXXALIASWARN (unsetenv); # endif #elif defined GNULIB_POSIXCHECK -# undef unsetenv # if HAVE_RAW_DECL_UNSETENV _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " "use gnulib module unsetenv for portability"); diff --git a/lib/string.in.h b/lib/string.in.h index fdcdd21bed6..a323b1cd6da 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -312,7 +312,6 @@ _GL_FUNCDECL_SYS (explicit_bzero, void, _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); _GL_CXXALIASWARN (explicit_bzero); #elif defined GNULIB_POSIXCHECK -# undef explicit_bzero # if HAVE_RAW_DECL_EXPLICIT_BZERO _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " "use gnulib module explicit_bzero for portability"); @@ -328,7 +327,6 @@ _GL_FUNCDECL_SYS (ffsl, int, (long int i), ); _GL_CXXALIAS_SYS (ffsl, int, (long int i)); _GL_CXXALIASWARN (ffsl); #elif defined GNULIB_POSIXCHECK -# undef ffsl # if HAVE_RAW_DECL_FFSL _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); # endif @@ -351,7 +349,6 @@ _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); # endif _GL_CXXALIASWARN (ffsll); #elif defined GNULIB_POSIXCHECK -# undef ffsll # if HAVE_RAW_DECL_FFSLL _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); # endif @@ -409,10 +406,11 @@ _GL_CXXALIASWARN1 (memchr, void const *, _GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK -# undef memchr /* Assume memchr is always declared. */ -_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " - "use gnulib module memchr for portability" ); +_GL_WARN_ON_USE_CXX (memchr, + const void *, void *, (void const *, int, size_t), + "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); #endif /* Are S1 and S2, of size N, bytewise equal? */ @@ -458,7 +456,6 @@ _GL_CXXALIAS_SYS (memmem, void *, # endif _GL_CXXALIASWARN (memmem); #elif defined GNULIB_POSIXCHECK -# undef memmem # if HAVE_RAW_DECL_MEMMEM _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " "use gnulib module memmem-simple for portability, " @@ -496,7 +493,6 @@ _GL_CXXALIAS_SYS (mempcpy, void *, _GL_CXXALIASWARN (mempcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef mempcpy # if HAVE_RAW_DECL_MEMPCPY _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " "use gnulib module mempcpy for portability"); @@ -529,7 +525,6 @@ _GL_CXXALIASWARN1 (memrchr, void const *, _GL_CXXALIASWARN (memrchr); # endif #elif defined GNULIB_POSIXCHECK -# undef memrchr # if HAVE_RAW_DECL_MEMRCHR _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " "use gnulib module memrchr for portability"); @@ -560,7 +555,6 @@ _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); _GL_CXXALIASWARN (memset_explicit); # endif #elif defined GNULIB_POSIXCHECK -# undef memset_explicit # if HAVE_RAW_DECL_MEMSET_EXPLICIT _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " "use gnulib module memset_explicit for portability"); @@ -595,7 +589,6 @@ _GL_CXXALIASWARN1 (rawmemchr, void const *, _GL_CXXALIASWARN (rawmemchr); # endif #elif defined GNULIB_POSIXCHECK -# undef rawmemchr # if HAVE_RAW_DECL_RAWMEMCHR _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " "use gnulib module rawmemchr for portability"); @@ -627,7 +620,6 @@ _GL_CXXALIAS_SYS (stpcpy, char *, _GL_CXXALIASWARN (stpcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef stpcpy # if HAVE_RAW_DECL_STPCPY _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " "use gnulib module stpcpy for portability"); @@ -664,7 +656,6 @@ _GL_CXXALIAS_SYS (stpncpy, char *, _GL_CXXALIASWARN (stpncpy); # endif #elif defined GNULIB_POSIXCHECK -# undef stpncpy # if HAVE_RAW_DECL_STPNCPY _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " "use gnulib module stpncpy for portability"); @@ -674,7 +665,6 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " #if defined GNULIB_POSIXCHECK /* strchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ -# undef strchr /* Assume strchr is always declared. */ _GL_WARN_ON_USE_CXX (strchr, const char *, char *, (const char *, int), @@ -720,7 +710,6 @@ _GL_CXXALIASWARN1 (strchrnul, char const *, _GL_CXXALIASWARN (strchrnul); # endif #elif defined GNULIB_POSIXCHECK -# undef strchrnul # if HAVE_RAW_DECL_STRCHRNUL _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " "use gnulib module strchrnul for portability"); @@ -785,7 +774,6 @@ _GL_FUNCDECL_SYS (strdup, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef strdup # if HAVE_RAW_DECL_STRDUP _GL_WARN_ON_USE (strdup, "strdup is unportable - " "use gnulib module strdup for portability"); @@ -846,7 +834,6 @@ _GL_CXXALIAS_SYS (strncat, char *, _GL_CXXALIASWARN (strncat); # endif #elif defined GNULIB_POSIXCHECK -# undef strncat # if HAVE_RAW_DECL_STRNCAT _GL_WARN_ON_USE (strncat, "strncat is unportable - " "use gnulib module strncat for portability"); @@ -901,7 +888,6 @@ _GL_FUNCDECL_SYS (strndup, char *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef strndup # if HAVE_RAW_DECL_STRNDUP _GL_WARN_ON_USE (strndup, "strndup is unportable - " "use gnulib module strndup for portability"); @@ -932,7 +918,6 @@ _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK -# undef strnlen # if HAVE_RAW_DECL_STRNLEN _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " "use gnulib module strnlen for portability"); @@ -944,7 +929,6 @@ _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ -# undef strcspn /* Assume strcspn is always declared. */ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " "in multibyte locales - " @@ -981,7 +965,6 @@ _GL_CXXALIASWARN (strpbrk); Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ -# undef strpbrk _GL_WARN_ON_USE_CXX (strpbrk, const char *, char *, (const char *, const char *), "strpbrk cannot work correctly on character strings " @@ -1001,7 +984,6 @@ _GL_WARN_ON_USE_CXX (strpbrk, #if defined GNULIB_POSIXCHECK /* strspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it cannot work with multibyte strings. */ -# undef strspn /* Assume strspn is always declared. */ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " "in multibyte locales - " @@ -1011,7 +993,6 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " #if defined GNULIB_POSIXCHECK /* strrchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ -# undef strrchr /* Assume strrchr is always declared. */ _GL_WARN_ON_USE_CXX (strrchr, const char *, char *, (const char *, int), @@ -1046,13 +1027,11 @@ _GL_CXXALIAS_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim)); _GL_CXXALIASWARN (strsep); # if defined GNULIB_POSIXCHECK -# undef strsep _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " "in multibyte locales - " "use mbssep if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK -# undef strsep # if HAVE_RAW_DECL_STRSEP _GL_WARN_ON_USE (strsep, "strsep is unportable - " "use gnulib module strsep for portability"); @@ -1095,11 +1074,13 @@ _GL_CXXALIASWARN (strstr); as a sequence of bytes, not of characters. */ # undef strstr /* Assume strstr is always declared. */ -_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " - "work correctly on character strings in most " - "multibyte locales - " - "use mbsstr if you care about internationalization, " - "or use strstr if you care about speed"); +_GL_WARN_ON_USE_CXX (strstr, + const char *, char *, (const char *, const char *), + "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); #endif /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive @@ -1145,7 +1126,6 @@ _GL_CXXALIASWARN (strcasestr); /* strcasestr() does not work with multibyte strings: It is a glibc extension, and glibc implements it only for unibyte locales. */ -# undef strcasestr # if HAVE_RAW_DECL_STRCASESTR _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " "strings in multibyte locales - " @@ -1191,7 +1171,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # else -# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK +# if @UNDEFINE_STRTOK_R@ # undef strtok_r # endif # if ! @HAVE_DECL_STRTOK_R@ @@ -1211,7 +1191,6 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " "use mbstok_r if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK -# undef strtok_r # if HAVE_RAW_DECL_STRTOK_R _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " "use gnulib module strtok_r for portability"); @@ -1579,7 +1558,6 @@ _GL_CXXALIAS_SYS (strerror, char *, (int)); _GL_CXXALIASWARN (strerror); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror /* Assume strerror is always declared. */ _GL_WARN_ON_USE (strerror, "strerror is unportable - " "use gnulib module strerror to guarantee non-NULL result"); @@ -1607,7 +1585,6 @@ _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); _GL_CXXALIASWARN (strerror_r); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror_r # if HAVE_RAW_DECL_STRERROR_R _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " "use gnulib module strerror_r-posix for portability"); @@ -1636,7 +1613,6 @@ _GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale)); _GL_CXXALIASWARN (strerror_l); # endif #elif defined GNULIB_POSIXCHECK -# undef strerror_l # if HAVE_RAW_DECL_STRERROR_L _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - " "use gnulib module strerror_l for portability"); @@ -1671,7 +1647,6 @@ _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); _GL_CXXALIASWARN (strerrorname_np); # endif #elif defined GNULIB_POSIXCHECK -# undef strerrorname_np # if HAVE_RAW_DECL_STRERRORNAME_NP _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " "use gnulib module strerrorname_np for portability"); @@ -1686,7 +1661,6 @@ _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), ); _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); _GL_CXXALIASWARN (sigabbrev_np); #elif defined GNULIB_POSIXCHECK -# undef sigabbrev_np # if HAVE_RAW_DECL_SIGABBREV_NP _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " "use gnulib module sigabbrev_np for portability"); @@ -1701,7 +1675,6 @@ _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), ); _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); _GL_CXXALIASWARN (sigdescr_np); #elif defined GNULIB_POSIXCHECK -# undef sigdescr_np # if HAVE_RAW_DECL_SIGDESCR_NP _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " "use gnulib module sigdescr_np for portability"); @@ -1725,7 +1698,6 @@ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); # endif _GL_CXXALIASWARN (strsignal); #elif defined GNULIB_POSIXCHECK -# undef strsignal # if HAVE_RAW_DECL_STRSIGNAL _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " "use gnulib module strsignal for portability"); @@ -1751,7 +1723,6 @@ _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); # endif _GL_CXXALIASWARN (strverscmp); #elif defined GNULIB_POSIXCHECK -# undef strverscmp # if HAVE_RAW_DECL_STRVERSCMP _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " "use gnulib module strverscmp for portability"); diff --git a/lib/strnlen.c b/lib/strnlen.c index 155a594fccd..f6990415762 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -25,10 +25,10 @@ size_t strnlen (const char *s, size_t maxlen) { - size_t i = 0; /* Do not use memchr, because on some platforms memchr has undefined behavior if MAXLEN exceeds the number of bytes in S. */ - for (; i < maxlen && s[i]; i++) + size_t i; + for (i = 0; i < maxlen && s[i]; i++) continue; return i; } diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h index 11663b2ebdc..1d9dff92995 100644 --- a/lib/sys_random.in.h +++ b/lib/sys_random.in.h @@ -94,7 +94,6 @@ _GL_CXXALIAS_SYS (getrandom, ssize_t, _GL_CXXALIASWARN (getrandom); # endif #elif defined GNULIB_POSIXCHECK -# undef getrandom # if HAVE_RAW_DECL_GETRANDOM _GL_WARN_ON_USE (getrandom, "getrandom is unportable - " "use gnulib module getrandom for portability"); diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 9106702deb1..891b4aa0fe0 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -283,7 +283,6 @@ _GL_CXXALIAS_SYS_CAST (pselect, int, _GL_CXXALIASWARN (pselect); # endif #elif defined GNULIB_POSIXCHECK -# undef pselect # if HAVE_RAW_DECL_PSELECT _GL_WARN_ON_USE (pselect, "pselect is not portable - " "use gnulib module pselect for portability"); @@ -316,7 +315,6 @@ _GL_CXXALIASWARN (select); # define select select_used_without_requesting_gnulib_module_select # endif #elif defined GNULIB_POSIXCHECK -# undef select # if HAVE_RAW_DECL_SELECT _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " "use gnulib module select for portability"); diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 8f676cb390e..859f04e6b53 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -451,7 +451,6 @@ _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (chmod); #elif defined GNULIB_POSIXCHECK -# undef chmod # if HAVE_RAW_DECL_CHMOD _GL_WARN_ON_USE (chmod, "chmod has portability problems - " "use gnulib module chmod for portability"); @@ -496,7 +495,6 @@ _GL_CXXALIAS_SYS (fchmodat, int, # endif _GL_CXXALIASWARN (fchmodat); #elif defined GNULIB_POSIXCHECK -# undef fchmodat # if HAVE_RAW_DECL_FCHMODAT _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " "use gnulib module openat for portability"); @@ -528,7 +526,6 @@ _GL_CXXALIASWARN (fstat); /* Above, we define stat to _stati64. */ # define fstat _fstati64 #elif defined GNULIB_POSIXCHECK -# undef fstat # if HAVE_RAW_DECL_FSTAT _GL_WARN_ON_USE (fstat, "fstat has portability problems - " "use gnulib module fstat for portability"); @@ -567,7 +564,6 @@ _GL_CXXALIASWARN (fstatat); # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat # endif #elif defined GNULIB_POSIXCHECK -# undef fstatat # if HAVE_RAW_DECL_FSTATAT _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " "use gnulib module openat for portability"); @@ -597,7 +593,6 @@ _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); _GL_CXXALIASWARN (futimens); # endif #elif defined GNULIB_POSIXCHECK -# undef futimens # if HAVE_RAW_DECL_FUTIMENS _GL_WARN_ON_USE (futimens, "futimens is not portable - " "use gnulib module futimens for portability"); @@ -618,7 +613,6 @@ _GL_CXXALIAS_SYS (getumask, mode_t, (void)); _GL_CXXALIASWARN (getumask); # endif #elif defined GNULIB_POSIXCHECK -# undef getumask # if HAVE_RAW_DECL_GETUMASK _GL_WARN_ON_USE (getumask, "getumask is not portable - " "use gnulib module getumask for portability"); @@ -636,7 +630,6 @@ _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode), _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); _GL_CXXALIASWARN (lchmod); #elif defined GNULIB_POSIXCHECK -# undef lchmod # if HAVE_RAW_DECL_LCHMOD _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " "use gnulib module lchmod for portability"); @@ -698,7 +691,6 @@ _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); #elif defined GNULIB_POSIXCHECK -# undef mkdir # if HAVE_RAW_DECL_MKDIR _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " "use gnulib module mkdir for portability"); @@ -714,7 +706,6 @@ _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode), _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkdirat); #elif defined GNULIB_POSIXCHECK -# undef mkdirat # if HAVE_RAW_DECL_MKDIRAT _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " "use gnulib module openat for portability"); @@ -740,7 +731,6 @@ _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); # endif _GL_CXXALIASWARN (mkfifo); #elif defined GNULIB_POSIXCHECK -# undef mkfifo # if HAVE_RAW_DECL_MKFIFO _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " "use gnulib module mkfifo for portability"); @@ -768,7 +758,6 @@ _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkfifoat); # endif #elif defined GNULIB_POSIXCHECK -# undef mkfifoat # if HAVE_RAW_DECL_MKFIFOAT _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " "use gnulib module mkfifoat for portability"); @@ -794,7 +783,6 @@ _GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK -# undef mknod # if HAVE_RAW_DECL_MKNOD _GL_WARN_ON_USE (mknod, "mknod is not portable - " "use gnulib module mknod for portability"); @@ -826,7 +814,6 @@ _GL_CXXALIAS_SYS (mknodat, int, _GL_CXXALIASWARN (mknodat); # endif #elif defined GNULIB_POSIXCHECK -# undef mknodat # if HAVE_RAW_DECL_MKNODAT _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " "use gnulib module mkfifoat for portability"); @@ -904,7 +891,6 @@ _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) #define stat stat_used_without_requesting_gnulib_module_stat */ #elif defined GNULIB_POSIXCHECK -# undef stat # if HAVE_RAW_DECL_STAT _GL_WARN_ON_USE (stat, "stat is unportable - " "use gnulib module stat for portability"); @@ -944,7 +930,6 @@ _GL_CXXALIASWARN (lstat); # define lstat lstat_used_without_requesting_gnulib_module_lstat # endif #elif defined GNULIB_POSIXCHECK -# undef lstat # if HAVE_RAW_DECL_LSTAT _GL_WARN_ON_USE (lstat, "lstat is unportable - " "use gnulib module lstat for portability"); @@ -998,7 +983,6 @@ _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, _GL_CXXALIASWARN (utimensat); # endif #elif defined GNULIB_POSIXCHECK -# undef utimensat # if HAVE_RAW_DECL_UTIMENSAT _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " "use gnulib module utimensat for portability"); diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index e6d15613bec..470e6c321e2 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -133,7 +133,6 @@ namespace GNULIB_NAMESPACE { } # endif #elif defined GNULIB_POSIXCHECK -# undef gettimeofday # if HAVE_RAW_DECL_GETTIMEOFDAY _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " "use gnulib module gettimeofday for portability"); diff --git a/lib/time.in.h b/lib/time.in.h index d28702d2f61..3ce2de16f2a 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -161,7 +161,6 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_get); # endif # elif defined GNULIB_POSIXCHECK -# undef timespec_get # if HAVE_RAW_DECL_TIMESPEC_GET _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " "use gnulib module timespec_get for portability"); @@ -190,7 +189,6 @@ _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_getres); # endif # elif defined GNULIB_POSIXCHECK -# undef timespec_getres # if HAVE_RAW_DECL_TIMESPEC_GETRES _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " "use gnulib module timespec_getres for portability"); @@ -212,7 +210,6 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); _GL_CXXALIASWARN (time); # endif # elif defined GNULIB_POSIXCHECK -# undef time # if HAVE_RAW_DECL_TIME _GL_WARN_ON_USE (time, "time has consistency problems - " "use gnulib module time for portability"); @@ -243,7 +240,6 @@ _GL_CXXALIAS_SYS (nanosleep, int, # endif _GL_CXXALIASWARN (nanosleep); # elif defined GNULIB_POSIXCHECK -# undef nanosleep # if HAVE_RAW_DECL_NANOSLEEP _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " "use gnulib module nanosleep for portability"); @@ -284,7 +280,6 @@ _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); # elif defined GNULIB_POSIXCHECK -# undef tzset # if HAVE_RAW_DECL_TZSET _GL_WARN_ON_USE (tzset, "tzset has portability problems - " "use gnulib module tzset for portability"); @@ -306,7 +301,6 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); _GL_CXXALIASWARN (mktime); # endif # elif defined GNULIB_POSIXCHECK -# undef mktime # if HAVE_RAW_DECL_MKTIME _GL_WARN_ON_USE (mktime, "mktime has portability problems - " "use gnulib module mktime for portability"); @@ -362,12 +356,10 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIASWARN (gmtime_r); # endif # elif defined GNULIB_POSIXCHECK -# undef localtime_r # if HAVE_RAW_DECL_LOCALTIME_R _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " "use gnulib module time_r for portability"); # endif -# undef gmtime_r # if HAVE_RAW_DECL_GMTIME_R _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " "use gnulib module time_r for portability"); @@ -393,7 +385,6 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); _GL_CXXALIASWARN (localtime); # endif # elif defined GNULIB_POSIXCHECK -# undef localtime # if HAVE_RAW_DECL_LOCALTIME _GL_WARN_ON_USE (localtime, "localtime has portability problems - " "use gnulib module localtime for portability"); @@ -430,7 +421,6 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, struct tm *restrict __tm)); _GL_CXXALIASWARN (strptime); # elif defined GNULIB_POSIXCHECK -# undef strptime # if HAVE_RAW_DECL_STRPTIME _GL_WARN_ON_USE (strptime, "strptime is unportable - " "use gnulib module strptime for portability"); @@ -483,7 +473,6 @@ _GL_CXXALIAS_SYS (strftime, size_t, _GL_CXXALIASWARN (strftime); # endif # elif defined GNULIB_POSIXCHECK -# undef strftime # if HAVE_RAW_DECL_STRFTIME _GL_WARN_ON_USE (strftime, "strftime has portability problems - " "use gnulib module strftime-fixes for portability"); @@ -618,7 +607,6 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); _GL_CXXALIASWARN (timegm); # endif # elif defined GNULIB_POSIXCHECK -# undef timegm # if HAVE_RAW_DECL_TIMEGM _GL_WARN_ON_USE (timegm, "timegm is unportable - " "use gnulib module timegm for portability"); @@ -629,28 +617,24 @@ _GL_WARN_ON_USE (timegm, "timegm is unportable - " buffers when given outlandish struct tm values. Portable applications should use strftime (or even sprintf) instead. */ # if defined GNULIB_POSIXCHECK -# undef asctime # if HAVE_RAW_DECL_ASCTIME _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef asctime_r # if HAVE_RAW_DECL_ASCTIME_R _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef ctime # if HAVE_RAW_DECL_CTIME _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # endif # if defined GNULIB_POSIXCHECK -# undef ctime_r # if HAVE_RAW_DECL_CTIME_R _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 5b5838240aa..72d66eaa3a9 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -302,7 +302,6 @@ _GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); # endif _GL_CXXALIASWARN (access); #elif defined GNULIB_POSIXCHECK -# undef access # if HAVE_RAW_DECL_ACCESS /* The access() function is a security risk. */ _GL_WARN_ON_USE (access, "access does not always support X_OK - " @@ -339,7 +338,6 @@ _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIASWARN (chdir); #elif defined GNULIB_POSIXCHECK -# undef chdir # if HAVE_RAW_DECL_CHDIR _GL_WARN_ON_USE (chdir, "chdir is not always in - " "use gnulib module chdir for portability"); @@ -384,7 +382,6 @@ _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); # endif _GL_CXXALIASWARN (chown); #elif defined GNULIB_POSIXCHECK -# undef chown # if HAVE_RAW_DECL_CHOWN _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " "doesn't treat a uid or gid of -1 on some systems - " @@ -418,7 +415,6 @@ _GL_CXXALIASWARN (close); # define close close_used_without_requesting_gnulib_module_close # endif #elif defined GNULIB_POSIXCHECK -# undef close /* Assume close is always declared. */ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " "use gnulib module close for portability"); @@ -465,7 +461,6 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, _GL_CXXALIASWARN (copy_file_range); # endif #elif defined GNULIB_POSIXCHECK -# undef copy_file_range # if HAVE_RAW_DECL_COPY_FILE_RANGE _GL_WARN_ON_USE (copy_file_range, "copy_file_range is unportable - " @@ -492,7 +487,6 @@ _GL_CXXALIAS_SYS (dup, int, (int oldfd)); # endif _GL_CXXALIASWARN (dup); #elif defined GNULIB_POSIXCHECK -# undef dup # if HAVE_RAW_DECL_DUP _GL_WARN_ON_USE (dup, "dup is unportable - " "use gnulib module dup for portability"); @@ -537,7 +531,6 @@ _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIASWARN (dup2); #elif defined GNULIB_POSIXCHECK -# undef dup2 # if HAVE_RAW_DECL_DUP2 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " "use gnulib module dup2 for portability"); @@ -585,7 +578,6 @@ _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIASWARN (dup3); # endif #elif defined GNULIB_POSIXCHECK -# undef dup3 # if HAVE_RAW_DECL_DUP3 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " "use gnulib module dup3 for portability"); @@ -653,7 +645,6 @@ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " "use the gnulib module faccessat instead"); # endif #elif defined GNULIB_POSIXCHECK -# undef euidaccess # if HAVE_RAW_DECL_EUIDACCESS _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " "use gnulib module euidaccess for portability"); @@ -675,7 +666,6 @@ _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execl); #elif defined GNULIB_POSIXCHECK -# undef execl # if HAVE_RAW_DECL_EXECL _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " "use gnulib module execl for portability"); @@ -710,7 +700,6 @@ _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execle); #elif defined GNULIB_POSIXCHECK -# undef execle # if HAVE_RAW_DECL_EXECLE _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " "use gnulib module execle for portability"); @@ -746,7 +735,6 @@ _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); # endif _GL_CXXALIASWARN (execlp); #elif defined GNULIB_POSIXCHECK -# undef execlp # if HAVE_RAW_DECL_EXECLP _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " "use gnulib module execlp for portability"); @@ -783,7 +771,6 @@ _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execv); #elif defined GNULIB_POSIXCHECK -# undef execv # if HAVE_RAW_DECL_EXECV _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " "use gnulib module execv for portability"); @@ -822,7 +809,6 @@ _GL_CXXALIAS_SYS (execve, int, # endif _GL_CXXALIASWARN (execve); #elif defined GNULIB_POSIXCHECK -# undef execve # if HAVE_RAW_DECL_EXECVE _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " "use gnulib module execve for portability"); @@ -860,7 +846,6 @@ _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); # endif _GL_CXXALIASWARN (execvp); #elif defined GNULIB_POSIXCHECK -# undef execvp # if HAVE_RAW_DECL_EXECVP _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " "use gnulib module execvp for portability"); @@ -906,7 +891,6 @@ _GL_CXXALIAS_SYS (execvpe, int, _GL_CXXALIASWARN (execvpe); # endif #elif defined GNULIB_POSIXCHECK -# undef execvpe # if HAVE_RAW_DECL_EXECVPE _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " "use gnulib module execvpe for portability"); @@ -963,7 +947,6 @@ _GL_CXXALIAS_SYS (faccessat, int, _GL_CXXALIASWARN (faccessat); # endif #elif defined GNULIB_POSIXCHECK -# undef faccessat # if HAVE_RAW_DECL_FACCESSAT _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " "use gnulib module faccessat for portability"); @@ -1000,7 +983,6 @@ _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); # endif #elif defined GNULIB_POSIXCHECK -# undef fchdir # if HAVE_RAW_DECL_FCHDIR _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " "use gnulib module fchdir for portability"); @@ -1030,7 +1012,6 @@ _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, # endif _GL_CXXALIASWARN (fchownat); #elif defined GNULIB_POSIXCHECK -# undef fchownat # if HAVE_RAW_DECL_FCHOWNAT _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " "use gnulib module fchownat for portability"); @@ -1060,7 +1041,6 @@ _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); _GL_CXXALIASWARN (fdatasync); # endif #elif defined GNULIB_POSIXCHECK -# undef fdatasync # if HAVE_RAW_DECL_FDATASYNC _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " "use gnulib module fdatasync for portability"); @@ -1079,7 +1059,6 @@ _GL_FUNCDECL_SYS (fsync, int, (int fd), ); _GL_CXXALIAS_SYS (fsync, int, (int fd)); _GL_CXXALIASWARN (fsync); #elif defined GNULIB_POSIXCHECK -# undef fsync # if HAVE_RAW_DECL_FSYNC _GL_WARN_ON_USE (fsync, "fsync is unportable - " "use gnulib module fsync for portability"); @@ -1113,7 +1092,6 @@ _GL_CXXALIAS_SYS (ftruncate, int, _GL_CXXALIASWARN (ftruncate); # endif #elif defined GNULIB_POSIXCHECK -# undef ftruncate # if HAVE_RAW_DECL_FTRUNCATE _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " "use gnulib module ftruncate for portability"); @@ -1152,7 +1130,6 @@ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK -# undef getcwd # if HAVE_RAW_DECL_GETCWD _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " "use gnulib module getcwd for portability"); @@ -1210,7 +1187,6 @@ _GL_CXXALIAS_SYS (getdomainname, int, _GL_CXXALIASWARN (getdomainname); # endif #elif defined GNULIB_POSIXCHECK -# undef getdomainname # if HAVE_RAW_DECL_GETDOMAINNAME _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " "use gnulib module getdomainname for portability"); @@ -1238,7 +1214,6 @@ _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); # endif _GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK -# undef getdtablesize # if HAVE_RAW_DECL_GETDTABLESIZE _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " "use gnulib module getdtablesize for portability"); @@ -1269,7 +1244,6 @@ _GL_CXXALIAS_SYS (getentropy, int, _GL_CXXALIASWARN (getentropy); # endif #elif defined GNULIB_POSIXCHECK -# undef getentropy # if HAVE_RAW_DECL_GETENTROPY _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " "use gnulib module getentropy for portability"); @@ -1302,7 +1276,6 @@ _GL_CXXALIAS_SYS (getgroups, int, # endif _GL_CXXALIASWARN (getgroups); #elif defined GNULIB_POSIXCHECK -# undef getgroups # if HAVE_RAW_DECL_GETGROUPS _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " "use gnulib module getgroups for portability"); @@ -1342,7 +1315,6 @@ _GL_CXXALIASWARN (gethostname); # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname # endif #elif defined GNULIB_POSIXCHECK -# undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " "use gnulib module gethostname for portability"); @@ -1377,7 +1349,6 @@ _GL_CXXALIAS_SYS (getlogin, char *, (void)); _GL_CXXALIASWARN (getlogin); # endif #elif defined GNULIB_POSIXCHECK -# undef getlogin # if HAVE_RAW_DECL_GETLOGIN _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " "use gnulib module getlogin for portability"); @@ -1420,7 +1391,6 @@ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); _GL_CXXALIASWARN (getlogin_r); # endif #elif defined GNULIB_POSIXCHECK -# undef getlogin_r # if HAVE_RAW_DECL_GETLOGIN_R _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " "use gnulib module getlogin_r for portability"); @@ -1507,7 +1477,6 @@ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); _GL_CXXALIASWARN (getpagesize); # endif #elif defined GNULIB_POSIXCHECK -# undef getpagesize # if HAVE_RAW_DECL_GETPAGESIZE _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " "use gnulib module getpagesize for portability"); @@ -1538,7 +1507,6 @@ _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); # endif _GL_CXXALIASWARN (getpass); #elif defined GNULIB_POSIXCHECK -# undef getpass # if HAVE_RAW_DECL_GETPASS _GL_WARN_ON_USE (getpass, "getpass is unportable - " "use gnulib module getpass or getpass-gnu for portability"); @@ -1581,7 +1549,6 @@ _GL_CXXALIAS_SYS (getusershell, char *, (void)); # endif _GL_CXXALIASWARN (getusershell); #elif defined GNULIB_POSIXCHECK -# undef getusershell # if HAVE_RAW_DECL_GETUSERSHELL _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1605,7 +1572,6 @@ _GL_CXXALIAS_SYS (setusershell, void, (void)); # endif _GL_CXXALIASWARN (setusershell); #elif defined GNULIB_POSIXCHECK -# undef setusershell # if HAVE_RAW_DECL_SETUSERSHELL _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1630,7 +1596,6 @@ _GL_CXXALIAS_SYS (endusershell, void, (void)); # endif _GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK -# undef endusershell # if HAVE_RAW_DECL_ENDUSERSHELL _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " "use gnulib module getusershell for portability"); @@ -1646,7 +1611,6 @@ _GL_FUNCDECL_SYS (group_member, int, (gid_t gid), ); _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); _GL_CXXALIASWARN (group_member); #elif defined GNULIB_POSIXCHECK -# undef group_member # if HAVE_RAW_DECL_GROUP_MEMBER _GL_WARN_ON_USE (group_member, "group_member is unportable - " "use gnulib module group-member for portability"); @@ -1674,7 +1638,6 @@ _GL_CXXALIAS_SYS (isatty, int, (int fd)); # endif _GL_CXXALIASWARN (isatty); #elif defined GNULIB_POSIXCHECK -# undef isatty # if HAVE_RAW_DECL_ISATTY _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " "use gnulib module isatty for portability"); @@ -1719,7 +1682,6 @@ _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif _GL_CXXALIASWARN (lchown); #elif defined GNULIB_POSIXCHECK -# undef lchown # if HAVE_RAW_DECL_LCHOWN _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " "use gnulib module lchown for portability"); @@ -1748,7 +1710,6 @@ _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif _GL_CXXALIASWARN (link); #elif defined GNULIB_POSIXCHECK -# undef link # if HAVE_RAW_DECL_LINK _GL_WARN_ON_USE (link, "link is unportable - " "use gnulib module link for portability"); @@ -1787,7 +1748,6 @@ _GL_CXXALIAS_SYS (linkat, int, _GL_CXXALIASWARN (linkat); # endif #elif defined GNULIB_POSIXCHECK -# undef linkat # if HAVE_RAW_DECL_LINKAT _GL_WARN_ON_USE (linkat, "linkat is unportable - " "use gnulib module linkat for portability"); @@ -1817,7 +1777,6 @@ _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif _GL_CXXALIASWARN (lseek); #elif defined GNULIB_POSIXCHECK -# undef lseek # if HAVE_RAW_DECL_LSEEK _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " "systems - use gnulib module lseek for portability"); @@ -1850,7 +1809,6 @@ _GL_FUNCDECL_SYS (pipe, int, (int fd[2]), _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); _GL_CXXALIASWARN (pipe); #elif defined GNULIB_POSIXCHECK -# undef pipe # if HAVE_RAW_DECL_PIPE _GL_WARN_ON_USE (pipe, "pipe is unportable - " "use gnulib module pipe-posix for portability"); @@ -1884,7 +1842,6 @@ _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); _GL_CXXALIASWARN (pipe2); # endif #elif defined GNULIB_POSIXCHECK -# undef pipe2 # if HAVE_RAW_DECL_PIPE2 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " "use gnulib module pipe2 for portability"); @@ -1921,7 +1878,6 @@ _GL_CXXALIAS_SYS (pread, ssize_t, _GL_CXXALIASWARN (pread); # endif #elif defined GNULIB_POSIXCHECK -# undef pread # if HAVE_RAW_DECL_PREAD _GL_WARN_ON_USE (pread, "pread is unportable - " "use gnulib module pread for portability"); @@ -1958,7 +1914,6 @@ _GL_CXXALIAS_SYS (pwrite, ssize_t, _GL_CXXALIASWARN (pwrite); # endif #elif defined GNULIB_POSIXCHECK -# undef pwrite # if HAVE_RAW_DECL_PWRITE _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " "use gnulib module pwrite for portability"); @@ -2036,7 +1991,6 @@ _GL_CXXALIAS_SYS (readlink, ssize_t, # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK -# undef readlink # if HAVE_RAW_DECL_READLINK _GL_WARN_ON_USE (readlink, "readlink is unportable - " "use gnulib module readlink for portability"); @@ -2071,7 +2025,6 @@ _GL_CXXALIAS_SYS (readlinkat, ssize_t, _GL_CXXALIASWARN (readlinkat); # endif #elif defined GNULIB_POSIXCHECK -# undef readlinkat # if HAVE_RAW_DECL_READLINKAT _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " "use gnulib module readlinkat for portability"); @@ -2098,7 +2051,6 @@ _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); # endif _GL_CXXALIASWARN (rmdir); #elif defined GNULIB_POSIXCHECK -# undef rmdir # if HAVE_RAW_DECL_RMDIR _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " "use gnulib module rmdir for portability"); @@ -2155,7 +2107,6 @@ _GL_CXXALIAS_SYS_CAST (sethostname, int, _GL_CXXALIASWARN (sethostname); # endif #elif defined GNULIB_POSIXCHECK -# undef sethostname # if HAVE_RAW_DECL_SETHOSTNAME _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " "use gnulib module sethostname for portability"); @@ -2183,7 +2134,6 @@ _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIASWARN (sleep); #elif defined GNULIB_POSIXCHECK -# undef sleep # if HAVE_RAW_DECL_SLEEP _GL_WARN_ON_USE (sleep, "sleep is unportable - " "use gnulib module sleep for portability"); @@ -2238,7 +2188,6 @@ _GL_CXXALIAS_SYS (symlink, int, # endif _GL_CXXALIASWARN (symlink); #elif defined GNULIB_POSIXCHECK -# undef symlink # if HAVE_RAW_DECL_SYMLINK _GL_WARN_ON_USE (symlink, "symlink is not portable - " "use gnulib module symlink for portability"); @@ -2270,7 +2219,6 @@ _GL_CXXALIAS_SYS (symlinkat, int, _GL_CXXALIASWARN (symlinkat); # endif #elif defined GNULIB_POSIXCHECK -# undef symlinkat # if HAVE_RAW_DECL_SYMLINKAT _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " "use gnulib module symlinkat for portability"); @@ -2302,7 +2250,6 @@ _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); _GL_CXXALIASWARN (truncate); # endif #elif defined GNULIB_POSIXCHECK -# undef truncate # if HAVE_RAW_DECL_TRUNCATE _GL_WARN_ON_USE (truncate, "truncate is unportable - " "use gnulib module truncate for portability"); @@ -2336,7 +2283,6 @@ _GL_CXXALIAS_SYS (ttyname_r, int, _GL_CXXALIASWARN (ttyname_r); # endif #elif defined GNULIB_POSIXCHECK -# undef ttyname_r # if HAVE_RAW_DECL_TTYNAME_R _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " "use gnulib module ttyname_r for portability"); @@ -2363,7 +2309,6 @@ _GL_CXXALIAS_SYS (unlink, int, (char const *file)); # endif _GL_CXXALIASWARN (unlink); #elif defined GNULIB_POSIXCHECK -# undef unlink # if HAVE_RAW_DECL_UNLINK _GL_WARN_ON_USE (unlink, "unlink is not portable - " "use gnulib module unlink for portability"); @@ -2403,7 +2348,6 @@ _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); # endif _GL_CXXALIASWARN (unlinkat); #elif defined GNULIB_POSIXCHECK -# undef unlinkat # if HAVE_RAW_DECL_UNLINKAT _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " "use gnulib module unlinkat for portability"); @@ -2433,7 +2377,6 @@ _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK -# undef usleep # if HAVE_RAW_DECL_USLEEP _GL_WARN_ON_USE (usleep, "usleep is unportable - " "use gnulib module usleep for portability"); commit 16a70518880ef8f54bd853020f1606d3abf04d8e Author: Aaron Jensen Date: Fri Nov 21 21:20:01 2025 -0800 Fix indentation of keyword argument arrays/hashes in ruby-mode * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Check for ':' and '=>' as previous tokens, and handle symbols ending with ':' to properly indent keyword argument arrays and hashes when ruby-bracketed-args-indent is nil. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol): Handle arrays/hashes that are children of 'pair' nodes (keyword arguments) to ensure consistent indentation. * test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb: Add test cases for keyword argument arrays and hashes with both symbol-colon and hash-rocket syntax. When ruby-bracketed-args-indent is nil, arrays and hashes used as keyword argument values now indent by ruby-indent-level from the line start, matching the documented behavior and fixing inconsistent indentation (bug#74517). (https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00939.html) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index b1104bf88a0..67ed863235b 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -847,7 +847,10 @@ This only affects the output of the command `ruby-toggle-block'." (`(:before . ,(or "(" "[" "{")) (cond ((and (not (eq ruby-bracketed-args-indent t)) - (smie-rule-prev-p "," "(" "[")) + (or (smie-rule-prev-p "," "(" "[" "=>") + (save-excursion + (let ((tok (ruby-smie--backward-token))) + (and tok (string-match ":\\'" tok)))))) (cons 'column (current-indentation))) ((and (equal token "{") (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";" "do")) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 03ea6616ae1..8d4499fb4ad 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -871,7 +871,11 @@ a statement container is a node that matches ((and (not (eq ruby-bracketed-args-indent t)) (string-match-p "\\`array\\|hash\\'" (treesit-node-type parent)) - (equal (treesit-node-parent parent) found) + (or (equal (treesit-node-parent parent) found) + ;; When the array/hash is part of a pair (keyword argument), + ;; check if the pair's parent is the found node. + (and (equal (treesit-node-type (treesit-node-parent parent)) "pair") + (equal (treesit-node-parent (treesit-node-parent parent)) found))) ;; Grandparent is not a parenless call. (or (not (equal (treesit-node-type found) "argument_list")) (equal (treesit-node-type (treesit-node-child found 0)) diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb index c1aaff78ac9..27905f757d5 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb @@ -37,6 +37,24 @@ def foo ) end +some_method(arg, include: [ + :value1, + :value2 +]) + +some_method(arg, options: { + key: "value" +}) + +some_method(arg, :include => [ + :value1, + :value2 +]) + +some_method(arg, :options => { + :key => "value" +}) + # Local Variables: # ruby-bracketed-args-indent: nil # End: commit 36f1fde9b9c9db19cfb15eb16ebfc44b3f9c13b9 Author: Stephen Gildea Date: Tue Nov 25 14:14:23 2025 -0800 * test/lisp/time-stamp-tests.el: More tests of word conversions. diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 4aecb4e80f9..3f74a36ca39 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -443,9 +443,9 @@ This is a separate function so it can have an `ert-explainer' property." "Return STRING padded on the left to 4 characters." (time-stamp-test--pad-left-to-string-width string 4)) -(defun formatz-mod-pad-l10 (string) - "Return STRING padded on the left to 10 characters." - (time-stamp-test--pad-left-to-string-width string 10)) +(defun formatz-mod-pad-l15 (string) + "Return STRING padded on the left to 15 characters." + (time-stamp-test--pad-left-to-string-width string 15)) (defun time-stamp-test--pad-left-to-string-width (string width) "Return STRING padded on the left to string-width WIDTH." @@ -460,23 +460,24 @@ This is a separate function so it can have an `ert-explainer' property." (with-time-stamp-test-env ;; implemented and recommended since 1997 (time-stamp-test-AB "%#A" "%^A") - (time-stamp-test-AB "%#10A" "%^A" #'formatz-mod-pad-l10) + (time-stamp-test-AB "%#15A" "%^A" #'formatz-mod-pad-l15) ;; implemented since 1997, recommended 1997-2024 (time-stamp-test-AB "%3a" "%a") ;; recommended 1997-2019 (time-stamp-test-AB "%:a" "%A") ;; recommended 1997-2019, warned since 2024, will change (time-stamp-test-AB "%3A" "%^a" :warn) - (time-stamp-test-AB "%10A" "%^A" #'formatz-mod-pad-l10 :warn) + (time-stamp-test-AB "%15A" "%^A" #'formatz-mod-pad-l15 :warn) ;; implemented since 2001, recommended since 2019 (time-stamp-test-AB ("%#a" "%#3a") "%^a") (time-stamp-test-AB "%#4a" "%^a" #'formatz-mod-pad-l4) ;; implemented since 2001, recommended 2019-2024 (time-stamp-test-AB "%:A" "%A") ;; broken 2019-2024 - (time-stamp-test-AB "%:10A" "%A" #'formatz-mod-pad-l10) + (time-stamp-test-AB "%:15A" "%A" #'formatz-mod-pad-l15) ;; broken in 2019, changed in 2024 (time-stamp-test-AB ("%-A" "%_A") "%A") + (time-stamp-test-AB ("%-a" "%_a") "%a") ;; warned 1997-2019, changed in 2019, recommended (with caveat) since 2024 (time-stamp-test-AB "%a" "%a") (time-stamp-test-AB ("%4a" "%04a") "%a" #'formatz-mod-pad-l4) commit 47aec3cbc9a2e9dbf7760cab9dbf80ee18e07ba9 Author: Sean Whitton Date: Tue Nov 25 22:08:19 2025 +0000 Make it easier to enable Abbrev mode by default * lisp/cus-start.el: Make 'abbrev-mode' customizable. * doc/emacs/abbrevs.texi (Abbrev Concepts): * etc/NEWS: * src/buffer.c (syms_of_buffer): : Document enabling Abbrev mode by default in all buffers by customizing 'abbrev-mode' to a non-nil value. diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi index d2799a78e09..4ee8e759570 100644 --- a/doc/emacs/abbrevs.texi +++ b/doc/emacs/abbrevs.texi @@ -49,11 +49,13 @@ insert @samp{find outer otter.}. @cindex Abbrev mode @cindex mode, Abbrev Abbrevs expand only when Abbrev mode, a buffer-local minor mode, is -enabled. Disabling Abbrev mode does not cause abbrev definitions to -be forgotten, but they do not expand until Abbrev mode is enabled -again. The command @kbd{M-x abbrev-mode} toggles Abbrev mode; with a -numeric argument, it turns Abbrev mode on if the argument is positive, -off otherwise. @xref{Minor Modes}. +enabled. Disabling Abbrev mode does not cause abbrev definitions to be +forgotten, but they do not expand until Abbrev mode is enabled again. +The command @kbd{M-x abbrev-mode} toggles Abbrev mode in the current +buffer; with a numeric argument, it turns Abbrev mode on if the argument +is positive, off otherwise (@pxref{Minor Modes}). To enable Abbrev mode +by default in all buffers, customize the variable @code{abbrev-mode} to +a non-@code{nil} value (@pxref{Easy Customization}). Abbrevs can have @dfn{mode-specific} definitions, active only in one major mode. Abbrevs can also have @dfn{global} definitions that are active in diff --git a/etc/NEWS b/etc/NEWS index 7f94998bc77..d10bc520388 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3102,6 +3102,13 @@ contains an encrypted file, is an empty buffer, is a hidden buffer, or is the "*scratch*" buffer. If it cannot locate any acceptable buffers, it will begrudgingly use the scratch buffer. +** Abbrev mode + ++++ +*** You can now enable Abbrev mode by default using Easy Customization. +Customize the variable 'abbrev-mode' to non-nil to enable Abbrev mode by +default in all buffers. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index c4ab23bec61..19ac478e21a 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -173,6 +173,13 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of "24.1") (delete-auto-save-files auto-save boolean) (kill-buffer-delete-auto-save-files auto-save boolean "28.1") + (abbrev-mode abbrev boolean nil + ;; Not `custom-set-minor-mode' because it is a + ;; buffer-local minor mode. Customizing it to + ;; non-nil means enabling the mode in all + ;; buffers which don't locally disable it. + :initialize custom-initialize-default + :set custom-set-default) ;; callint.c (mark-even-if-inactive editing-basics boolean) ;; callproc.c diff --git a/src/buffer.c b/src/buffer.c index e44b6daf587..3ef95626600 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5218,8 +5218,10 @@ Format with `format-mode-line' to produce a string value. */); doc: /* Local (mode-specific) abbrev table of current buffer. */); DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil, - doc: /* Non-nil if Abbrev mode is enabled. -Use the command `abbrev-mode' to change this variable. */); + doc: /* Non-nil if Abbrev mode is enabled. +Use the command `abbrev-mode' to change the value of this variable in +the current buffer. Customize this variable to non-nil to enable Abbrev +mode by default in all buffers. */); DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), Qintegerp, commit 158bf5da779a30be4cde06929771715ef55e13c5 Author: Sean Whitton Date: Tue Nov 25 21:37:27 2025 +0000 Refine VC-Dir mass mark changes * lisp/vc/vc-dir.el (vc-dir-mark-file): Prompt before unmarking all subitems. Use y-or-n-p and user-error instead of yes-or-no-p and error. (vc-dir-unmark-file): Use y-or-n-p instead of yes-or-no-p. (vc-dir-allow-mass-mark-changes): Update docs. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 6f0f3747dab..ef5aa5dbda2 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -131,7 +131,8 @@ See `run-hooks'." When a directory in VC-Dir is marked, then for most VCS, this means that all files within it are implicitly marked as well. -For consistency, the mark and unmark commands (principally \\\\[vc-dir-mark] and \\[vc-dir-unmark]) will +For consistency, the mark and unmark commands \ +(principally \\\\[vc-dir-mark] and \\[vc-dir-unmark]) will not explicitly mark or unmark entries if doing so would result in a situation where both a directory and a file or directory within it are both marked. @@ -145,13 +146,7 @@ be marked or unmarked. If this variable is nil, the commands will refuse to do anything if they would need to mark or unmark other entries too. If this variable is any other non-nil value, the commands will always -proceed to mark and unmark other entries, without asking. - -There is one operation where marking or unmarking other entries in order -to mark or unmark the entry at point is unlikely to be surprising: -when you use \\[vc-dir-mark] on a directory which already has marked items within it. -In this case, the subitems are unmarked regardless of the value of this -option." +proceed to mark and unmark other entries, without asking." :type '(choice (const :tag "Don't allow" nil) (const :tag "Prompt to allow" ask) (const :tag "Allow without prompting" t)) @@ -739,16 +734,25 @@ If IF-MARKED, return the nearest marked parent." (file (ewoc-data crt)) (to-inval (list crt))) ;; We do not allow a state in which a directory is marked and also - ;; some of its files are marked. If the user's intent is clear, - ;; adjust things for them so that they can proceed. - (if-let* (((vc-dir-fileinfo->directory file)) - (children (vc-dir--children crt t))) + ;; some of its files are marked. If the user's intent is apparent, + ;; offer to adjust things for them so that they can proceed. + (if-let* ((_ (vc-dir-fileinfo->directory file)) + (children (vc-dir--children crt t)) + (name (vc-dir-fileinfo->name file))) ;; The user wants to mark a directory where some of its children - ;; are already marked. The user's intent is quite clear, so - ;; unconditionally unmark the children. - (dolist (child children) - (setf (vc-dir-fileinfo->marked (ewoc-data child)) nil) - (push child to-inval)) + ;; are already marked. Although the user's intent is clear, by + ;; default we still ask them before unmarking in order to avoid + ;; accidental erasure of complex patterns of marks. + (progn (when (or (not vc-dir-allow-mass-mark-changes) + (and (eq vc-dir-allow-mass-mark-changes 'ask) + (not (y-or-n-p + (format "\ +Replace marks on subitems with marking `%s' itself?" + name))))) + (user-error "`%s' is already marked" name)) + (dolist (child children) + (setf (vc-dir-fileinfo->marked (ewoc-data child)) nil) + (push child to-inval))) (when-let* ((parent (vc-dir--parent crt t)) (name (vc-dir-fileinfo->name (ewoc-data parent)))) ;; The user seems to want to mark an entry whose directory is @@ -756,10 +760,10 @@ If IF-MARKED, return the nearest marked parent." ;; most VCS, they may not really intend this. (when (or (not vc-dir-allow-mass-mark-changes) (and (eq vc-dir-allow-mass-mark-changes 'ask) - (not (yes-or-no-p + (not (y-or-n-p (format "`%s' is already marked; unmark it?" name))))) - (error "`%s' is already marked" name)) + (user-error "`%s' is already marked" name)) (setf (vc-dir-fileinfo->marked (ewoc-data parent)) nil) (push parent to-inval))) (setf (vc-dir-fileinfo->marked file) t) @@ -897,7 +901,7 @@ Directories must have trailing slashes." (all-children (vc-dir--children parent))) (when (and vc-dir-allow-mass-mark-changes (or (not (eq vc-dir-allow-mass-mark-changes 'ask)) - (yes-or-no-p + (y-or-n-p (format "\ Replace mark on `%s' with marks on all subitems but this one?" (vc-dir-fileinfo->name file))))) @@ -918,9 +922,8 @@ Replace mark on `%s' with marks on all subitems but this one?" (children (vc-dir--children crt t)) ((and vc-dir-allow-mass-mark-changes (or (not (eq vc-dir-allow-mass-mark-changes 'ask)) - (yes-or-no-p - (format "Unmark all items within `%s'?" - (vc-dir-fileinfo->name file))))))) + (y-or-n-p (format "Unmark all items within `%s'?" + (vc-dir-fileinfo->name file))))))) (dolist (child children) (setf (vc-dir-fileinfo->marked (ewoc-data child)) nil) (push child to-inval))))) commit 304d4435b1e00fd96bbd75646be3ccb5569c9bdc Author: Sean Whitton Date: Tue Nov 25 21:07:04 2025 +0000 Make diff-revert-and-kill-hunk consider an active region * lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): When the region is active, operate on all hunks it overlaps. * doc/emacs/files.texi (Diff Mode): * etc/NEWS: Document the change. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 69d6c9da354..d82a2b8948d 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1835,7 +1835,8 @@ confirm deletions or applying hunks to backup files. @item C-c M-u Revert this hunk, and then remove the hunk from the diffs (@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target -file. +file. When the region is active, the command reverse-applies and kills +hunks that the region overlaps. This command is useful in buffers generated by @w{@kbd{C-x v =}} and @w{@kbd{C-x v D}} (@pxref{Old Revisions}). These buffers present you @@ -1843,7 +1844,7 @@ with a view of the changes you've made, and you can use this command to undo changes you didn't intend to do, or no longer want. This is a destructive operation, so by default, this command asks you to -confirm you really want to revert and kill the hunk. You can customize +confirm you really want to revert and kill the hunks. You can customize @code{diff-ask-before-revert-and-kill-hunk} to control that. @findex diff-apply-buffer diff --git a/etc/NEWS b/etc/NEWS index c2cb4159de3..7f94998bc77 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2031,6 +2031,8 @@ This command reverts the hunk at point (i.e., applies the reverse of the hunk), and then removes the hunk from the diffs. This is useful to undo or revert changes, committed and uncommitted, when you are in buffers generated by 'C-x v =' and 'C-x v D'. +When the region is active, the command reverse-applies and kills hunks +that the region overlaps. --- *** 'diff-file-prev' and 'diff-hunk-prev' always move to start of header. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 29976cf5f55..02d3768a8a8 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2256,8 +2256,10 @@ With a prefix argument, try to REVERSE the hunk." :type 'boolean :version "31.1") -(defun diff-revert-and-kill-hunk () +(defun diff-revert-and-kill-hunk (&optional beg end) "Reverse-apply and then kill the hunk at point. Save changed buffer. +Interactively, if the region is active, reverse-apply and kill all +hunks that the region overlaps. This command is useful in buffers generated by \\[vc-diff] and \\[vc-root-diff], especially when preparing to commit the patch with \\[vc-next-action]. @@ -2268,13 +2270,39 @@ to permanently drop changes you didn't intend, or no longer want. This is a destructive operation, so by default, this command asks you to confirm you really want to reverse-apply and kill the hunk. You can -customize `diff-ask-before-revert-and-kill-hunk' to control that." - (interactive) +customize `diff-ask-before-revert-and-kill-hunk' to control that. + +When called from Lisp with optional arguments BEG and END non-nil, +reverse-apply and kill all hunks overlapped by the region from BEG to +END as though called interactively with an active region delimited by +BEG and END." + (interactive (list (use-region-beginning) (use-region-end))) + (when (xor beg end) + (error "Invalid call to `diff-revert-and-kill-hunk'")) (when (or (not diff-ask-before-revert-and-kill-hunk) - (yes-or-no-p "Really reverse-apply and kill this hunk?")) - (cl-destructuring-bind (beg end) (diff-bounds-of-hunk) - (when (null (diff-apply-buffer beg end t)) - (diff-hunk-kill))))) + (y-or-n-p "Really reverse-apply and kill hunk(s)?")) + (if beg + (save-excursion + (goto-char beg) + (setq beg (car (diff-bounds-of-hunk))) + (goto-char end) + (setq end (cadr (diff-bounds-of-hunk)))) + (pcase-setq `(,beg ,end) (diff-bounds-of-hunk))) + (when (null (diff-apply-buffer beg end t)) + ;; Use `diff-hunk-kill' because it properly handles file headers, + ;; except if we are killing the last hunk we need not be concerned + ;; with that. If we are not deleting the very last hunk then + ;; exploit how `diff-hunk-kill' will always leave us at the + ;; beginning of a hunk (except when killing the very last hunk!). + (if (eql end (point-max)) + (let ((inhibit-read-only t)) + (kill-region beg end)) + (setq end (copy-marker end)) + (unwind-protect + (cl-loop initially (goto-char beg) + do (diff-hunk-kill) + until (eql (point) (marker-position end))) + (set-marker end nil)))))) (defun diff-apply-buffer (&optional beg end reverse test-or-no-save) "Apply the diff in the entire diff buffer. commit f5953186efbfcbf8e5c40b5d64b3e32f03e7403b Author: Sean Whitton Date: Tue Nov 25 21:05:50 2025 +0000 ; * lisp/emacs-lisp/pcase.el (pcase-setq): Fix parameter names. diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index cd6b5e42771..07802849489 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -356,16 +356,17 @@ of the elements of LIST is performed as if by `pcase-let'. ;;;###autoload (defmacro pcase-setq (pat val &rest args) "Assign values to variables by destructuring with `pcase'. -PATTERNS are normal `pcase' patterns, and VALUES are expression. +Each PATTERN is a normal `pcase' pattern, and each VALUE an expression. Evaluation happens sequentially as in `setq' (not in parallel). An example: (pcase-setq \\=`((,a) [(,b)]) \\='((1) [(2)])) -VAL is presumed to match PAT. Failure to match may signal an error or go -undetected, binding variables to arbitrary values, such as nil. +Each VALUE is presumed to match its PATTERN. Failure to match may +signal an error or go undetected, binding variables to arbitrary values, +such as nil. -\(fn PATTERNS VALUE PATTERN VALUES ...)" +\(fn PATTERN VALUE PATTERN VALUE ...)" (declare (debug (&rest [pcase-PAT form]))) (cond (args commit 39e9f96ba01649506675c22da7090fb80dce6cc6 Author: Sean Whitton Date: Tue Nov 25 20:30:21 2025 +0000 ; * lisp/emacs-lisp/cond-star.el: Tidy up dummy macro definitions. diff --git a/lisp/emacs-lisp/cond-star.el b/lisp/emacs-lisp/cond-star.el index b7283938452..ac448d9dcdf 100644 --- a/lisp/emacs-lisp/cond-star.el +++ b/lisp/emacs-lisp/cond-star.el @@ -97,10 +97,10 @@ are passed along to the rest of the clauses in this `cond*' construct. ;; highlighting. ;;;###autoload -(defmacro match* (pattern _datum) +(defmacro match* (_pattern _datum) "This specifies matching DATUM against PATTERN. -It is not really a Lisp function, and it is meaningful -only in the CONDITION of a `cond*' clause. +This is not really a Lisp operator; it is meaningful only in the +CONDITION of a `cond*' clause. `_' matches any value. KEYWORD matches that keyword. @@ -160,32 +160,32 @@ ATOM (meaning any other kind of non-list not described above) \(constrain SYMBOL EXP) matches datum if the form EXP is true. EXP can refer to symbols bound earlier in the pattern." - ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. - (byte-compile-warn-x pattern "`match*' used other than as a `cond*' condition")) + (macroexp-warn-and-return "`match*' used other than as a `cond*' condition" + nil 'suspicious)) ;;;###autoload -(defmacro bind* (&rest bindings) - "This macro evaluates BINDINGS like `let*'. -It is not really a Lisp function, and it is meaningful -only in the CONDITION of a `cond*' clause." - ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. - (byte-compile-warn-x bindings "`bind*' used other than as a `cond*' condition")) +(defmacro bind* (&rest _bindings) + "Evaluate BINDINGS like `let*'. +This is not really a Lisp operator; it is meaningful only in the +CONDITION of a `cond*' clause. See `cond*' for details." + (macroexp-warn-and-return "`bind*' used other than as a `cond*' condition" + nil 'suspicious)) ;;;###autoload -(defmacro bind-and* (&rest bindings) - "This macro evaluates BINDINGS like `if-let*'. -It is not really a Lisp function, and it is meaningful -only in the CONDITION of a `cond*' clause." - ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. - (byte-compile-warn-x bindings "`bind-and*' used other than as a `cond*' condition")) +(defmacro bind-and* (&rest _bindings) + "Evaluate BINDINGS like `if-let*'. +This is not really a Lisp operator; it is meaningful only in the +CONDITION of a `cond*' clause. See `cond*' for details." + (macroexp-warn-and-return "`bind-and*' used other than as a `cond*' condition" + nil 'suspicious)) ;;;###autoload -(defmacro pcase* (pattern _datum) - "This macro evaluates BINDINGS like `pcase-let'. -It is not really a Lisp function, and it is meaningful -only in the CONDITION of a `cond*' clause." - ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. - (byte-compile-warn-x pattern "`pcase*' used other than as a `cond*' condition")) +(defmacro pcase* (_pattern _datum) + "Evaluate PATTERN and DATUM like an element of BINDINGS in `pcase-let'. +This is not really a Lisp operator; it is meaningful only in the +CONDITION of a `cond*' clause. See `cond*' for details." + (macroexp-warn-and-return "`pcase*' used other than as a `cond*' condition" + nil 'suspicious)) (defun cond*-non-exit-clause-p (clause) "If CLAUSE, a cond* clause, is a non-exit clause, return t." commit 449e15de5ba751b44408613cf5dd2633cb256b5a Author: Sean Whitton Date: Tue Nov 25 15:53:15 2025 +0000 ; * lisp/vc/diff-mode.el (diff-goto-source): Revise docstring again. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 22e72f92377..29976cf5f55 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2349,12 +2349,14 @@ applied. Other non-nil values are reserved." (defun diff-goto-source (&optional other-file event) "Jump to the corresponding source line. -By default, jump to the new source file; jump to the old source file -instead when either -- `diff-jump-to-old-file' is non-nil and you don't supply a prefix - argument (when called from Lisp, optional argument OTHER-FILE is nil) -- `diff-jump-to-old-file' is nil and you supply a prefix argument - (when called from Lisp, optional argument OTHER-FILE is non-nil) +By default, jump to the new source file. +With a prefix argument (when called from Lisp, with optional argument +OTHER-FILE non-nil), jump to the old source file. +If `diff-jump-to-old-file' is non-nil then the meaning of the prefix +argument (or, when called from Lisp, the meaning of optional argument +OTHER-FILE) is reversed: a prefix argument (respectively, OTHER-FILE +non-nil) means to jump to the new source file, and the lack of one +(respectively, OTHER-FILE nil) means to jump to the old source file. In addition, if you supply a prefix argument bigger than 8 (for example with \\[universal-argument] \\[universal-argument]), \ the value of `diff-jump-to-old-file' is toggled for the commit 59e8b7267feaf0ec702239f94a1085e7c8e4b476 Author: Sean Whitton Date: Tue Nov 25 14:53:19 2025 +0000 Make diff-apply-hunk consider an active region * lisp/vc/diff-mode.el (diff-apply-buffer): New 'no-save' meaning for fourth optional argument. Reserve other non-nil values for this argument. Use ngettext for one message. (diff-apply-hunk): If the region is active, apply all hunks that the region overlaps, like diff-apply-buffer. * doc/emacs/files.texi (Diff Mode): * etc/NEWS: Document the change to diff-apply-hunk. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index f677804b6a4..69d6c9da354 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1824,6 +1824,13 @@ reverse of the hunk, which changes the ``new'' version into the ``old'' version. If @code{diff-jump-to-old-file} is non-@code{nil}, apply the hunk to the ``old'' version of the file instead. +@code{diff-apply-hunk} prompts you to confirm deleting files and +applying hunks to backup files, and it offers to reverse-apply hunks +that are already applied. If the region is active, however, it applies +all hunks that the region overlaps without doing any prompting. In this +mode, it simply fails if any hunks do not apply cleanly, and does not +confirm deletions or applying hunks to backup files. + @findex diff-revert-and-kill-hunk @item C-c M-u Revert this hunk, and then remove the hunk from the diffs diff --git a/etc/NEWS b/etc/NEWS index 7d132356484..c2cb4159de3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2045,19 +2045,22 @@ useful to prepare a "*vc-diff*" buffer for committing a single hunk. When the region is active, it deletes all hunks that the region does not overlap. -*** 'diff-apply-hunk' now supports creating and deleting files. - --- *** 'vc-version-diff' and 'vc-root-version-diff' changed default for REV1. They suggest the previous revision as the default for REV1, not the last one as before. This makes them different from 'vc-diff' and 'vc-root-diff' when those are called without a prefix argument. +*** 'diff-apply-hunk' now supports creating and deleting files. + ++++ +*** 'diff-apply-hunk' and 'diff-apply-buffer' now consider the region. +If the region is active, these commands now apply all hunks that the +region overlaps. Otherwise, they have their existing behavior. + +++ -*** 'diff-apply-buffer' now considers the region and can reverse-apply. -If the region is active, this command now applies all hunks that the -region overlaps; otherwise, it applies all hunks. -With a prefix argument, it now reverse-applies the hunks. +*** 'diff-apply-buffer' can reverse-apply. +With a prefix argument, it now reverse-applies hunks. This matches the existing prefix argument to 'diff-apply-hunk'. ** Ediff diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 70dc68e2122..22e72f92377 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2138,73 +2138,97 @@ SWITCHED is non-nil if the patch is already applied." (defvar diff-apply-hunk-to-backup-file nil) -(defun diff-apply-hunk (&optional reverse) - "Apply the current hunk to the source file and go to the next. +(defun diff-apply-hunk (&optional reverse beg end) + "Apply the current hunk to its source file and go to the next hunk. By default, the new source file is patched, but if the variable `diff-jump-to-old-file' is non-nil, then the old source file is patched instead (some commands, such as `diff-goto-source' can change the value of this variable when given an appropriate prefix argument). -With a prefix argument, REVERSE the hunk." - (interactive "P") - (diff-beginning-of-hunk t) - (pcase-let* (;; Do not accept BUFFER.REV buffers as source location. - (diff-vc-backend nil) - ;; When we detect deletion, we will use the old file name. - (deletion (equal null-device (car (diff-hunk-file-names reverse)))) - (`(,buf ,line-offset ,pos ,old ,new ,switched) - ;; Sometimes we'd like to have the following behavior: if - ;; REVERSE go to the new file, otherwise go to the old. - ;; But that means that by default we use the old file, which is - ;; the opposite of the default for diff-goto-source, and is thus - ;; confusing. Also when you don't know about it it's - ;; pretty surprising. - ;; TODO: make it possible to ask explicitly for this behavior. - ;; - ;; This is duplicated in diff-test-hunk. - (diff-find-source-location (xor deletion reverse) reverse))) - (cond - ((null line-offset) - (user-error "Can't find the text to patch")) - ((with-current-buffer buf - (and buffer-file-name - (backup-file-name-p buffer-file-name) - (not diff-apply-hunk-to-backup-file) - (not (setq-local diff-apply-hunk-to-backup-file - (yes-or-no-p (format "Really apply this hunk to %s? " - (file-name-nondirectory - buffer-file-name))))))) - (user-error "%s" - (substitute-command-keys - (format "Use %s\\[diff-apply-hunk] to apply it to the other file" - (if (not reverse) "\\[universal-argument] "))))) - ((and switched - ;; A reversed patch was detected, perhaps apply it in reverse. - (not (save-window-excursion - (pop-to-buffer buf) - (goto-char (+ (car pos) (cdr old))) - (y-or-n-p - (if reverse - "Hunk hasn't been applied yet; apply it now? " - "Hunk has already been applied; undo it? "))))) - (message "(Nothing done)")) - ((and deletion (not switched)) - (when (y-or-n-p (format-message "Delete file `%s'?" - (buffer-file-name buf))) - (delete-file (buffer-file-name buf) delete-by-moving-to-trash) - (kill-buffer buf))) - (t - ;; Apply the hunk - (with-current-buffer buf - (goto-char (car pos)) - (delete-region (car pos) (cdr pos)) - (insert (car new))) - ;; Display BUF in a window - (set-window-point (display-buffer buf '(nil (inhibit-same-window . t))) - (+ (car pos) (cdr new))) - (diff-hunk-status-msg line-offset (xor switched reverse) nil) - (when diff-advance-after-apply-hunk - (diff-hunk-next)))))) +With a prefix argument (when called from Lisp, with optional argument +REVERSE non-nil), reverse-apply the hunk(s). + +Prompt to confirm deleting files and applying hunks to backup files. +Offer to reverse-apply hunks that are already applied. +Interactively, if the region is active, apply all hunks that the +region overlaps. In this mode, fail instead of prompting if any +hunks do not cleanly apply, and do not confirm deletions or +applying hunks to backup files (the same as the command +`diff-apply-buffer' with an active region, which see). + +When called from Lisp with optional arguments BEG and END non-nil, +apply all hunks overlapped by the region from BEG to END as though +called interactively with an active region delimited by BEG and +END." + (interactive (list current-prefix-arg + (use-region-beginning) + (use-region-end))) + (cond* + ((xor beg end) + (error "Invalid call to `diff-apply-hunk'")) + (beg + (diff-apply-buffer beg end reverse 'no-save)) + + (t (diff-beginning-of-hunk t)) + ((bind* + ;; Do not accept BUFFER.REV buffers as source location. + (diff-vc-backend nil) + ;; When we detect deletion, we will use the old file name. + (deletion (equal null-device (car (diff-hunk-file-names reverse)))))) + ((pcase* `(,buf ,line-offset ,pos ,old ,new ,switched) + ;; Sometimes we'd like to have the following behavior: if + ;; REVERSE go to the new file, otherwise go to the old. + ;; But that means that by default we use the old file, which is + ;; the opposite of the default for diff-goto-source, and is thus + ;; confusing. Also when you don't know about it it's + ;; pretty surprising. + ;; TODO: make it possible to ask explicitly for this behavior. + ;; + ;; This is duplicated in diff-test-hunk. + (diff-find-source-location (xor deletion reverse) reverse))) + + ((null line-offset) + (user-error "Can't find the text to patch")) + ((with-current-buffer buf + (and buffer-file-name + (backup-file-name-p buffer-file-name) + (not diff-apply-hunk-to-backup-file) + (not + (setq-local diff-apply-hunk-to-backup-file + (yes-or-no-p + (format "Really apply this hunk to %s? " + (file-name-nondirectory buffer-file-name))))))) + (user-error "%s" + (substitute-command-keys + (format "Use %s\\[diff-apply-hunk] to apply it to the other file" + (and (not reverse) "\\[universal-argument] "))))) + ((and switched + ;; A reversed patch was detected, perhaps apply it in reverse. + (not (save-window-excursion + (pop-to-buffer buf) + (goto-char (+ (car pos) (cdr old))) + (y-or-n-p + (if reverse + "Hunk hasn't been applied yet; apply it now? " + "Hunk has already been applied; undo it? "))))) + (message "(Nothing done)")) + ((and deletion (not switched)) + (when (y-or-n-p (format-message "Delete file `%s'?" + (buffer-file-name buf))) + (delete-file (buffer-file-name buf) delete-by-moving-to-trash) + (kill-buffer buf))) + (t + ;; Apply the hunk + (with-current-buffer buf + (goto-char (car pos)) + (delete-region (car pos) (cdr pos)) + (insert (car new))) + ;; Display BUF in a window + (set-window-point (display-buffer buf '(nil (inhibit-same-window . t))) + (+ (car pos) (cdr new))) + (diff-hunk-status-msg line-offset (xor switched reverse) nil) + (when diff-advance-after-apply-hunk + (diff-hunk-next))))) (defun diff-test-hunk (&optional reverse) @@ -2252,7 +2276,7 @@ customize `diff-ask-before-revert-and-kill-hunk' to control that." (when (null (diff-apply-buffer beg end t)) (diff-hunk-kill))))) -(defun diff-apply-buffer (&optional beg end reverse test) +(defun diff-apply-buffer (&optional beg end reverse test-or-no-save) "Apply the diff in the entire diff buffer. Interactively, if the region is active, apply all hunks that the region overlaps; otherwise, apply all hunks. @@ -2266,15 +2290,18 @@ and saved, or the number of failed hunk applications otherwise. Optional arguments BEG and END restrict the hunks to be applied to those lying between BEG and END. Optional argument REVERSE means to reverse-apply hunks. -Optional argument TEST means to not actually apply or reverse-apply any -hunks, but return the same information: nil if all hunks can be applied, -or the number of hunks that can't be applied." +Optional argument TEST-OR-NO-SAVE `no-save' means not to save any +changed buffers, `test' or t means to not actually apply or +reverse-apply any hunks, but return the same information: nil if +all hunks can be applied, or the number of hunks that can't be +applied. Other non-nil values are reserved." (interactive (list (use-region-beginning) (use-region-end) current-prefix-arg)) (let ((buffer-edits nil) (failures 0) - (diff-refine nil)) + (diff-refine nil) + (test (memq test-or-no-save '(t test)))) (save-excursion (goto-char (or beg (point-min))) (diff-beginning-of-hunk t) @@ -2302,8 +2329,12 @@ or the number of hunks that can't be applied." (goto-char (car pos)) (delete-region (car pos) (cdr pos)) (insert (car dst)))) - (save-buffer))) - (message "Saved %d buffers" (length buffer-edits))) + (unless (eq test-or-no-save 'no-save) + (save-buffer)))) + (message (ngettext "%s %d buffer" "%s %d buffers" + (length buffer-edits)) + (if (eq test-or-no-save 'no-save) "Edited" "Saved") + (length buffer-edits))) nil) (t (unless test commit 1844ce4a0fb3b4143b3fbc9942df1d6c9bf8fcd3 Author: Sean Whitton Date: Tue Nov 25 14:22:58 2025 +0000 * lisp/emacs-lisp/cond-star.el (pcase*): New dummy definition. diff --git a/lisp/emacs-lisp/cond-star.el b/lisp/emacs-lisp/cond-star.el index d2a7f05a06b..b7283938452 100644 --- a/lisp/emacs-lisp/cond-star.el +++ b/lisp/emacs-lisp/cond-star.el @@ -93,7 +93,7 @@ are passed along to the rest of the clauses in this `cond*' construct. ;; FIXME: Want an Edebug declaration. (cond*-convert clauses)) -;; The following three macros are autoloaded for the sake of syntax +;; The following four macros are autoloaded for the sake of syntax ;; highlighting. ;;;###autoload @@ -169,7 +169,7 @@ ATOM (meaning any other kind of non-list not described above) It is not really a Lisp function, and it is meaningful only in the CONDITION of a `cond*' clause." ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. - (byte-compile-warn-x bindings "`bind' used other than as a `cond*' condition")) + (byte-compile-warn-x bindings "`bind*' used other than as a `cond*' condition")) ;;;###autoload (defmacro bind-and* (&rest bindings) @@ -179,6 +179,14 @@ only in the CONDITION of a `cond*' clause." ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. (byte-compile-warn-x bindings "`bind-and*' used other than as a `cond*' condition")) +;;;###autoload +(defmacro pcase* (pattern _datum) + "This macro evaluates BINDINGS like `pcase-let'. +It is not really a Lisp function, and it is meaningful +only in the CONDITION of a `cond*' clause." + ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. + (byte-compile-warn-x pattern "`pcase*' used other than as a `cond*' condition")) + (defun cond*-non-exit-clause-p (clause) "If CLAUSE, a cond* clause, is a non-exit clause, return t." (or (null (cdr-safe clause)) ;; clause has only one element. commit 3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b Author: Sean Whitton Date: Tue Nov 25 14:06:29 2025 +0000 ; diff-mode-el: Improve docstrings re diff-jump-to-old-file. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 3e45ff045e2..70dc68e2122 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2046,8 +2046,10 @@ Whitespace differences are ignored." OTHER-FILE, if non-nil, means to look at the diff's name and line numbers for the old file. Furthermore, use `diff-vc-revisions' if it's available. If `diff-jump-to-old-file' is non-nil, the - sense of this parameter is reversed. If the prefix argument is - 8 or more, `diff-jump-to-old-file' is set to OTHER-FILE. + sense of this parameter is reversed. If OTHER-FILE considered + as a raw prefix argument has a numeric value bigger than 8, + toggle `diff-jump-to-old-file' for the remainder of this Emacs + session, i.e., set it to nil if it's non-nil, non-nil if it's nil. REVERSE, if non-nil, switches the sense of SRC and DST (see below). NOPROMPT, if non-nil, means not to prompt the user. Return a list (BUF LINE-OFFSET (BEG . END) SRC DST SWITCHED). @@ -2256,6 +2258,8 @@ Interactively, if the region is active, apply all hunks that the region overlaps; otherwise, apply all hunks. With a prefix argument, reverse-apply the hunks. If applying all hunks succeeds, save the changed buffers. +By default apply diffs to new source files; apply them to old +files if `diff-jump-to-old-file' is non-nil. When called from Lisp, returns nil if buffers were successfully modified and saved, or the number of failed hunk applications otherwise. @@ -2276,6 +2280,9 @@ or the number of hunks that can't be applied." (diff-beginning-of-hunk t) (while (pcase-let ((`(,buf ,line-offset ,pos ,_src ,dst ,switched) (diff-find-source-location nil reverse test))) + ;; FIXME: Should respect `diff-apply-hunk-to-backup-file' + ;; similarly to how `diff-apply-buffer' does. + ;; Prompt for each relevant file. (cond ((and line-offset (not switched)) (push (cons pos dst) (alist-get buf buffer-edits))) @@ -2310,14 +2317,25 @@ or the number of hunks that can't be applied." (defun diff-goto-source (&optional other-file event) "Jump to the corresponding source line. -`diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg -is given) determines whether to jump to the old or the new file. -If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) -then `diff-jump-to-old-file' is also set, for the next invocations. - -Under version control, the OTHER-FILE prefix arg means jump to the old -revision of the file if point is on an old changed line, or to the new -revision of the file otherwise." + +By default, jump to the new source file; jump to the old source file +instead when either +- `diff-jump-to-old-file' is non-nil and you don't supply a prefix + argument (when called from Lisp, optional argument OTHER-FILE is nil) +- `diff-jump-to-old-file' is nil and you supply a prefix argument + (when called from Lisp, optional argument OTHER-FILE is non-nil) +In addition, if you supply a prefix argument bigger than 8 (for example +with \\[universal-argument] \\[universal-argument]), \ +the value of `diff-jump-to-old-file' is toggled for the +remainder of this Emacs session (i.e., set to non-nil if nil, or +set to nil if non-nil). When called from Lisp this toggling +happens when the value of optional argument OTHER-FILE considered +as a prefix argument has a numeric value bigger than 8. + +Under version control, jumping to the old file means jumping to the old +revision of the file in the manner of \\[vc-revision-other-window], \ +and occurs only when +point is on an old changed line (i.e. a removed line)." (interactive (list current-prefix-arg last-input-event)) ;; When pointing at a removal line, we probably want to jump to ;; the old location, and else to the new (i.e. as if reverting). commit 9b505dd8d40ab0568c36984215afc5d5406b9b93 Author: Alan Mackenzie Date: Tue Nov 25 11:57:06 2025 +0000 CC Mode: update Version: header. Add a comment about it * lisp/progmodes/cc-defs.el (c-version): Add a comment encouraging maintainers to keep cc-mode.el's Version: header the same. * lisp/progmodes/cc-mode.el (top level): Update the Version: header to 5.35.2. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 22e68a748d1..9af34b1b9b0 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -86,6 +86,8 @@ ;;; Variables also used at compile time. +;; IMPORTANT NOTE! On changing `c-version', also update the "version +;; header" near the beginning of cc-mode.el to match. (defconst c-version "5.35.2" "CC Mode version number.") diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 76071d54f9c..2fe96152b33 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -12,7 +12,7 @@ ;; Created: a long, long, time ago. adapted from the original c-mode.el ;; Keywords: c languages ;; The version header below is used for ELPA packaging. -;; Version: 5.33.1 +;; Version: 5.35.2 ;; This file is part of GNU Emacs. commit 6d600f492a722dc43a11e90676cf8ecac092f029 Author: Michael Albinus Date: Tue Nov 25 09:33:17 2025 +0100 Add etc/NEWS style rules * CONTRIBUTE (Documenting your changes): Refer to admin/notes/documentation. * admin/notes/documentation: Add etc/NEWS style rules. (Bug#79851) diff --git a/CONTRIBUTE b/CONTRIBUTE index be10dbda8b3..ed42c4b8116 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -142,7 +142,8 @@ the convention of leaving 2 spaces between sentences. For more specific tips on Emacs's doc style, see https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Tips.html -Use 'checkdoc' to check for documentation errors before submitting a patch. +and see the file admin/notes/documentation. Use 'checkdoc' to check for +documentation errors before submitting a patch. ** Testing your changes diff --git a/admin/notes/documentation b/admin/notes/documentation index 22bacb48b68..f6fa321b217 100644 --- a/admin/notes/documentation +++ b/admin/notes/documentation @@ -113,5 +113,54 @@ is where a feature works _differently_ in the previous version. In those cases, the user might have trouble figuring out how to use the old version without some sort of help. + ** To indicate possession, write Emacs's rather than Emacs'. https://lists.gnu.org/r/emacs-devel/2012-02/msg00649.html + + +** etc/NEWS style rules + +Any change that matters to end-users should have an entry in etc/NEWS. +This is not intended as reference of design decisions or interfaces. + +*** Each NEWS entry starts with a heading that summarizes the entry. +It takes just one line, and will finish with a period. Section +headings, which are one level up from entry headings, are not full +sentences. First-level headings are broad categories, and the other +section headings are the names of Emacs features. Don't use Lisp +symbols for section headings. E.g. "Random mode" not "'random-mode'". + +*** All new, changed or obsoleted user options and commands are documented. +Document the default value or the argument list, respectively. + +If a user option or command is obsoleted or changes the default value / +argument list, document how to keep the previous behavior. + +Document further new, changed or obsoleted variables and functions, if +they are relevant for package authors. + +*** Lisp symbols, Lisp forms and and key sequences are quoted 'like-this'. +This results in clickable Lisp symbols when the NEWS file is visited via +'view-emacs-news' ('C-h n'). Also single key names or keywords must +follow this rule, like 'TAB' or ':type'. Exception: the symbols t and +nil are not quoted. + +Arguments of a function are written in capital letters LIKE-THIS, and they +are not quoted. + +If Lisp forms are written in a line of its own, they are not quoted. +Separate these lines from the previous and following text by an empty +line. Indent them with a width of 4 spaces. + +*** File names, buffer names, process names are strings. +Quote them with quotation marks "like this". Exception: Lisp file names +like subr.el, which are not quoted. + +*** External program names are quoted with quotation marks like "this". + +*** Manuals (Info pages) are referenced like "(elisp) Documentation Tips". + +*** Prior pushing your changes, check the result. +Call 'emacs-news-view-mode'. Lisp symbols and Info manual links shall +be decorated, and clicking on them shall lead to the respective Help +buffer or Info node.