uNetworking / uNetworking/uSockets
Tests fail to compile: error: comparison between pointer and integer ('void *' and 'int')
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 307
- PR merge metrics
- No merged PRs in 30d
Description
All these errors are due to the obvious type mismatch in the code:
cd /usr/ports/net/usockets/work/uSockets-0.8.7 && c++ -o test tests/sni_test.c /usr/ports/net/usockets/work/stage/usr/local/lib/libuSockets.so && ./test
c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
tests/sni_test.c:25:9: error: no matching function for call to 'sni_add'
assert(sni_add(sni, "*.google.com", 13) == 0);
^~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:4:5: note: candidate function not viable: no known conversion from 'int' to 'void *' for 3rd argument
int sni_add(void *sni, const char *hostname, void *user);
^
tests/sni_test.c:26:9: error: no matching function for call to 'sni_add'
assert(sni_add(sni, "test.google.com", 14) == 0);
^~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:4:5: note: candidate function not viable: no known conversion from 'int' to 'void *' for 3rd argument
int sni_add(void *sni, const char *hostname, void *user);
^
tests/sni_test.c:29:9: error: no matching function for call to 'sni_add'
assert(sni_add(sni, "*.google.com", 15) != 0);
^~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:4:5: note: candidate function not viable: no known conversion from 'int' to 'void *' for 3rd argument
int sni_add(void *sni, const char *hostname, void *user);
^
tests/sni_test.c:30:46: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "anything.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:32:42: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "docs.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:33:39: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "*.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:34:42: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "test.google.com") == 14);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:36:42: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "yolo.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:39:44: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_remove(sni, "test.google.com") == 14);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:40:42: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "test.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:41:41: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_remove(sni, "*.google.com") == 13);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:45:9: error: no matching function for call to 'sni_add'
assert(sni_add(sni, "www.google.com", 16) == 0);
^~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:4:5: note: candidate function not viable: no known conversion from 'int' to 'void *' for 3rd argument
int sni_add(void *sni, const char *hostname, void *user);
^
tests/sni_test.c:46:9: error: no matching function for call to 'sni_add'
assert(sni_add(sni, "www.google.com.au.ck.uk", 17) == 0);
^~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:4:5: note: candidate function not viable: no known conversion from 'int' to 'void *' for 3rd argument
int sni_add(void *sni, const char *hostname, void *user);
^
tests/sni_test.c:47:41: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "www.google.com") == 16);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:48:50: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "www.google.com.au.ck.uk") == 17);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:50:52: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_remove(sni, "www.google.com.au.ck.uk") == 17);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
tests/sni_test.c:51:41: error: comparison between pointer and integer ('void *' and 'int')
assert(sni_find(sni, "www.google.com") == 16);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
^
17 errors generated.
Version: 0.8.7
clang-16
FreeBSD 14.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/sni_test.c and the sni_add, sni_find, and sni_remove declarations shown in the compiler output. Recheck the intended argument and return types, then rerun the reported FreeBSD clang command; done means the test compiles without the pointer/integer diagnostics and its assertions run successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100