Re: [PATCH 3/4] Port unwind protection to C23

2023-03-26 Thread Martin D Kealey
While C has never guaranteed that pointers all have the same size & alignment, POSIX does provide this guarantee, although indirectly (it has to be true for dlsym() to work, for example). Bash seems to need an environment that's "kinda POSIX" (at least emulating the POSIX process & signal models),

[PATCH] add definition for count_all_jobs() in parse.y if --disable-job-control

2023-03-26 Thread Emanuele Torre
--- parse.y | 1 + 1 file changed, 1 insertion(+) diff --git a/parse.y b/parse.y index 639912b6..65c1d88a 100644 --- a/parse.y +++ b/parse.y @@ -73,6 +73,7 @@ # include "jobs.h" #else extern int cleanup_dead_jobs (void); +extern int count_all_jobs (void); #endif /* JOB_CONTROL */ #if defi

Re: [PATCH] Pacify gcc -Wpointer-to-int-cast

2023-03-26 Thread Sam James
Paul Eggert writes: > * lib/sh/random.c (genseed): Use a different type, to pacify GCC > "warning: cast from pointer to integer of different size > [-Wpointer-to-int-cast]" on platforms with 64-bit pointers > and 32-bit int. Thanks for this one. I've been meaning to report it because -Wpointer-

Re: Bash not portable to C23

2023-03-26 Thread Paul Eggert
On 2023-03-24 12:04, Chet Ramey wrote: However, Bash's devel branch still has old-style function definitions and therefore won't compile with a strict C23 compiler. For example, get_variable_value in variables.c is old-style. I assume there would be interest in fixing remaining areas where Bash

[PATCH 1/4] Port more functions etc. to C23

2023-03-26 Thread Paul Eggert
Port more function definitions and declarations to C23. This includes adding a return type when it defaulted to int. Add some casts to and from GENERIC_LIST * that are needed now that the list functions are prototyped. This does not finish the job, as some trickier functions still won't work with

[PATCH 2/4] Remove no-longer-used K&R cruft

2023-03-26 Thread Paul Eggert
Since we now assume C89 function prototypes anyway, remove no-longer-used cruft that is used only for ports to compilers requiring K&R style. --- aclocal.m4 | 35 + builtins/common.c | 23 ++ builtins/mkbuiltins.c | 4 --- builtins/pri

[PATCH 4/4] Assume __STDC__ if it merely assumes C89 or later

2023-03-26 Thread Paul Eggert
There's no longer any point to worrying about K&R compilers as the code won't work with them anyway. Simplify the code by omitting __STDC__ tests when that merely is checking for C89 or later, as we assume C89 prototypes now. --- aclocal.m4| 15 --- builtins/enable.def

[PATCH 3/4] Port unwind protection to C23

2023-03-26 Thread Paul Eggert
Do not assume that all pointers have the same representation at the machine level and that address space is linear, as the C standard does not guarantee this and it is not true on a few unusual platforms. Fixing this also uncovered a bug on conventional 64-bit platforms, where the call 'add_unwind

[PATCH] Pacify gcc -Wpointer-to-int-cast

2023-03-26 Thread Paul Eggert
* lib/sh/random.c (genseed): Use a different type, to pacify GCC "warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]" on platforms with 64-bit pointers and 32-bit int. --- lib/sh/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sh/random