1. 01 Dec, 2020 1 commit
  2. 14 Sep, 2020 1 commit
  3. 11 Sep, 2020 1 commit
    • Kirill Smelkov's avatar
      *: Fix build with recent gcc/binutils · b97c7f08
      Kirill Smelkov authored
      With current Debian testing I get:
      
      	tools/ccanlint/ccanlint -s --deps-fail-ignore   ccan/compiler/ && touch ccan/compiler/.ok
      	compiler: Module tests compile (tests_compile): FAIL
      	/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/ccan/compiler/test/run-is_compile_constant.c:Compile failed:
      	/usr/bin/ld: /tmp/ccanlint-129350.1804289383/tap.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/ccan/tap/tap.h:249: multiple definition of `tap_fail_callback'; /tmp/ccrAwqbl.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/ccan/tap/tap.h:249: first defined here
      	collect2: error: ld returned 1 exit status
      	...
      
      	cc -g3 -ggdb -Wall -Wstrict-prototypes -Wold-style-definition -Wundef -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -DCCAN_STR_DEBUG=1 -I.  -MMD -MP -MFtools/ccanlint/ccanlint.d -MTtools/ccanlint/ccanlint tools/ccanlint/ccanlint.c tools/ccanlint/async.o tools/ccanlint/file_analysis.o tools/ccanlint/licenses.o tools/ccanlint/tests/avoids_cpp_reserved.o tools/ccanlint/tests/depends_accurate.o tools/ccanlint/tests/depends_build.o tools/ccanlint/tests/depends_build_without_features.o tools/ccanlint/tests/depends_exist.o tools/ccanlint/tests/examples_compile.o tools/ccanlint/tests/examples_exist.o tools/ccanlint/tests/examples_relevant.o tools/ccanlint/tests/examples_run.o tools/ccanlint/tests/hash_if.o tools/ccanlint/tests/headers_idempotent.o tools/ccanlint/tests/info_compiles.o tools/ccanlint/tests/info_documentation_exists.o tools/ccanlint/tests/info_exists.o tools/ccanlint/tests/info_ported.o tools/ccanlint/tests/info_summary_single_line.o tools/ccanlin
       t/tests/license_comment.o tools/ccanlint/tests/license_depends_compat.o tools/ccanlint/tests/license_exists.o tools/ccanlint/tests/license_file_compat.o tools/ccanlint/tests/main_header_compiles.o tools/ccanlint/tests/main_header_exists.o tools/ccanlint/tests/module_builds.o tools/ccanlint/tests/module_links.o tools/ccanlint/tests/no_trailing_whitespace.o tools/ccanlint/tests/objects_build.o tools/ccanlint/tests/objects_build_with_stringchecks.o tools/ccanlint/tests/objects_build_without_features.o tools/ccanlint/tests/reduce_features.o tools/ccanlint/tests/tests_compile.o tools/ccanlint/tests/tests_compile_coverage.o tools/ccanlint/tests/tests_coverage.o tools/ccanlint/tests/tests_exist.o tools/ccanlint/tests/tests_helpers_compile.o tools/ccanlint/tests/tests_pass.o tools/ccanlint/tests/tests_pass_valgrind.o tools/ccanlint/tests/tests_pass_without_features.o ccan/autodata/autodata.o ccan/dgraph/dgraph.o ccan/ilog/ilog.o ccan/lbalance/lbalance.o ccan/ptr_valid/ptr_valid.o ccan/strma
       p/strmap.o tools/ccan_dir.o tools/compi
      	le.o tools/depends.o tools/doc_extract-core.o tools/gcov.o tools/manifest.o tools/read_config_header.o tools/tools.o ccan/asort/asort.o ccan/err/err.o ccan/foreach/foreach.o ccan/hash/hash.o ccan/htable/htable.o ccan/list/list.o ccan/membuf/membuf.o ccan/noerr/noerr.o ccan/opt/helpers.o ccan/opt/opt.o ccan/opt/parse.o ccan/opt/usage.o ccan/rbuf/rbuf.o ccan/read_write_all/read_write_all.o ccan/str/debug.o ccan/str/str.o ccan/take/take.o ccan/tal/tal.o ccan/tal/grab_file/grab_file.o ccan/tal/link/link.o ccan/tal/path/path.o ccan/tal/str/str.o ccan/time/time.o -lm -o tools/ccanlint/ccanlint
      	/usr/bin/ld: tools/ccanlint/async.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	/usr/bin/ld: tools/ccanlint/file_analysis.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	/usr/bin/ld: tools/ccanlint/licenses.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	/usr/bin/ld: tools/ccanlint/tests/avoids_cpp_reserved.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/./tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined
      	here
      	/usr/bin/ld: tools/ccanlint/tests/depends_accurate.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/./tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	/usr/bin/ld: tools/ccanlint/tests/depends_build.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/./tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	/usr/bin/ld: tools/ccanlint/tests/depends_build_without_features.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/./tools/ccanlint/../ccanlint/licenses.h:33: multiple definition of `license_compatible'; /tmp/cc72h7qq.o:/home/kirr/src/wendelin/wendelin.core/3rdparty/ccan/tools/ccanlint/../ccanlint/licenses.h:33: first defined here
      	...
      
      The errors are valid becuase symbols are declared without extern in .h
      files and those .h files are included from multiple translation units.
      
      -> Fix it. I'm not sure why it used to compile ok before.
      Signed-off-by: Kirill Smelkov's avatarKirill Smelkov <kirr@nexedi.com>
      Message-Id: <20200910191610.131510-1-kirr@nexedi.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      b97c7f08
  4. 17 Jul, 2020 1 commit
    • Rusty Russell's avatar
      tools/configurator: fix compile error with -O2 · cbc7cbf1
      Rusty Russell authored
      In file included from /usr/include/string.h:495,
                       from configuratortest.c:2:
      In function ‘strncpy’,
          inlined from ‘main’ at configuratortest.c:6:2:
      /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 8 equals destination size [-Wstringop-truncation]
        106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      cbc7cbf1
  5. 19 Jun, 2020 1 commit
  6. 20 Feb, 2020 2 commits
  7. 19 Feb, 2020 1 commit
  8. 17 Feb, 2020 1 commit
    • Rusty Russell's avatar
      tal: don't defer-after-free if a destructor deletes itself. · c910bdce
      Rusty Russell authored
      ==10868==    at 0x109A96: notify (tal.c:220)
      ==10868==    by 0x109F7E: del_tree (tal.c:397)
      ==10868==    by 0x10A31A: tal_free (tal.c:481)
      ==10868==    by 0x10BE73: main (run-destructor.c:75)
      ==10868==  Address 0x4a60bd8 is 8 bytes inside a block of size 32 free'd
      ==10868==    at 0x483BA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10868==    by 0x109D4F: del_notifier_property (tal.c:340)
      ==10868==    by 0x10A610: tal_del_notifier_ (tal.c:564)
      ==10868==    by 0x10A687: tal_del_destructor_ (tal.c:576)
      ==10868==    by 0x10B653: remove_own_destructor (run-destructor.c:35)
      ==10868==    by 0x109A67: notify (tal.c:235)
      ==10868==    by 0x109F7E: del_tree (tal.c:397)
      ==10868==    by 0x10A31A: tal_free (tal.c:481)
      ==10868==    by 0x10BE73: main (run-destructor.c:75)
      ==10868==  Block was alloc'd at
      ==10868==    at 0x483A7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10868==    by 0x109AD5: allocate (tal.c:245)
      ==10868==    by 0x109C3E: add_notifier_property (tal.c:300)
      ==10868==    by 0x10A467: tal_add_destructor_ (tal.c:516)
      ==10868==    by 0x10BDFE: main (run-destructor.c:74)
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c910bdce
  9. 11 Feb, 2020 1 commit
    • Rusty Russell's avatar
      opt: fix opt_unregister. · 4f20b75c
      Rusty Russell authored
      Instead of memmoving N structs, we were memmoving N bytes.
      
      But why did the test pass then?  It was doing memmove(..., 1)
      instead of memmove(..., sizeof(struct opt_table)!
      
      Because the two structures were really similar; the main difference
      was the first entry, which points to the name.  But they were allocated
      consecutively, and Intel being little-endian, the only difference was
      the first byte!  Thus memmove(1) was enough to make it "work".
      
      Change two options in the test to be sufficiently different, and
      the bug shows up.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      4f20b75c
  10. 04 Feb, 2020 4 commits
  11. 22 Oct, 2019 1 commit
    • Kirill Smelkov's avatar
      bitmap: Allow bitmap type to be forward declared · 39b46a02
      Kirill Smelkov authored
      Currently bitmap type is defined via untagged struct which makes it
      impossible to forward declare it. Forward-declaring is useful since all
      bitmap functions only use bitmap* and in public user-visible
      headers/datastructures it is enough to indicate that a data field with
      bitmap pointer is there, whereas bitmap.h can be included only in
      implementation.
      
      Beside that some headers are included by both C and C++ parts of a
      project, and when ccan/bitmap.h is processed by C++ compiler it gives:
      
          ./3rdparty/ccan/ccan/bitmap/bitmap.h: In function ‘bitmap* bitmap_alloc(long unsigned int)’:
          ./3rdparty/ccan/ccan/bitmap/bitmap.h:201:15: error: invalid conversion from ‘void*’ to ‘bitmap*’ [-fpermissive]
            return malloc(bitmap_sizeof(nbits));
                   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
          ./3rdparty/ccan/ccan/bitmap/bitmap.h: In function ‘bitmap* bitmap_realloc0(bitmap*, long unsigned int, long unsigned int)’:
          ./3rdparty/ccan/ccan/bitmap/bitmap.h:227:18: error: invalid conversion from ‘void*’ to ‘bitmap*’ [-fpermissive]
            bitmap = realloc(bitmap, bitmap_sizeof(nbits));
                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          ./3rdparty/ccan/ccan/bitmap/bitmap.h: In function ‘bitmap* bitmap_realloc1(bitmap*, long unsigned int, long unsigned int)’:
          ./3rdparty/ccan/ccan/bitmap/bitmap.h:238:18: error: invalid conversion from ‘void*’ to ‘bitmap*’ [-fpermissive]
            bitmap = realloc(bitmap, bitmap_sizeof(nbits));
      
      -> Give to users ability not to force-include ccan/bitmap.h by
      forward-declaring bitmaps like this:
      
          typedef struct bitmap bitmap;
          ...
          struct MyStruct {
              bitmap *my_bitmap;
          };
      
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: Kirill Smelkov's avatarKirill Smelkov <kirr@nexedi.com>
      Message-Id: <20191021150903.25159-1-kirr@nexedi.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      39b46a02
  12. 10 Oct, 2019 1 commit
  13. 04 Oct, 2019 1 commit
  14. 14 Aug, 2019 1 commit
  15. 13 Aug, 2019 1 commit
  16. 01 Aug, 2019 1 commit
  17. 31 Jul, 2019 1 commit
  18. 11 Jul, 2019 1 commit
    • David Gibson's avatar
      bitmap: Fix some bugs on 32-bit platforms · cdd0b8b5
      David Gibson authored
      The bitmap_word type is an unsigned long.  However in some places we assign
      it using -1ULL, a 64-bit value on many platforms.  We sometimes get away
      with this because it masks correctly, but in other cases it breaks things.
      
      To clean this up define a new BITMAP_WORD_1 constant, indicating a
      bitmap_word with all bits set, and use that instead of explicit UL or ULL
      qualifiers.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      cdd0b8b5
  19. 11 Jun, 2019 4 commits
  20. 23 May, 2019 1 commit
  21. 22 May, 2019 1 commit
  22. 21 May, 2019 2 commits
  23. 02 Apr, 2019 1 commit
    • Rusty Russell's avatar
      htable: avoid branch in calculating perfect bit. · 7623d082
      Rusty Russell authored
      Final results of tools/speed/10000000 (10 runs) shows a slight
      slowdown in some tests, but it makes an empty htable smaller.
      
      -Initial delete all: 96-98(96.4+/-0.66) ns
      +Initial delete all: 97-99(98.2+/-0.75) ns
      -Initial re-inserting: 117-124(121.4+/-1.9) ns
      +Initial re-inserting: 124-131(126.4+/-2.4) ns
      -Adding (a different) half: 49-50(49.3+/-0.46) ns
      +Adding (a different) half: 50-52(51.2+/-0.75) ns
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      7623d082
  24. 01 Apr, 2019 2 commits
  25. 16 Mar, 2019 3 commits
  26. 04 Mar, 2019 4 commits