libctf: add missing header in BFD ELF check
authorNick Alcock <nick.alcock@oracle.com>
Wed, 3 Feb 2021 14:09:02 +0000 (14:09 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 10 Feb 2021 15:26:57 +0000 (15:26 +0000)
Without this, GCC warns:

In file included from conftest.c:36:
../../libctf/../bfd/elf-bfd.h: In function 'bfd_section_is_ctf':
../../libctf/../bfd/elf-bfd.h:3089:10: warning: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
 3089 |   return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
      |          ^~~~~~~
../../libctf/../bfd/elf-bfd.h:3089:33: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
 3089 |   return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
      |                                 ^
<built-in>: note: built-in 'strncmp' declared here

These warnings do not currently throw off the result of the configure
check, but it's better to squash them anyway.

libctf/ChangeLog
2021-02-03  Nick Alcock  <nick.alcock@oracle.com>

* configure.ac (ac_cv_libctf_bfd_elf): Include string.h.
* configure: Regenerated.

libctf/ChangeLog
libctf/configure
libctf/configure.ac

index 135add5a6c23e6b6051e31929972b4031f480d83..cf529038d7028736c7678cc265c91dffd953b84e 100644 (file)
@@ -1,3 +1,8 @@
+2021-02-03  Nick Alcock  <nick.alcock@oracle.com>
+
+       * configure.ac (ac_cv_libctf_bfd_elf): Include string.h.
+       * configure: Regenerated.
+
 2021-02-03  Nick Alcock  <nick.alcock@oracle.com>
 
        * configure.ac (EXPECT): Check for, in order to define...
index 902eadd5d7a87bb1569d58091a797523ab06be0f..d5b7861157488561e0173ab34be33a35bc6292da 100755 (executable)
@@ -12875,6 +12875,7 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
+            #include <string.h>
             #include "bfd.h"
             #include "elf-bfd.h"
 int
index c6b80442e07a62bcea2c98b61cc38a00d1d51e5e..90e3c437d6057f69bce30bc62fb78f195446247a 100644 (file)
@@ -88,6 +88,7 @@ intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
 LIBS="-lbfd -liberty -lz $intl $LIBS"
 AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf,
 [AC_TRY_LINK([#include <stdlib.h>
+            #include <string.h>
             #include "bfd.h"
             #include "elf-bfd.h"],
            [(void) bfd_section_from_elf_index (NULL, 0);