compile warnings after <string.h> include removed #409

issue paveljanik opened this issue on August 4, 2016
  1. paveljanik commented at 9:54 AM on August 4, 2016: contributor

    After removal of string.h include (https://github.com/bitcoin-core/secp256k1/commit/a6c6f994b55619154fda3de20527dc560b8ca1ed):

    In file included from src/tests.c:16:
    In file included from ./src/secp256k1.c:14:
    ./src/ecmult_impl.h:186:9: warning: implicitly declaring library function
          'memcpy' with type 'void *(void *, const void *, unsigned long)'
            memcpy(dst->pre_g, src->pre_g, size);
            ^
    ./src/ecmult_impl.h:186:9: note: include the header <string.h> or explicitly
          provide a declaration for 'memcpy'
    ./src/ecmult_impl.h:230:5: warning: implicitly declaring library function
          'memset' with type 'void *(void *, int, unsigned long)'
        memset(wnaf, 0, len * sizeof(wnaf[0]));
        ^
    ./src/ecmult_impl.h:230:5: note: include the header <string.h> or explicitly
          provide a declaration for 'memset'
    2 warnings generated.
    
  2. paveljanik cross-referenced this on Aug 4, 2016 from issue Bring secp256k1 subtree up to date with master by laanwj
  3. laanwj commented at 10:39 AM on August 4, 2016: member

    Interestingly, I don't see this warning when compiling secp256k1 stand-alone, even though it should (-pedantic -Wall -Wextra).

  4. paveljanik commented at 10:40 AM on August 4, 2016: contributor

    I think it depends on the compiler. In my case, it was

    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin14.5.0
    
  5. laanwj commented at 10:44 AM on August 4, 2016: member

    I compile with clang (3.9) too. I see the warning when compiling bitcoin w/ https://github.com/bitcoin/bitcoin/issues/8453, but not when compiling this library independently.

  6. paveljanik commented at 10:48 AM on August 4, 2016: contributor

    gcc-4.8.3 on openSUSE:

    In file included from src/secp256k1.c:14:0:
    src/ecmult_impl.h: In function 'secp256k1_ecmult_context_clone':
    src/ecmult_impl.h:186:9: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
             memcpy(dst->pre_g, src->pre_g, size);
             ^
    src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
    src/ecmult_impl.h: In function 'secp256k1_ecmult_wnaf':
    src/ecmult_impl.h:230:5: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
         memset(wnaf, 0, len * sizeof(wnaf[0]));
         ^
    src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function 'memset' [enabled by default]
    

    All logs here are from standalone compile, current master here c5b32e16c4d2560ce829caf88a413fc06fd83d09.

  7. laanwj commented at 10:53 AM on August 4, 2016: member

    Narrowed it down to libsecp256k1-config.h. When I copy the one from my bitcoin directory I get the warnings.

    OK, this happens with --with-bignum=no, libgmp includes string.h which hides this issue, the compiler issue was a sidetrack. Thanks @paveljanik .

  8. laanwj cross-referenced this on Aug 4, 2016 from issue Add string.h include to ecmult_impl by laanwj
  9. sipa closed this on Aug 4, 2016

  10. pinheadmz cross-referenced this on Dec 10, 2020 from issue Error when I run `yarn add bcrypto` by timi-codes

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me