Re: strpbrk stops expand.c from compiling on Ubuntu 26-04

Jeremy Harris via Exim-dev <[email protected]> Sat, 2 May 2026 22:45:51 +0100
Newsgroups gmane.mail.exim.devel
Message-ID <[email protected]>
On 2026/05/02 9:50 PM, Andrew C Aitchison via Exim-dev wrote:
> Do we have an Ubuntu 26-04 (Resolute Raccoon) build animal ?

We don't have any animals at all that claim to be Ubuntu.
As usual, volunteers would be welcome.


> The full definition of strpbrk in /usr/include/string.h
> (which *has* changed in this Ubuntu) now conditionally has
> separate declarations for const and non-const:
> 
> grep -3 strpbrk /usr/include/string.h | sed -e 's/^/  /'
>    #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
>    extern "C++"
>    {
>    extern char *strpbrk (char *__s, const char *__accept)
>         __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
>    extern const char *strpbrk (const char *__s, const char *__accept)
>         __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
> 
>    # ifdef __OPTIMIZE__
>    __extern_always_inline char *
>    strpbrk (char *__s, const char *__accept) __THROW
>    {
>      return __builtin_strpbrk (__s, __accept);
>    }
> 
>    __extern_always_inline const char *
>    strpbrk (const char *__s, const char *__accept) __THROW
>    {
>      return __builtin_strpbrk (__s, __accept);
>    }
>    # endif
>    }
>    #else
>    extern char *strpbrk (const char *__s, const char *__accept)
>         __THROW __attribute_pure__ __nonnull ((1, 2));
>    # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
>    #  define strpbrk(S, ACCEPT)                                  \
>      __glibc_const_generic (S, const char *, strpbrk (S, ACCEPT))
>    # endif
>    #endif
>    /* Find the first occurrence of NEEDLE in HAYSTACK.  */
> 
> Does this look different from other platforms, in a way that might cause
> the compiler to object ?

Fedora 43 /usr/include/string.h looks pretty much the same.  I have no clue
if that stuff affects C, or is C++ only.

> clang -E expand.c turns line 4638 into
>     for(char * cp; cp = _Generic (0 ? ((const char *) item) : (void *) 1, const void *: (const char *) (strpbrk ((const char *) item, tok)), default: strpbrk ((const char *) item, tok)); item = (unsigned char *) cp) 


... and what I don't see in (the string.h section) is any mention of a Generic.

Though, a known generic we could use here to operate cleanly on a (non-const) string
[ "item" not being const ] happens to be really what is wanted.  I wonder when the
definition of strbrk() changed?  The manpage here only describes it as

      char *strpbrk(const char *s, const char *accept);
STANDARDS
        C11, POSIX.1-2008.

> cc1: all warnings being treated as errors 

It's quite likely I don't do that.
-- 
Cheers,
   Jeremy

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
##   [email protected]
## Exim details at https://www.exim.org/
## Please use the Wiki with this list - https://code.exim.org/exim/wiki/wiki