Hi Florian,
Thank you for the tough job, which ports Fedora to modern C..
I have two questions.
On 2023/02/14 16:06, Florian Weimer wrote:
+@@ -123,14 +142,70 @@
+ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+ #define __bos0(ptr) __builtin_object_size (ptr, 0)
+
++/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
++#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \
++ || __GNUC_PREREQ (12, 0))
++# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
++# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
++#else
++# define __glibc_objsize0(__o) __bos0 (__o)
++# define __glibc_objsize(__o) __bos (__o)
++#endif
++
++#if __USE_FORTIFY_LEVEL > 0
I could not find this line in the latest GDB source and the related
patches. What is this for?
+@@ -134,6 +136,7 @@ typedef int (*_bashfunc)(const char *, ...);
+ #else
+ typedef int (*_bashfunc)();
+ #endif
++#include <stdlib.h>
+ main()
The GDB patch b4f26d541aa7 ("Import GNU Readline 8.1") has the
following:
@@ -134,6 +138,8 @@ typedef int (*_bashfunc)(const char *, ...);
#else
typedef int (*_bashfunc)();
#endif
+#include <stdlib.h>
+int
main()
{
_bashfunc pf;
Isn't this "int" needed?
Some following hunks are also different from the patch, but I could not
figure out the reason. It's preferable to be the same as the original
patch or source for future additional patches, if possible.
Thanks,
Kazu
P.S. I will be out of office this week, back next week.
+ {
+ _bashfunc pf;
+@@ -191,6 +194,7 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
++#include <stdlib.h>
+ #ifndef UNDER_SYS_SIGLIST_DECLARED
+ extern char *_sys_siglist[];
+ #endif
+@@ -218,6 +222,7 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
++#include <stdlib.h>
+ #if !HAVE_DECL_SYS_SIGLIST
+ extern char *sys_siglist[];
+ #endif
+@@ -273,6 +278,7 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
+ [AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <fcntl.h>
++#include <stdlib.h>
+ main()
+ {
+ int fd1, fd2, fl;
+@@ -335,6 +341,7 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
+ # include <ndir.h>
+ # endif
+ #endif /* HAVE_DIRENT_H */
++#include <stdlib.h>
+ main()
+ {
+ DIR *dir;
+@@ -514,6 +521,7 @@ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
++#include <stdlib.h>
+ main()
+ {
+ #ifdef HAVE_QUAD_T