Skip to content
Snippets Groups Projects
  • Xi Ruoyao's avatar
    21c74b6e
    fixincludes: Declare memmem if it's not declared in system headers [PR109293] · 21c74b6e
    Xi Ruoyao authored
    memmem is not POSIX so the system may lack it.  Then libiberty will
    provide an implementation, but it's a "supplemental function" and not
    declared in libiberty.h.  We need to declare the prototype to use it
    then.
    
    See libiberty doc at
    https://gcc.gnu.org/onlinedocs/libiberty/Supplemental-Functions.html.
    
    Tested by bootstrapping GCC in the following container environments on
    x86_64-linux-gnu:
    
    1. "Vanilla" system with memmem in Glibc.
    2. memmem removed from string.h.
    3. memmem removed from both string.h and libc.so.
    
    For 3, also verified that memmem from libiberty is linked into fixincl
    executable.
    
    Ok for trunk?
    
    fixincludes/ChangeLog:
    
    	PR other/109293
    	* configure.ac (AC_CHECK_DECLS): Add memmem.
    	* configure: Regenerate.
    	* config.h.in: Regenerate.
    	* system.h (memmem): Declare if HAVE_DECL_MEMMEM is zero.
    fixincludes: Declare memmem if it's not declared in system headers [PR109293]
    Xi Ruoyao authored
    memmem is not POSIX so the system may lack it.  Then libiberty will
    provide an implementation, but it's a "supplemental function" and not
    declared in libiberty.h.  We need to declare the prototype to use it
    then.
    
    See libiberty doc at
    https://gcc.gnu.org/onlinedocs/libiberty/Supplemental-Functions.html.
    
    Tested by bootstrapping GCC in the following container environments on
    x86_64-linux-gnu:
    
    1. "Vanilla" system with memmem in Glibc.
    2. memmem removed from string.h.
    3. memmem removed from both string.h and libc.so.
    
    For 3, also verified that memmem from libiberty is linked into fixincl
    executable.
    
    Ok for trunk?
    
    fixincludes/ChangeLog:
    
    	PR other/109293
    	* configure.ac (AC_CHECK_DECLS): Add memmem.
    	* configure: Regenerate.
    	* config.h.in: Regenerate.
    	* system.h (memmem): Declare if HAVE_DECL_MEMMEM is zero.