bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] rawmemchr: modernize and simplify


From: Bruno Haible
Subject: Re: [PATCH] rawmemchr: modernize and simplify
Date: Sun, 22 Aug 2021 00:36:42 +0200

Hi Paul,

> * lib/rawmemchr.c (HAVE_RAWMEMCHR): Assume it’s not defined;
> otherwise this file would not be compiled.

Unfortunately, this assumption does not hold. This file, when used as
part of the 'relocatable-prog-wrapper' module, is compiled unconditionally.

$ ./gnulib-tool --find lib/rawmemchr.c
rawmemchr
relocatable-prog-wrapper

In build-aux/install-reloc lines 225..253 the compilation command compiles
this file always. The patch thus causes a definition of rawmemchr to be
included in the trampoline executables even on platforms that don't need it.

This patch should fix it.


2021-08-21  Bruno Haible  <bruno@clisp.org>

        rawmemchr: Fix use in relocatable-prog-wrapper (regression 2021-08-20).
        * lib/rawmemchr.c: Restore test of HAVE_RAWMEMCHR.
        * modules/relocatable-prog-wrapper (Depends-on): Add stdalign.

diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
index 469bfa3cd..e7a00b803 100644
--- a/lib/rawmemchr.c
+++ b/lib/rawmemchr.c
@@ -19,11 +19,14 @@
 /* Specification.  */
 #include <string.h>
 
-#include <limits.h>
-#include <stdalign.h>
-#include <stdint.h>
+/* A function definition is only needed if HAVE_RAWMEMCHR is not defined.  */
+#if !HAVE_RAWMEMCHR
 
-#include "verify.h"
+# include <limits.h>
+# include <stdalign.h>
+# include <stdint.h>
+
+# include "verify.h"
 
 /* Find the first occurrence of C in S.  */
 void *
@@ -118,3 +121,5 @@ rawmemchr (const void *s, int c_in)
     char_ptr++;
   return (void *) char_ptr;
 }
+
+#endif
diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper
index d816033ee..fa5691621 100644
--- a/modules/relocatable-prog-wrapper
+++ b/modules/relocatable-prog-wrapper
@@ -64,6 +64,7 @@ largefile
 libc-config
 pathmax
 ssize_t
+stdalign
 stdbool
 stddef
 stdint






reply via email to

[Prev in Thread] Current Thread [Next in Thread]